diff --git a/ProjectManageGttPlugin.java b/ProjectManageGttPlugin.java new file mode 100644 index 0000000000000000000000000000000000000000..64a0c5dd2b4a2211b902914e4e4f2d88759a4271 --- /dev/null +++ b/ProjectManageGttPlugin.java @@ -0,0 +1,203 @@ +package kdec; + + + import com.alibaba.fastjson.JSONObject; + import kd.bos.bill.AbstractBillPlugIn; + import kd.bos.ext.form.control.CustomControl; + import kd.bos.form.control.Control; + import kd.bos.form.events.CustomEventArgs; + import kd.bos.util.CollectionUtils; + import kd.sdk.plugin.Plugin; + + import java.math.BigDecimal; + import java.util.ArrayList; + import java.util.EventObject; + import java.util.HashMap; + import java.util.List; + +/** + * 单据界面 + */ +public class ProjectManageGttPlugin extends AbstractBillPlugIn implements Plugin { + @Override + public void afterCreateNewData(EventObject e) { + String planjsonstr="{\"tasks\": [\n" + + " {\"id\": -1, \"name\": \"Gantt editor\", \"progress\": 1, \"progressByWorklog\": false, \"relevance\": 0, \"type\": \"plan\", \"typeId\": \"plan\", \"description\": \"\", \"code\": \"\", \"level\": 0, \"status\": \"STATUS_ACTIVE\", \"depends\": \"\", \"canWrite\": true, \"start\": 1396994400000, \"duration\": 20, \"end\": 0, \"1693474514008\": false, \"endIsMilestone\": false, \"collapsed\": false, \"assigs\": [], \"hasChild\": true},\n" + + " {\"id\": -2, \"name\": \"coding\", \"progress\": 0, \"progressByWorklog\": false, \"relevance\": 0, \"type\": \"\", \"typeId\": \"\", \"description\": \"\", \"code\": \"\", \"level\": 1, \"status\": \"STATUS_ACTIVE\", \"depends\": \"\", \"canWrite\": true, \"start\": 1693474514008, \"duration\": 1000, \"end\": 1713474514008, \"startIsMilestone\": false, \"endIsMilestone\": false, \"collapsed\": false, \"assigs\": [], \"hasChild\": true},\n" + + " {\"id\": -3, \"name\": \"gantt part\", \"progress\": 0, \"progressByWorklog\": false, \"relevance\": 0, \"type\": \"\", \"typeId\": \"\", \"description\": \"\", \"code\": \"\", \"level\": 2, \"status\": \"STATUS_ACTIVE\", \"depends\": \"\", \"canWrite\": true, \"start\": 1693474514008, \"duration\": 500, \"end\": 1693474514008, \"startIsMilestone\": false, \"endIsMilestone\": false, \"collapsed\": false, \"assigs\": [], \"hasChild\": false},\n" + + " {\"id\": -4, \"name\": \"editor part\", \"progress\": 0, \"progressByWorklog\": false, \"relevance\": 0, \"type\": \"\", \"typeId\": \"\", \"description\": \"\", \"code\": \"\", \"level\": 2, \"status\": \"STATUS_SUSPENDED\", \"depends\": \"3\", \"canWrite\": true, \"start\": 1693474514008, \"duration\": 500, \"end\": 1693474514008, \"startIsMilestone\": false, \"endIsMilestone\": false, \"collapsed\": false, \"assigs\": [], \"hasChild\": false},\n" + + " {\"id\": -5, \"name\": \"testing\", \"progress\": 0, \"progressByWorklog\": false, \"relevance\": 0, \"type\": \"\", \"typeId\": \"\", \"description\": \"\", \"code\": \"\", \"level\": 1, \"status\": \"STATUS_SUSPENDED\", \"depends\": \"2:5\", \"canWrite\": true, \"start\": 1693474514008, \"duration\": 5, \"end\": 1693474514008, \"startIsMilestone\": false, \"endIsMilestone\": false, \"collapsed\": false, \"assigs\": [], \"hasChild\": true},\n" + + " {\"id\": -6, \"name\": \"test on safari\", \"progress\": 0, \"progressByWorklog\": false, \"relevance\": 0, \"type\": \"\", \"typeId\": \"\", \"description\": \"\", \"code\": \"\", \"level\": 2, \"status\": \"STATUS_SUSPENDED\", \"depends\": \"\", \"canWrite\": true, \"start\": 1398981600000, \"duration\": 2, \"end\": 1693474514008, \"startIsMilestone\": false, \"endIsMilestone\": false, \"collapsed\": false, \"assigs\": [], \"hasChild\": false},\n" + + " {\"id\": -7, \"name\": \"test on ie\", \"progress\": 0, \"progressByWorklog\": false, \"relevance\": 0, \"type\": \"\", \"typeId\": \"\", \"description\": \"\", \"code\": \"\", \"level\": 2, \"status\": \"STATUS_SUSPENDED\", \"depends\": \"6\", \"canWrite\": true, \"start\": 1399327200000, \"duration\": 3, \"end\": 1693474514008, \"startIsMilestone\": false, \"endIsMilestone\": false, \"collapsed\": false, \"assigs\": [], \"hasChild\": false},\n" + + " {\"id\": -8, \"name\": \"test on chrome\", \"progress\": 0, \"progressByWorklog\": false, \"relevance\": 0, \"type\": \"\", \"typeId\": \"\", \"description\": \"\", \"code\": \"\", \"level\": 2, \"status\": \"STATUS_SUSPENDED\", \"depends\": \"6\", \"canWrite\": true, \"start\": 1399327200000, \"duration\": 2, \"end\": 1693474514008, \"startIsMilestone\": false, \"endIsMilestone\": false, \"collapsed\": false, \"assigs\": [], \"hasChild\": false}\n" + + " ], \"selectedRow\": 2, \"deletedTaskIds\": [],\n" + + " \"resources\": [\n" + + " {\"id\": \"tmp_1\", \"name\": \"Resource 1\"},\n" + + " {\"id\": \"tmp_2\", \"name\": \"Resource 2\"},\n" + + " {\"id\": \"tmp_3\", \"name\": \"Resource 3\"},\n" + + " {\"id\": \"tmp_4\", \"name\": \"Resource 4\"}\n" + + " ],\n" + + " \"roles\": [\n" + + " {\"id\": \"tmp_1\", \"name\": \"Project Manager\"},\n" + + " {\"id\": \"tmp_2\", \"name\": \"Worker\"},\n" + + " {\"id\": \"tmp_3\", \"name\": \"Stakeholder\"},\n" + + " {\"id\": \"tmp_4\", \"name\": \"Customer\"}\n" + + " ], \"canWrite\": true, \"canDelete\":true, \"canWriteOnParent\": true, canAdd:true}"; + JSONObject planjson = (JSONObject) JSONObject.parse(planjsonstr); + JSONObject resources = new JSONObject(); + resources.put("id","123"); + resources.put("name","资源测试"); + planjson.put("resources",resources); + long l = System.currentTimeMillis(); + ArrayList var29 = new ArrayList(); + JSONObject var31 = new JSONObject(); + var31.put("id", 123321); + var31.put("name", "软件开发"); + var29.add(var31); + planjson.put("roles", var29); + HashMap var33 = new HashMap(); + var33.put("result", true); + var33.put("data", planjson); + var33.put("eventArgs", "selectData"); + CustomControl control = this.getView().getControl("kdec_customcontrolap"); + control.setData(var33); + super.afterCreateNewData(e); + } + + @Override + public void afterBindData(EventObject e) { + + super.afterBindData(e); + } + + @Override + public void customEvent(CustomEventArgs e) { + String var2 = e.getEventArgs(); + String var3 = e.getEventName(); + Long var4 = 0L; + Long var5=0L; + byte var7 = -1; + switch(var3.hashCode()) { + case -1656440122: + if (var3.equals("selectData")) {//保存 + var7 = 1; + } + break; + case -850981221: + if (var3.equals("addPlanRequire")) {//新增需求 + var7 = 6; + } + break; + case -335429343: + if (var3.equals("bindWorkItem")) {//关联工作项 + var7 = 2; + } + break; + case 96417: + if (var3.equals("add")) { + var7 = 0; + } + break; + case 894313487: + if (var3.equals("addPlanTask")) {//新增任务 + var7 = 7; + } + break; + case 1339276547: + if (var3.equals("showConfirm")) { + var7 = 4; + } + break; + case 2067279966: + if (var3.equals("showTip")) { + var7 = 3; + } + break; + case 2081159717: + if (var3.equals("taskIsChanged")) { + var7 = 5; + } + } + switch(var7) { + case 0: + this.save(var2, var4);//保存 + break; + case 1: + this.selectData(var4, var5); + break; + case 2: + this.bindWorkItem(var4); + break; + case 3: + this.getView().showTipNotification(var2, 1000); + break; + case 4: + this.showConfirm(); + break; + case 5: + this.taskIsChanged(var2); + break; + case 6: + this.addPlanRequire(var4); + break; + case 7: + this.addPlanTask(var4); + break; + default: + this.getView().showTipNotification("不存在的操作,请联系系统管理员", 1000); + } + super.customEvent(e); + } + + private void addPlanTask(Long var4) { + + } + + private void addPlanRequire(Long var4) { + } + + private void taskIsChanged(String var2) { + } + + private void showConfirm() { + } +//关联工作项,选中行 + private void bindWorkItem(Long projectId) { + ArrayList var4=new ArrayList(); + JSONObject jsonObject=new JSONObject(); + jsonObject.put("id", "123456"); + jsonObject.put("name", "工作名称"); + //任务进度 + jsonObject.put("progress", BigDecimal.valueOf(100L)); + jsonObject.put("code", "123456"); + jsonObject.put("start", System.currentTimeMillis()); + jsonObject.put("end", System.currentTimeMillis()); + jsonObject.put("dmp_type", "需求"); + jsonObject.put("typeId", "dmp_require_manage_org"); + + + jsonObject.put("status", "STATUS_DONE"); + List var15 = new ArrayList(); + JSONObject var17 = new JSONObject(); + var17.put("resourceId", 123456L); + var17.put("roleId", 123321); + var17.put("effort", 0); + var17.put("id", String.format("tmp_%s", System.currentTimeMillis())); + ((List)var15).add(var17); + + jsonObject.put("assigs", var15); + var4.add(jsonObject); + HashMap var19 = new HashMap(); + var19.put("result", true); + var19.put("data", var4); + var19.put("eventArgs", "bindWorkItem"); + CustomControl var20 = (CustomControl)this.getView().getControl("kdec_customcontrolap"); + var20.setData(var19); + } + + private void selectData(Long var4, Long var5) { + } + + private void save(String var2, Long var4) { + } +} \ No newline at end of file diff --git a/README.md b/README.md index db0b39cca7ecef4a34a3711af64709374d3ad4f0..ea7a71681f023e4fa5397b2611259229acbcc0b2 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,112 @@ # jQueryGantt #### 介绍 -金蝶云·苍穹自定义控件之甘特图控件 +金蝶云·苍穹平台自定义控件集成甘特图jquerygantt的开源项目 +JQuery.Gantt是一个开源的基于JQuery库的用于实现甘特图效果的可扩展功能的JS组件库。 #### 软件架构 -软件架构说明 +金蝶云·苍穹平台自定义控件集成甘特图jquerygantt的开源项目 #### 安装教程 -1. xxxx -2. xxxx -3. xxxx +1. 应用中导入元数据gttexample_meta.zip +2. 自定义控件上传的控件方案资源为jQueryGantt +3. 苍穹后台插件文件夹复制到本地 #### 使用说明 +1、打开页面时,初始化甘特图数据 +甘特图控件初始化事件var ge = new GanttMaster(); +ge.init($(“#workSpace”)); +甘特图前端存储项目ge.saveProject() +甘特图前端加载项目ge.loadProject( [yourJsonProject] ) -1. xxxx -2. xxxx -3. xxxx +(1)后台插件发送数据kdec.ProjectManageGttPlugin#afterCreateNewData +(2)前端js接收并初始化数据var updateHtml = function(model,data) +model.dom.ge.loadProject(project); +project的数据结构如下 +{ + "canWriteOnParent": true, + "roles": [ + { + "name": "软件开发", + "id": 123321 + } + ], + "canAdd": true, + "resources": { + "name": "资源测试", + "id": "123" + }, + "canWrite": true, + "canDelete": true, + "selectedRow": 2, + "tasks": [ + { + "code": "", + "assigs": [ + + ], + "level": 0, + "depends": "", + "collapsed": false, + "start": 1396994400000, + "description": "", + "canWrite": true, + "type": "plan", + "progressByWorklog": false, + "relevance": 0, + "duration": 20, + "1693474514008": false, + "endIsMilestone": false, + "hasChild": true, + "name": "Gantt editor", + "progress": 1, + "typeId": "plan", + "end": 0, + "id": -1, + "status": "STATUS_ACTIVE" + }, + { + "code": "", + "assigs": [ + + ], + "level": 1, + "depends": "", + "collapsed": false, + "start": 1693474514008, + "description": "", + "canWrite": true, + "type": "", + "progressByWorklog": false, + "relevance": 0, + "duration": 1000, + "endIsMilestone": false, + "hasChild": true, + "name": "coding", + "progress": 0, + "typeId": "", + "end": 1713474514008, + "id": -2, + "startIsMilestone": false, + "status": "STATUS_ACTIVE" + } + ], + "deletedTaskIds": [ + + ] + } -#### 参与贡献 +2、前后端交互 +(1)前端点击保存、新增需求、新增任务、关联工作项时,分别触发jQueryGantt\js\init.js里面的 +saveGanttOnServer、addPlanRequire、addPlanTask、bindWorkItem等方法,这些js里面会给后端发送invoke指令 +(2)苍穹后端插件接收前端请求并处理相关业务kdec.ProjectManageGttPlugin#customEvent -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request +#### 版本支持 +COSMICV5.0.011 -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +#### 参考资料 +开源组件库jQuery Gantt编辑器由Roberto Bicchierai和Silvia Chelazzi编写,源开发文档: +https://roberto.twproject.com/2012/08/24/jquery-gantt-editor/ diff --git a/gttcosmic.zip b/gttcosmic.zip new file mode 100644 index 0000000000000000000000000000000000000000..2b606f0edb9ca7e8b5f385e80ee77cd501ad005b Binary files /dev/null and b/gttcosmic.zip differ diff --git a/gttexample_meta.zip b/gttexample_meta.zip new file mode 100644 index 0000000000000000000000000000000000000000..721dbdb054c23dcd56e45220929c3be6feb5dc12 Binary files /dev/null and b/gttexample_meta.zip differ diff --git a/jQueryGantt/css/index.css b/jQueryGantt/css/index.css new file mode 100644 index 0000000000000000000000000000000000000000..af987d35630407a86e99db1a1e35ad8bb8889e31 --- /dev/null +++ b/jQueryGantt/css/index.css @@ -0,0 +1,22 @@ + + .resEdit { + padding: 15px; + } + + .resLine { + width: 95%; + padding: 3px; + margin: 5px; + border: 1px solid #d0d0d0; + } + + body { + overflow: hidden; + } + + .ganttButtonBar h1{ + color: #000000; + font-weight: bold; + font-size: 28px; + margin-left: 10px; + } \ No newline at end of file diff --git a/jQueryGantt/css/tinyselect.css b/jQueryGantt/css/tinyselect.css new file mode 100644 index 0000000000000000000000000000000000000000..9c3507437fb5c5d6066bbff2a93eed9abc047673 --- /dev/null +++ b/jQueryGantt/css/tinyselect.css @@ -0,0 +1,144 @@ +.tinyselect { + height: 25px; + /* height: 50px; */ + display: inline-block; + min-width: 130px; + position: relative; +} + +.tinyselect .selectbox { + position: absolute; + height: 85%; + width: 100%; + + text-align: left; + + border-top:none; + border-left:none; + border-right:none; + /* line-height: 22px; */ + padding-left: 10px; + box-sizing: border-box; + + cursor: pointer; + border-radius: 3px; + + white-space: nowrap; + overflow-x: hidden; + background-color:white; + margin-top:10px; +} + +.tinyselect .selectbox::after { + content: ' '; + position: absolute; + right: 0px; + /* border-left: 1px solid #ccc; */ + height: 100%; + font-size: 10pt; + line-height: 34px; + padding: 0px 8px; + width: 10px; + /* background-color: #eee; */ + background-repeat: no-repeat; + background-position: center; + + /* background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAJCAYAAADkZNYtAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuOWwzfk4AAABXSURBVChTjY0BCYBAFMWugw3MYRAbmMROhjGDFXQTThSfcoNx/P8HV2DEvUG7kxVTUPV+MWCKqt4fLJhC9y96TLH7yIz30PmTDjc09HX+ZUJj3ybC96UczHIuzhJ1BlkAAAAASUVORK5CYII='); */ + +} + +.tinyselect .selectbox.open::after { + content: ' '; + background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAJCAYAAADkZNYtAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuOWwzfk4AAABYSURBVChTY8ABWqE0QZAOxP+hNF4gDMTvgBikGESD+DgByHqQQhjG6RwlIEZWCMMgcQywA4ixKQaJowAbIMamEIZB8nBwB4ixKYJhkDwYRAAxNgVomCECALjaLs5bhaybAAAAAElFTkSuQmCC'); + +} + + + + +.tinyselect .dropdown { + position: absolute; + width: 100%; + top: 33px; + border: 1px solid #ccc; + + background-color: white; + z-index: 100; + + box-sizing: border-box; + max-height: 200px; + + overflow-x: hidden; + overflow-y: scroll; +} + +.tinyselect .dropdown .searchcontainer { + padding: 5px; +} + +.tinyselect .dropdown .searchbox { + /* width: 100%; */ + width: 87%; + border: 1px solid #ccc; + font-size: 10pt; + line-height: 1.5em; + padding: 0 5px; +} + +.tinyselect .dropdown .searchicon { + position: absolute; + top: 12px; + /* right: 8px; */ + right: 3px; + width: 14px; + height: 14px; + background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuOWwzfk4AAADESURBVDhPnZLBDcIwDEW7DIt0CmZgBW5tc2AAFugWDNB7FuDMAB0g+FV25AQLJA5Prb797djJUEoJmabptCzLVVjneb4Lo483yYYadqF0bBQkJzJdSJIOT/7RtPuKLmS0yPgCq+zhyGq+NYGU0tkCXvdQVNh68TgmX697JJahEf/uaAEWE80oMbb9OSPJus1jq5zA6SxmR0erJhFGM30h20kOk85WL5wCWogu3N9q3Y3QFM3Xw8D+adUn9QtvfEQJMWV4A2WMBVG/g0M8AAAAAElFTkSuQmCC'); +} + + + + + +.tinyselect .itemcontainer { + list-style: none; + margin: 0; + padding: 0; +} + +.tinyselect .itemcontainer > li { + padding: 5px 2px; +} + +.tinyselect .itemcontainer > li.item { + padding: 5px 10px; + height:28px; +} + +.tinyselect .itemcontainer > li.selected { + background-color: #eee; + height:28px; +} + +.tinyselect .itemcontainer > li.item:hover { + background-color: #1b6eab; + color: white; +} + +.tinyselect .itemcontainer li.loadindicator { + padding: 15px; + font-weight: bold; +} + +.tinyselect .itemcontainer li.loaderrorindicator { + padding: 15px; + font-weight: bold; + color: red; +} +.select_3 +{ + width:50%; +} +.select_4 +{ + width:100px; +} \ No newline at end of file diff --git a/jQueryGantt/html/gantt.html b/jQueryGantt/html/gantt.html new file mode 100644 index 0000000000000000000000000000000000000000..ffe702a24a2324e42cbda60725471f9a76d5dd6f --- /dev/null +++ b/jQueryGantt/html/gantt.html @@ -0,0 +1,274 @@ +
style="padding:0px; overflow-y:auto; overflow-x:hidden;height:100%;position:relative;margin:0 5px">
+ + \ No newline at end of file diff --git a/jQueryGantt/index.js b/jQueryGantt/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8ba1771810a20f404cb42debd13808583e4215ee --- /dev/null +++ b/jQueryGantt/index.js @@ -0,0 +1,160 @@ +(function (KDApi, $) { + // 构造函数 + function MyComponent (model) { + this._setModel(model) + } + + MyComponent.prototype = { + // 绑定model + _setModel: function (model) { + this.model = model + }, + // 生命周期:初始化 + init: function (props) { + console.log('-----init', this.model, props); + setHtml(this.model,props.data); + }, + // 生命周期:更新 + update: function (props) { + if (this.model.dom.ge){ + //编辑器已经准备好了,直接更新数据 + updateHtml(this.model,props.data) + }else{ + //编辑器还没有准备好,先记录下状态和数据 + this.model.dom.formulaState = 1 + this.model.dom.formulaData = props.data + } + }, + // 生命周期:销毁 + destoryed: function () { + console.log('-----destoryed', this.model) + var pageId = this.model.pageId.substring(18,this.model.pageId.length); + deleteInstance(pageId); + } + + } + + // 加载文件和模板 + var setHtml = function (model,data) { + var cssPath = [ + "./css/index.css?ver=1.4", + "./jQueryGantt/platform.css?ver=1.4", + "./jQueryGantt/libs/jquery/dateField/jquery.dateField.css?ver=1.4", + "./jQueryGantt/gantt.css?ver=1.4", + "./css/tinyselect.css?ver=1.4", + + ] + var pageId = model.pageId.substring(18,model.pageId.length); + KDApi.loadFile(cssPath,model.schemaId,() => { + KDApi.getTemplateStringByFilePath('./html/gantt.html',model.schemaId,{ + name_space: KDApi.nameSpace(model.schemaId), + mainId:"work_"+pageId, + pageId:pageId + }).then(result => { + model.dom.innerHTML = result + initEvent(model,data); + }) + }) + + + } + + // DOM节点操作函数 + var initEvent = function (model,data) { + + var filePath = [ + "./jQueryGantt/libs/jquery/jquery.min.js?ver=1.4", + "./jQueryGantt/libs/jquery/jquery-ui.min.js?ver=1.4", + + "./jQueryGantt/libs/jquery/jquery.livequery.1.1.1.min.js?ver=1.4", + "./jQueryGantt/libs/jquery/jquery.timers.js?ver=1.4", + + "./jQueryGantt/libs/utilities.js?ver=1.4", + "./jQueryGantt/libs/forms.js?ver=1.4", + "./jQueryGantt/libs/date.js?ver=1.4", + "./jQueryGantt/libs/dialogs.js?ver=1.4", + "./jQueryGantt/libs/layout.js?ver=1.4", + "./jQueryGantt/libs/i18nJs_cn.js?ver=1.4", + "./jQueryGantt/libs/jquery/dateField/jquery.dateField.js?ver=1.4", + "./jQueryGantt/libs/jquery/JST/jquery.JST.js?ver=1.4", + "./jQueryGantt/libs/jquery/valueSlider/jquery.mb.slider.js?ver=1.4", + "./jQueryGantt/libs/layer/layer.js?ver=1.4", + + "./jQueryGantt/libs/jquery/svg/jquery.svg.min.js?ver=1.4", + "./jQueryGantt/libs/jquery/svg/jquery.svgdom.1.8.js?ver=1.4", + "./jQueryGantt/libs/tinyselect.js?ver=1.4", + + + "./jQueryGantt/ganttUtilities.js?ver=1.4", + "./jQueryGantt/ganttTask.js?ver=1.4", + "./jQueryGantt/ganttDrawerSVG.js?ver=1.4", + "./jQueryGantt/ganttZoom.js?ver=1.4", + "./jQueryGantt/ganttGridEditor.js?ver=1.4", + "./jQueryGantt/ganttMaster.js?ver=1.4", + "./js/init.js?ver=1.4" + ] + + loadScript(model,filePath,filePath.length,0,data); + } + + var loadScript = function(model,filePath,length, index,data) { + if(index < length){ + KDApi.loadFile(filePath[index], model, function(){ + if(index == length-1){ + var pageId = model.pageId.substring(18,model.pageId.length); + model.dom.ge = new GanttMaster(); + model.dom.ge.set100OnClose=true; + model.dom.ge.shrinkParent=true; + model.dom.ge.init($("#work_"+pageId)); + model.dom.ge.pageId = pageId; + loadI18n(); + setInstance(model); + //如果状态为1,表明之前因为编辑器还没准备好就已经接收了更新数据命令,此时需要将数据更新 + if (model.dom.formulaState === 1){ + updateHtml(model,model.dom.formulaData) + model.dom.formulaState = 0 + } + } + loadScript(model,filePath,length, index+1,data); + }) + } + } + + var updateHtml = function(model,data){ + if(data && data.result){ + if(data.eventArgs == "selectData"){ + var project = data.data ? data.data : getDemoProject(); + delete model.dom.ge.gantt.zoom; + if (!project.canWrite){ + $(".ganttButtonBar button.requireWrite").attr("disabled","true"); + } + model.dom.ge.loadProject(project); + model.dom.ge.checkpoint(); + }else if(data.eventArgs == "bindWorkItem"){ + var row = model.dom.ge.currentTask.getRow() + 1; + if (row>0) { + for (let i = 0; i < data.data.length; i++) { + var taskData = data.data[i]; + model.dom.ge.beginTransaction(); + var task = new Task(taskData.id, taskData.name, taskData.code, model.dom.ge.currentTask.level+ 1, taskData.start, taskData.end, 1); + task.type = taskData.dmp_type; + task.progress = taskData.progress; + task.assigs = taskData.assigs; + task.typeId = taskData.typeId; + task.status = taskData.status; + task = model.dom.ge.addTask(task, row); + // task.indent(); + model.dom.ge.endTransaction(); + } + } + }else if(data.eventArgs == "clearGantt"){ + var pageId = model.pageId.substring(18,model.pageId.length); + clearGantt(pageId); + saveGanttOnServer(pageId); + } + } + } + console.log('-----------------init') + // 注册自定义控件 + KDApi.register('jQueryGantt', MyComponent) +})(window.KDApi, jQuery) \ No newline at end of file diff --git a/jQueryGantt/jQueryGantt/README.md b/jQueryGantt/jQueryGantt/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1721dd9f2fdad2bfc0affd3c5c5fac5d7e6aab98 --- /dev/null +++ b/jQueryGantt/jQueryGantt/README.md @@ -0,0 +1,38 @@ +jQueryGantt +=========== +jQuery Gantt editor has been written by Roberto Bicchierai and Silvia Chelazzi + + +Twproject jQuery Gantt + +These are some key features: +* jQuery based 3.2 +* MIT licensed: you can reuse everywhere https://opensource.org/licenses/MIT +* JSON import-export +* internationalizable +* manage task status –> project workflow +* manage dependencies +* manage assignments (resources, roles efforts) +* server synchronization ready +* full undo-redo support +* cross browser (at least for recent versions) +* keyboard editing support +* SVG visual editor +* print friendly +* collapsible branches +* critical path +* milestones, progress etc. +* zoom + +Try the online working demo here: https://gantt.twproject.com + +Read here about latest release: https://roberto.twproject.com/2017/04/05/new-gantt-editor-release-the-best-ever/ + +Read the genesis of this component here: http://roberto.twproject.com/2012/06/14/the-javascript-gantt-odyssey/ + +Documentation is here: http://roberto.twproject.com/2012/08/24/jquery-gantt-editor/ + +jQuery Gantt editor is part of Twproject 6 project + + + diff --git a/jQueryGantt/jQueryGantt/composer.json b/jQueryGantt/jQueryGantt/composer.json new file mode 100644 index 0000000000000000000000000000000000000000..311050524072b770eecbb894f762fe9237517a0d --- /dev/null +++ b/jQueryGantt/jQueryGantt/composer.json @@ -0,0 +1,9 @@ +{ + "name": "robicch/jquery-gantt", + "description": "Twproject Gantt editor is a free online tool for creating and sharing Gantts", + "type": "library", + "license": "MIT", + "keywords": ["jquery","gantt"], + "homepage": "https://github.com/robicch/jQueryGantt", + "require": {} +} diff --git a/jQueryGantt/jQueryGantt/gantt.css b/jQueryGantt/jQueryGantt/gantt.css new file mode 100644 index 0000000000000000000000000000000000000000..278d19752f4ad169491e6f8d2bd920d90560ad3c --- /dev/null +++ b/jQueryGantt/jQueryGantt/gantt.css @@ -0,0 +1,872 @@ + +body{ + /*overflow: hidden;*/ +} + +.TWGanttWorkSpace.ganttFullScreen{ + position: fixed; + top:0; + left:0; + bottom:0; + right: 0; + margin: auto; + z-index: 1000; + background-color: #fff; +} + +/* -------------------------------------- GRIDIFY -----------------------------------*/ +.gdfTable { + table-layout: fixed; + border-collapse: separate; + border-spacing: 0; + background-color: #fff; +} + +.gdfTable td, .gdfTable th { + vertical-align: middle; + overflow: hidden; + text-overflow: clip; + white-space: nowrap; + font-size: 14px +} + +.gdfCell { + overflow: hidden; + padding:4px 2px; + border-bottom: 1px solid #eee; + border-right: 1px solid #eee; + font-family: arial, helvetica, sans-serif; +} + +.gdfCell.noClip{ + overflow: visible; +} + +.gdfColHeader { + min-width: 5px; + height: 30px; + background-color: #eee; + border-bottom:2px solid #bbb; + border-right: 1px solid #bbb; +} + +.gdfColHeader:last-of-type { + border-right: none; +} + +.gdfCell:last-of-type { + border-right: none; +} + + +.gdfCellInput { + border: 0 none; + font-size: 12px; + height: 20px; + margin: 0; + padding: 0; + width: 100%; + background-color: #d4fbe8; +} + +.gdfCellWrap { + border: 0 none; + font-size: 12px; + height: 17px; + margin: 0; + padding: 0; + width: 100%; + overflow: hidden; + + background-color: #ffcccc; +} + +.gdfHResizing { + cursor: w-resize; +} + + +/* -------------------------------------- SPLITTER -----------------------------------*/ +.splitterContainer { + width: 100%; + height: 100%; +} + +.splitBox1{ + overflow-x: scroll; + overflow-y: hidden; +} + +.splitBox2 { + overflow-x: scroll; + overflow-y: auto; +} + + +.splitElement { + outline-style: none; + position: absolute; + height: 100%; + background-color: #f3f3f3; +} + +.vSplitBar { + position: relative; + width: 5px; + /*background-color: rgba(170, 170, 170, .2);*/ + cursor: ew-resize; + text-align: center; + color: white; + box-shadow: 0 0 3px rgba(0, 0, 0, .4); + background: rgba(170, 170, 170, .2) url("res/ganttSplitterGrip.png") no-repeat center center; + z-index: 5; +} + +.unselectable .vSplitBar, .vSplitBar:hover { + background-color: rgba(170, 170, 170, .5); + box-shadow: 0 0 5px rgba(0, 0, 0, .5); + +} + +.vSplitBar .toLeft,.vSplitBar .toRight,.vSplitBar .toCenter{ + font-family: icons,TeamworkRegular; + cursor: pointer; + position: absolute; + top: 0; + margin-top: 0; + /*background-color: rgba(170, 170, 170, .2);*/ + /*background-color: rgba(0, 126, 221, 0.3);*/ + background-color: rgba(47, 170, 201, 0.3); + z-index: 2; + font-size: 10px; + width: 15px; + /*box-shadow: 0 0 1px rgba(0, 0, 0, .5);*/ +} + +.unselectable .vSplitBar .toLeft,.unselectable .vSplitBar .toCenter,.unselectable .vSplitBar .toRight, .vSplitBar:hover .toLeft, .vSplitBar:hover .toRight, .vSplitBar:hover .toCenter{ + /*background-color: rgba(170, 170, 170, 1);*/ + /*background-color: rgba(0, 126, 221, 1);*/ + background-color: rgba(47, 170, 201, 1); + + box-shadow: 0 0 1px rgba(0, 0, 0, .4); +} + +.vSplitBar .toLeft { + left: -19px; + text-align: left; +} +.vSplitBar .toCenter{ + left:-4px; + text-align: center; +} +.vSplitBar .toRight{ + left:10px; + text-align: right; +} + +.ganttFixHead{ + position: absolute; + z-index: 2; + top:0; +} + +/* -------------------------------------- GANTT -----------------------------------*/ + +.ganttTable{ + table-layout:fixed; + background-color: #ffffff; +} + +.ganttTable td,.ganttTable th{ + overflow: hidden; + text-overflow: clip; + white-space: nowrap; +} + +.ganttHead1,.ganttHead2{ + height:20px; +} + +.ganttHead1 th{ + border-left:1px solid #b0b0b0; + padding: 0; + margin: 0; + /*border-right: 1px solid #bbb;*/ + border-bottom:1px solid #bbb; + background: #EEEEEE; + white-space: pre-line; + word-break: break-all; +} + +.ganttHead1 th, +.ganttHead2 th{ + white-space: nowrap; + overflow: hidden; +} + +.ganttHead2 th{ + padding: 0; + margin: 0; + border-left:1px solid #b0b0b0; + /*border-right: 1px solid #bbb;*/ + border-bottom:2px solid #bbb; + background: #EEEEEE; +} + +.ganttHead1 th.headSmall,.ganttHead2 th.headSmall{ + font-size: 10px; +} + +.ganttHead1 th.headLeft,.ganttHead2 th.headLeft{ + text-align: left; +} + +.ganttToday{ + position:absolute; + top:0; + width:1px; + height:100%; + border-left:2px dotted #13AFA5; +} + +.ganttTitle img { + max-width: 150px; +} + +.ganttButtonBar{ + position:relative; + z-index: 2; + /*background-color: #fff;*/ + border-bottom: 1px solid #959595; + padding: 5px 0 5px 10px; +} + +.dataTable .ganttButtonBar{ + border-bottom: none; +} + +.ganttButtonBar .buttons { + position: relative; + display:inline-block; + width: 100%; + margin-top: 0; + height: 45px; +} + +.dataTable .ganttButtonBar .buttons { + display:inline-block; + width: 100%; +} + +.ganttButtonBar .buttons button{ + vertical-align: middle; + margin:0; + outline: none; +} + +.ganttButtonBar .buttons .button.textual.icon { + height: 45px; +} + + +.button span.teamworkIcon { + text-indent: -10px; +} + + +.button.textual span.teamworkIcon { + font-size: 140% +} + +#saveGanttButton { + margin-left:20px; + padding: 5px 12px; + margin-bottom: 0; + vertical-align: middle; +} + + +.ganttButtonSeparator{ + border-left:1px solid #dadada; + margin:0 10px; + font-size: 130%; + vertical-align: middle; +} + +.ganttLines{ + position:absolute; + width:100%; + height:1px; + border-top:1px solid #eee; + z-index:1; +} + +.ganttLinks{ + z-index:10; +} + + +.ganttTable td.end{ + border-right: 2px dotted #ddd; +} + +.ganttHead2 th.holy{ + background-color: rgba(236, 195, 176, 0.40); +} +.ganttBodyCell.holy{ + background-color: rgba(255, 245, 230, 0.51); +} + + +/* -------------------------------------- TASK -----------------------------------*/ + +.taskBoxDiv{ + position:absolute; + height:25px; + margin-top:3px; + z-index:100; +} + +.taskBoxDiv .layout { + height:100%; + color:#DB2727; + border-radius:2px; + background: #eee; /* Old browsers */ + border:1px solid #bbb; +} + +.taskBoxDiv .taskStatus { + left:5px; + top:10px; + position:absolute; + width:10px; + height:10px; +} + +.taskBoxDiv .layout .milestone{ + top:0; + position:absolute; + width:18px; + background: url(res/milestone.png) no-repeat; + height:18px; + display:none; +} +.taskBoxDiv .layout .milestone.end{ + right:0; +} +.taskBoxDiv .layout .milestone.active{ + display:block; +} + +.taskBoxDiv.hasChild .layout{ + border-top:2px solid black; +} + +.taskBoxDiv .taskProgress{ + height:5px; + position:absolute; +} + +.taskBoxDiv .layout.extDep{ + background-image:url(res/hasExternalDeps.png); +} + + +.taskLabel{ + position:absolute; + height:28px; + color:black; + text-align:right; + padding-right:5px; + overflow:hidden; + left:-200px; + width:195px; + white-space:nowrap; +} + + +.taskDepLine { + border: 1px solid #9999ff; + overflow: hidden; + position: absolute; +} + + +.taskEditRow,.emptyRow { + height:30px; +} + +.taskEditRow input, .columnWidthTest{ + border: 0 none; + font-size: 14px; + height: 20px; + margin: 0; + padding:0; + outline: 0; + width: 100%; + border-radius: 0; + vertical-align: text-bottom; +} + +.taskEditRow input[type=checkbox]{ + transform:scale(.7); + width:15px; + height: 15px; +} + +.columnWidthTest{ + width: auto; +} + +.taskEditRow input:focus{ + font-weight: bold; +} + +.taskEditRow input{ + background-color: transparent; +} + +.taskEditRow.rowSelected td{ + background-color:rgb(234, 248, 255); +} + + +.isGanttList .taskEditRow:nth-child(odd), .assigEditRow:nth-child(odd){ + background-color: #ffffff; +} +.isGanttList .taskEditRow:nth-child(even), .assigEditRow:nth-child(even){ + background-color: #ffffff; +} + +input[readonly]{ + color: #c0c0c0; +} + +.taskStatusBox{ + position:absolute; + /*width:100px;*/ + height:26px; + border:1px solid #a0a0a0; + background-color:#fff; + margin-top:-21px; + margin-left:-2px; + padding: 4px; + z-index: 100; +} +.taskStatus{ + width:15px; + height:15px; + display:inline-block; + text-indent: 0; + position:relative; + box-shadow: none; + border-radius: 50%; + border:0; + cursor: pointer; +} +.taskStatus[status=STATUS_ACTIVE]{ + background-color: #0e5fd8; + color: #fff; +} + +.taskStatus2{ + padding-left: 28px; + height: 21px; + line-height: 20px; + text-decoration: none; +} +/**进行中*/ +.taskStatus2[status=STATUS_ACTIVE]{ + background: url(../../../../../icons/pc/state/jinxingzhong.png?v=1.0) 5px 3px no-repeat; + background-size: 18px 18px; +} +/**计划中*/ +.taskStatus2[status=STATUS_WAITING]{ + background: url(../../../../../icons/pc/state/queren_48_48.png?v=1.0) 5px 3px no-repeat; + background-size: 18px 18px; +} +/**已完成*/ +.taskStatus2[status=STATUS_DONE]{ + background: url(../../../../../icons/pc/state/success_28_28.png?v=1.0) 5px 3px no-repeat; + background-size: 18px 18px; +} +/**已失效*/ +.taskStatus2[status=STATUS_FAILED]{ + background: url(../../../../../icons/pc/other/deleteicon_hover.png?v=1.0) 5px 3px no-repeat; + background-size: 18px 18px; +} +/**已延期*/ +.taskStatus2[status=STATUS_UNDEFINED]{ + background: url(../../../../../icons/pc/state/warning34_34.png?v=1.0) 5px 3px no-repeat; + background-size: 18px 18px; +} + + + +.taskStatus[status=STATUS_DONE]{ + background-color: #6EBEF4; + color:#000; +} +.taskStatus[status=STATUS_FAILED]{ + background-color: #763A96; + color: #fff; +} +.taskStatus[status=STATUS_SUSPENDED]{ + background-color: #F9C154; + color:#000; +} +.taskStatus[status=STATUS_WAITING]{ + background-color:#F79136; + color:#000; +} +.taskStatus[status=STATUS_UNDEFINED]{ + background-color: #dededf; + color:#000; +} +.taskStatus.selected{ + border:#666 2px solid; +} + +select.taskStatus{ + width: auto; + height: auto; + border-radius: 2px; +} + +.assigsTableWrapper{ + position: relative; + height: 150px; + overflow: auto; + margin-top: -20px; +} + +.unselectable { + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -o-user-select: none; + user-select: none; +} + + +.exp-controller{ + display:inline-block; + width:16px; + height:16px; + position: relative; + top: 2px; + margin-left: -18px; +} + +.isParent .exp-controller{ + background-image: url(res/toggle_collapse.png); +} + +.isParent.collapsed .exp-controller{ + cursor: pointer; + background-image: url(res/toggle-expand.png); +} + +.ui-resizable-helper { border: 1px dotted #00F; } +.ui-resizable-e, .ui-resizable-w {width: 5px;} +.ui-draggable{ + cursor:move; +} + +/*--------------------------------------------------- SVG --------------------------------------------------*/ +.ganttSVGBox{ + position: absolute; + top:0; + left: 0; + height: 100%; + background-color: transparent; + width: 100%; + overflow-y: hidden; /*IE11 bug*/ +} + +.taskBoxSVG{ + overflow: visible; +} + +.taskBoxSVG .taskLayout{ + stroke-width:0; + stroke:#999; +} + +.taskLinkPathSVG{ + stroke: rgba(47, 151, 198, 1); + /*stroke:#9999ff;*/ + stroke-width:2.5px; + fill:none; + cursor:pointer; +} + +.ganttLinesSVG{ + fill:transparent; + stroke-width:1; + stroke:#eee; +} + +.isGanttList .ganttLinesSVG:nth-child(even){ + fill:transparent; + stroke-width:1; + stroke:#fff; + +} +.isGanttList .ganttLinesSVG:nth-child(odd){ + fill:transparent; + stroke-width:1; + stroke:#eee; +} + +.ganttLinesSVG.rowSelected{ + fill: rgb(234, 248, 255) !important; + /*fill: rgba(255, 255, 153, 0.50) !important;*/ +} + +.ganttTodaySVG{ + stroke-width:2px; + stroke:#e06671; + stroke-linecap:"round"; + stroke-dasharray:2,2; +} + +.colorByStatus .taskStatusSVG[status=STATUS_ACTIVE]{ + fill: #00BBFF; +} +.colorByStatus .taskStatusSVG[status=STATUS_DONE]{ + fill: #31C181; +} +.colorByStatus .taskStatusSVG[status=STATUS_FAILED]{ + fill: #FA574F; +} +.colorByStatus .taskStatusSVG[status=STATUS_SUSPENDED]{ + fill: #f9c154; +} +.colorByStatus .taskStatusSVG[status=STATUS_UNDEFINED]{ + fill: #FD6C6A; +} +.colorByStatus .taskStatusSVG[status=STATUS_UNDEFINED] .taskLayout{ + stroke: #ccc; + stroke-width:1; +} + +.colorByStatus .taskStatusSVG[status=STATUS_DONE] .textPerc, +.colorByStatus .taskStatusSVG[status=STATUS_ACTIVE] .textPerc, +.colorByStatus .taskStatusSVG[status=STATUS_FAILED] .textPerc{ + fill: #fff; +} + +.deSVG.deSVGdrag { + cursor: move; +} + +.deSVG.deSVGhand { + cursor: ew-resize; +} + +.linkHandleSVG{ + display:none; + stroke:transparent; + stroke-width:5; + fill: rgba(47, 151, 198, 0.7); + cursor: pointer; +} + +.linkLineSVG{ + stroke-width:5px; + stroke: rgba(47, 151, 198, 0.7); + stroke-linecap:"round"; + opacity: .5; +} + +.linkOnProgress .deSVG.taskBoxSVG { + cursor:cell; +} + +.taskBoxSVG.linkOver .taskLayout{ + stroke-width:1px; + stroke:rgba(47, 151, 198, 0.7); + opacity: 1; +} + +.taskLabelSVG { + stroke: none; + fill:#999; + font-size: 12px; +} + +.critical .taskLinkPathSVG{ + stroke:red; +} + +.taskBoxSVG.critical .taskLayout{ + stroke:red; +} + +.focused .taskLinkPathSVG{ + stroke-width:5px; + stroke: rgba(47, 151, 198, 0.7); +} + +.taskBoxSVG.focused .taskLayout{ + stroke-width:3px; + stroke: rgba(47, 151, 198, 0.7); +} + +.taskBoxSVG.critical .taskLayout{ + stroke-width:3px; + stroke: rgba(255, 0, 0, 0.7); +} + + + +/*--------------------------------------------------- RESOURCE ADD --------------------------------------------------*/ +.ganttAddResource{ + position: absolute; + width: 660px; + height: 300px; + border: 1px solid red; + background-color: white; + box-shadow: 0 0 5px rgba(0,0,0,0.3); + top:120px; + left:70px; + z-index: 200; + padding: 10px; +} + +.ganttAddResource tr.isCompany{ + display:none; +} + +.ganttAddResource.isCompany tr.isCompany{ + display:table-row; +} +.ganttAddResource.isCompany tr.isPerson{ + display:none; +} +.ganttAddResourceBG { + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; + background-color: rgba(0, 0, 0, .3); + z-index: 200; +} + + +/*---------------------------------#LOG_CHANGES_CONTAINER --------------------------------------------*/ +#LOG_CHANGES_CONTAINER{ + display: none; + width: 300px; + top:-130px; + margin-left: -35px +} + + +.userProfile { + font-size: 16px; + vertical-align: middle; + text-align: right; + margin: 0 5px 0 0; + padding: 5px; + float: right; + position: relative; + z-index: 50; + line-height: 40px; + vertical-align: middle; + position: absolute; + right: 0; +} + +.userLine { + max-width: 150px; + display: inline-block; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + margin: 0;padding: 0; + vertical-align: middle; +} + +.avatar { + vertical-align: middle; + padding: 1px; + width: 27px; + height: 27px; + border: 1px solid #dedede +} + +/*--------------------------------------------------- Media queries --------------------------------------------------*/ + +/* Large screens */ + +@media only screen and (max-width : 1260px) { + + .ganttButtonBar .button span.teamworkIcon { + font-size: 130%; + } + .userLine { + display: none; + } + +} + +@media only screen and (min-width : 1261px) and (max-width : 1320px) { + + .ganttButtonBar .button span.teamworkIcon { + font-size: 130%; + } + + .button { + font-size: 100%; + padding: 3px 9px 6px; + margin-right: 5px; + margin-bottom: 5px + } + + .userLine { + display: none; + } + +} + +@media only screen and (max-width : 1160px) { + + .userProfile { + float: none; + position: absolute; + top:0; + right: 10px; + } + + .userProfile .teamworkIcon { + color: rgb(255, 255, 255); + } + .userProfile .ganttButtonSeparator, .userProfile .avatar { + border-color: rgb(127, 154, 170); + } + +} + +/* Ipad */ + +@media only screen and (min-width: 768px) and (max-width: 1024px){ + .ganttButtonSeparator { + margin-left: 2px; + padding-right: 6px; + font-size: 100%; + } + .button { + padding: 5px 6px 6px; + } +} + +/* Mobile TODO */ + +@media only screen and (max-width: 767px) { + .button { + font-size: 50%; + } +} diff --git a/jQueryGantt/jQueryGantt/ganttDrawerSVG.js b/jQueryGantt/jQueryGantt/ganttDrawerSVG.js new file mode 100644 index 0000000000000000000000000000000000000000..c1baa51ba67f17d154c941bd1e3c173cf0341fa5 --- /dev/null +++ b/jQueryGantt/jQueryGantt/ganttDrawerSVG.js @@ -0,0 +1,1060 @@ +/* + Copyright (c) 2012-2018 Open Lab + Written by Roberto Bicchierai and Silvia Chelazzi http://roberto.open-lab.com + 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. + + + todo For compatibility with IE and SVGElements.getElementsByClassName not implemented changed every find starting from SVGElement (the other works fine) + .find(".classname")) -> .find("[class*=classname]) + */ +function Ganttalendar(startMillis, endMillis, master, minGanttSize) { + this.master = master; // is the a GantEditor instance + this.element; // is the jquery element containing gantt + + this.svg; // instance of svg object containing gantt + this.tasksGroup; //instance of svg group containing tasks + this.linksGroup; //instance of svg group containing links + + this.minGanttSize = minGanttSize; + this.includeToday = false; //when true today is always visible. If false boundaries comes from tasks periods + this.showCriticalPath = false; //when true critical path is highlighted + + this.initZoomlevels(); // initialite the zoom level definitions + + this.originalStartMillis=startMillis; + this.originalEndMillis=endMillis; + this.gridChanged=true; //witness for boundaries changed. Force to redraw gantt grid + this.element = this.createGanttGrid(); // fake + + this.linkOnProgress = false; //set to true when creating a new link + + this.taskHeight=20; + this.resizeZoneWidth=5; + this.taskVertOffset = (this.master.rowHeight - this.taskHeight) / 2; +} + + +Ganttalendar.prototype.zoomGantt = function (isPlus) { + var curLevel = this.zoom; + var pos = this.zoomLevels.indexOf(curLevel + ""); + + var centerMillis=this.getCenterMillis(); + var newPos = pos; + if (isPlus) { + newPos = pos <= 0 ? 0 : pos - 1; + } else { + newPos = pos >= this.zoomLevels.length - 1 ? this.zoomLevels.length - 1 : pos + 1; + } + if (newPos != pos) { + curLevel = this.zoomLevels[newPos]; + this.gridChanged=true; + this.zoom = curLevel; + + this.storeZoomLevel(); + this.redraw(); + this.goToMillis(centerMillis); + } +}; + + + +Ganttalendar.prototype.getStoredZoomLevel = function () { + if (localStorage && localStorage.getObject("TWPGanttSavedZooms")) { + var savedZooms = localStorage.getObject("TWPGanttSavedZooms"); + return savedZooms[this.master.tasks[0].id]; + } + return false; +}; + +Ganttalendar.prototype.storeZoomLevel = function () { + //console.debug("storeZoomLevel: "+this.zoom); + if (localStorage) { + var savedZooms; + if (!localStorage.getObject("TWPGanttSavedZooms")) + savedZooms = {}; + else + savedZooms = localStorage.getObject("TWPGanttSavedZooms"); + + savedZooms[this.master.tasks[0].id]=this.zoom; + + localStorage.setObject("TWPGanttSavedZooms", savedZooms); + } +}; + +Ganttalendar.prototype.createHeadCell=function(level,zoomDrawer,rowCtx,lbl, span, additionalClass,start, end) { + var x = (start.getTime() - self.startMillis)* zoomDrawer.computedScaleX; + var th = $("").html(lbl).attr("colSpan", span); + if (level>1) { //set width on second level only + var w = (end.getTime() - start.getTime()) * zoomDrawer.computedScaleX; + th.width(w); + } + if (additionalClass) + th.addClass(additionalClass); + rowCtx.append(th); +}; + +Ganttalendar.prototype.createBodyCell=function(zoomDrawer,tr,span, isEnd, additionalClass) { + var ret = $("").html("").attr("colSpan", span).addClass("ganttBodyCell"); + if (isEnd) + ret.addClass("end"); + if (additionalClass) + ret.addClass(additionalClass); + tr.append(ret); +}; + + +Ganttalendar.prototype.createGanttGrid = function () { + //console.debug("Gantt.createGanttGrid zoom: "+this.zoom +" " + new Date(this.originalStartMillis).format() + " - " + new Date(this.originalEndMillis).format()); + //var prof = new Profiler("ganttDrawer.createGanttGrid"); + var self = this; + + // get the zoomDrawer + // if the desired level is not there uses the largest one (last one) + var zoomDrawer=self.zoomDrawers[self.zoom] || self.zoomDrawers[self.zoomLevels[self.zoomLevels.length-1]]; + + //get best dimension for gantt + var adjustedStartDate= new Date(this.originalStartMillis); + var adjustedEndDate=new Date(this.originalEndMillis); + zoomDrawer.adjustDates(adjustedStartDate,adjustedEndDate); + + self.startMillis = adjustedStartDate.getTime(); //real dimension of gantt + self.endMillis = adjustedEndDate.getTime(); + + //this is computed by hand in order to optimize cell size + var computedTableWidth= (self.endMillis - self.startMillis) * zoomDrawer.computedScaleX; + + //set a minimal width + computedTableWidth = Math.max(computedTableWidth, self.minGanttSize); + + var table = $(""); + + //loop for header1 + var start = new Date(self.startMillis); + var tr1 = $("").addClass("ganttHead1"); + while (start.getTime() <= self.endMillis) { + zoomDrawer.row1(start,tr1); + } + + //loop for header2 e tbody + start = new Date(self.startMillis); + var tr2 = $("").addClass("ganttHead2"); + var trBody = $("").addClass("ganttBody"); + while (start.getTime() <= self.endMillis) { + zoomDrawer.row2(start,tr2,trBody); + } + + table.append(tr1).append(tr2); // removed as on FF there are rounding issues //.css({width:computedTableWidth}); + + var head = table.clone().addClass("ganttFixHead"); + + table.append(trBody).addClass("ganttTable"); + + + var height = self.master.editor.element.height(); + table.height(height); + + var box = $("
"); + box.addClass("gantt unselectable").attr("unselectable", "true").css({position:"relative", width:computedTableWidth}); + box.append(table); + box.append(head); + + //create the svg + box.svg({settings:{class:"ganttSVGBox"}, + onLoad: function (svg) { + //console.debug("svg loaded", svg); + + //creates gradient and definitions + var defs = svg.defs('myDefs'); + + //create backgound + var extDep = svg.pattern(defs, "extDep", 0, 0, 10, 10, 0, 0, 10, 10, {patternUnits:'userSpaceOnUse'}); + var img=svg.image(extDep, 0, 0, 10, 10, KDApi.nameSpace("jQueryGantt") +"./jQueryGantt/res/ganttSplitterGrip.png",{opacity:.3}); + + self.svg = svg; + $(svg).addClass("ganttSVGBox"); + + //creates grid group + var gridGroup = svg.group("gridGroup"); + + //creates links group + self.linksGroup = svg.group("linksGroup"); + + //creates tasks group + self.tasksGroup = svg.group("tasksGroup"); + + //compute scalefactor fx + //self.fx = computedTableWidth / (endPeriod - startPeriod); + self.fx = zoomDrawer.computedScaleX; + + } + }); + + return box; +}; + + +//<%-------------------------------------- GANT TASK GRAPHIC ELEMENT --------------------------------------%> +Ganttalendar.prototype.drawTask = function (task) { + //console.debug("drawTask", task.name,this.master.showBaselines,this.taskHeight); + var self = this; + //var prof = new Profiler("ganttDrawTask"); + + if (self.master.showBaselines) { + var baseline = self.master.baselines[task.id]; + if (baseline) { + //console.debug("baseLine",baseline) + var baseTask = $(_createBaselineSVG(task, baseline)); + baseTask.css("opacity", .5); + task.ganttBaselineElement = baseTask; + } + } + + var taskBox = $(_createTaskSVG(task)); + task.ganttElement = taskBox; + + + if (self.showCriticalPath && task.isCritical) + taskBox.addClass("critical"); + + if (this.master.permissions.canWrite || task.canWrite) { + + //bind all events on taskBox + taskBox + .click(function (e) { // manages selection + e.stopPropagation();// to avoid body remove focused + self.element.find("[class*=focused]").removeClass("focused"); + $(".ganttSVGBox .focused").removeClass("focused"); + var el = $(this); + if (!self.resDrop) + el.addClass("focused"); + self.resDrop = false; //hack to avoid select + + $("body").off("click.focused").one("click.focused", function () { + $(".ganttSVGBox .focused").removeClass("focused"); + }) + + }).dblclick(function () { + if (self.master.permissions.canSeePopEdit) + if(task.typeId === "plan"){ + self.master.editor.openFullEditor(task,false); + $("select[name='resourceId']").tinyselect(); + } + }).mouseenter(function () { + //bring to top + var el = $(this); + if (!self.linkOnProgress) { + $("[class*=linkHandleSVG]").hide(); + el.find("[class*=linkHandleSVG]").stopTime("hideLink").show(); + } else { + el.addClass("linkOver"); + } + }).mouseleave(function () { + var el = $(this); + el.removeClass("linkOver").find("[class*=linkHandleSVG]").oneTime(500,"hideLink",function(){$(this).hide()}); + + }).mouseup(function (e) { + $(":focus").blur(); // in order to save grid field when moving task + }).mousedown(function () { + var task = self.master.getTask($(this).attr("taskid")); + task.rowElement.click(); + }).dragExtedSVG($(self.svg.root()), { + canResize: this.master.permissions.canWrite || task.canWrite, + canDrag: !task.depends && (this.master.permissions.canWrite || task.canWrite), + resizeZoneWidth:self.resizeZoneWidth, + startDrag: function (e) { + $(".ganttSVGBox .focused").removeClass("focused"); + }, + drag: function (e) { + $("[from=" + task.id + "],[to=" + task.id + "]").trigger("update"); + }, + drop: function (e) { + self.resDrop = true; //hack to avoid select + var taskbox = $(this); + var task = self.master.getTask(taskbox.attr("taskid")); + var s = Math.round((parseFloat(taskbox.attr("x")) / self.fx) + self.startMillis); + self.master.beginTransaction(); + self.master.moveTask(task, new Date(s)); + self.master.endTransaction(); + }, + startResize:function (e) { + $(".ganttSVGBox .focused").removeClass("focused"); + var taskbox = $(this); + var text = $(self.svg.text(parseInt(taskbox.attr("x")) + parseInt(taskbox.attr("width") + 8), parseInt(taskbox.attr("y")), "", {"font-size":"10px", "fill":"red"})); + taskBox.data("textDur", text); + }, + resize: function (e) { + //find and update links from, to + var taskbox = $(this); + var st = Math.round((parseFloat(taskbox.attr("x")) / self.fx) + self.startMillis); + var en = Math.round(((parseFloat(taskbox.attr("x")) + parseFloat(taskbox.attr("width"))) / self.fx) + self.startMillis); + var d = getDurationInUnits(computeStartDate(st), computeEndDate(en)); + var text = taskBox.data("textDur"); + text.attr("x", parseInt(taskbox.attr("x")) + parseInt(taskbox.attr("width")) + 8).html(durationToString(d)); + + $("[from=" + task.id + "],[to=" + task.id + "]").trigger("update"); + }, + stopResize: function (e) { + self.resDrop = true; //hack to avoid select + var textBox = taskBox.data("textDur"); + if (textBox) + textBox.remove(); + var taskbox = $(this); + var task = self.master.getTask(taskbox.attr("taskid")); + var st = Math.round((parseFloat(taskbox.attr("x")) / self.fx) + self.startMillis); + var en = Math.round(((parseFloat(taskbox.attr("x")) + parseFloat(taskbox.attr("width"))) / self.fx) + self.startMillis); + + //in order to avoid rounding issue if the movement is less than 1px we keep the same start and end dates + if (Math.abs(st-task.start)<1/self.fx) { + st = task.start; + } + if (Math.abs(en-task.end)<1/self.fx) { + en = task.end; + } + + self.master.beginTransaction(); + self.master.changeTaskDates(task, new Date(st), new Date(en)); + self.master.endTransaction(); + } + }); + + //binding for creating link + taskBox.find("[class*=linkHandleSVG]").mousedown(function (e) { + e.preventDefault(); + e.stopPropagation(); + var taskBox = $(this).closest(".taskBoxSVG"); + var svg = $(self.svg.root()); + var offs = svg.offset(); + self.linkOnProgress = true; + self.linkFromEnd = $(this).is(".taskLinkEndSVG"); + svg.addClass("linkOnProgress"); + + // create the line + var startX = parseFloat(taskBox.attr("x")) + (self.linkFromEnd ? parseFloat(taskBox.attr("width")) : 0); + var startY = parseFloat(taskBox.attr("y")) + parseFloat(taskBox.attr("height")) / 2; + var line = self.svg.line(startX, startY, e.pageX - offs.left - 5, e.pageY - offs.top - 5, {class:"linkLineSVG"}); + var circle = self.svg.circle(startX, startY, 5, {class:"linkLineSVG"}); + + //bind mousemove to draw a line + svg.bind("mousemove.linkSVG", function (e) { + var offs = svg.offset(); + var nx = e.pageX - offs.left; + var ny = e.pageY - offs.top; + var c = Math.sqrt(Math.pow(nx - startX, 2) + Math.pow(ny - startY, 2)); + nx = nx - (nx - startX) * 10 / c; + ny = ny - (ny - startY) * 10 / c; + self.svg.change(line, { x2:nx, y2:ny}); + self.svg.change(circle, { cx:nx, cy:ny}); + }); + + //bind mouseup un body to stop + $("body").one("mouseup.linkSVG", function (e) { + $(line).remove(); + $(circle).remove(); + self.linkOnProgress = false; + svg.removeClass("linkOnProgress"); + + $(self.svg.root()).unbind("mousemove.linkSVG"); + var targetBox = $(e.target).closest(".taskBoxSVG"); + //console.debug("create link from " + taskBox.attr("taskid") + " to " + targetBox.attr("taskid")); + + if (targetBox && targetBox.attr("taskid") != taskBox.attr("taskid")) { + var taskTo; + var taskFrom; + if (self.linkFromEnd) { + taskTo = self.master.getTask(targetBox.attr("taskid")); + taskFrom = self.master.getTask(taskBox.attr("taskid")); + } else { + taskFrom = self.master.getTask(targetBox.attr("taskid")); + taskTo = self.master.getTask(taskBox.attr("taskid")); + } + + if (taskTo && taskFrom) { + var gap = 0; + var depInp = taskTo.rowElement.find("[name=depends]"); + depInp.val(depInp.val() + ((depInp.val() + "").length > 0 ? "," : "") + (taskFrom.getRow() + 1) + (gap != 0 ? ":" + gap : "")); + depInp.blur(); + } + } + }) + }); + } + //ask for redraw link + self.redrawLinks(); + + //prof.stop(); + + + function _createTaskSVG(task) { + var svg = self.svg; + + var dimensions = { + x : Math.round((task.start - self.startMillis) * self.fx), + y : task.rowElement.position().top + task.rowElement.offsetParent().scrollTop() + self.taskVertOffset, + width : Math.max(Math.round((task.end - task.start) * self.fx), 1), + height: (self.master.showBaselines ? self.taskHeight / 1.3 : self.taskHeight) + }; + var taskSvg = svg.svg(self.tasksGroup, dimensions.x, dimensions.y, dimensions.width, dimensions.height, {class:"taskBox taskBoxSVG taskStatusSVG", status:task.status, taskid:task.id,fill:task.color||"#eee" }); + + //svg.title(taskSvg, task.name); + //external box + var layout = svg.rect(taskSvg, 0, 0, "100%", "100%", {class:"taskLayout", rx:"2", ry:"2"}); + //external dep + if (task.hasExternalDep) + svg.rect(taskSvg, 0, 0, "100%", "100%", {fill:"url(#extDep)"}); + + //progress + if (task.progress > 0) { + var progress = svg.rect(taskSvg, 0, "20%", (task.progress > 100 ? 100 : task.progress) + "%", "60%", {rx:"2", ry:"2",fill:"rgba(0,0,0,.4)"}); + if (dimensions.width > 50) { + var textStyle = {fill:"#888", "font-size":"10px",class:"textPerc teamworkIcons",transform:"translate(5)"}; + if (task.progress > 100) + textStyle["font-weight"]="bold"; + if (task.progress > 90) + textStyle.transform = "translate(-40)"; + svg.text(taskSvg, (task.progress > 90 ? 100 : task.progress) + "%", (self.master.rowHeight - 5) / 2, (task.progress > 100 ? "!!! " : "") + task.progress + "%", textStyle); + } + } + + if (task.isParent()) + svg.rect(taskSvg, 0, 0, "100%", 3, {fill:"#000"}); + + if (task.startIsMilestone) { + svg.image(taskSvg, -9, dimensions.height/2-9, 18, 18, KDApi.nameSpace("jQueryGantt") +"./jQueryGantt/res/milestone.png") + } + + if (task.endIsMilestone) { + svg.image(taskSvg, "100%",dimensions.height/2-9, 18, 18, KDApi.nameSpace("jQueryGantt") +"./jQueryGantt/res/milestone.png", {transform:"translate(-9)"}) + } + + //task label + svg.text(taskSvg, "100%", 18, task.name, {class:"taskLabelSVG", transform:"translate(20,-5)"}); + + //link tool + if (task.level>0){ + svg.circle(taskSvg, -self.resizeZoneWidth, dimensions.height/2,dimensions.height/3, {class:"taskLinkStartSVG linkHandleSVG", transform:"translate("+(-dimensions.height/3+1)+")"}); + svg.circle(taskSvg, dimensions.width+self.resizeZoneWidth,dimensions.height/2,dimensions.height/3, {class:"taskLinkEndSVG linkHandleSVG", transform:"translate("+(dimensions.height/3-1)+")"}); + } + return taskSvg + } + + + function _createBaselineSVG(task, baseline) { + var svg = self.svg; + + var dimensions = { + x : Math.round((baseline.startDate - self.startMillis) * self.fx), + y : task.rowElement.position().top + task.rowElement.offsetParent().scrollTop() + self.taskVertOffset + self.taskHeight / 2, + width : Math.max(Math.round((baseline.endDate - baseline.startDate) * self.fx), 1), + height: (self.master.showBaselines ? self.taskHeight / 1.5 : self.taskHeight) + }; + var taskSvg = svg.svg(self.tasksGroup, dimensions.x, dimensions.y, dimensions.width, dimensions.height, {class: "taskBox taskBoxSVG taskStatusSVG baseline", status: baseline.status, taskid: task.id, fill: task.color || "#eee" }); + + //tooltip + var label = "" + task.name + ""; + label += "
"; + label += "@" + new Date(self.master.baselineMillis).format(); + label += "

"; + label += "Status: " + baseline.status; + label += "

"; + label += "Start: " + new Date(baseline.startDate).format(); + label += "
"; + label += "End: " + new Date(baseline.endDate).format(); + label += "
"; + label += "Duration: " + baseline.duration; + label += "
"; + label += "Progress: " + baseline.progress + "%"; + + $(taskSvg).attr("data-label", label).on("click", function (event) { + showBaselineInfo(event, this,self); + //bind hide + }); + + //external box + var layout = svg.rect(taskSvg, 0, 0, "100%", "100%", {class: "taskLayout", rx: "2", ry: "2"}); + + + //progress + + if (baseline.progress > 0) { + var progress = svg.rect(taskSvg, 0, "20%", (baseline.progress > 100 ? 100 : baseline.progress) + "%", "60%", {rx: "2", ry: "2", fill: "rgba(0,0,0,.4)"}); + /*if (dimensions.width > 50) { + var textStyle = {fill:"#888", "font-size":"10px",class:"textPerc teamworkIcons",transform:"translate(5)"}; + if (baseline.progress > 100) + textStyle["font-weight"]="bold"; + if (baseline.progress > 90) + textStyle.transform = "translate(-40)"; + svg.text(taskSvg, (baseline.progress > 90 ? 100 : baseline.progress) + "%", (self.master.rowHeight - 5) / 2, (baseline.progress > 100 ? "!!! " : "") + baseline.progress + "%", textStyle); + }*/ + } + + //if (task.isParent()) + // svg.rect(taskSvg, 0, 0, "100%", 3, {fill:"#000"}); + + + //task label + //svg.text(taskSvg, "100%", 18, task.name, {class:"taskLabelSVG", transform:"translate(20,-5)"}); + + + return taskSvg + } + +}; + + +Ganttalendar.prototype.addTask = function (task) { + //currently do nothing +}; + + +//<%-------------------------------------- GANT DRAW LINK SVG ELEMENT --------------------------------------%> +//'from' and 'to' are tasks already drawn +Ganttalendar.prototype.drawLink = function (from, to, type) { + //console.debug("drawLink") + var self = this; + var peduncolusSize = 10; + + /** + * Given an item, extract its rendered position + * width and height into a structure. + */ + function buildRectFromTask(task) { + var self=task.master.gantt; + var editorRow = task.rowElement; + var top = editorRow.position().top + editorRow.offsetParent().scrollTop(); + var x = Math.round((task.start - self.startMillis) * self.fx); + var rect = {left: x, top: top + self.taskVertOffset, width: Math.max(Math.round((task.end - task.start) * self.fx),1), height: self.taskHeight}; + return rect; + } + + /** + * The default rendering method, which paints a start to end dependency. + */ + function drawStartToEnd(from, to, ps) { + var svg = self.svg; + + //this function update an existing link + function update() { + var group = $(this); + var from = group.data("from"); + var to = group.data("to"); + + var rectFrom = buildRectFromTask(from); + var rectTo = buildRectFromTask(to); + + var fx1 = rectFrom.left; + var fx2 = rectFrom.left + rectFrom.width; + var fy = rectFrom.height / 2 + rectFrom.top; + + var tx1 = rectTo.left; + var tx2 = rectTo.left + rectTo.width; + var ty = rectTo.height / 2 + rectTo.top; + + + var tooClose = tx1 < fx2 + 2 * ps; + var r = 5; //radius + var arrowOffset = 5; + var up = fy > ty; + var fup = up ? -1 : 1; + + var prev = fx2 + 2 * ps > tx1; + var fprev = prev ? -1 : 1; + + var image = group.find("image"); + var p = svg.createPath(); + + if (tooClose) { + var firstLine = fup * (rectFrom.height / 2 - 2 * r + 2); + p.move(fx2, fy) + .line(ps, 0, true) + .arc(r, r, 90, false, !up, r, fup * r, true) + .line(0, firstLine, true) + .arc(r, r, 90, false, !up, -r, fup * r, true) + .line(fprev * 2 * ps + (tx1 - fx2), 0, true) + .arc(r, r, 90, false, up, -r, fup * r, true) + .line(0, (Math.abs(ty - fy) - 4 * r - Math.abs(firstLine)) * fup - arrowOffset, true) + .arc(r, r, 90, false, up, r, fup * r, true) + .line(ps, 0, true); + image.attr({x:tx1 - 5, y:ty - 5 - arrowOffset}); + + } else { + p.move(fx2, fy) + .line((tx1 - fx2) / 2 - r, 0, true) + .arc(r, r, 90, false, !up, r, fup * r, true) + .line(0, ty - fy - fup * 2 * r + arrowOffset, true) + .arc(r, r, 90, false, up, r, fup * r, true) + .line((tx1 - fx2) / 2 - r, 0, true); + image.attr({x:tx1 - 5, y:ty - 5 + arrowOffset}); + } + + group.find("path").attr({d:p.path()}); + } + + + // create the group + var group = svg.group(self.linksGroup, "" + from.id + "-" + to.id); + svg.title(group, from.name + " -> " + to.name); + + var p = svg.createPath(); + + //add the arrow + svg.image(group, 0, 0, 5, 10, KDApi.nameSpace("jQueryGantt") +"./jQueryGantt/res/linkArrow.png"); + //create empty path + svg.path(group, p, {class:"taskLinkPathSVG"}); + + //set "from" and "to" to the group, bind "update" and trigger it + var jqGroup = $(group).data({from:from, to:to }).attr({from:from.id, to:to.id}).on("update", update).trigger("update"); + + if (self.showCriticalPath && from.isCritical && to.isCritical) + jqGroup.addClass("critical"); + + jqGroup.addClass("linkGroup"); + return jqGroup; + } + + + /** + * A rendering method which paints a start to start dependency. + */ + function drawStartToStart(from, to) { + console.error("StartToStart not supported on SVG"); + var rectFrom = buildRectFromTask(from); + var rectTo = buildRectFromTask(to); + } + + var link; + // Dispatch to the correct renderer + if (type == 'start-to-start') { + link = drawStartToStart(from, to, peduncolusSize); + } else { + link = drawStartToEnd(from, to, peduncolusSize); + } + + // in order to create a dependency you will need permissions on both tasks + if (this.master.permissions.canWrite || ( from.canWrite && to.canWrite)) { + link.click(function (e) { + var el = $(this); + e.stopPropagation();// to avoid body remove focused + self.element.find("[class*=focused]").removeClass("focused"); + $(".ganttSVGBox .focused").removeClass("focused"); + var el = $(this); + if (!self.resDrop) + el.addClass("focused"); + self.resDrop = false; //hack to avoid select + + $("body").off("click.focused").one("click.focused", function () { + $(".ganttSVGBox .focused").removeClass("focused"); + }) + + }); + } + + +}; + +Ganttalendar.prototype.redrawLinks = function () { + //console.debug("redrawLinks "); + var self = this; + this.element.stopTime("ganttlnksredr"); + this.element.oneTime(10, "ganttlnksredr", function () { + + //var prof=new Profiler("gd_drawLink_real"); + + //remove all links + $("#linksGroup").empty(); + + var collapsedDescendant = []; + + //[expand] + var collapsedDescendant = self.master.getCollapsedDescendant(); + for (var i = 0; i < self.master.links.length; i++) { + var link = self.master.links[i]; + + if (collapsedDescendant.indexOf(link.from) >= 0 || collapsedDescendant.indexOf(link.to) >= 0) continue; + + var rowA=link.from.getRow(); + var rowB=link.to.getRow(); + + //if link is out of visible screen continue + if(Math.max(rowA,rowB)self.master.lastVisibleTaskIndex) continue; + + self.drawLink(link.from, link.to); + } + //prof.stop(); + }); +}; + + +Ganttalendar.prototype.reset = function () { + //var prof= new Profiler("ganttDrawerSVG.reset"); + this.element.find("[class*=linkGroup]").remove(); + this.element.find("[taskid]").remove(); + //prof.stop() +}; + + +Ganttalendar.prototype.redrawTasks = function (drawAll) { + //console.debug("redrawTasks "); + var self=this; + //var prof = new Profiler("ganttRedrawTasks"); + + self.element.find("table.ganttTable").height(self.master.editor.element.height()); + + var collapsedDescendant = this.master.getCollapsedDescendant(); + + var startRowAdd=self.master.firstScreenLine-self.master.rowBufferSize; + var endRowAdd =self.master.firstScreenLine+self.master.numOfVisibleRows+self.master.rowBufferSize; + + $("#linksGroup,#tasksGroup").empty(); + var gridGroup=$("#gridGroup").empty().get(0); + + //add missing ones + var row=0; + self.master.firstVisibleTaskIndex=-1; + for (var i=0;i=0){ + continue; + } + if (drawAll || (row>=startRowAdd && row self.startMillis && new Date().getTime() < self.endMillis) { + var x = Math.round(((new Date().getTime()) - self.startMillis) * self.fx); + self.svg.line(gridGroup, x, 0, x, "100%", {class: "ganttTodaySVG"}); + } + + + //prof.stop(); +}; + + +Ganttalendar.prototype.shrinkBoundaries = function () { + //console.debug("shrinkBoundaries") + var start = Infinity; + var end = -Infinity; + for (var i = 0; i < this.master.tasks.length; i++) { + var task = this.master.tasks[i]; + if (start > task.start) + start = task.start; + if (end < task.end) + end = task.end; + } + + //if include today synch extremes + if (this.includeToday) { + var today = new Date().getTime(); + start = start > today ? today : start; + end = end< today ? today : end; + } + + //mark boundaries as changed + this.gridChanged=this.gridChanged || this.originalStartMillis!=start || this.originalEndMillis!=end; + + this.originalStartMillis=start; + this.originalEndMillis=end; +}; + +Ganttalendar.prototype.setBestFittingZoom = function () { + //console.debug("setBestFittingZoom"); + + if (this.getStoredZoomLevel()) { + this.zoom = this.getStoredZoomLevel(); + return; + } + + + //if zoom is not defined get the best fitting one + var dur = this.originalEndMillis -this.originalStartMillis; + var minDist = Number.MAX_VALUE; + var i = 0; + for (; i < this.zoomLevels.length; i++) { + var dist = Math.abs(dur - millisFromString(this.zoomLevels[i])); + if (dist <= minDist) { + minDist = dist; + } else { + break; + } + this.zoom = this.zoomLevels[i]; + } + + this.zoom=this.zoom||this.zoomLevels[this.zoomLevels.length-1]; + +}; + +Ganttalendar.prototype.redraw = function () { + //console.debug("redraw",this.zoom, this.originalStartMillis, this.originalEndMillis); + //var prof= new Profiler("Ganttalendar.redraw"); + + if (this.showCriticalPath) { + this.master.computeCriticalPath(); + } + + if (this.gridChanged) { + this.gridChanged=false; + var par = this.element.parent(); + + //try to maintain last scroll + var scrollY = par.scrollTop(); + var scrollX = par.scrollLeft(); + + this.element.remove(); + + var domEl = this.createGanttGrid(); + this.element = domEl; + par.append(domEl); + this.redrawTasks(true); + + //set old scroll + par.scrollTop(scrollY); + par.scrollLeft(scrollX); + + } else { + this.redrawTasks(true); + } + + + //set current task + this.synchHighlight(); + + //prof.stop(); + //Profiler.displayAll(); + //Profiler.reset() + +}; + + +Ganttalendar.prototype.fitGantt = function () { + delete this.zoom; + this.redraw(); +}; + +Ganttalendar.prototype.synchHighlight = function () { + //console.debug("synchHighlight",this.master.currentTask); + if (this.master.currentTask ){ + // take care of collapsed rows + var ganttHighLighterPosition=this.master.editor.element.find(".taskEditRow:visible").index(this.master.currentTask.rowElement); + this.master.gantt.element.find(".ganttLinesSVG").removeClass("rowSelected").eq(ganttHighLighterPosition).addClass("rowSelected"); + } else { + $(".rowSelected").removeClass("rowSelected"); // todo non c'era + } +}; + + +Ganttalendar.prototype.getCenterMillis= function () { + return parseInt((this.element.parent().scrollLeft()+this.element.parent().width()/2)/this.fx+this.startMillis); +}; + +Ganttalendar.prototype.goToMillis= function (millis) { + var x = Math.round(((millis) - this.startMillis) * this.fx) -this.element.parent().width()/2; + this.element.parent().scrollLeft(x); +}; + +Ganttalendar.prototype.centerOnToday = function () { + this.goToMillis(new Date().getTime()); +}; + + +/** + * Allows drag and drop and extesion of task boxes. Only works on x axis + * @param opt + * @return {*} + */ +$.fn.dragExtedSVG = function (svg, opt) { + + //doing this can work with one svg at once only + var target; + var svgX; + var offsetMouseRect; + + var options = { + canDrag: true, + canResize: true, + resizeZoneWidth:5, + minSize: 10, + startDrag: function (e) {}, + drag: function (e) {}, + drop: function (e) {}, + startResize: function (e) {}, + resize: function (e) {}, + stopResize: function (e) {} + }; + + $.extend(options, opt); + + this.each(function () { + var el = $(this); + svgX = svg.parent().offset().left; //parent is used instead of svg for a Firefox oddity + if (options.canDrag) + el.addClass("deSVGdrag"); + + if (options.canResize || options.canDrag) { + el.bind("mousedown.deSVG",function (e) { + //console.debug("mousedown.deSVG"); + if ($(e.target).is("image")) { + e.preventDefault(); + } + + target = $(this); + var x1 = parseFloat(el.find("[class*=taskLayout]").offset().left); + var x2 = x1 + parseFloat(el.attr("width")); + var posx = e.pageX; + + $("body").unselectable(); + + //start resize end + if (options.canResize && Math.abs(posx-x2)<=options.resizeZoneWidth) { + //store offset mouse x2 + offsetMouseRect = x2 - e.pageX; + target.attr("oldw", target.attr("width")); + var one = true; + + //bind event for start resizing + $(svg).bind("mousemove.deSVG", function (e) { + //hide link circle + $("[class*=linkHandleSVG]").hide(); + + if (one) { + //trigger startResize + options.startResize.call(target.get(0), e); + one = false; + } + + //manage resizing + var nW = e.pageX - x1 + offsetMouseRect; + + target.attr("width", nW < options.minSize ? options.minSize : nW); + //callback + options.resize.call(target.get(0), e); + }); + + //bind mouse up on body to stop resizing + $("body").one("mouseup.deSVG", stopResize); + + + //start resize start + } else if (options.canResize && Math.abs(posx-x1)<=options.resizeZoneWidth) { + //store offset mouse x1 + offsetMouseRect = parseFloat(target.attr("x")); + target.attr("oldw", target.attr("width")); //todo controllare se è ancora usato oldw + + var one = true; + + //bind event for start resizing + $(svg).bind("mousemove.deSVG", function (e) { + //hide link circle + $("[class*=linkHandleSVG]").hide(); + + if (one) { + //trigger startResize + options.startResize.call(target.get(0), e); + one = false; + } + + //manage resizing + var nx1= offsetMouseRect-(posx-e.pageX); + var nW = (x2-x1) + (posx-e.pageX); + nW=nW < options.minSize ? options.minSize : nW; + target.attr("x",nx1); + target.attr("width", nW); + //callback + options.resize.call(target.get(0), e); + }); + + //bind mouse up on body to stop resizing + $("body").one("mouseup.deSVG", stopResize); + + + // start drag + } else if (options.canDrag) { + //store offset mouse x1 + offsetMouseRect = parseFloat(target.attr("x")) - e.pageX; + target.attr("oldx", target.attr("x")); + + var one = true; + //bind event for start dragging + $(svg).bind("mousemove.deSVG",function (e) { + //hide link circle + $("[class*=linkHandleSVG]").hide(); + if (one) { + //trigger startDrag + options.startDrag.call(target.get(0), e); + one = false; + } + + //manage resizing + target.attr("x", offsetMouseRect + e.pageX); + //callback + options.drag.call(target.get(0), e); + + }).bind("mouseleave.deSVG", drop); + + //bind mouse up on body to stop resizing + $("body").one("mouseup.deSVG", drop); + + } + } + ).bind("mousemove.deSVG", + function (e) { + var el = $(this); + var x1 = el.find("[class*=taskLayout]").offset().left; + var x2 = x1 + parseFloat(el.attr("width")); + var posx = e.pageX; + + //set cursor handle + //if (options.canResize && (x2-x1)>3*options.resizeZoneWidth &&((posx<=x2 && posx >= x2- options.resizeZoneWidth) || (posx>=x1 && posx<=x1+options.resizeZoneWidth))) { + if (options.canResize && (Math.abs(posx-x1)<=options.resizeZoneWidth || Math.abs(posx-x2)<=options.resizeZoneWidth)) { + el.addClass("deSVGhand"); + } else { + el.removeClass("deSVGhand"); + } + } + ).addClass("deSVG"); + } + }); + return this; + + + function stopResize(e) { + $(svg).unbind("mousemove.deSVG").unbind("mouseup.deSVG").unbind("mouseleave.deSVG"); + if (target && target.attr("oldw")!=target.attr("width")) + options.stopResize.call(target.get(0), e); //callback + target = undefined; + $("body").clearUnselectable(); + } + + function drop(e) { + $(svg).unbind("mousemove.deSVG").unbind("mouseup.deSVG").unbind("mouseleave.deSVG"); + if (target && target.attr("oldx") != target.attr("x")) + options.drop.call(target.get(0), e); //callback + target = undefined; + $("body").clearUnselectable(); + } + +}; diff --git a/jQueryGantt/jQueryGantt/ganttGridEditor.js b/jQueryGantt/jQueryGantt/ganttGridEditor.js new file mode 100644 index 0000000000000000000000000000000000000000..cb0beb0758f913d51a44aa642c5e298a5d8984f8 --- /dev/null +++ b/jQueryGantt/jQueryGantt/ganttGridEditor.js @@ -0,0 +1,741 @@ +/* + Copyright (c) 2012-2018 Open Lab + Written by Roberto Bicchierai and Silvia Chelazzi http://roberto.open-lab.com + 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. + */ +function GridEditor(master) { + this.master = master; // is the a GantEditor instance + + var editorTabel = $.JST.createFromTemplate({}, "TASKSEDITHEAD"); + if (!master.permissions.canSeeDep) + editorTabel.find(".requireCanSeeDep").hide(); + + this.gridified = $.gridify(editorTabel); + this.element = this.gridified.find(".gdfTable").eq(1); + + this.minAllowedDate=new Date(new Date().getTime()-3600000*24*365*20).format(); + this.maxAllowedDate=new Date(new Date().getTime()+3600000*24*365*30).format(); +} + + +GridEditor.prototype.fillEmptyLines = function () { + //console.debug("fillEmptyLines") + var factory = new TaskFactory(); + var master = this.master; + + //console.debug("GridEditor.fillEmptyLines"); + var rowsToAdd = master.minRowsInEditor - this.element.find(".taskEditRow").length; + var empty=this.element.find(".emptyRow").length; + rowsToAdd=Math.max(rowsToAdd,empty>5?0:5-empty); + + //fill with empty lines + for (var i = 0; i < rowsToAdd; i++) { + var emptyRow = $.JST.createFromTemplate({}, "TASKEMPTYROW"); + if (!master.permissions.canSeeDep) + emptyRow.find(".requireCanSeeDep").hide(); + + //click on empty row create a task and fill above + emptyRow.click(function (ev) { + //console.debug("emptyRow.click") + var emptyRow = $(this); + //add on the first empty row only + if (!master.permissions.canAdd || emptyRow.prevAll(".emptyRow").length > 0) + return; + + master.beginTransaction(); + var lastTask; + var start = new Date().getTime(); + var level = 0; + if (master.tasks[0]) { + start = master.tasks[0].start; + level = master.tasks[0].level + 1; + } + + //fill all empty previouses + var cnt=0; + emptyRow.prevAll(".emptyRow").addBack().each(function () { + cnt++; + var ch = factory.build("tmp_fk" + new Date().getTime()+"_"+cnt, "", "", level, start, Date.workingPeriodResolution); + var task = master.addTask(ch); + lastTask = ch; + }); + master.endTransaction(); + if (lastTask.rowElement) { + lastTask.rowElement.find("[name=name]").focus();//focus to "name" input + } + }); + this.element.append(emptyRow); + } +}; + + +GridEditor.prototype.addTask = function (task, row, hideIfParentCollapsed) { + //console.debug("GridEditor.addTask",task,row); + //var prof = new Profiler("ganttGridEditor.addTask"); + + //remove extisting row + this.element.find("#tid_" + task.id).remove(); + + var taskRow = $.JST.createFromTemplate(task, "TASKROW"); + + if (!this.master.permissions.canSeeDep) + taskRow.find(".requireCanSeeDep").hide(); + + if (!this.master.permissions.canSeePopEdit) + taskRow.find(".edit .teamworkIcon").hide(); + + //save row element on task + task.rowElement = taskRow; + + this.bindRowEvents(task, taskRow); + + if (typeof(row) != "number") { + var emptyRow = this.element.find(".emptyRow:first"); //tries to fill an empty row + if (emptyRow.length > 0) + emptyRow.replaceWith(taskRow); + else + this.element.append(taskRow); + } else { + var tr = this.element.find("tr.taskEditRow").eq(row); + if (tr.length > 0) { + tr.before(taskRow); + } else { + this.element.append(taskRow); + } + + } + + //[expand] + if (hideIfParentCollapsed) { + if (task.collapsed) taskRow.addClass('collapsed'); + var collapsedDescendant = this.master.getCollapsedDescendant(); + if (collapsedDescendant.indexOf(task) >= 0) taskRow.hide(); + } + //prof.stop(); + return taskRow; +}; + +GridEditor.prototype.refreshExpandStatus = function (task) { + //console.debug("refreshExpandStatus",task); + if (!task) return; + if (task.isParent()) { + task.rowElement.addClass("isParent"); + } else { + task.rowElement.removeClass("isParent"); + } + + + var par = task.getParent(); + if (par && !par.rowElement.is("isParent")) { + par.rowElement.addClass("isParent"); + } + +}; + +GridEditor.prototype.refreshTaskRow = function (task) { + //console.debug("refreshTaskRow") + //var profiler = new Profiler("editorRefreshTaskRow"); + + var canWrite=this.master.permissions.canWrite || task.canWrite; + + var row = task.rowElement; + + row.find(".taskRowIndex").html(task.getRow() + 1).css("padding-right",task.typeId!="plan" ? "16px":"0px");; + row.find(".teamworkIcon").css("display",task.typeId!="plan" ? "none":"unset"); + row.find(".indentCell").css("padding-left", task.level * 10 + 18); + row.find("[name=name]").val(task.name).prop("readonly",task.typeId!=="plan"); + row.find("[name=code]").val(task.code); + row.find("[status]").attr("status", task.status); + + row.find("[name=type]").css("color",task.typeId!=="plan" ? "#c0c0c0" : "#000000").css("font-weight",task.typeId!=="plan" ? "unset" : "bold"); + + row.find("[name=duration]").val(durationToString(task.duration)).prop("readonly",task.typeId!=="plan" || !canWrite || task.isParent() && task.master.shrinkParent); + row.find("[name=progress]").val(task.progress).prop("readonly",task.typeId!=="plan"); + row.find("[name=startIsMilestone]").prop("checked", task.startIsMilestone); + row.find("[name=start]").val(new Date(task.start).format()).updateOldValue().prop("readonly",task.typeId!=="plan" || !canWrite || task.depends || !(task.canWrite || this.master.permissions.canWrite) ); // called on dates only because for other field is called on focus event + row.find("[name=endIsMilestone]").prop("checked", task.endIsMilestone); + row.find("[name=end]").val(new Date(task.end).format()).prop("readonly",task.typeId!=="plan" || !canWrite || task.isParent() && task.master.shrinkParent).updateOldValue(); + row.find("[name=depends]").val(task.depends).prop("readonly",task.typeId!=="plan"); + row.find(".taskAssigs").html(task.getAssigsString()).css("color",task.typeId!=="plan" ? "#c0c0c0" : "#000000"); + + //manage collapsed + if (task.collapsed) + row.addClass("collapsed"); + else + row.removeClass("collapsed"); + + + //Enhancing the function to perform own operations + this.master.element.trigger('gantt.task.afterupdate.event', task); + //profiler.stop(); +}; + +GridEditor.prototype.redraw = function () { + //console.debug("GridEditor.prototype.redraw") + //var prof = new Profiler("gantt.GridEditor.redraw"); + for (var i = 0; i < this.master.tasks.length; i++) { + this.refreshTaskRow(this.master.tasks[i]); + } + // check if new empty rows are needed + if (this.master.fillWithEmptyLines) + this.fillEmptyLines(); + + //prof.stop() + +}; + +GridEditor.prototype.reset = function () { + this.element.find("[taskid]").remove(); +}; + + +GridEditor.prototype.bindRowEvents = function (task, taskRow) { + var self = this; + //console.debug("bindRowEvents",this,this.master,this.master.permissions.canWrite, task.canWrite); + + //bind row selection + taskRow.click(function (event) { + var row = $(this); + //console.debug("taskRow.click",row.attr("taskid"),event.target) + //var isSel = row.hasClass("rowSelected"); + row.closest("table").find(".rowSelected").removeClass("rowSelected"); + row.addClass("rowSelected"); + + //set current task + self.master.currentTask = self.master.getTask(row.attr("taskId")); + + //move highlighter + self.master.gantt.synchHighlight(); + + //if offscreen scroll to element + var top = row.position().top; + if (top > self.element.parent().height()) { + row.offsetParent().scrollTop(top - self.element.parent().height() + 100); + } else if (top <= 40) { + row.offsetParent().scrollTop(row.offsetParent().scrollTop() - 40 + top); + } + }); + + + if (this.master.permissions.canWrite || task.canWrite) { + self.bindRowInputEvents(task, taskRow); + + } else { //cannot write: disable input + taskRow.find("input").prop("readonly", true); + taskRow.find("input:checkbox,select").prop("disabled", true); + } + + if (!this.master.permissions.canSeeDep) + taskRow.find("[name=depends]").attr("readonly", true); + + self.bindRowExpandEvents(task, taskRow); + + if (this.master.permissions.canSeePopEdit) { + if(task.typeId === "plan"){ + taskRow.find(".edit").click(function () { + self.openFullEditor(task, false); + $("select[name='resourceId']").tinyselect(); + }); + } + + // 双击负责人 + taskRow.dblclick(function (ev) { //open editor only if no text has been selected + if (window.getSelection().toString().trim()=="" && task.typeId === "plan") + self.openFullEditor(task, $(ev.target).closest(".taskAssigs").size()>0) + $("select[name='resourceId']").tinyselect(); + }); + } + //prof.stop(); +}; + + +GridEditor.prototype.bindRowExpandEvents = function (task, taskRow) { + var self = this; + //expand collapse + taskRow.find(".exp-controller").click(function () { + var el = $(this); + var taskId = el.closest("[taskid]").attr("taskid"); + var task = self.master.getTask(taskId); + if (task.collapsed) { + self.master.expand(task,false); + } else { + self.master.collapse(task,false); + } + }); +}; + +GridEditor.prototype.bindRowInputEvents = function (task, taskRow) { + var self = this; + + //bind dateField on dates + taskRow.find(".date").each(function () { + var el = $(this); + el.click(function () { + var inp = $(this); + inp.dateField({ + inputField: el, + minDate:self.minAllowedDate, + maxDate:self.maxAllowedDate, + callback: function (d) { + $(this).blur(); + } + }); + }); + + el.blur(function (date) { + var inp = $(this); + if (inp.isValueChanged()) { + if (!Date.isValid(inp.val())) { + alert(GanttMaster.messages["INVALID_DATE_FORMAT"]); + inp.val(inp.getOldValue()); + + } else { + var row = inp.closest("tr"); + var taskId = row.attr("taskId"); + var task = self.master.getTask(taskId); + + var leavingField = inp.prop("name"); + var dates = resynchDates(inp, row.find("[name=start]"), row.find("[name=startIsMilestone]"), row.find("[name=duration]"), row.find("[name=end]"), row.find("[name=endIsMilestone]")); + //console.debug("resynchDates",new Date(dates.start), new Date(dates.end),dates.duration) + //update task from editor + self.master.beginTransaction(); + self.master.changeTaskDates(task, dates.start, dates.end); + self.master.endTransaction(); + inp.updateOldValue(); //in order to avoid multiple call if nothing changed + } + } + }); + }); + + + //milestones checkbox + taskRow.find(":checkbox").click(function () { + var el = $(this); + var row = el.closest("tr"); + var taskId = row.attr("taskId"); + + var task = self.master.getTask(taskId); + + //update task from editor + var field = el.prop("name"); + + if (field == "startIsMilestone" || field == "endIsMilestone") { + self.master.beginTransaction(); + //milestones + task[field] = el.prop("checked"); + resynchDates(el, row.find("[name=start]"), row.find("[name=startIsMilestone]"), row.find("[name=duration]"), row.find("[name=end]"), row.find("[name=endIsMilestone]")); + self.master.endTransaction(); + } + + }); + + + //binding on blur for task update (date exluded as click on calendar blur and then focus, so will always return false, its called refreshing the task row) + taskRow.find("input:text:not(.date)").focus(function () { + $(this).updateOldValue(); + + }).blur(function (event) { + var el = $(this); + var row = el.closest("tr"); + var taskId = row.attr("taskId"); + var task = self.master.getTask(taskId); + //update task from editor + var field = el.prop("name"); + + if (el.isValueChanged()) { + self.master.beginTransaction(); + + if (field == "depends") { + var oldDeps = task.depends; + task.depends = el.val(); + + // update links + var linkOK = self.master.updateLinks(task); + if (linkOK) { + //synchronize status from superiors states + var sups = task.getSuperiors(); + + var oneFailed=false; + var oneUndefined=false; + var oneActive=false; + var oneSuspended=false; + var oneWaiting=false; + for (var i = 0; i < sups.length; i++) { + oneFailed=oneFailed|| sups[i].from.status=="STATUS_FAILED"; + oneUndefined=oneUndefined|| sups[i].from.status=="STATUS_UNDEFINED"; + oneActive=oneActive|| sups[i].from.status=="STATUS_ACTIVE"; + oneSuspended=oneSuspended|| sups[i].from.status=="STATUS_SUSPENDED"; + oneWaiting=oneWaiting|| sups[i].from.status=="STATUS_WAITING"; + } + + if (oneFailed){ + task.changeStatus("STATUS_FAILED") + } else if (oneUndefined){ + task.changeStatus("STATUS_UNDEFINED") + } else if (oneActive){ + //task.changeStatus("STATUS_SUSPENDED") + task.changeStatus("STATUS_WAITING") + } else if (oneSuspended){ + task.changeStatus("STATUS_SUSPENDED") + } else if (oneWaiting){ + task.changeStatus("STATUS_WAITING") + } else { + task.changeStatus("STATUS_ACTIVE") + } + + self.master.changeTaskDeps(task); //dates recomputation from dependencies + } + + } else if (field == "duration") { + var dates = resynchDates(el, row.find("[name=start]"), row.find("[name=startIsMilestone]"), row.find("[name=duration]"), row.find("[name=end]"), row.find("[name=endIsMilestone]")); + self.master.changeTaskDates(task, dates.start, dates.end); + + } else if (field == "name" && el.val() == "") { // remove unfilled task + self.master.deleteCurrentTask(taskId); + + + } else if (field == "progress" ) { + task[field]=parseFloat(el.val())||0; + el.val(task[field]); + + } else { + task[field] = el.val(); + } + self.master.endTransaction(); + + } else if (field == "name" && el.val() == "") { // remove unfilled task even if not changed + if (task.getRow()!=0) { + self.master.deleteCurrentTask(taskId); + + }else { + el.oneTime(1,"foc",function(){$(this).focus()}); // + event.preventDefault(); + //return false; + } + + } + }); + + //cursor key movement + taskRow.find("input").keydown(function (event) { + var theCell = $(this); + var theTd = theCell.parent(); + var theRow = theTd.parent(); + var col = theTd.prevAll("td").length; + + var ret = true; + if (!event.ctrlKey) { + switch (event.keyCode) { + case 13: + if (theCell.is(":text")) + theCell.blur(); + break; + + case 37: //left arrow + if (!theCell.is(":text") || (!this.selectionEnd || this.selectionEnd == 0)) + theTd.prev().find("input").focus(); + break; + case 39: //right arrow + if (!theCell.is(":text") || (!this.selectionEnd || this.selectionEnd == this.value.length)) + theTd.next().find("input").focus(); + break; + + case 38: //up arrow + //var prevRow = theRow.prev(); + var prevRow = theRow.prevAll(":visible:first"); + var td = prevRow.find("td").eq(col); + var inp = td.find("input"); + + if (inp.length > 0) + inp.focus(); + break; + case 40: //down arrow + //var nextRow = theRow.next(); + var nextRow = theRow.nextAll(":visible:first"); + var td = nextRow.find("td").eq(col); + var inp = td.find("input"); + if (inp.length > 0) + inp.focus(); + else + nextRow.click(); //create a new row + break; + case 36: //home + break; + case 35: //end + break; + + case 9: //tab + case 13: //enter + break; + } + } + return ret; + + }).focus(function () { + $(this).closest("tr").click(); + }); + + + //change status + taskRow.find(".taskStatus").click(function () { + var el = $(this); + var tr = el.closest("[taskid]"); + var taskId = tr.attr("taskid"); + var task = self.master.getTask(taskId); + + var changer = $.JST.createFromTemplate({}, "CHANGE_STATUS"); + changer.find("[status=" + task.status + "]").addClass("selected"); + changer.find(".taskStatus").click(function (e) { + e.stopPropagation(); + var newStatus = $(this).attr("status"); + changer.remove(); + self.master.beginTransaction(); + task.changeStatus(newStatus); + self.master.endTransaction(); + el.attr("status", task.status); + }); + el.oneTime(3000, "hideChanger", function () { + changer.remove(); + }); + el.after(changer); + }); + +}; + +GridEditor.prototype.openFullEditor = function (task, editOnlyAssig) { + var self = this; + + if (!self.master.permissions.canSeePopEdit) + return; + + var taskRow=task.rowElement; + + //task editor in popup + var taskId = taskRow.attr("taskId"); + + //make task editor + var taskEditor = $.JST.createFromTemplate(task, "TASK_EDITOR"); + + //hide task data if editing assig only + if (editOnlyAssig) { + taskEditor.find(".taskData").hide(); + taskEditor.find(".assigsTableWrapper").height(455); + taskEditor.prepend("

\""+task.name+"\"

"); + } + + //got to extended editor + if (task.isNew()|| !self.master.permissions.canSeeFullEdit){ + taskEditor.find("#taskFullEditor").remove(); + } else { + taskEditor.bind("openFullEditor.gantt",function () { + window.location.href=contextPath+"/applications/teamwork/task/taskEditor.jsp?CM=ED&OBJID="+task.id; + }); + } + + + taskEditor.find("#name").val(task.name).prop("readonly",task.typeId!="plan"); + taskEditor.find("#description").val(task.description).prop("readonly",task.typeId!="plan"); + taskEditor.find("#code").val(task.code).prop("readonly",true); + taskEditor.find("#progress").val(task.progress ? parseFloat(task.progress) : 0).prop("readonly",task.progressByWorklog==true || task.typeId!="plan"); + taskEditor.find("#progressByWorklog").prop("checked",task.progressByWorklog); + taskEditor.find("#status").val(task.status).prop("readonly",task.typeId!="plan"); + taskEditor.find("#type").val(task.typeId).prop("readonly",true); + taskEditor.find("#type_txt").val(task.type); + taskEditor.find("#relevance").val(task.relevance); + //cvc_redraw(taskEditor.find(".cvcComponent")); + taskEditor.find("#saveButton").css("display",task.typeId!="plan" ? "none":"unset"); + + if (task.startIsMilestone) + taskEditor.find("#startIsMilestone").prop("checked", true); + if (task.endIsMilestone) + taskEditor.find("#endIsMilestone").prop("checked", true); + + taskEditor.find("#duration").val(durationToString(task.duration)).prop("readonly",task.typeId!="plan"); + var startDate = taskEditor.find("#start"); + startDate.val(new Date(task.start).format()); + //start is readonly in case of deps + if (task.depends || !(this.master.permissions.canWrite ||task.canWrite) || task.typeId!="plan") { + startDate.attr("readonly", "true"); + } else { + startDate.removeAttr("readonly"); + } + + taskEditor.find("#end").val(new Date(task.end).format()).prop("readonly",task.typeId!="plan"); + + //make assignments table + var assigsTable = taskEditor.find("#assigsTable"); + assigsTable.find("[assId]").remove(); + // loop on assignments + if(task.assigs.length){ + for (var i = 0; i < task.assigs.length; i++) { + var assig = task.assigs[i]; + var assigRow = $.JST.createFromTemplate({task: task, assig: assig}, "ASSIGNMENT_ROW"); + assigsTable.append(assigRow); + } + }else{ + var assigRow = $.JST.createFromTemplate({task: task, assig: {id: "tmp_" + new Date().getTime()+"_"+cnt}}, "ASSIGNMENT_ROW"); + assigsTable.append(assigRow); + } + + taskEditor.find(":input").updateOldValue(); + + if (!(self.master.permissions.canWrite || task.canWrite)) { + taskEditor.find("input,textarea").prop("readOnly", true); + taskEditor.find("input:checkbox,select").prop("disabled", true); + taskEditor.find("#saveButton").remove(); + taskEditor.find(".button").addClass("disabled"); + + } else { + + //bind dateField on dates, duration + taskEditor.find("#start,#end,#duration").click(function () { + var input = $(this); + if (input.is("[entrytype=DATE]")) { + input.dateField({ + inputField: input, + minDate:self.minAllowedDate, + maxDate:self.maxAllowedDate, + callback: function (d) {$(this).blur();} + }); + } + }).blur(function () { + var inp = $(this); + if (inp.validateField()) { + resynchDates(inp, taskEditor.find("[name=start]"), taskEditor.find("[name=startIsMilestone]"), taskEditor.find("[name=duration]"), taskEditor.find("[name=end]"), taskEditor.find("[name=endIsMilestone]")); + //workload computation + if (typeof(workloadDatesChanged)=="function") + workloadDatesChanged(); + } + }); + + taskEditor.find("#startIsMilestone,#endIsMilestone").click(function () { + var inp = $(this); + resynchDates(inp, taskEditor.find("[name=start]"), taskEditor.find("[name=startIsMilestone]"), taskEditor.find("[name=duration]"), taskEditor.find("[name=end]"), taskEditor.find("[name=endIsMilestone]")); + }); + + //bind add assignment + var cnt=0; + taskEditor.find("#addAssig").click(function () { + cnt++; + var assigsTable = taskEditor.find("#assigsTable"); + var assigRow = $.JST.createFromTemplate({task: task, assig: {id: "tmp_" + new Date().getTime()+"_"+cnt}}, "ASSIGNMENT_ROW"); + assigsTable.append(assigRow); + $("#bwinPopupd").scrollTop(10000); + $("select[name='resourceId'][style!='width: 100%; display: none;']").tinyselect(); + }).click(); + + //save task + taskEditor.bind("saveFullEditor.gantt",function () { + //console.debug("saveFullEditor"); + var task = self.master.getTask(taskId); // get task again because in case of rollback old task is lost + + self.master.beginTransaction(); + task.name = taskEditor.find("#name").val(); + task.description = taskEditor.find("#description").val(); + task.code = taskEditor.find("#code").val(); + task.progress = parseFloat(taskEditor.find("#progress").val()); + //task.duration = parseInt(taskEditor.find("#duration").val()); //bicch rimosso perchè devono essere ricalcolata dalla start end, altrimenti sbaglia + task.startIsMilestone = taskEditor.find("#startIsMilestone").is(":checked"); + task.endIsMilestone = taskEditor.find("#endIsMilestone").is(":checked"); + + // task.type = taskEditor.find("#type_txt").val(); + // task.typeId = taskEditor.find("#type").val(); + task.relevance = taskEditor.find("#relevance").val(); + task.progressByWorklog= taskEditor.find("#progressByWorklog").is(":checked"); + + //set assignments + var cnt=0; + taskEditor.find("tr[assId]").each(function () { + var trAss = $(this); + var assId = trAss.attr("assId"); + var resId = trAss.find("[name=resourceId]").val(); + var resName = trAss.find("[name=resourceId_txt]").val(); // from smartcombo text input part + var roleId = trAss.find("[name=roleId]").val(); + var effort = millisFromString(trAss.find("[name=effort]").val(),true); + + //check if the selected resource exists in ganttMaster.resources + var res= self.master.getOrCreateResource(resId,resName); + + //if resource is not found nor created + if (!res) + return; + + //check if an existing assig has been deleted and re-created with the same values + var found = false; + for (var i = 0; i < task.assigs.length; i++) { + var ass = task.assigs[i]; + + if (assId == ass.id) { + ass.effort = effort; + ass.roleId = roleId; + ass.resourceId = res.id; + ass.touched = true; + found = true; + break; + + } else if (roleId == ass.roleId && res.id == ass.resourceId) { + ass.effort = effort; + ass.touched = true; + found = true; + break; + + } + } + + if (!found && resId && roleId) { //insert + cnt++; + var ass = task.createAssignment("tmp_" + new Date().getTime()+"_"+cnt, resId, roleId, effort); + ass.touched = true; + } + + }); + + //remove untouched assigs + task.assigs = task.assigs.filter(function (ass) { + var ret = ass.touched; + delete ass.touched; + return ret; + }); + + //change dates + task.setPeriod(Date.parseString(taskEditor.find("#start").val()).getTime(), Date.parseString(taskEditor.find("#end").val()).getTime() + (3600000 * 22)); + + //change status + // task.changeStatus(taskEditor.find("#status").val()); + task.status = taskEditor.find("#status").val(); + + if (self.master.endTransaction()) { + taskEditor.find(":input").updateOldValue(); + closeBlackPopup(); + } + + }); + } + + taskEditor.attr("alertonchange","true"); + var ndo = createModalPopup(800, 450).append(taskEditor);//.append("
") + + //workload computation + if (typeof(workloadDatesChanged)=="function") + workloadDatesChanged(); + + + +}; diff --git a/jQueryGantt/jQueryGantt/ganttMaster.js b/jQueryGantt/jQueryGantt/ganttMaster.js new file mode 100644 index 0000000000000000000000000000000000000000..ce15d2152b8b745fffbab5c14a89c236f9fb5587 --- /dev/null +++ b/jQueryGantt/jQueryGantt/ganttMaster.js @@ -0,0 +1,1735 @@ +/* + Copyright (c) 2012-2018 Open Lab + Written by Roberto Bicchierai and Silvia Chelazzi http://roberto.open-lab.com + 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. + */ +function GanttMaster() { + this.tasks = []; + this.deletedTaskIds = []; + this.links = []; + + this.editor; //element for editor + this.gantt; //element for gantt + this.splitter; //element for splitter + + this.isMultiRoot=false; // set to true in case of tasklist + + this.workSpace; // the original element used for containing everything + this.element; // editor and gantt box without buttons + + + this.resources; //list of resources + this.roles; //list of roles + + this.minEditableDate = 0; + this.maxEditableDate = Infinity; + this.set100OnClose=false; + this.shrinkParent=false; + + this.fillWithEmptyLines=true; //when is used by widget it could be usefull to do not fill with empty lines + + this.rowHeight = 30; // todo get it from css? + this.minRowsInEditor=30; // number of rows always visible in editor + this.numOfVisibleRows=0; //number of visible rows in the editor + this.firstScreenLine=0; //first visible row ignoring collapsed tasks + this.rowBufferSize=5; + this.firstVisibleTaskIndex=-1; //index of first task visible + this.lastVisibleTaskIndex=-1; //index of last task visible + + this.baselines={}; // contains {taskId:{taskId,start,end,status,progress}} + this.showBaselines=false; //allows to draw baselines + this.baselineMillis; //millis of the current baseline loaded + + + this.permissions = { + canWriteOnParent: true, + canWrite: true, + canAdd: true, + canDelete: true, + canInOutdent: true, + canMoveUpDown: true, + canSeePopEdit: true, + canSeeFullEdit: true, + canSeeDep: true, + canSeeCriticalPath: true, + canAddIssue: false, + cannotCloseTaskIfIssueOpen: false + }; + + this.firstDayOfWeek = Date.firstDayOfWeek; + this.serverClientTimeOffset = 0; + + this.currentTask; // task currently selected; + + this.resourceUrl = "res/"; // URL to resources (images etc.) + this.__currentTransaction; // a transaction object holds previous state during changes + this.__undoStack = []; + this.__redoStack = []; + this.__inUndoRedo = false; // a control flag to avoid Undo/Redo stacks reset when needed + + Date.workingPeriodResolution=1; //by default 1 day + + var self = this; +} + + +GanttMaster.prototype.init = function (workSpace) { + var place=$("
").prop("id","TWGanttArea").css( {padding:0, "overflow-y":"auto", "overflow-x":"hidden","border":"1px solid #e5e5e5",position:"relative"}); + workSpace.append(place).addClass("TWGanttWorkSpace"); + + this.workSpace=workSpace; + this.element = place; + this.numOfVisibleRows=Math.ceil(this.element.height()/this.rowHeight); + + //by default task are coloured by status + this.element.addClass('colorByStatus' ) + + var self = this; + //load templates + $("#gantEditorTemplates").loadTemplates().remove(); + + //create editor + this.editor = new GridEditor(this); + place.append(this.editor.gridified); + + //create gantt + this.gantt = new Ganttalendar(new Date().getTime() - 3600000 * 24 * 2, new Date().getTime() + 3600000 * 24 * 5, this, place.width() * .6); + + //setup splitter + self.splitter = $.splittify.init(place, this.editor.gridified, this.gantt.element, 50); + self.splitter.firstBoxMinWidth = 5; + self.splitter.secondBoxMinWidth = 20; + + //prepend buttons + var ganttButtons = $.JST.createFromTemplate({}, "GANTBUTTONS"); + place.before(ganttButtons); + this.checkButtonPermissions(); + + + //bindings + workSpace.bind("deleteFocused.gantt", function (e) { + //delete task or link? + var focusedSVGElement=self.gantt.element.find(".focused.focused.linkGroup"); + if (focusedSVGElement.size()>0) + self.removeLink(focusedSVGElement.data("from"), focusedSVGElement.data("to")); + else + self.deleteCurrentTask(); + }).bind("addAboveCurrentTask.gantt", function () { + self.addAboveCurrentTask(); + }).bind("addBelowCurrentTask.gantt", function () { + self.addBelowCurrentTask(); + }).bind("indentCurrentTask.gantt", function () { + self.indentCurrentTask(); + }).bind("outdentCurrentTask.gantt", function () { + self.outdentCurrentTask(); + }).bind("moveUpCurrentTask.gantt", function () { + self.moveUpCurrentTask(); + }).bind("moveDownCurrentTask.gantt", function () { + self.moveDownCurrentTask(); + }).bind("collapseAll.gantt", function () { + self.collapseAll(); + }).bind("expandAll.gantt", function () { + self.expandAll(); + }).bind("fullScreen.gantt", function () { + self.fullScreen(); + }).bind("print.gantt", function () { + self.print(); + + + }).bind("zoomPlus.gantt", function () { + self.gantt.zoomGantt(true); + }).bind("zoomMinus.gantt", function () { + self.gantt.zoomGantt(false); + + }).bind("openFullEditor.gantt", function () { + self.editor.openFullEditor(self.currentTask,false); + }).bind("openAssignmentEditor.gantt", function () { + self.editor.openFullEditor(self.currentTask,true); + }).bind("addIssue.gantt", function () { + self.addIssue(); + }).bind("openExternalEditor.gantt", function () { + self.openExternalEditor(); + + }).bind("undo.gantt", function () { + self.undo(); + }).bind("redo.gantt", function () { + self.redo(); + }).bind("resize.gantt", function () { + self.resize(); + }); + + + //bind editor scroll + self.splitter.firstBox.scroll(function () { + + //notify scroll to editor and gantt + self.gantt.element.stopTime("test").oneTime(10, "test", function () { + var oldFirstRow = self.firstScreenLine; + var newFirstRow = Math.floor(self.splitter.firstBox.scrollTop() / self.rowHeight); + if (Math.abs(oldFirstRow - newFirstRow) >= self.rowBufferSize) { + self.firstScreenLine = newFirstRow; + self.scrolled(oldFirstRow); + } + }); + }); + + + //keyboard management bindings + $("body").bind("keydown.body", function (e) { + //console.debug(e.keyCode+ " "+e.target.nodeName, e.ctrlKey) + + var eventManaged = true; + var isCtrl = e.ctrlKey || e.metaKey; + var bodyOrSVG = e.target.nodeName.toLowerCase() == "body" || e.target.nodeName.toLowerCase() == "svg"; + var inWorkSpace=$(e.target).closest("#TWGanttArea").length>0; + + //store focused field + var focusedField=$(":focus"); + var focusedSVGElement = self.gantt.element.find(".focused.focused");// orrible hack for chrome that seems to keep in memory a cached object + + var isFocusedSVGElement=focusedSVGElement.length >0; + + if ((inWorkSpace ||isFocusedSVGElement) && isCtrl && e.keyCode == 37) { // CTRL+LEFT on the grid + self.outdentCurrentTask(); + focusedField.focus(); + + } else if (inWorkSpace && isCtrl && e.keyCode == 38) { // CTRL+UP on the grid + self.moveUpCurrentTask(); + focusedField.focus(); + + } else if (inWorkSpace && isCtrl && e.keyCode == 39) { //CTRL+RIGHT on the grid + self.indentCurrentTask(); + focusedField.focus(); + + } else if (inWorkSpace && isCtrl && e.keyCode == 40) { //CTRL+DOWN on the grid + self.moveDownCurrentTask(); + focusedField.focus(); + + } else if (isCtrl && e.keyCode == 89) { //CTRL+Y + self.redo(); + + } else if (isCtrl && e.keyCode == 90) { //CTRL+Y + self.undo(); + + + } else if ( (isCtrl && inWorkSpace) && (e.keyCode == 8 || e.keyCode == 46) ) { //CTRL+DEL CTRL+BACKSPACE on grid + self.deleteCurrentTask(); + + } else if ( focusedSVGElement.is(".taskBox") && (e.keyCode == 8 || e.keyCode == 46) ) { //DEL BACKSPACE svg task + self.deleteCurrentTask(); + + } else if ( focusedSVGElement.is(".linkGroup") && (e.keyCode == 8 || e.keyCode == 46) ) { //DEL BACKSPACE svg link + self.removeLink(focusedSVGElement.data("from"), focusedSVGElement.data("to")); + + } else { + eventManaged=false; + } + + + if (eventManaged) { + e.preventDefault(); + e.stopPropagation(); + } + + }); + + //ask for comment input + $("#saveGanttButton").after($('#LOG_CHANGES_CONTAINER')); + + //ask for comment management + // this.element.on("saveRequired.gantt",this.manageSaveRequired); + + + //resize + $(window).resize(function () { + place.css({width: "100%", height: $(window).height() - place.position().top - 160}); + place.trigger("resize.gantt"); + }).oneTime(2, "resize", function () {$(window).trigger("resize")}); + +}; + +GanttMaster.messages = { + "CANNOT_WRITE": "CANNOT_WRITE", + "CHANGE_OUT_OF_SCOPE": "NO_RIGHTS_FOR_UPDATE_PARENTS_OUT_OF_EDITOR_SCOPE", + "START_IS_MILESTONE": "START_IS_MILESTONE", + "END_IS_MILESTONE": "END_IS_MILESTONE", + "TASK_HAS_CONSTRAINTS": "TASK_HAS_CONSTRAINTS", + "GANTT_ERROR_DEPENDS_ON_OPEN_TASK": "GANTT_ERROR_DEPENDS_ON_OPEN_TASK", + "GANTT_ERROR_DESCENDANT_OF_CLOSED_TASK": "GANTT_ERROR_DESCENDANT_OF_CLOSED_TASK", + "TASK_HAS_EXTERNAL_DEPS": "TASK_HAS_EXTERNAL_DEPS", + "GANTT_ERROR_LOADING_DATA_TASK_REMOVED": "GANTT_ERROR_LOADING_DATA_TASK_REMOVED", + "CIRCULAR_REFERENCE": "CIRCULAR_REFERENCE", + "CANNOT_MOVE_TASK": "CANNOT_MOVE_TASK", + "CANNOT_DEPENDS_ON_ANCESTORS": "CANNOT_DEPENDS_ON_ANCESTORS", + "CANNOT_DEPENDS_ON_DESCENDANTS": "CANNOT_DEPENDS_ON_DESCENDANTS", + "INVALID_DATE_FORMAT": "INVALID_DATE_FORMAT", + "GANTT_SEMESTER_SHORT": "GANTT_SEMESTER_SHORT", + "GANTT_SEMESTER": "GANTT_SEMESTER", + "GANTT_QUARTER_SHORT": "GANTT_QUARTER_SHORT", + "GANTT_QUARTER": "GANTT_QUARTER", + "GANTT_WEEK": "GANTT_WEEK", + "GANTT_WEEK_SHORT": "GANTT_WEEK_SHORT", + "CANNOT_CLOSE_TASK_IF_OPEN_ISSUE": "CANNOT_CLOSE_TASK_IF_OPEN_ISSUE", + "PLEASE_SAVE_PROJECT": "PLEASE_SAVE_PROJECT", + "CANNOT_CREATE_SAME_LINK": "CANNOT_CREATE_SAME_LINK" +}; + + +GanttMaster.prototype.createTask = function (id, name, code, level, start, duration) { + var factory = new TaskFactory(); + return factory.build(id, name, code, level, start, duration); +}; + + +GanttMaster.prototype.getOrCreateResource = function (id, name) { + var res= this.getResource(id); + if (!res && id && name) { + res = this.createResource(id, name); + } + return res +}; + +GanttMaster.prototype.createResource = function (id, name) { + var res = new Resource(id, name); + this.resources.push(res); + return res; +}; + + +//update depends strings +GanttMaster.prototype.updateDependsStrings = function () { + //remove all deps + for (var i = 0; i < this.tasks.length; i++) { + this.tasks[i].depends = ""; + } + + for (var i = 0; i < this.links.length; i++) { + var link = this.links[i]; + var dep = link.to.depends; + link.to.depends = link.to.depends + (link.to.depends == "" ? "" : ",") + (link.from.getRow() + 1) + (link.lag ? ":" + link.lag : ""); + } + +}; + +GanttMaster.prototype.removeLink = function (fromTask, toTask) { + //console.debug("removeLink"); + if (!this.permissions.canWrite || (!fromTask.canWrite && !toTask.canWrite)) + return; + + this.beginTransaction(); + var found = false; + for (var i = 0; i < this.links.length; i++) { + if (this.links[i].from == fromTask && this.links[i].to == toTask) { + this.links.splice(i, 1); + found = true; + break; + } + } + + if (found) { + this.updateDependsStrings(); + if (this.updateLinks(toTask)) + this.changeTaskDates(toTask, toTask.start, toTask.end); // fake change to force date recomputation from dependencies + } + this.endTransaction(); +}; + +GanttMaster.prototype.__removeAllLinks = function (task, openTrans) { + + if (openTrans) + this.beginTransaction(); + var found = false; + for (var i = 0; i < this.links.length; i++) { + if (this.links[i].from == task || this.links[i].to == task) { + this.links.splice(i, 1); + found = true; + } + } + + if (found) { + this.updateDependsStrings(); + } + if (openTrans) + this.endTransaction(); +}; + +//------------------------------------ ADD TASK -------------------------------------------- +GanttMaster.prototype.addTask = function (task, row) { + //console.debug("master.addTask",task,row,this); + + task.master = this; // in order to access controller from task + + //replace if already exists + var pos = -1; + for (var i = 0; i < this.tasks.length; i++) { + if (task.id == this.tasks[i].id) { + pos = i; + break; + } + } + + if (pos >= 0) { + this.tasks.splice(pos, 1); + row = parseInt(pos); + } + + //add task in collection + if (typeof(row) != "number") { + this.tasks.push(task); + } else { + this.tasks.splice(row, 0, task); + + //recompute depends string + this.updateDependsStrings(); + } + + //add Link collection in memory + var linkLoops = !this.updateLinks(task); + + // set the status according to parent + // if (task.getParent()) + // task.status = task.getParent().status; + // else + // task.status = "STATUS_ACTIVE"; + if(!task.status){ + task.status = "STATUS_WAITING"; + } + + var ret = task; + if (linkLoops || !task.setPeriod(task.start, task.end)) { + //remove task from in-memory collection + //console.debug("removing task from memory",task); + this.tasks.splice(task.getRow(), 1); + ret = undefined; + } else { + //append task to editor + this.editor.addTask(task, row); + //append task to gantt + this.gantt.addTask(task); + } + +//trigger addedTask event + $(this.element).trigger("addedTask.gantt", task); + return ret; +}; + + +/** + * a project contais tasks, resources, roles, and info about permisions + * @param project + */ +GanttMaster.prototype.loadProject = function (project) { + //console.debug("loadProject", project) + this.beginTransaction(); + this.serverClientTimeOffset = typeof project.serverTimeOffset !="undefined"? (parseInt(project.serverTimeOffset) + new Date().getTimezoneOffset() * 60000) : 0; + this.resources = project.resources; + this.roles = project.roles; + + //permissions from loaded project + // this.permissions.canWrite = project.canWrite; + // this.permissions.canAdd = project.canAdd; + // this.permissions.canWriteOnParent = project.canWriteOnParent; + // this.permissions.cannotCloseTaskIfIssueOpen = project.cannotCloseTaskIfIssueOpen; + // this.permissions.canAddIssue = project.canAddIssue; + // this.permissions.canDelete = project.canDelete; + + ({ canWriteOnParent:this.permissions.canWriteOnParent=true, + canWrite:this.permissions.canWrite=true, + canAdd:this.permissions.canAdd =true, + canDelete:this.permissions.canDelete =true, + canInOutdent:this.permissions.canInOutdent =true, + canMoveUpDown:this.permissions.canMoveUpDown =true, + canSeePopEdit:this.permissions.canSeePopEdit =true, + canSeeFullEdit:this.permissions.canSeeFullEdit =true, + canSeeDep:this.permissions.canSeeDep =true, + canSeeCriticalPath:this.permissions.canSeeCriticalPath =true, + canAddIssue:this.permissions.canAddIssue =false, + cannotCloseTaskIfIssueOpen:this.permissions.cannotCloseTaskIfIssueOpen =true + }=project); + //repaint button bar basing on permissions + this.checkButtonPermissions(); + + + + if (project.minEditableDate) + this.minEditableDate = computeStart(project.minEditableDate); + else + this.minEditableDate = -Infinity; + + if (project.maxEditableDate) + this.maxEditableDate = computeEnd(project.maxEditableDate); + else + this.maxEditableDate = Infinity; + + + //recover stored ccollapsed statuas + var collTasks=this.loadCollapsedTasks(); + + //shift dates in order to have client side the same hour (e.g.: 23:59) of the server side + for (var i = 0; i < project.tasks.length; i++) { + var task = project.tasks[i]; + task.start += this.serverClientTimeOffset; + task.end += this.serverClientTimeOffset; + //set initial collapsed status + task.collapsed=collTasks.indexOf(task.id)>=0; + } + + + this.loadTasks(project.tasks, project.selectedRow); + this.deletedTaskIds = []; + + + //recover saved zoom level + if (project.zoom){ + this.gantt.zoom = project.zoom; + } else { + this.gantt.shrinkBoundaries(); + this.gantt.setBestFittingZoom(); + } + + + this.endTransaction(); + var self = this; + this.gantt.element.oneTime(200, function () {self.gantt.centerOnToday()}); +}; + + +GanttMaster.prototype.loadTasks = function (tasks, selectedRow) { + //console.debug("GanttMaster.prototype.loadTasks") + //var prof=new Profiler("ganttMaster.loadTasks"); + var factory = new TaskFactory(); + + //reset + this.reset(); + + for (var i = 0; i < tasks.length; i++) { + var task = tasks[i]; + if (!(task instanceof Task)) { + var t = factory.build(task.id, task.name, task.code, task.level, task.start, task.duration, task.collapsed); + for (var key in task) { + if (key != "end" && key != "start") + t[key] = task[key]; //copy all properties + } + task = t; + } + task.master = this; // in order to access controller from task + this.tasks.push(task); //append task at the end + } + + for (var i = 0; i < this.tasks.length; i++) { + var task = this.tasks[i]; + + + var numOfError = this.__currentTransaction && this.__currentTransaction.errors ? this.__currentTransaction.errors.length : 0; + //add Link collection in memory + while (!this.updateLinks(task)) { // error on update links while loading can be considered as "warning". Can be displayed and removed in order to let transaction commits. + if (this.__currentTransaction && numOfError != this.__currentTransaction.errors.length) { + var msg = ""; + while (numOfError < this.__currentTransaction.errors.length) { + var err = this.__currentTransaction.errors.pop(); + msg = msg + err.msg + "\r\n"; + } + + getInstance(this.pageId).model.invoke('showTip',msg); + } + this.__removeAllLinks(task, false); + } + + if (!task.setPeriod(task.start, task.end)) { + alert(GanttMaster.messages.GANNT_ERROR_LOADING_DATA_TASK_REMOVED + "\n" + task.name ); + //remove task from in-memory collection + this.tasks.splice(task.getRow(), 1); + } else { + //append task to editor + this.editor.addTask(task, null, true); + //append task to gantt + this.gantt.addTask(task); + } + } + + //this.editor.fillEmptyLines(); + //prof.stop(); + + // re-select old row if tasks is not empty + if (this.tasks && this.tasks.length > 0) { + selectedRow = selectedRow ? selectedRow : 0; + this.tasks[selectedRow].rowElement.click(); + } +}; + + +GanttMaster.prototype.getTask = function (taskId) { + var ret; + for (var i = 0; i < this.tasks.length; i++) { + var tsk = this.tasks[i]; + if (tsk.id == taskId) { + ret = tsk; + break; + } + } + return ret; +}; + + +GanttMaster.prototype.getResource = function (resId) { + var ret; + for (var i = 0; i < this.resources.length; i++) { + var res = this.resources[i]; + if (res.id == resId) { + ret = res; + break; + } + } + return ret; +}; + + +GanttMaster.prototype.changeTaskDeps = function (task) { + return task.moveTo(task.start,false,true); +}; + +GanttMaster.prototype.changeTaskDates = function (task, start, end) { + //console.debug("changeTaskDates",task, start, end) + return task.setPeriod(start, end); +}; + + +GanttMaster.prototype.moveTask = function (task, newStart) { + return task.moveTo(newStart, true,true); +}; + + +GanttMaster.prototype.taskIsChanged = function () { + getInstance(this.pageId).model.invoke('taskIsChanged',true); + + //console.debug("taskIsChanged"); + var master = this; + + //refresh is executed only once every 50ms + this.element.stopTime("gnnttaskIsChanged"); + //var profilerext = new Profiler("gm_taskIsChangedRequest"); + this.element.oneTime(50, "gnnttaskIsChanged", function () { + //console.debug("task Is Changed real call to redraw"); + //var profiler = new Profiler("gm_taskIsChangedReal"); + master.redraw(); + master.element.trigger("gantt.redrawCompleted"); + //profiler.stop(); + }); + //profilerext.stop(); +}; + + +GanttMaster.prototype.checkButtonPermissions = function () { + var ganttButtons=$(".ganttButtonBar"); + //hide buttons basing on permissions + if (!this.permissions.canWrite) + ganttButtons.find(".requireCanWrite").hide(); + + if (!this.permissions.canAdd) + ganttButtons.find(".requireCanAdd").hide(); + + if (!this.permissions.canInOutdent) + ganttButtons.find(".requireCanInOutdent").hide(); + + if (!this.permissions.canMoveUpDown) + ganttButtons.find(".requireCanMoveUpDown").hide(); + + if (!this.permissions.canDelete) + ganttButtons.find(".requireCanDelete").hide(); + + if (!this.permissions.canSeeCriticalPath) + ganttButtons.find(".requireCanSeeCriticalPath").hide(); + + if (!this.permissions.canAddIssue) + ganttButtons.find(".requireCanAddIssue").hide(); + +}; + + +GanttMaster.prototype.redraw = function () { + this.editor.redraw(); + this.gantt.redraw(); +}; + +GanttMaster.prototype.reset = function () { + //console.debug("GanttMaster.prototype.reset"); + this.tasks = []; + this.links = []; + this.deletedTaskIds = []; + if (!this.__inUndoRedo) { + this.__undoStack = []; + this.__redoStack = []; + } else { // don't reset the stacks if we're in an Undo/Redo, but restart the inUndoRedo control + this.__inUndoRedo = false; + } + delete this.currentTask; + + this.editor.reset(); + this.gantt.reset(); +}; + + +GanttMaster.prototype.showTaskEditor = function (taskId) { + var task = this.getTask(taskId); + task.rowElement.find(".edit").click(); +}; + +GanttMaster.prototype.saveProject = function () { + return this.saveGantt(false); +}; + +GanttMaster.prototype.saveGantt = function (forTransaction) { + //var prof = new Profiler("gm_saveGantt"); + var saved = []; + for (var i = 0; i < this.tasks.length; i++) { + var task = this.tasks[i]; + var cloned = task.clone(); + + //shift back to server side timezone + if (!forTransaction) { + cloned.start -= this.serverClientTimeOffset; + cloned.end -= this.serverClientTimeOffset; + } + + saved.push(cloned); + } + + var ret = {tasks: saved}; + if (this.currentTask) { + ret.selectedRow = this.currentTask.getRow(); + } + + ret.deletedTaskIds = this.deletedTaskIds; //this must be consistent with transactions and undo + + if (!forTransaction) { + ret.resources = this.resources; + ret.roles = this.roles; + ret.canAdd = this.permissions.canAdd; + ret.canWrite = this.permissions.canWrite; + ret.canWriteOnParent = this.permissions.canWriteOnParent; + ret.zoom = this.gantt.zoom; + + //save collapsed tasks on localStorage + this.storeCollapsedTasks(); + + //mark un-changed task and assignments + this.markUnChangedTasksAndAssignments(ret); + + //si aggiunge il commento al cambiamento di date/status + ret.changesReasonWhy=$("#LOG_CHANGES").val(); + + } + + //prof.stop(); + return ret; +}; + + +GanttMaster.prototype.markUnChangedTasksAndAssignments=function(newProject){ + //console.debug("markUnChangedTasksAndAssignments"); + //si controlla che ci sia qualcosa di cambiato, ovvero che ci sia l'undo stack + if (this.__undoStack.length>0){ + var oldProject=JSON.parse(this.__undoStack[0]); + //si looppano i "nuovi" task + for (var i=0;i0){ + + //se abbiamo trovato il vecchio task e questo aveva delle assegnazioni + if (oldTask && oldTask.assigs && oldTask.assigs.length>0){ + for (var j=0;j=0) + collTasks.splice(pos,1); + } + } + localStorage.setObject("TWPGanttCollTasks2", collTasks); + } +}; + + + +GanttMaster.prototype.updateLinks = function (task) { + //console.debug("updateLinks",task); + //var prof= new Profiler("gm_updateLinks"); + + // defines isLoop function + function isLoop(task, target, visited) { + //var prof= new Profiler("gm_isLoop"); + //console.debug("isLoop :"+task.name+" - "+target.name); + if (target == task) { + return true; + } + + var sups = task.getSuperiors(); + + //my parent' superiors are my superiors too + var p = task.getParent(); + while (p) { + sups = sups.concat(p.getSuperiors()); + p = p.getParent(); + } + + //my children superiors are my superiors too + var chs = task.getChildren(); + for (var i = 0; i < chs.length; i++) { + sups = sups.concat(chs[i].getSuperiors()); + } + + var loop = false; + //check superiors + for (var i = 0; i < sups.length; i++) { + var supLink = sups[i]; + if (supLink.from == target) { + loop = true; + break; + } else { + if (visited.indexOf(supLink.from.id + "x" + target.id) <= 0) { + visited.push(supLink.from.id + "x" + target.id); + if (isLoop(supLink.from, target, visited)) { + loop = true; + break; + } + } + } + } + + //check target parent + var tpar = target.getParent(); + if (tpar) { + if (visited.indexOf(task.id + "x" + tpar.id) <= 0) { + visited.push(task.id + "x" + tpar.id); + if (isLoop(task, tpar, visited)) { + loop = true; + } + } + } + + //prof.stop(); + return loop; + } + + //remove my depends + this.links = this.links.filter(function (link) { + return link.to != task; + }); + + var todoOk = true; + if (task.depends) { + + //cannot depend from an ancestor + var parents = task.getParents(); + //cannot depend from descendants + var descendants = task.getDescendant(); + + var deps = task.depends.split(","); + var newDepsString = ""; + + var visited = []; + var depsEqualCheck = []; + for (var j = 0; j < deps.length; j++) { + var depString = deps[j]; // in the form of row(lag) e.g. 2:3,3:4,5 + var supStr =depString; + var lag = 0; + var pos = depString.indexOf(":"); + if (pos>0){ + supStr=depString.substr(0,pos); + var lagStr=depString.substr(pos+1); + lag=Math.ceil((stringToDuration(lagStr)) / Date.workingPeriodResolution) * Date.workingPeriodResolution; + } + + var sup = this.tasks[parseInt(supStr)-1]; + + if (sup) { + if (parents && parents.indexOf(sup) >= 0) { + this.setErrorOnTransaction("\""+task.name + "\"\n" + GanttMaster.messages.CANNOT_DEPENDS_ON_ANCESTORS + "\n\"" + sup.name+"\""); + todoOk = false; + + } else if (descendants && descendants.indexOf(sup) >= 0) { + this.setErrorOnTransaction("\""+task.name + "\"\n" + GanttMaster.messages.CANNOT_DEPENDS_ON_DESCENDANTS + "\n\"" + sup.name+"\""); + todoOk = false; + + } else if (isLoop(sup, task, visited)) { + todoOk = false; + this.setErrorOnTransaction(GanttMaster.messages.CIRCULAR_REFERENCE + "\n\"" + task.id +" - "+ task.name + "\" -> \"" + sup.id +" - "+sup.name+"\""); + + } else if(depsEqualCheck.indexOf(sup)>=0) { + this.setErrorOnTransaction(GanttMaster.messages.CANNOT_CREATE_SAME_LINK + "\n\"" + sup.name+"\" -> \""+task.name+"\""); + todoOk = false; + + } else { + this.links.push(new Link(sup, task, lag)); + newDepsString = newDepsString + (newDepsString.length > 0 ? "," : "") + supStr+(lag==0?"":":"+durationToString(lag)); + } + + if (todoOk) + depsEqualCheck.push(sup); + } + } + task.depends = newDepsString; + } + //prof.stop(); + + return todoOk; +}; + + +GanttMaster.prototype.moveUpCurrentTask = function () { + var self = this; + //console.debug("moveUpCurrentTask",self.currentTask) + if (self.currentTask) { + if (!(self.permissions.canWrite || self.currentTask.canWrite) || !self.permissions.canMoveUpDown ) + return; + + self.beginTransaction(); + self.currentTask.moveUp(); + self.endTransaction(); + } +}; + +GanttMaster.prototype.moveDownCurrentTask = function () { + var self = this; + //console.debug("moveDownCurrentTask",self.currentTask) + if (self.currentTask) { + if (!(self.permissions.canWrite || self.currentTask.canWrite) || !self.permissions.canMoveUpDown ) + return; + + self.beginTransaction(); + self.currentTask.moveDown(); + self.endTransaction(); + } +}; + +GanttMaster.prototype.outdentCurrentTask = function () { + var self = this; + if (self.currentTask) { + var par = self.currentTask.getParent(); + //can outdent if you have canRight on current task and on its parent and canAdd on grandfather + if (!self.currentTask.canWrite || !par.canWrite || !par.getParent() || !par.getParent().canAdd) + return; + + self.beginTransaction(); + self.currentTask.outdent(); + self.endTransaction(); + + //[expand] + if (par) self.editor.refreshExpandStatus(par); + } +}; + +GanttMaster.prototype.indentCurrentTask = function () { + var self = this; + if (self.currentTask) { + + //can indent if you have canRight on current and canAdd on the row above + var row = self.currentTask.getRow(); + if (!self.currentTask.canWrite || row <= 0 || !self.tasks[row - 1].canAdd) + return; + + self.beginTransaction(); + self.currentTask.indent(); + self.endTransaction(); + } +}; + +GanttMaster.prototype.addBelowCurrentTask = function () { + var self = this; + //console.debug("addBelowCurrentTask",self.currentTask) + var factory = new TaskFactory(); + var ch; + var row = 0; + if (self.currentTask && self.currentTask.name) { + //add below add a brother if current task is not already a parent + var addNewBrother = !(self.currentTask.isParent() || self.currentTask.level==0); + + var canAddChild=self.currentTask.canAdd; + var canAddBrother=self.currentTask.getParent() && self.currentTask.getParent().canAdd; + + //if you cannot add a brother you will try to add a child + addNewBrother=addNewBrother&&canAddBrother; + + if (!canAddBrother && !canAddChild) + return; + + + ch = factory.build("tmp_" + new Date().getTime(), "", "", self.currentTask.level+ (addNewBrother ?0:1), self.currentTask.start, 1); + row = self.currentTask.getRow() + 1; + + if (row>0) { + self.beginTransaction(); + var task = self.addTask(ch, row); + if (task) { + task.rowElement.click(); + task.rowElement.find("[name=name]").focus(); + } + self.endTransaction(); + } + } +}; + +GanttMaster.prototype.addAboveCurrentTask = function () { + var self = this; + // console.debug("addAboveCurrentTask",self.currentTask) + + if(!self.currentTask){ + getInstance(self.pageId).model.invoke('showTip',"请选择要添加的行。"); + return; + } + + //check permissions + if ((self.currentTask.getParent() && !self.currentTask.getParent().canAdd) ) + return; + + var factory = new TaskFactory(); + + var ch; + var row = 0; + if (self.currentTask && self.currentTask.name) { + //cannot add brothers to root + if (self.currentTask.level <= 0){ + getInstance(self.pageId).model.invoke('showTip',"不能选择根节点。"); + return; + } + + + ch = factory.build("tmp_" + new Date().getTime(), "", "", self.currentTask.level, self.currentTask.start, 1); + row = self.currentTask.getRow(); + + if (row > 0) { + self.beginTransaction(); + var task = self.addTask(ch, row); + if (task) { + task.rowElement.click(); + task.rowElement.find("[name=name]").focus(); + } + self.endTransaction(); + } + } +}; +GanttMaster.prototype.deleteFocused = function () { + var self = this; + var focusedSVGElement=self.gantt.element.find(".focused.focused.linkGroup"); + if (focusedSVGElement.size()>0) + self.removeLink(focusedSVGElement.data("from"), focusedSVGElement.data("to")); + else + self.deleteCurrentTask(); +} +GanttMaster.prototype.deleteCurrentTask = function (taskId) { + //console.debug("deleteCurrentTask",this.currentTask , this.isMultiRoot) + var self = this; + + var task; + if (taskId) + task=self.getTask(taskId); + else + task=self.currentTask; + + if (!task || !self.permissions.canDelete && !task.canDelete) + return; + + var taskIsEmpty=task.name==""; + + var row = task.getRow(); + if (task && (row > 0 || self.isMultiRoot || task.isNew()) ) { + var par = task.getParent(); + self.beginTransaction(); + task.deleteTask(); + task = undefined; + + //recompute depends string + self.updateDependsStrings(); + + //redraw + self.taskIsChanged(); + + //[expand] + if (par) + self.editor.refreshExpandStatus(par); + + + //focus next row + row = row > self.tasks.length - 1 ? self.tasks.length - 1 : row; + if (!taskIsEmpty && row >= 0) { + task = self.tasks[row]; + task.rowElement.click(); + task.rowElement.find("[name=name]").focus(); + } + self.endTransaction(); + } +}; + + + + +GanttMaster.prototype.collapseAll = function () { + //console.debug("collapseAll"); + if (this.currentTask){ + this.currentTask.collapsed=true; + var desc = this.currentTask.getDescendant(); + for (var i=0; i= 0) continue; + childTask.rowElement.show(); + } + + this.redraw(); + + //store collapse statuses + this.storeCollapsedTasks(); + +}; + + +GanttMaster.prototype.getCollapsedDescendant = function () { + var allTasks = this.tasks; + var collapsedDescendant = []; + for (var i = 0; i < allTasks.length; i++) { + var task = allTasks[i]; + if (collapsedDescendant.indexOf(task) >= 0) continue; + if (task.collapsed) collapsedDescendant = collapsedDescendant.concat(task.getDescendant()); + } + return collapsedDescendant; +} + + + + +GanttMaster.prototype.addIssue = function () { + var self = this; + + if (self.currentTask && self.currentTask.isNew()){ + alert(GanttMaster.messages.PLEASE_SAVE_PROJECT); + return; + } + if (!self.currentTask || !self.currentTask.canAddIssue) + return; + + openIssueEditorInBlack('0',"AD","ISSUE_TASK="+self.currentTask.id); +}; + +GanttMaster.prototype.openExternalEditor = function () { + //console.debug("openExternalEditor ") + var self = this; + if (!self.currentTask) + return; + + if (self.currentTask.isNew()){ + alert(GanttMaster.messages.PLEASE_SAVE_PROJECT); + return; + } + + //window.location.href=contextPath+"/applications/teamwork/task/taskEditor.jsp?CM=ED&OBJID="+self.currentTask.id; +}; + +//<%----------------------------- TRANSACTION MANAGEMENT ---------------------------------%> +GanttMaster.prototype.beginTransaction = function () { + if (!this.__currentTransaction) { + this.__currentTransaction = { + snapshot: JSON.stringify(this.saveGantt(true)), + errors: [] + }; + } else { + console.error("Cannot open twice a transaction"); + } + return this.__currentTransaction; +}; + + +//this function notify an error to a transaction -> transaction will rollback +GanttMaster.prototype.setErrorOnTransaction = function (errorMessage, task) { + if (this.__currentTransaction) { + this.__currentTransaction.errors.push({msg: errorMessage, task: task}); + } else { + console.error(errorMessage); + } +}; + +GanttMaster.prototype.isTransactionInError = function () { + if (!this.__currentTransaction) { + console.error("Transaction never started."); + return true; + } else { + return this.__currentTransaction.errors.length > 0 + } + +}; + +GanttMaster.prototype.endTransaction = function () { + if (!this.__currentTransaction) { + console.error("Transaction never started."); + return true; + } + + var ret = true; + + //no error -> commit + if (this.__currentTransaction.errors.length <= 0) { + //console.debug("committing transaction"); + + //put snapshot in undo + this.__undoStack.push(this.__currentTransaction.snapshot); + //clear redo stack + this.__redoStack = []; + + //shrink gantt bundaries + this.gantt.shrinkBoundaries(); + this.taskIsChanged(); //enqueue for gantt refresh + + + //error -> rollback + } else { + ret = false; + //console.debug("rolling-back transaction"); + + //compose error message + var msg = ""; + for (var i = 0; i < this.__currentTransaction.errors.length; i++) { + var err = this.__currentTransaction.errors[i]; + msg = msg + err.msg+"\r\n"; + } + getInstance(this.pageId).model.invoke('showTip',msg); + + + //try to restore changed tasks + var oldTasks = JSON.parse(this.__currentTransaction.snapshot); + this.deletedTaskIds = oldTasks.deletedTaskIds; + this.__inUndoRedo = true; // avoid Undo/Redo stacks reset + this.loadTasks(oldTasks.tasks, oldTasks.selectedRow); + this.redraw(); + + } + //reset transaction + this.__currentTransaction = undefined; + + //show/hide save button + this.saveRequired(); + + //[expand] + this.editor.refreshExpandStatus(this.currentTask); + + return ret; +}; + +// inhibit undo-redo +GanttMaster.prototype.checkpoint = function () { + //console.debug("GanttMaster.prototype.checkpoint"); + this.__undoStack = []; + this.__redoStack = []; + this.saveRequired(); +}; + +//----------------------------- UNDO/REDO MANAGEMENT ---------------------------------%> + +GanttMaster.prototype.undo = function () { + //console.debug("undo before:",this.__undoStack,this.__redoStack); + if (this.__undoStack.length > 0) { + var his = this.__undoStack.pop(); + this.__redoStack.push(JSON.stringify(this.saveGantt())); + var oldTasks = JSON.parse(his); + this.deletedTaskIds = oldTasks.deletedTaskIds; + this.__inUndoRedo = true; // avoid Undo/Redo stacks reset + this.loadTasks(oldTasks.tasks, oldTasks.selectedRow); + this.redraw(); + //show/hide save button + this.saveRequired(); + } +}; + +GanttMaster.prototype.redo = function () { + //console.debug("redo before:",undoStack,redoStack); + if (this.__redoStack.length > 0) { + var his = this.__redoStack.pop(); + this.__undoStack.push(JSON.stringify(this.saveGantt())); + var oldTasks = JSON.parse(his); + this.deletedTaskIds = oldTasks.deletedTaskIds; + this.__inUndoRedo = true; // avoid Undo/Redo stacks reset + this.loadTasks(oldTasks.tasks, oldTasks.selectedRow); + this.redraw(); + //console.debug("redo after:",undoStack,redoStack); + + this.saveRequired(); + } +}; + + +GanttMaster.prototype.saveRequired = function () { + //console.debug("saveRequired") + //show/hide save button + if(this.__undoStack.length>0 ) { + $("#saveGanttButton").removeClass("disabled"); + $("form[alertOnChange] #Gantt").val(new Date().getTime()); // set a fake variable as dirty + // this.element.trigger("saveRequired.gantt",[true]); + this.manageSaveRequired(true); + + + } else { + $("#saveGanttButton").addClass("disabled"); + $("form[alertOnChange] #Gantt").updateOldValue(); // set a fake variable as clean + // this.element.trigger("saveRequired.gantt",[false]); + this.manageSaveRequired(false); + + } +}; + + +GanttMaster.prototype.print = function () { + this.gantt.redrawTasks(true); + print(); +}; + + +GanttMaster.prototype.resize = function () { + var self=this; + //console.debug("GanttMaster.resize") + this.element.stopTime("resizeRedraw").oneTime(50,"resizeRedraw",function(){ + self.splitter.resize(); + self.numOfVisibleRows=Math.ceil(self.element.height()/self.rowHeight); + self.firstScreenLine=Math.floor(self.splitter.firstBox.scrollTop()/self.rowHeight) ; + self.gantt.redrawTasks(); + }); +}; + + + + +GanttMaster.prototype.scrolled = function (oldFirstRow) { + var self=this; + var newFirstRow=self.firstScreenLine; + + //if scroll something + if (newFirstRow!=oldFirstRow){ + //console.debug("Ganttalendar.scrolled oldFirstRow:"+oldFirstRow+" new firstScreenLine:"+newFirstRow); + + var collapsedDescendant = self.getCollapsedDescendant(); + + var scrollDown=newFirstRow>oldFirstRow; + var startRowDel; + var endRowDel; + var startRowAdd; + var endRowAdd; + + if(scrollDown){ + startRowDel=oldFirstRow-self.rowBufferSize; + endRowDel=newFirstRow-self.rowBufferSize; + startRowAdd=Math.max(oldFirstRow+self.numOfVisibleRows+self.rowBufferSize,endRowDel); + endRowAdd =newFirstRow+self.numOfVisibleRows+self.rowBufferSize; + } else { + startRowDel=newFirstRow+self.numOfVisibleRows+self.rowBufferSize; + endRowDel=oldFirstRow+self.numOfVisibleRows+self.rowBufferSize; + startRowAdd=newFirstRow-self.rowBufferSize; + endRowAdd =Math.min(oldFirstRow-self.rowBufferSize,startRowDel); + } + + var firstVisibleRow=newFirstRow-self.rowBufferSize; //ignoring collapsed tasks + var lastVisibleRow =newFirstRow+self.numOfVisibleRows+self.rowBufferSize; + + + //console.debug("remove startRowDel:"+startRowDel+" endRowDel:"+endRowDel ) + //console.debug("add startRowAdd:"+startRowAdd+" endRowAdd:"+endRowAdd) + + var row=0; + self.firstVisibleTaskIndex=-1; + for (var i=0;i=0){ + continue; + } + + //remove rows on top + if (row>=startRowDel && row=startRowAdd && row=firstVisibleRow && row 0) && (!t.isParent() || (t.isParent() && !t.isDependent())); + }); + + // reset values + for (var i = 0; i < tasks.length; i++) { + var t = tasks[i]; + t.earlyStart = -1; + t.earlyFinish = -1; + t.latestStart = -1; + t.latestFinish = -1; + t.criticalCost = -1; + t.isCritical = false; + } + + // tasks whose critical cost has been calculated + var completed = []; + // tasks whose critical cost needs to be calculated + var remaining = tasks.concat(); // put all tasks in remaining + + + // Backflow algorithm + // while there are tasks whose critical cost isn't calculated. + while (remaining.length > 0) { + var progress = false; + + // find a new task to calculate + for (var i = 0; i < remaining.length; i++) { + var task = remaining[i]; + var inferiorTasks = task.getInferiorTasks(); + + if (containsAll(completed, inferiorTasks)) { + // all dependencies calculated, critical cost is max dependency critical cost, plus our cost + var critical = 0; + for (var j = 0; j < inferiorTasks.length; j++) { + var t = inferiorTasks[j]; + if (t.criticalCost > critical) { + critical = t.criticalCost; + } + } + task.criticalCost = critical + task.duration; + // set task as calculated an remove + completed.push(task); + remaining.splice(i, 1); + + // note we are making progress + progress = true; + } + } + // If we haven't made any progress then a cycle must exist in + // the graph and we wont be able to calculate the critical path + if (!progress) { + console.error("Cyclic dependency, algorithm stopped!"); + return false; + } + } + + // set earlyStart, earlyFinish, latestStart, latestFinish + computeMaxCost(tasks); + var initialNodes = initials(tasks); + calculateEarly(initialNodes); + calculateCritical(tasks); + + return tasks; + + + function containsAll(set, targets) { + for (var i = 0; i < targets.length; i++) { + if (set.indexOf(targets[i]) < 0) + return false; + } + return true; + } + + function computeMaxCost(tasks) { + var max = -1; + for (var i = 0; i < tasks.length; i++) { + var t = tasks[i]; + + if (t.criticalCost > max) + max = t.criticalCost; + } + //console.debug("Critical path length (cost): " + max); + for (var i = 0; i < tasks.length; i++) { + var t = tasks[i]; + t.setLatest(max); + } + } + + function initials(tasks) { + var initials = []; + for (var i = 0; i < tasks.length; i++) { + if (!tasks[i].depends || tasks[i].depends == "") + initials.push(tasks[i]); + } + return initials; + } + + function calculateEarly(initials) { + for (var i = 0; i < initials.length; i++) { + var initial = initials[i]; + initial.earlyStart = 0; + initial.earlyFinish = initial.duration; + setEarly(initial); + } + } + + function setEarly(initial) { + var completionTime = initial.earlyFinish; + var inferiorTasks = initial.getInferiorTasks(); + for (var i = 0; i < inferiorTasks.length; i++) { + var t = inferiorTasks[i]; + if (completionTime >= t.earlyStart) { + t.earlyStart = completionTime; + t.earlyFinish = completionTime + t.duration; + } + setEarly(t); + } + } + + function calculateCritical(tasks) { + for (var i = 0; i < tasks.length; i++) { + var t = tasks[i]; + t.isCritical = (t.earlyStart == t.latestStart) + } + } + +}; + +//------------------------------------------- MANAGE CHANGE LOG INPUT --------------------------------------------------- +GanttMaster.prototype.manageSaveRequired=function(ev, showSave) { + //console.debug("manageSaveRequired", showSave); + + var self=this; + function checkChanges() { + var changes = false; + //there is somethin in the redo stack? + if (self.__undoStack.length > 0) { + var oldProject = JSON.parse(self.__undoStack[0]); + //si looppano i "nuovi" task + for (var i = 0; !changes && i < self.tasks.length; i++) { + var newTask = self.tasks[i]; + //se è un task che c'erà già + if (!(""+newTask.id).startsWith("tmp_")) { + //si recupera il vecchio task + var oldTask; + for (var j = 0; j < oldProject.tasks.length; j++) { + if (oldProject.tasks[j].id == newTask.id) { + oldTask = oldProject.tasks[j]; + break; + } + } + // chack only status or dateChanges + if (oldTask && (oldTask.status != newTask.status || oldTask.start != newTask.start || oldTask.end != newTask.end)) { + changes = true; + break; + } + } + } + } + $("#LOG_CHANGES_CONTAINER").css("display", changes ? "inline-block" : "none"); + } + + + if (showSave) { + $("body").stopTime("gantt.manageSaveRequired").oneTime(200, "gantt.manageSaveRequired", checkChanges); + } else { + $("#LOG_CHANGES_CONTAINER").hide(); + } + +} + + +/** + * workStartHour,endStartHour : millis from 00:00 + * dateFormat dd/MM/yyyy HH:mm + * working period resolution in millis or days + */ +GanttMaster.prototype.setHoursOn = function(startWorkingHour,endWorkingHour,dateFormat,resolution){ + //console.debug("resolution",resolution) + Date.defaultFormat= dateFormat; + Date.startWorkingHour=startWorkingHour; + Date.endWorkingHour=endWorkingHour; + Date.useMillis=resolution>=1000; + Date.workingPeriodResolution=resolution; + millisInWorkingDay=endWorkingHour-startWorkingHour; +}; diff --git a/jQueryGantt/jQueryGantt/ganttPrint.css b/jQueryGantt/jQueryGantt/ganttPrint.css new file mode 100644 index 0000000000000000000000000000000000000000..5b0bccdee53ac90e38299cd5f4b2d76ac5c5f306 --- /dev/null +++ b/jQueryGantt/jQueryGantt/ganttPrint.css @@ -0,0 +1,59 @@ +.noprint { + display:none !important; +} + +BODY, TBODY { + font-family: arial; + font-size: 12px; + margin: 0; + color: #000; + overflow: visible!important; +} + +.teamworkIcon{ + display:none; +} + +.mainColumn{ + width:98% !important; +} + + +#TWGanttArea{ + overflow-x: visible !important; + overflow-y: visible !important; + width: auto !important; + height: auto !important; + border:none !important; +} + +.splitterContainer{ + width: auto !important; + height: auto !important; +} +.splitElement{ + position: static !important; + width: auto !important; + height: auto !important; + top:0 !important; + left: 0 !important; + overflow-x: visible !important; + overflow-y: visible !important; +} + +.vSplitBar,.emptyRow{ + display: none !important; +} + +.gdfTable{ + width: 0 !important; + } + +.splitBox2{ + page-break-before: always !important; +} + + +.ganttFixHead{ + display: none !important; +} diff --git a/jQueryGantt/jQueryGantt/ganttTask.js b/jQueryGantt/jQueryGantt/ganttTask.js new file mode 100644 index 0000000000000000000000000000000000000000..73cf3b84a6e3a938b14460b81994846359f2f722 --- /dev/null +++ b/jQueryGantt/jQueryGantt/ganttTask.js @@ -0,0 +1,1234 @@ +/* + Copyright (c) 2012-2018 Open Lab + Written by Roberto Bicchierai and Silvia Chelazzi http://roberto.open-lab.com + 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. + */ + +/** + * A method to instantiate valid task models from + * raw data. + */ +function TaskFactory() { + + /** + * Build a new Task + */ + this.build = function (id, name, code, level, start, duration, collapsed) { + // Set at beginning of day + var adjusted_start = computeStart(start); + var calculated_end = computeEndByDuration(adjusted_start, duration); + return new Task(id, name, code, level, adjusted_start, calculated_end, duration, collapsed); + }; + +} + +function Task(id, name, code, level, start, end, duration, collapsed) { + this.id = id; + this.name = name; + this.progress = 0; + this.progressByWorklog = true; + this.relevance = 0; + this.type = "计划"; + this.typeId = "plan"; + this.description = ""; + this.code = code ? code : new Date().getTime()*1234567; + this.level = level; + this.status = "STATUS_WAITING"; + this.depends = ""; + + this.start = start; + this.duration = duration; + this.end = end; + + this.startIsMilestone = false; + this.endIsMilestone = false; + + this.collapsed = collapsed; + + //permissions + // by default all true, but must be inherited from parent + this.canWrite = true; + this.canAdd = true; + this.canDelete = true; + this.canAddIssue = true; + + this.rowElement; //row editor html element + this.ganttElement; //gantt html element + this.master; + + + this.assigs = []; +} + +Task.prototype.clone = function () { + var ret = {}; + for (var key in this) { + if (typeof(this[key]) != "function") + if (typeof(this[key]) != "object" || Array.isArray(this[key])) + ret[key] = this[key]; + } + return ret; +}; + +Task.prototype.getAssigsString = function () { + var ret = ""; + for (var i = 0; i < this.assigs.length; i++) { + var ass = this.assigs[i]; + var res = this.master.getResource(ass.resourceId); + if (res) { + ret = ret + (ret == "" ? "" : ", ") + res.name; + } + } + return ret; +}; + +Task.prototype.createAssignment = function (id, resourceId, roleId, effort) { + var assig = new Assignment(id, resourceId, roleId, effort); + this.assigs.push(assig); + return assig; +}; + + +//<%---------- SET PERIOD ---------------------- --%> +Task.prototype.setPeriod = function (start, end) { + //console.debug("setPeriod ",this.code,this.name,new Date(start), new Date(end)); + //var profilerSetPer = new Profiler("gt_setPeriodJS"); + + if (start instanceof Date) { + start = start.getTime(); + } + + if (end instanceof Date) { + end = end.getTime(); + } + + var originalPeriod = { + start: this.start, + end: this.end, + duration: this.duration + }; + + + //compute legal start/end //todo mossa qui R&S 30/3/2016 perchè altrimenti il calcolo della durata, che è stato modificato sommando giorni, sbaglia + start = computeStart(start); + end=computeEnd(end); + + var newDuration = recomputeDuration(start, end); + + //if are equals do nothing and return true + if ( start == originalPeriod.start && end == originalPeriod.end && newDuration == originalPeriod.duration) { + return true; + } + + if (newDuration == this.duration) { // is shift + return this.moveTo(start, false,true); + } + + var wantedStartMillis = start; + + var children = this.getChildren(); + + if(this.master.shrinkParent && children.length>0) { + var chPeriod= this.getChildrenBoudaries(); + start = chPeriod.start; + end = chPeriod.end; + } + + + //cannot start after end + if (start > end) { + start = end; + } + + //if there are dependencies compute the start date and eventually moveTo + var startBySuperiors = this.computeStartBySuperiors(start); + if (startBySuperiors != start) { + return this.moveTo(startBySuperiors, false,true); + } + + var somethingChanged = false; + + if (this.start != start || this.start != wantedStartMillis) { + this.start = start; + somethingChanged = true; + } + + //set end + var wantedEndMillis = end; + + if (this.end != end || this.end != wantedEndMillis) { + this.end = end; + somethingChanged = true; + } + + this.duration = recomputeDuration(this.start, this.end); + + //profilerSetPer.stop(); + + //nothing changed exit + if (!somethingChanged) + return true; + + //cannot write exit + if (!this.canWrite) { + this.master.setErrorOnTransaction("\"" + this.name + "\"\n" + GanttMaster.messages["CANNOT_WRITE"], this); + return false; + } + + //external dependencies: exit with error + if (this.hasExternalDep) { + this.master.setErrorOnTransaction("\"" + this.name + "\"\n" + GanttMaster.messages["TASK_HAS_EXTERNAL_DEPS"], this); + return false; + } + + var todoOk = true; + + //I'm restricting + var deltaPeriod = originalPeriod.duration - this.duration; + var restricting = deltaPeriod > 0; + var enlarging = deltaPeriod < 0; + var restrictingStart = restricting && (originalPeriod.start < this.start); + var restrictingEnd = restricting && (originalPeriod.end > this.end); + + if (restricting) { + //loops children to get boundaries + var bs = Infinity; + var be = 0; + for (var i = 0; i < children.length; i++) { + + var ch = children[i]; + if (restrictingEnd) { + be = Math.max(be, ch.end); + } else { + bs = Math.min(bs, ch.start); + } + } + + if (restrictingEnd) { + this.end = Math.max(be, this.end); + } else { + this.start = Math.min(bs, this.start); + } + this.duration = recomputeDuration(this.start, this.end); + if (this.master.shrinkParent ) { + todoOk = updateTree(this); + } + + } else { + + //check global boundaries + if (this.start < this.master.minEditableDate || this.end > this.master.maxEditableDate) { + this.master.setErrorOnTransaction("\"" + this.name + "\"\n" +GanttMaster.messages["CHANGE_OUT_OF_SCOPE"], this); + todoOk = false; + } + + //console.debug("set period: somethingChanged",this); + if (todoOk ) { + todoOk = updateTree(this); + } + } + + if (todoOk) { + todoOk = this.propagateToInferiors(end); + } + return todoOk; +}; + + +//<%---------- MOVE TO ---------------------- --%> +Task.prototype.moveTo = function (start, ignoreMilestones, propagateToInferiors) { + //console.debug("moveTo ",this.name,new Date(start),this.duration,ignoreMilestones); + //var profiler = new Profiler("gt_task_moveTo"); + + if (start instanceof Date) { + start = start.getTime(); + } + + var originalPeriod = { + start: this.start, + end: this.end + }; + + var wantedStartMillis = start; + + //set a legal start + start = computeStart(start); + + //if depends, start is set to max end + lag of superior + start = this.computeStartBySuperiors(start); + + var end = computeEndByDuration(start, this.duration); + + + //check milestones compatibility + if (!this.checkMilestonesConstraints(start,end,ignoreMilestones)) + return false; + + if (this.start != start || this.start != wantedStartMillis) { + //in case of end is milestone it never changes! + //if (!ignoreMilestones && this.endIsMilestone && end != this.end) { + // this.master.setErrorOnTransaction("\"" + this.name + "\"\n" + GanttMaster.messages["END_IS_MILESTONE"], this); + // return false; + //} + this.start = start; + this.end = end; + //profiler.stop(); + + //check global boundaries + if (this.start < this.master.minEditableDate || this.end > this.master.maxEditableDate) { + this.master.setErrorOnTransaction("\"" + this.name + "\"\n" +GanttMaster.messages["CHANGE_OUT_OF_SCOPE"], this); + return false; + } + + + // bicch 22/4/2016: quando si sposta un task con child a cavallo di holidays, i figli devono essere shiftati in workingDays, non in millisecondi, altrimenti si cambiano le durate + // when moving children you MUST consider WORKING days, + // var panDeltaInWM = getDistanceInUnits(new Date(originalPeriod.start),new Date(this.start)); + + //loops children to shift them + var children = this.getChildren(); + for (var i = 0; i < children.length; i++) { + var ch = children[i]; + // var chStart=incrementDateByUnits(new Date(ch.start),panDeltaInWM); + ch.moveTo(ch.start,false,false); + } + + if (!updateTree(this)) { + return false; + } + + if (propagateToInferiors) { + this.propagateToInferiors(end); + var todoOk = true; + var descendants = this.getDescendant(); + for (var i = 0; i < descendants.length; i++) { + ch = descendants[i]; + if (!ch.propagateToInferiors(ch.end)) + return false; + } + } + } + + return true; +}; + + +Task.prototype.checkMilestonesConstraints = function (newStart,newEnd,ignoreMilestones) { + +//if start is milestone cannot be move + if (!ignoreMilestones && (this.startIsMilestone && newStart != this.start )) { + //notify error + this.master.setErrorOnTransaction("\"" + this.name + "\"\n" + GanttMaster.messages["START_IS_MILESTONE"], this); + return false; + } else if (!ignoreMilestones && (this.endIsMilestone && newEnd != this.end)) { + //notify error + this.master.setErrorOnTransaction("\"" + this.name + "\"\n" + GanttMaster.messages["END_IS_MILESTONE"], this); + return false; + } else if (this.hasExternalDep) { + //notify error + this.master.setErrorOnTransaction("\"" + this.name + "\"\n" + GanttMaster.messages["TASK_HAS_EXTERNAL_DEPS"], this); + return false; + } + return true; +}; + +//<%---------- PROPAGATE TO INFERIORS ---------------------- --%> +Task.prototype.propagateToInferiors = function (end) { + //console.debug("propagateToInferiors "+this.name) + //and now propagate to inferiors + var todoOk = true; + var infs = this.getInferiors(); + if (infs && infs.length > 0) { + for (var i = 0; i < infs.length; i++) { + var link = infs[i]; + if (!link.to.canWrite) { + this.master.setErrorOnTransaction(GanttMaster.messages["CANNOT_WRITE"] + "\n\"" + link.to.name + "\"", link.to); + break; + } + todoOk = link.to.moveTo(end, false,true); //this is not the right date but moveTo checks start + if (!todoOk) + break; + } + } + return todoOk; +}; + + +//<%---------- COMPUTE START BY SUPERIORS ---------------------- --%> +Task.prototype.computeStartBySuperiors = function (proposedStart) { + //if depends -> start is set to max end + lag of superior + var supEnd=proposedStart; + var sups = this.getSuperiors(); + if (sups && sups.length > 0) { + supEnd=0; + for (var i = 0; i < sups.length; i++) { + var link = sups[i]; + supEnd = Math.max(supEnd, incrementDateByUnits(new Date(link.from.end), link.lag)); + } + supEnd+=1; + } + return computeStart(supEnd); +}; + + +function updateTree(task) { + //console.debug("updateTree ",task.code,task.name, new Date(task.start), new Date(task.end)); + var error; + + //try to enlarge parent + var p = task.getParent(); + + //no parent:exit + if (!p) + return true; + + var newStart; + var newEnd; + + //id shrink start and end are computed on children boundaries + if (task.master.shrinkParent) { + var chPeriod= p.getChildrenBoudaries(); + newStart = chPeriod.start; + newEnd = chPeriod.end; + } else { + newStart = p.start; + newEnd = p.end; + + if (p.start > task.start) { + newStart = task.start; + } + if (p.end < task.end) { + newEnd = task.end; + } + } + + if (p.start!=newStart) { + if (p.startIsMilestone) { + task.master.setErrorOnTransaction("\"" + p.name + "\"\n" + GanttMaster.messages["START_IS_MILESTONE"], task); + return false; + } else if (p.depends) { + task.master.setErrorOnTransaction("\"" + p.name + "\"\n" + GanttMaster.messages["TASK_HAS_CONSTRAINTS"], task); + return false; + } + } + if (p.end!=newEnd) { + if (p.endIsMilestone) { + task.master.setErrorOnTransaction("\"" + p.name + "\"\n" + GanttMaster.messages["END_IS_MILESTONE"], task); + return false; + } + } + + + //propagate updates if needed + if (newStart != p.start || newEnd != p.end) { + + //can write? + if (!p.canWrite) { + task.master.setErrorOnTransaction(GanttMaster.messages["CANNOT_WRITE"] + "\n" + p.name, task); + return false; + } + + //has external deps ? + if (p.hasExternalDep) { + task.master.setErrorOnTransaction(GanttMaster.messages["TASK_HAS_EXTERNAL_DEPS"] + "\n\"" + p.name + "\"", task); + return false; + } + + return p.setPeriod(newStart, newEnd); + } + + return true; +} + + +Task.prototype.getChildrenBoudaries = function () { + var newStart = Infinity; + var newEnd = -Infinity; + var children = this.getChildren(); + for (var i = 0; i < children.length; i++) { + var ch = children[i]; + newStart = Math.min(newStart, ch.start); + newEnd = Math.max(newEnd, ch.end); + } + return({start:newStart,end:newEnd}) +} + +//<%---------- CHANGE STATUS ---------------------- --%> +Task.prototype.changeStatus = function (newStatus,forceStatusCheck) { + //console.debug("changeStatus: "+this.name+" from "+this.status+" -> "+newStatus); + + var cone = this.getDescendant(); + + function propagateStatus(task, newStatus, manuallyChanged, propagateFromParent, propagateFromChildren) { + //console.debug("propagateStatus",task.name, task.status,newStatus, manuallyChanged, propagateFromParent, propagateFromChildren); + var oldStatus = task.status; + + //no changes exit + if (newStatus == oldStatus && !forceStatusCheck) { + return true; + } + + var todoOk = true; + task.status = newStatus; + + + //xxxx -> STATUS_DONE may activate dependent tasks, both suspended and undefined. Will set to done all children. + //STATUS_FAILED -> STATUS_DONE do nothing if not forced by hand + if (newStatus == "STATUS_DONE") { + + // cannot close task if open issues + if (task.master.permissions.cannotCloseTaskIfIssueOpen && task.openIssues > 0) { + task.master.setErrorOnTransaction(GanttMaster.messages["CANNOT_CLOSE_TASK_IF_OPEN_ISSUE"] + " \"" + task.name + "\""); + return false; + } + + + if ((manuallyChanged || oldStatus != "STATUS_FAILED")) { //cannot set failed task as closed for cascade - only if changed manually + + //can be closed only if superiors are already done + var sups = task.getSuperiors(); + for (var i = 0; i < sups.length; i++) { + if (sups[i].from.status != "STATUS_DONE" && cone.indexOf(sups[i].from)<0) { // è un errore se un predecessore è non chiuso ed è fuori dal cono + if (manuallyChanged || propagateFromParent) //genere un errore bloccante se è cambiato a mano o se il cambiamento arriva dal parent ed ho una dipendenza fuori dal cono (altrimenti avrei un attivo figlio di un chiuso + task.master.setErrorOnTransaction(GanttMaster.messages["GANTT_ERROR_DEPENDS_ON_OPEN_TASK"] + "\n\"" + sups[i].from.name + "\" -> \"" + task.name + "\""); + todoOk = false; + break; + } + } + + if (todoOk) { + // set progress to 100% if needed by settings + if (task.master.set100OnClose && !task.progressByWorklog ){ + task.progress=100; + } + + //set children as done + propagateStatusToChildren(task,newStatus,false); + + //set inferiors as active + propagateStatusToInferiors( task.getInferiors(), "STATUS_ACTIVE"); + } + } else { // una propagazione tenta di chiudere un task fallito + todoOk = false; + } + + + // STATUS_UNDEFINED -> STATUS_ACTIVE all children become active, if they have no dependencies. + // STATUS_SUSPENDED -> STATUS_ACTIVE sets to active all children and their descendants that have no inhibiting dependencies. + // STATUS_WAITING -> STATUS_ACTIVE sets to active all children and their descendants that have no inhibiting dependencies. + // STATUS_DONE -> STATUS_ACTIVE all those that have dependencies must be set to suspended. + // STATUS_FAILED -> STATUS_ACTIVE nothing happens: child statuses must be reset by hand. + } else if (newStatus == "STATUS_ACTIVE") { + + if (manuallyChanged || (oldStatus != "STATUS_FAILED" && oldStatus != "STATUS_SUSPENDED")) { //cannot set failed or suspended task as active for cascade - only if changed manually + + //can be active only if superiors are already done, not only on this task, but also on ancestors superiors + var sups = task.getSuperiors(); + + for (var i = 0; i < sups.length; i++) { + if (sups[i].from.status != "STATUS_DONE") { + if (manuallyChanged || propagateFromChildren) + task.master.setErrorOnTransaction(GanttMaster.messages["GANTT_ERROR_DEPENDS_ON_OPEN_TASK"] + "\n\"" + sups[i].from.name + "\" -> \"" + task.name + "\""); + todoOk = false; + break; + } + } + + // check if parent is already active + if (todoOk) { + var par = task.getParent(); + if (par && par.status != "STATUS_ACTIVE") { + // todoOk = propagateStatus(par, "STATUS_ACTIVE", false, false, true); //todo abbiamo deciso di non far propagare lo status verso l'alto + todoOk = false; + } + } + + + if (todoOk) { + if (oldStatus == "STATUS_UNDEFINED" || oldStatus == "STATUS_SUSPENDED" || oldStatus == "STATUS_WAITING" ) { + //set children as active + propagateStatusToChildren(task,newStatus,true); + } + + //set inferiors as suspended + //propagateStatusToInferiors( task.getInferiors(), "STATUS_SUSPENDED"); + propagateStatusToInferiors( task.getInferiors(), "STATUS_WAITING"); + } + } else { + todoOk = false; + } + + // xxxx -> STATUS_WAITING all active children and their active descendants become waiting. when not failed or forced + } else if (newStatus == "STATUS_WAITING" ) { + if (manuallyChanged || oldStatus != "STATUS_FAILED") { //cannot set failed task as waiting for cascade - only if changed manually + + //check if parent if not active + var par = task.getParent(); + if (par && (par.status != "STATUS_ACTIVE" && par.status != "STATUS_SUSPENDED" && par.status != "STATUS_WAITING")) { + todoOk = false; + } + + + if (todoOk) { + //set children as STATUS_WAITING + propagateStatusToChildren(task, "STATUS_WAITING", true); + + //set inferiors as STATUS_WAITING + propagateStatusToInferiors( task.getInferiors(), "STATUS_WAITING"); + } + } else { + todoOk = false; + } + + // xxxx -> STATUS_SUSPENDED all active children and their active descendants become suspended. when not failed or forced + } else if (newStatus == "STATUS_SUSPENDED" ) { + if (manuallyChanged || oldStatus != "STATUS_FAILED") { //cannot set failed task as closed for cascade - only if changed manually + + //check if parent if not active + var par = task.getParent(); + if (par && (par.status != "STATUS_ACTIVE" && par.status != "STATUS_SUSPENDED" && par.status != "STATUS_WAITING")) { + todoOk = false; + } + + + if (todoOk) { + //set children as STATUS_SUSPENDED + propagateStatusToChildren(task, "STATUS_SUSPENDED", true); + + //set inferiors as STATUS_SUSPENDED + propagateStatusToInferiors( task.getInferiors(), "STATUS_SUSPENDED"); + } + } else { + todoOk = false; + } + + // xxxx -> STATUS_FAILED children and dependent failed + // xxxx -> STATUS_UNDEFINED children and dependant become undefined. + } else if (newStatus == "STATUS_FAILED" || newStatus == "STATUS_UNDEFINED") { + + //set children as failed or undefined + propagateStatusToChildren(task,newStatus,false); + + //set inferiors as failed + propagateStatusToInferiors( task.getInferiors(), newStatus); + } + if (!todoOk) { + task.status = oldStatus; + //console.debug("status rolled back: "+task.name + " to " + oldStatus); + } + + return todoOk; + } + + /** + * A helper method to traverse an array of 'inferior' tasks + * and signal a status change. + */ + function propagateStatusToInferiors( infs, status) { + for (var i = 0; i < infs.length; i++) { + propagateStatus(infs[i].to, status, false, false, false); + } + } + + /** + * A helper method to loop children and propagate new status + */ + function propagateStatusToChildren(task, newStatus, skipClosedTasks) { + var chds = task.getChildren(); + for (var i = 0; i < chds.length; i++) + if (!(skipClosedTasks && chds[i].status == "STATUS_DONE") ) + propagateStatus(chds[i], newStatus, false, true, false); + } + + + var manuallyChanged=true; + + var oldStatus = this.status; + //first call + if (propagateStatus(this, newStatus, manuallyChanged, false, false)) { + return true; + } else { + this.status = oldStatus; + return false; + } +}; + +Task.prototype.synchronizeStatus = function () { + //console.debug("synchronizeStatus",this.name); + var oldS = this.status; + this.status = this.getParent()?this.getParent().status:"STATUS_UNDEFINED"; // di default si invalida lo stato mettendo quello del padre, in modo che inde/outd siano consistenti + return this.changeStatus(oldS,true); +}; + +Task.prototype.isLocallyBlockedByDependencies = function () { + var sups = this.getSuperiors(); + var blocked = false; + for (var i = 0; i < sups.length; i++) { + if (sups[i].from.status != "STATUS_DONE") { + blocked = true; + break; + } + } + return blocked; +}; + +//<%---------- TASK STRUCTURE ---------------------- --%> +Task.prototype.getRow = function () { + ret = -1; + if (this.master) + ret = this.master.tasks.indexOf(this); + return ret; +}; + + +Task.prototype.getParents = function () { + var ret; + if (this.master) { + var topLevel = this.level; + var pos = this.getRow(); + ret = []; + for (var i = pos; i >= 0; i--) { + var par = this.master.tasks[i]; + if (topLevel > par.level) { + topLevel = par.level; + ret.push(par); + } + } + } + return ret; +}; + + +Task.prototype.getParent = function () { + var ret; + if (this.master) { + for (var i = this.getRow(); i >= 0; i--) { + var par = this.master.tasks[i]; + if (this.level > par.level) { + ret = par; + break; + } + } + } + return ret; +}; + + +Task.prototype.isParent = function () { + var ret = false; + if (this.master) { + var pos = this.getRow(); + if (pos < this.master.tasks.length - 1) + ret = this.master.tasks[pos + 1].level > this.level; + } + return ret; +}; + + +Task.prototype.getChildren = function () { + var ret = []; + if (this.master) { + var pos = this.getRow(); + for (var i = pos + 1; i < this.master.tasks.length; i++) { + var ch = this.master.tasks[i]; + if (ch.level == this.level + 1) + ret.push(ch); + else if (ch.level <= this.level) // exit loop if parent or brother + break; + } + } + return ret; +}; + + +Task.prototype.getDescendant = function () { + var ret = []; + if (this.master) { + var pos = this.getRow(); + for (var i = pos + 1; i < this.master.tasks.length; i++) { + var ch = this.master.tasks[i]; + if (ch.level > this.level) + ret.push(ch); + else + break; + } + } + return ret; +}; + + +Task.prototype.getSuperiors = function () { + var ret = []; + var task = this; + if (this.master) { + ret = this.master.links.filter(function (link) { + return link.to == task; + }); + } + return ret; +}; + +Task.prototype.getSuperiorTasks = function () { + var ret = []; + var sups = this.getSuperiors(); + for (var i = 0; i < sups.length; i++) + ret.push(sups[i].from); + return ret; +}; + + +Task.prototype.getInferiors = function () { + var ret = []; + var task = this; + if (this.master) { + ret = this.master.links.filter(function (link) { + return link.from == task; + }); + } + return ret; +}; + +Task.prototype.getInferiorTasks = function () { + var ret = []; + var infs = this.getInferiors(); + for (var i = 0; i < infs.length; i++) + ret.push(infs[i].to); + return ret; +}; + +Task.prototype.deleteTask = function () { + //console.debug("deleteTask",this.name,this.master.deletedTaskIds) + //if is the current one remove it + if (this.master.currentTask && this.master.currentTask.id==this.id) + delete this.master.currentTask; + + //delete both dom elements if exists + if (this.rowElement) + this.rowElement.remove(); + if (this.ganttElement) + this.ganttElement.remove(); + + //remove children + var chd = this.getChildren(); + for (var i = 0; i < chd.length; i++) { + //add removed child in list + chd[i].deleteTask(); + } + + if (!this.isNew()) + this.master.deletedTaskIds.push(this.id); + + + //remove from in-memory collection + this.master.tasks.splice(this.getRow(), 1); + + //remove from links + var task = this; + this.master.links = this.master.links.filter(function (link) { + return link.from != task && link.to != task; + }); +}; + + +Task.prototype.isNew = function () { + return (this.id + "").indexOf("tmp_") == 0; +}; + +Task.prototype.isDependent = function (t) { + //console.debug("isDependent",this.name, t.name) + var task = this; + var dep = this.master.links.filter(function (link) { + return link.from == task; + }); + + // is t a direct dependency? + for (var i = 0; i < dep.length; i++) { + if (dep[i].to == t) + return true; + } + // is t an indirect dependency + for (var i = 0; i < dep.length; i++) { + if (dep[i].to.isDependent(t)) { + return true; + } + } + return false; +}; + +Task.prototype.setLatest = function (maxCost) { + this.latestStart = maxCost - this.criticalCost; + this.latestFinish = this.latestStart + this.duration; +}; + + +//<%------------------------------------------ INDENT/OUTDENT --------------------------------%> +Task.prototype.indent = function () { + //console.debug("indent", this); + //a row above must exist + var row = this.getRow(); + + //no row no party + if (row <= 0) + return false; + + var ret = false; + var taskAbove = this.master.tasks[row - 1]; + var newLev = this.level + 1; + if (newLev <= taskAbove.level + 1) { + ret = true; + + //trick to get parents after indent + this.level++; + var futureParents = this.getParents(); + this.level--; + + var oldLevel = this.level; + for (var i = row; i < this.master.tasks.length; i++) { + var desc = this.master.tasks[i]; + if (desc.level > oldLevel || desc == this) { + desc.level++; + //remove links from this and descendant to my parents + this.master.links = this.master.links.filter(function (link) { + var linkToParent = false; + if (link.to == desc) + linkToParent = futureParents.indexOf(link.from) >= 0; + else if (link.from == desc) + linkToParent = futureParents.indexOf(link.to) >= 0; + return !linkToParent; + }); + //remove links from this and descendants to predecessors of parents in order to avoid loop + var predecessorsOfFutureParents=[]; + for (var j=0;j= 0; + return !linkToParent; + }); + + + } else + break; + } + + var parent = this.getParent(); + // set start date to parent' start if no deps + if (parent && !this.depends) { + var new_end = computeEndByDuration(parent.start, this.duration); + this.master.changeTaskDates(this, parent.start, new_end); + } + + + //recompute depends string + this.master.updateDependsStrings(); + //enlarge parent using a fake set period + updateTree(this); + //force status check starting from parent + this.getParent().synchronizeStatus(); + } + return ret; +}; + + +Task.prototype.outdent = function () { + //console.debug("outdent", this); + + //a level must be >1 -> cannot escape from root + if (this.level <= 1) + return false; + + var ret = false; + var oldLevel = this.level; + + ret = true; + var row = this.getRow(); + for (var i = row; i < this.master.tasks.length; i++) { + var desc = this.master.tasks[i]; + if (desc.level > oldLevel || desc == this) { + desc.level--; + } else + break; + } + + var task = this; + var chds = this.getChildren(); + //remove links from me to my new children + this.master.links = this.master.links.filter(function (link) { + var linkExist = (link.to == task && chds.indexOf(link.from) >= 0 || link.from == task && chds.indexOf(link.to) >= 0); + return !linkExist; + }); + + + //enlarge me if inherited children are larger + for (var i = 0; i < chds.length; i++) { + //remove links from me to my new children + chds[i].setPeriod(chds[i].start + 1, chds[i].end + 1); + } + + //recompute depends string + this.master.updateDependsStrings(); + + //enlarge parent using a fake set period + this.setPeriod(this.start + 1, this.end + 1); + + //force status check + this.synchronizeStatus(); + return ret; +}; + + +//<%------------------------------------------ MOVE UP / MOVE DOWN --------------------------------%> +Task.prototype.moveUp = function () { + //console.debug("moveUp", this); + var ret = false; + + //a row above must exist + var row = this.getRow(); + + //no row no party + if (row <= 0) + return false; + + //find new row + var newRow; + for (newRow = row - 1; newRow >= 0; newRow--) { + if (this.master.tasks[newRow].level <= this.level) + break; + } + + //is a parent or a brother + if (this.master.tasks[newRow].level == this.level) { + ret = true; + //compute descendant + var descNumber = 0; + for (var i = row + 1; i < this.master.tasks.length; i++) { + var desc = this.master.tasks[i]; + if (desc.level > this.level) { + descNumber++; + } else { + break; + } + } + //move in memory + var blockToMove = this.master.tasks.splice(row, descNumber + 1); + var top = this.master.tasks.splice(0, newRow); + this.master.tasks = [].concat(top, blockToMove, this.master.tasks); + //move on dom + var rows = this.master.editor.element.find("tr[taskid]"); + var domBlockToMove = rows.slice(row, row + descNumber + 1); + rows.eq(newRow).before(domBlockToMove); + + //recompute depends string + this.master.updateDependsStrings(); + } else { + this.master.setErrorOnTransaction(GanttMaster.messages["TASK_MOVE_INCONSISTENT_LEVEL"], this); + ret = false; + } + return ret; +}; + + +Task.prototype.moveDown = function () { + //console.debug("moveDown", this); + + //a row below must exist, and cannot move root task + var row = this.getRow(); + if (row >= this.master.tasks.length - 1 || row == 0) + return false; + + var ret = false; + + //find nearest brother + var newRow; + for (newRow = row + 1; newRow < this.master.tasks.length; newRow++) { + if (this.master.tasks[newRow].level <= this.level) + break; + } + + //is brother + if (this.master.tasks[newRow] && this.master.tasks[newRow].level == this.level) { + ret = true; + //find last desc + for (newRow = newRow + 1; newRow < this.master.tasks.length; newRow++) { + if (this.master.tasks[newRow].level <= this.level) + break; + } + + //compute descendant + var descNumber = 0; + for (var i = row + 1; i < this.master.tasks.length; i++) { + var desc = this.master.tasks[i]; + if (desc.level > this.level) { + descNumber++; + } else { + break; + } + } + + //move in memory + var blockToMove = this.master.tasks.splice(row, descNumber + 1); + var top = this.master.tasks.splice(0, newRow - descNumber - 1); + this.master.tasks = [].concat(top, blockToMove, this.master.tasks); + + + //move on dom + var rows = this.master.editor.element.find("tr[taskid]"); + var aft = rows.eq(newRow - 1); + var domBlockToMove = rows.slice(row, row + descNumber + 1); + aft.after(domBlockToMove); + + //recompute depends string + this.master.updateDependsStrings(); + } + + return ret; +}; + + +Task.prototype.canStatusBeChangedTo=function(newStatus) { + //lo stato corrente è sempre ok + if (newStatus==this.status) + return true; + + var parent=this.getParent(); + + //---------------------------------------------------------------------- STATUS_DONE ---------------------------------------------------------------- + // un task può essere STATUS_DONE se di root + // se il suo padre non è fallito o undefined + // se non ha previouses aperti + if ("STATUS_DONE"==newStatus) { + if (!parent ) + return true; + + if ("STATUS_FAILED"==parent.status || "STATUS_UNDEFINED"==parent.status) + return false; + + var sups=this.getSuperiorTasks(); + for (var i=0;i +function Link(taskFrom, taskTo, lagInWorkingDays) { + this.from = taskFrom; + this.to = taskTo; + this.lag = lagInWorkingDays; +} + + +//<%------------------------------------------------------------------------ ASSIGNMENT ---------------------------------------------------------------%> +function Assignment(id, resourceId, roleId, effort) { + this.id = id; + this.resourceId = resourceId; + this.roleId = roleId; + this.effort = effort; +} + + +//<%------------------------------------------------------------------------ RESOURCE ---------------------------------------------------------------%> +function Resource(id, name) { + this.id = id; + this.name = name; +} + + +//<%------------------------------------------------------------------------ ROLE ---------------------------------------------------------------%> +function Role(id, name) { + this.id = id; + this.name = name; +} + + + + diff --git a/jQueryGantt/jQueryGantt/ganttTestSuite.js b/jQueryGantt/jQueryGantt/ganttTestSuite.js new file mode 100644 index 0000000000000000000000000000000000000000..4eccc1f447b324ab4b7630736dc07d10b8c61bcd --- /dev/null +++ b/jQueryGantt/jQueryGantt/ganttTestSuite.js @@ -0,0 +1,475 @@ +var testCount=0; +function enqueueNewTest() { + var test = ganttTestUnits.shift(); + if (!test) + return; + + + //ci si registra per gli eventi di refresh + + ge.element.one("gantt.redrawCompleted", function () { + //si registra l'evento di validazione al refresh + ge.element.one("gantt.redrawCompleted", function () { + if (test.assertOk()) + console.debug("------------------------- OK!"); + else + console.error("Test "+testCount+ " \""+test.name+"\"------------------------- FAILED!"); + + //si passa al test successivo + setTimeout(enqueueNewTest, 200); + //enqueueNewTest(); + }); + + //si chiama la funzione di preparazione del test + console.debug("Test "+testCount+ " \""+test.name+"\""); + test.prepareTest(); + testCount++; + }); + + + //se nel test ci sono i task si resetta il gantt + if (test.tasks) { + //si resetta tutto + ge.reset(); + + //si prepara un progetto + var prj = { + tasks: test.tasks, + resources: [], + roles: [], + //permessi + canWriteOnParent: true, + canWrite: true, + canAdd: true, + canInOutdent: true, + canMoveUpDown: true, + canSeePopEdit: true, + canSeeFullEdit: true, + canSeeDep: true, + canSeeCriticalPath: true, + canAddIssue: false, + cannotCloseTaskIfIssueOpen: false + }; + + //si carica il progetto + ge.loadProject(prj); + + + // se i task non ci sono si parte dallo stato lasciato dall'ultimo test + } else { + //si lancia l'evento facendo finta di avere caricato tutti itask + ge.element.trigger("gantt.redrawCompleted"); + } + +} + + +$(function () { + console.debug("Gantt test unit activated"); + $("#workSpace").one("gantt.redrawCompleted", function () { + setTimeout(enqueueNewTest, 1000); + }); +}); + + +//--------------------------------------------------------------------- TEST UNIT DEFINITIONS ------------------------------------------------------------------------------------ + +var ganttTestUnits = []; + +// 0 -------------------------------------------------------------------------------------------------------------- +ganttTestUnits.push({name: "Passo 1: Chiudi P chiude F", + tasks: [ + {"id": "616", "name": "test", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "GTU", "level": 0, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1473976800000, "duration": 3, "end": 1474408799999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "startDate": "16/09/2016", "endDate": "20/09/2016", "lastModified": 1474028638447, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "canAddIssue": true, "hasChild": true}, + {"id": "tmp_fk1474274262872", "name": "P", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1473976800000, "duration": 1, "end": 1474063199999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": true}, + {"id": "tmp_fk1474274277068", "name": "F", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 2, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1473976800000, "duration": 1, "end": 1474063199999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false} + ], + prepareTest: function () { + //apro il selettore stati e chiudo il task + ge.tasks[1].rowElement.find(".taskStatus").click().oneTime(100, "setStat", function () {$(this).next().find("[status=STATUS_DONE]").click()}); + }, + assertOk: function () { + var ret = ge.tasks[1].status == "STATUS_DONE" && ge.tasks[2].status == "STATUS_DONE"; + return ret; + } +}); + +// 1 -------------------------------------------------------------------------------------------------------------- +ganttTestUnits.push({name: "Passo 2: Provo ad aprire P, non ci riesco", + prepareTest: function () { + //apro il selettore stati e chiudo il task + ge.tasks[2].rowElement.find(".taskStatus").click().oneTime(100, "setStat", function () {$(this).next().find("[status=STATUS_ACTIVE]").click()}); + }, + assertOk: function () { + return ret = ge.tasks[1].status == "STATUS_DONE" && ge.tasks[2].status == "STATUS_DONE"; + } +}); + +// 2 -------------------------------------------------------------------------------------------------------------- +ganttTestUnits.push({name: "Passo 3: Fallisce P fallisce F", + prepareTest: function () { + //apro il selettore stati e chiudo il task + ge.tasks[1].rowElement.find(".taskStatus").click().oneTime(100, "setStat", function () {$(this).next().find("[status=STATUS_FAILED]").click()}); + }, + assertOk: function () { + return ret = ge.tasks[1].status == "STATUS_FAILED"; + } +}); + +// 3 -------------------------------------------------------------------------------------------------------------- +ganttTestUnits.push({name: "Passo 4: Apro P, F resta fallito", + prepareTest: function () { + //apro il selettore stati e chiudo il task + ge.tasks[1].rowElement.find(".taskStatus").click().oneTime(100, "setStat", function () {$(this).next().find("[status=STATUS_ACTIVE]").click()}); + }, + assertOk: function () { + return ret = ge.tasks[2].status == "STATUS_FAILED"; + } +}); + +// 4 ------------------------------------------------------------------------------------ +ganttTestUnits.push({name: "Indenta figlio sotto padre chiuso: chiude figlio", + tasks: [ + {"id": "624", "name": "test", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T624", "level": 0, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "startDate": "19/09/2016", "endDate": "19/09/2016", "lastModified": 1474279210280, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "canAddIssue": true, "hasChild": true}, + {"id": "tmp_fk1474279215599", "name": "p", "progress": 100, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_DONE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false}, + {"id": "tmp_fk1474279220599", "name": "f", "progress": 100, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false} + ], + prepareTest: function () { + ge.currentTask = ge.tasks[2]; + ge.indentCurrentTask(); + }, + assertOk: function () { + //il figlio deve diventare chiuso + return ge.tasks[2].status == "STATUS_DONE"; + } +}); + + +//5 ------------------------------------------------------------------------------------ +ganttTestUnits.push({name: "Crea 2 dip da task aperto con lag diversi: C->waiting, c.start max lag ", + tasks: [ + {"id": "624", "name": "test", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T624", "level": 0, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "startDate": "19/09/2016", "endDate": "19/09/2016", "lastModified": 1474279210280, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "canAddIssue": true, "hasChild": true}, + {"id": "tmp_fk1474279215599", "name": "a", "progress": 100, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false}, + {"id": "tmp_fk1474279220599", "name": "b", "progress": 100, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false}, + {"id": "tmp_fk1474279220449", "name": "c", "progress": 100, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false} + ], + prepareTest: function () { + ge.tasks[3].rowElement.find("[name=depends]").val("2:1,3:2").blur(); + }, + assertOk: function () { + //il figlio deve diventare chiuso, la root si deve allargare e c deve usare il lag massimo + return ge.tasks[3].status == "STATUS_WAITING" && ge.tasks[0].duration == 4 && getDistanceInUnits(new Date(ge.tasks[2].start),new Date(ge.tasks[3].start)) == 3; + } +}); + + +// 6 ------------------------------------------------------------------------------------ +ganttTestUnits.push({name: "Crea dipendenza da task chiuso: mette B in stato aperto", + tasks: [ + {"id": "624", "name": "test", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T624", "level": 0, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "startDate": "19/09/2016", "endDate": "19/09/2016", "lastModified": 1474279210280, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "canAddIssue": true, "hasChild": true}, + {"id": "tmp_fk1474279215599", "name": "a", "progress": 100, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_DONE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false}, + {"id": "tmp_fk1474279220599", "name": "b", "progress": 100, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_WAITING", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false} + ], + prepareTest: function () { + ge.tasks[2].rowElement.find("[name=depends]").val("2").blur(); + }, + assertOk: function () { + //il figlio deve diventare chiuso + return ge.tasks[2].status == "STATUS_ACTIVE"; + } +}); + + +// 7 ------------------------------------------------------------------------------------ +ganttTestUnits.push({name: "Chiude A : mette B e C in stato aperto", + tasks: [ + {"id": "624", "name": "test", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T624", "level": 0, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 2, "end": 1474408799999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "startDate": "19/09/2016", "endDate": "19/09/2016", "lastModified": 1474279210280, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "canAddIssue": true, "hasChild": true}, + {"id": "tmp_fk1474292364588", "name": "a", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false}, + {"id": "tmp_fk1474292366844", "name": "b", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_WAITING", "depends": "2", "canWrite": true, "start": 1474322400000, "duration": 1, "end": 1474408799999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false}, + {"id": "tmp_fk1474292368291", "name": "c", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_WAITING", "depends": "2", "canWrite": true, "start": 1474322400000, "duration": 1, "end": 1474408799999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false} + ], + prepareTest: function () { + //apro il selettore stati e clicco su done + ge.tasks[1].rowElement.find(".taskStatus").click().oneTime(100, "setStat", function () {$(this).next().find("[status=STATUS_DONE]").click()}); + }, + assertOk: function () { + //"a" devere andare in completato + return ge.tasks[1].status == "STATUS_DONE" && ge.tasks[2].status == "STATUS_ACTIVE" && ge.tasks[3].status == "STATUS_ACTIVE"; + } +}); + + +// 8 ------------------------------------------------------------------------------------ +ganttTestUnits.push({name: "Tree tutto undefined, apro la root: A open B,C waiting", + tasks: [ + {"id": "624", "name": "test", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T624", "level": 0, "status": "STATUS_UNDEFINED", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 3, "end": 1474495199999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "startDate": "19/09/2016", "endDate": "19/09/2016", "lastModified": 1474279210280, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "canAddIssue": true, "hasChild": true}, + {"id": "tmp_fk1474292364588", "name": "a", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_UNDEFINED", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false}, + {"id": "tmp_fk1474292366844", "name": "b", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_UNDEFINED", "depends": "2", "canWrite": true, "start": 1474322400000, "duration": 1, "end": 1474408799999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false}, + {"id": "tmp_fk1474292368291", "name": "c", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_UNDEFINED", "depends": "3", "canWrite": true, "start": 1474408800000, "duration": 1, "end": 1474495199999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false} + ], + prepareTest: function () { + //apro il selettore stati e clicco su done + ge.tasks[0].rowElement.find(".taskStatus").click().oneTime(100, "setStat", function () {$(this).next().find("[status=STATUS_ACTIVE]").click()}); + }, + assertOk: function () { + //"a" devere andare in completato + return ge.tasks[0].status == "STATUS_ACTIVE" && ge.tasks[1].status == "STATUS_ACTIVE" && ge.tasks[2].status == "STATUS_WAITING" && ge.tasks[3].status == "STATUS_WAITING"; + } +}); + + +// 9 ------------------------------------------------------------------------------------ +ganttTestUnits.push({name: "Caso Cabassi passo 1: c dipende da a, c1 dipende da b1: si deve poter chiudere b1", + tasks: [ + {"id": "624", "name": "test", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T624", "level": 0, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 4, "end": 1474581599999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "startDate": "19/09/2016", "endDate": "19/09/2016", "lastModified": 1474279210280, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "canAddIssue": true, "hasChild": true}, + {"id": "tmp_fk1474293219659", "name": "a", "progress": 100, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false}, + {"id": "tmp_fk1474293221523", "name": "b", "progress": 100, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": true}, + {"id": "tmp_1474293309413", "name": "b1", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 2, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false}, + {"id": "tmp_fk1474293224322", "name": "c", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_WAITING", "depends": "2", "canWrite": true, "start": 1474322400000, "duration": 2, "end": 1474495199999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": true}, + {"id": "tmp_fk1474293224858", "name": "c1", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 2, "status": "STATUS_WAITING", "depends": "4", "canWrite": true, "start": 1474322400000, "duration": 1, "end": 1474408799999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false} + ], + prepareTest: function () { + //apro il selettore stati e clicco su done + ge.tasks[3].rowElement.find(".taskStatus").click().oneTime(100, "setStat", function () {$(this).next().find("[status=STATUS_DONE]").click()}); + }, + assertOk: function () { + //"b1" devere andare in completato c e c1 in waiting + return ge.tasks[3].status == "STATUS_DONE" && ge.tasks[4].status == "STATUS_WAITING" && ge.tasks[5].status == "STATUS_WAITING"; + } +}); + + +// 10 -------------------------------------------------------------------------------------------------------------- +ganttTestUnits.push({name: "Caso Cabassi passo 2: c dipende da a, c1 dipende da b1: chiudendo a c e c1 divengono attivi", + prepareTest: function () { + //apro il selettore stati e clicco su done + ge.tasks[1].rowElement.find(".taskStatus").click().oneTime(100, "setStat", function () {$(this).next().find("[status=STATUS_DONE]").click()}); + }, + assertOk: function () { + //a done, c,c1 attivi + return ge.tasks[1].status == "STATUS_DONE" && ge.tasks[4].status == "STATUS_ACTIVE" && ge.tasks[5].status == "STATUS_ACTIVE"; + } +}); + + +// 11 -------------------------------------------------------------------------------------------------------------- +ganttTestUnits.push({name: "Caso Cabassi passo 3: Fallisco predecessore, dip e figli falliscono. a->failed: c,c1->failed", + prepareTest: function () { + //apro il selettore stati e clicco su done + ge.tasks[1].rowElement.find(".taskStatus").click().oneTime(100, "setStat", function () {$(this).next().find("[status=STATUS_FAILED]").click()}); + }, + assertOk: function () { + //a done, c,c1 attivi + return ge.tasks[1].status == "STATUS_FAILED" && ge.tasks[4].status == "STATUS_FAILED" && ge.tasks[5].status == "STATUS_FAILED"; + } +}); + + +// 12 ------------------------------------------------------------------------------------ +ganttTestUnits.push({name: "Test durate: indenta b(2gg) sotto a(1gg): root -> 3gg, a->2gg, c prende la stessa fine di b", + tasks: [ + {"id": "624", "name": "test", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T624", "level": 0, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 2, "end": 1474408799999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "startDate": "19/09/2016", "endDate": "19/09/2016", "lastModified": 1474279210280, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "canAddIssue": true, "hasChild": true}, + {"id": "tmp_fk1474296996877", "name": "a", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false}, + {"id": "tmp_fk1474297003163", "name": "b", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 2, "end": 1474408799999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false}, + {"id": "tmp_fk1474297024666", "name": "c", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_WAITING", "depends": "2", "canWrite": true, "start": 1474322400000, "duration": 1, "end": 1474408799999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false} + ], + prepareTest: function () { + //indento b + ge.currentTask = ge.tasks[2]; + ge.indentCurrentTask(); + }, + assertOk: function () { + //root -> 3gg, a->2gg, c prende la stessa fine di b + return ge.tasks[0].duration == 3 && ge.tasks[1].duration == 2 && getDistanceInUnits(new Date(ge.tasks[2].start),new Date(ge.tasks[3].start)) == 2; + } +}); + + +// 13 ------------------------------------------------------------------------------------ +ganttTestUnits.push({name: "Loop indentando b1 sotto b: candidato figlio con dip che coinvolgono il futuro padre. Deve rimuovere la dip da b1 ad a", + tasks: [ + {"id":"745", "name": "test loop", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T745", "level": 0, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1476136800000, "duration": 6, "end": 1476827999999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "startDate": "11/10/2016", "endDate": "18/10/2016", "lastModified": 1476259070239, "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "canAddIssue": true, "hasChild": true}, + {"id": "tmp1", "name": "a", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T745.01.02", "level": 1, "status": "STATUS_WAITING", "depends": "4", "canWrite": true, "start": 1476655200000, "duration": 1, "end": 1476741599999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#F79136", "startDate": "17/10/2016", "endDate": "17/10/2016", "lastModified": 1476259070261, "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "parentId": "746", "canAddIssue": true, "hasChild": false}, + {"id": "tmp2", "name": "b", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T745.02", "level": 1, "status": "STATUS_WAITING", "depends": "2", "canWrite": true, "start": 1476741600000, "duration": 1, "end": 1476827999999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#F79136", "startDate": "18/10/2016", "endDate": "18/10/2016", "lastModified": 1476259070268, "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "parentId": "745", "canAddIssue": true, "hasChild": false}, + {"id": "tmp3", "name": "b1", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T745.03", "level": 1, "status": "STATUS_WAITING", "depends": "", "canWrite": true, "start": 1476396000000, "duration": 1, "end": 1476482399999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#F79136", "startDate": "14/10/2016", "endDate": "14/10/2016", "lastModified": 1476259070275, "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "parentId": "745", "canAddIssue": true, "hasChild": false} + ], + prepareTest: function () { + //indento b + ge.currentTask = ge.tasks[3]; + ge.indentCurrentTask(); + }, + assertOk: function () { + //deve aver indentato b1, ma rimosso le dip + return ge.tasks[3].level == 2 && ge.tasks[1].depends==""; + } +}); + +// 14 ------------------------------------------------------------------------------------ +ganttTestUnits.push({name: "Cambio le dipendenze di C mettendo lag -> A e B devono restare chiusi", + tasks: [ + {"id": "844", "name": "altro test", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T844", "level": 0, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1477346400000, "duration": 5, "end": 1477954799999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "startDate": "25/10/2016", "endDate": "31/10/2016", "lastModified": 1477385116247, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "canAddIssue": true, "hasChild": true}, + {"id": "tmp1", "name": "A", "progress": 100, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T844.01", "level": 1, "status": "STATUS_DONE", "depends": "", "canWrite": true, "start": 1477346400000, "duration": 1, "end": 1477432799999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#6EBEF4", "startDate": "25/10/2016", "endDate": "25/10/2016", "lastModified": 1477385116257, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "parentId": "844", "canAddIssue": true, "hasChild": false}, + {"id": "tmp2", "name": "B", "progress": 100, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T844.02", "level": 1, "status": "STATUS_DONE", "depends": "2", "canWrite": true, "start": 1477432800000, "duration": 1, "end": 1477519199999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#6EBEF4", "startDate": "26/10/2016", "endDate": "26/10/2016", "lastModified": 1477385116263, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "parentId": "844", "canAddIssue": true, "hasChild": false}, + {"id": "tmp3", "name": "C", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T844.03", "level": 1, "status": "STATUS_ACTIVE", "depends": "2", "canWrite": true, "start": 1477432800000, "duration": 1, "end": 1477519199999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "startDate": "26/10/2016", "endDate": "26/10/2016", "lastModified": 1477385116273, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "parentId": "844", "canAddIssue": true, "hasChild": false} + ], + prepareTest: function () { + //indento b + ge.tasks[3].rowElement.find("[name=depends]").val("2:1").blur(); + }, + assertOk: function () { + //deve aver lasciato A e B chiusi + return ge.tasks[1].status=="STATUS_DONE" && ge.tasks[2].status=="STATUS_DONE"; + } +}); + + + +// 15 ------------------------------------------------------------------------------------ +ganttTestUnits.push({name: "Pan/Move nel caso di un figlio F con dipendenze ad uno 'zio' Z. Sposto avanti R -> P mantiene la durata", + tasks: [ + {"id": "1134", "name": "Root", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T1134", "level": 0, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1480374000000, "duration": 2, "end": 1480546799999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "startDate": "01/12/2016", "endDate": "01/12/2016", "lastModified": 1480593817093, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "canAddIssue": true, "hasChild": true, "unchanged": false}, + {"id": "tmp1", "name": "Z", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1480374000000, "duration": 1, "end": 1480460399999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false}, + {"id": "tmp2", "name": "P", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1480374000000, "duration": 2, "end": 1480546799999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": true}, + {"id": "tmp3", "name": "F", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 2, "status": "STATUS_WAITING", "depends": "2", "canWrite": true, "start": 1480460400000, "duration": 1, "end": 1480546799999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false} + ], + +prepareTest: function () { + ge.shrinkParent=false; + //Sposto R + var r=ge.tasks[0]; + var d=Date.parseString(r.rowElement.find("[name=start]").val()); + d=incrementDateByUnits(d,1); + r.rowElement.find("[name=start]").val(d.format()).blur(); +}, +assertOk: function () { + //deve aver lasciato A e B chiusi + return ge.tasks[0].duration==2 && ge.tasks[2].duration==2; +} +}); + + +// 16 ------------------------------------------------------------------------------------ +ganttTestUnits.push({name: "Cambia la durata da 1 a 3 giorni: devono essere davvero tre giorni", + tasks: [ + {"id": "624", "name": "test", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T624", "level": 0, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "startDate": "19/09/2016", "endDate": "19/09/2016", "lastModified": 1474279210280, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "canAddIssue": true, "hasChild": true}, + ], + prepareTest: function () { + ge.tasks[0].rowElement.find("[name=duration]").val(3).blur(); + }, + assertOk: function () { + //la distanza deve essere 3 + var distanceInUnits = getDurationInUnits(new Date(ge.tasks[0].start), new Date(ge.tasks[0].end)); + //console.debug("Test 16: distanceInUnits="+distanceInUnits); + return distanceInUnits == 3; + } +}); + +// 17 ------------------------------------------------------------------------------------ +ganttTestUnits.push({name: "End is milestone: cambia la durata da 1 a 3 giorni: start deve andare indietro di 2 giorni, end non si deve muovere", + tasks: [ + {"id": "624", "name": "test", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T624", "level": 0, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1474236000000, "duration": 1, "end": 1474322399999, "startIsMilestone": false, "endIsMilestone": true, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "startDate": "19/09/2016", "endDate": "19/09/2016", "lastModified": 1474279210280, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "canAddIssue": true, "hasChild": true}, + ], + prepareTest: function () { + this.oldStart=new Date(ge.tasks[0].start); + this.oldEnd=new Date(ge.tasks[0].end); + ge.tasks[0].rowElement.find("[name=duration]").val(3).blur(); + }, + assertOk: function () { + var self=this; + var newStart=new Date(ge.tasks[0].start); + var newEnd=new Date(ge.tasks[0].end); + + var startCh = getDistanceInUnits(newStart,this.oldStart); + return startCh == 2 && newEnd.equals(this.oldEnd); + } +}); + + +// 18 -------------------------------------------------------------------------------------------------------------- +ganttTestUnits.push({name: "Passo 1: Sospende P Sospende F", + tasks: [ + {"id": "616", "name": "test", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "GTU", "level": 0, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1473976800000, "duration": 3, "end": 1474408799999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "startDate": "16/09/2016", "endDate": "20/09/2016", "lastModified": 1474028638447, "lastModifier": "System Manager", "totalIssues": 0, "openIssues": 0, "budget": 0, "totalCosts": 0, "totalWorklog": 0, "totalEstimated": 0, "canAddIssue": true, "hasChild": true}, + {"id": "tmp_fk1474274262872", "name": "P", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 1, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1473976800000, "duration": 1, "end": 1474063199999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": true}, + {"id": "tmp_fk1474274277068", "name": "F", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "", "level": 2, "status": "STATUS_ACTIVE", "depends": "", "canWrite": true, "start": 1473976800000, "duration": 1, "end": 1474063199999, "startIsMilestone": false, "endIsMilestone": false, "assigs": [], "hasChild": false} + ], + prepareTest: function () { + //apro il selettore stati e chiudo il task + ge.tasks[1].rowElement.find(".taskStatus").click().oneTime(100, "setStat", function () {$(this).next().find("[status=STATUS_SUSPENDED]").click()}); + + }, + assertOk: function () { + var ret = ge.tasks[1].status == "STATUS_SUSPENDED" && ge.tasks[2].status == "STATUS_SUSPENDED"; + return ret; + } +}); + +// 19 -------------------------------------------------------------------------------------------------------------- +ganttTestUnits.push({name: "Sposto il padre di 1 gg. Passo 1 avanti: padre stessa durata, figlio 1 stessa data del padre ", + tasks: [ + {"id": "tmp_1", "name": "p", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T3547", "level": 0, "status": "STATUS_ACTIVE", "depends": "", "start": 1512946800000, "duration": 2, "end": 1513119599999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "canWrite": true, "canAdd": true, "canDelete": true, "canAddIssue": true, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "tags": "", "color": "", "typeCode": "", "startDate": "11/12/2017", "endDate": "12/12/2017", "totalWorklog": 0, "totalEstimated": 0, "totalEstimatedFromIssues": 0, "totalIssues": 0, "openIssues": 0, "lastModified": 1512984195515, "lastModifier": "System Manager", "budget": 0, "totalCosts": 0}, + {"id": "tmp_2", "name": "a", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T3547.01", "level": 1, "status": "STATUS_ACTIVE", "depends": "", "start": 1512946800000, "duration": 1, "end": 1513033199999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "canWrite": true, "canAdd": true, "canDelete": true, "canAddIssue": true, "assigs": [], "loadComplete": false, "statusColor": "#3BBF67", "color": "", "typeCode": "", "startDate": "11/12/2017", "endDate": "11/12/2017", "totalWorklog": 0, "totalEstimated": 0, "totalEstimatedFromIssues": 0, "totalIssues": 0, "openIssues": 0, "lastModified": 1512984195646, "lastModifier": "System Manager", "parentId": "3547", "budget": 0, "totalCosts": 0}, + {"id": "tmp_3", "name": "b", "progress": 0, "progressByWorklog": false, "relevance": 0, "type": "", "typeId": "", "description": "", "code": "T3547.02", "level": 1, "status": "STATUS_WAITING", "depends": "2", "start": 1513033200000, "duration": 1, "end": 1513119599999, "startIsMilestone": false, "endIsMilestone": false, "collapsed": false, "canWrite": true, "canAdd": true, "canDelete": true, "canAddIssue": true, "assigs": [], "loadComplete": false, "statusColor": "#F79136", "color": "", "typeCode": "", "startDate": "12/12/2017", "endDate": "12/12/2017", "totalWorklog": 0, "totalEstimated": 0, "totalEstimatedFromIssues": 0, "totalIssues": 0, "openIssues": 0, "lastModified": 1512984195682, "lastModifier": "System Manager", "parentId": "3547", "budget": 0, "totalCosts": 0} + ], + prepareTest: function () { + ge.tasks[0].rowElement.find("[name=start]").val("12/12/2017").trigger("blur"); + + }, + assertOk: function () { + var ret = ge.tasks[0].rowElement.find("[name=duration]").val() == 2 && ge.tasks[1].rowElement.find("[name=start]").val()== "12/12/2017" ; + return ret; + } +}); + +// 20 -------------------------------------------------------------------------------------------------------------- +ganttTestUnits.push({name: "Sposto il padre di 1 gg. Passo 2 indietro: padre stessa durata, figlio 1 stessa data del padre ", + prepareTest: function () { + ge.tasks[0].rowElement.find("[name=start]").val("11/12/2017").trigger("blur"); + + }, + assertOk: function () { + var ret = ge.tasks[0].rowElement.find("[name=duration]").val() == 2 && ge.tasks[1].rowElement.find("[name=start]").val()== ge.tasks[0].rowElement.find("[name=start]").val() ; + return ret; + } +}); + +// 21 -------------------------------------------------------------------------------------------------------------- +ganttTestUnits.push({name: "Always shrink flag ON: accorciando la durata di un figlio da 2 a 1 il padre deve passare da 4 a 3", + tasks: [ + {"id":"tmp_1","name":"p","progress":0,"progressByWorklog":false,"relevance":0,"type":"","typeId":"","description":"","code":"T3547","level":0,"status":"STATUS_ACTIVE","depends":"","start":1512946800000,"duration":4,"end":1513292399999,"startIsMilestone":false,"endIsMilestone":false,"collapsed":false,"canWrite":true,"canAdd":true,"canDelete":true,"canAddIssue":true,"assigs":[],"loadComplete":false,"statusColor":"#3BBF67","tags":"","color":"","typeCode":"","totalWorklog":0,"totalEstimated":0,"totalEstimatedFromIssues":0,"totalIssues":0,"openIssues":0,"lastModified":1512984195515,"lastModifier":"System Manager","budget":0,"totalCosts":0}, + {"id":"tmp_2","name":"a","progress":0,"progressByWorklog":false,"relevance":0,"type":"","typeId":"","description":"","code":"T3547.01","level":1,"status":"STATUS_ACTIVE","depends":"","start":1512946800000,"duration":2,"end":1513119599999,"startIsMilestone":false,"endIsMilestone":false,"collapsed":false,"canWrite":true,"canAdd":true,"canDelete":true,"canAddIssue":true,"assigs":[],"loadComplete":false,"statusColor":"#3BBF67","color":"","typeCode":"","totalWorklog":0,"totalEstimated":0,"totalEstimatedFromIssues":0,"totalIssues":0,"openIssues":0,"lastModified":1512984195646,"lastModifier":"System Manager","parentId":"3547","budget":0,"totalCosts":0}, + {"id":"tmp_3","name":"b","progress":0,"progressByWorklog":false,"relevance":0,"type":"","typeId":"","description":"","code":"T3547.02","level":1,"status":"STATUS_WAITING","depends":"2","start":1513119600000,"duration":2,"end":1513292399999,"startIsMilestone":false,"endIsMilestone":false,"collapsed":false,"canWrite":true,"canAdd":true,"canDelete":true,"canAddIssue":true,"assigs":[],"loadComplete":false,"statusColor":"#F79136","color":"","typeCode":"","totalWorklog":0,"totalEstimated":0,"totalEstimatedFromIssues":0,"totalIssues":0,"openIssues":0,"lastModified":1512984195682,"lastModifier":"System Manager","parentId":"3547","budget":0,"totalCosts":0} + ], + prepareTest: function () { + ge.shrinkParent=true; + ge.tasks[1].rowElement.find("[name=duration]").val(1).trigger("blur"); + }, + assertOk: function () { + var ret = ge.tasks[0].rowElement.find("[name=duration]").val() == 3 ; + return ret; + } +}); + +// 22 -------------------------------------------------------------------------------------------------------------- +ganttTestUnits.push({name: "Always shrink flag OFF: accorciando la durata di un figlio da 2 a 1 il padre deve rimanere a 4", + tasks: [ + {"id":"tmp_1","name":"p","progress":0,"progressByWorklog":false,"relevance":0,"type":"","typeId":"","description":"","code":"T3547","level":0,"status":"STATUS_ACTIVE","depends":"","start":1512946800000,"duration":4,"end":1513292399999,"startIsMilestone":false,"endIsMilestone":false,"collapsed":false,"canWrite":true,"canAdd":true,"canDelete":true,"canAddIssue":true,"assigs":[],"loadComplete":false,"statusColor":"#3BBF67","tags":"","color":"","typeCode":"","totalWorklog":0,"totalEstimated":0,"totalEstimatedFromIssues":0,"totalIssues":0,"openIssues":0,"lastModified":1512984195515,"lastModifier":"System Manager","budget":0,"totalCosts":0}, + {"id":"tmp_2","name":"a","progress":0,"progressByWorklog":false,"relevance":0,"type":"","typeId":"","description":"","code":"T3547.01","level":1,"status":"STATUS_ACTIVE","depends":"","start":1512946800000,"duration":2,"end":1513119599999,"startIsMilestone":false,"endIsMilestone":false,"collapsed":false,"canWrite":true,"canAdd":true,"canDelete":true,"canAddIssue":true,"assigs":[],"loadComplete":false,"statusColor":"#3BBF67","color":"","typeCode":"","totalWorklog":0,"totalEstimated":0,"totalEstimatedFromIssues":0,"totalIssues":0,"openIssues":0,"lastModified":1512984195646,"lastModifier":"System Manager","parentId":"3547","budget":0,"totalCosts":0}, + {"id":"tmp_3","name":"b","progress":0,"progressByWorklog":false,"relevance":0,"type":"","typeId":"","description":"","code":"T3547.02","level":1,"status":"STATUS_WAITING","depends":"2","start":1513119600000,"duration":2,"end":1513292399999,"startIsMilestone":false,"endIsMilestone":false,"collapsed":false,"canWrite":true,"canAdd":true,"canDelete":true,"canAddIssue":true,"assigs":[],"loadComplete":false,"statusColor":"#F79136","color":"","typeCode":"","totalWorklog":0,"totalEstimated":0,"totalEstimatedFromIssues":0,"totalIssues":0,"openIssues":0,"lastModified":1512984195682,"lastModifier":"System Manager","parentId":"3547","budget":0,"totalCosts":0} + ], + prepareTest: function () { + ge.shrinkParent=false; + ge.tasks[1].rowElement.find("[name=duration]").val(1).trigger("blur"); + }, + assertOk: function () { + var ret = ge.tasks[0].rowElement.find("[name=duration]").val() == 4 ; + return ret; + } +}); + + + + +//ganttTestUnits=ganttTestUnits.slice(0,2) +//ganttTestUnits=[ganttTestUnits[21]] + +// esegue sono ultimo test +//ganttTestUnits = [ganttTestUnits[ganttTestUnits.length - 1]] diff --git a/jQueryGantt/jQueryGantt/ganttUtilities.js b/jQueryGantt/jQueryGantt/ganttUtilities.js new file mode 100644 index 0000000000000000000000000000000000000000..6bc92b278ed216e99e966ac3f0c91c7746d8d9e9 --- /dev/null +++ b/jQueryGantt/jQueryGantt/ganttUtilities.js @@ -0,0 +1,597 @@ +/* + Copyright (c) 2012-2018 Open Lab + Written by Roberto Bicchierai and Silvia Chelazzi http://roberto.open-lab.com + 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. + */ + +$.gridify = function (table, opt) { + var options = { + resizeZoneWidth: 10 + }; + + $.extend(options, opt); + + var box = $("
").addClass("gdfWrapper"); + box.append(table); + + var head = table.clone(); + head.addClass("table ganttFixHead"); + //remove non head + head.find("tbody").remove(); + box.append(head); + + box.append(table); + + var hTh = head.find(".gdfColHeader"); + var cTh = table.find(".gdfColHeader"); + for (var i = 0; i < hTh.length; i++) { + hTh.eq(i).data("fTh", cTh.eq(i)); + } + + //--------- set table to 0 to prevent a strange 100% + table.width(0); + head.width(0); + + + //---------------------- header management start + head.find("th.gdfColHeader:not(.gdfied)").mouseover(function () { + $(this).addClass("gdfColHeaderOver"); + + }).on("mouseout.gdf", function () { + $(this).removeClass("gdfColHeaderOver"); + if (!$.gridify.columInResize) { + $("body").removeClass("gdfHResizing"); + } + + }).on("mousemove.gdf", function (e) { + if (!$.gridify.columInResize) { + var colHeader = $(this); + var nextCol = colHeader.next(); + if (nextCol.length > 0 && nextCol.width() < options.resizeZoneWidth) + colHeader = nextCol; + + if (!colHeader.is(".gdfResizable")) + return; + + var mousePos = e.pageX - colHeader.offset().left; + + if (colHeader.width() - mousePos < options.resizeZoneWidth) { + $("body").addClass("gdfHResizing"); + } else { + $("body").removeClass("gdfHResizing"); + } + } + + }).on("mousedown.gdf", function (e) { + //console.debug("mousedown.gdf") + var colHeader = $(this); + + var nextCol = colHeader.next(); + if (nextCol.length > 0 && nextCol.width() < options.resizeZoneWidth) + colHeader = nextCol; + + if (!colHeader.is(".gdfResizable")) + return; + + var mousePos = e.pageX - colHeader.offset().left; + if (colHeader.width() - mousePos < options.resizeZoneWidth) { + $("body").unselectable(); + $.gridify.columInResize = colHeader; + //on event for start resizing + $(document).on("mousemove.gdf", function (e) { + + e.preventDefault(); + $("body").addClass("gdfHResizing"); + + //manage resizing + var w = e.pageX - $.gridify.columInResize.offset().left; + w = w <= 1 ? 1 : w; + $.gridify.columInResize.width(w); + $.gridify.columInResize.data("fTh").width(w); + + + //on mouse up on body to stop resizing + }).on("mouseup.gdf", function () { + //console.debug("mouseup.gdf") + $(this).off("mousemove.gdf").off("mouseup.gdf").clearUnselectable(); + $("body").removeClass("gdfHResizing"); + delete $.gridify.columInResize; + + //save columns dimension + storeGridState(); + + }); + } + + }).on("dblclick.gdf", function () { + //console.debug("dblclick.gdf") + var col = $(this); + + if (!col.is(".gdfResizable")) + return; + + var idx = $("th", col.parents("table")).index(col); + var columnTd = $("td:nth-child(" + (idx + 1) + ")", table); + var w = 0; + columnTd.each(function () { + var td = $(this); + var content = td.children("input").length ? td.children("input").val() : td.html(); + var tmp = $("
").addClass("columnWidthTest").html(content).css({position: "absolute"}); + $("body").append(tmp); + w = Math.max(w, tmp.width() + parseFloat(td.css("padding-left"))); + tmp.remove(); + }); + + w = w + 5; + col.width(w); + col.data("fTh").width(w); + + //save columns dimension + storeGridState(); + return false; + + }).addClass("gdfied unselectable").attr("unselectable", "true"); + + + function storeGridState() { + //console.debug("storeGridState"); + if (localStorage) { + var gridState = {}; + + var colSizes = []; + $(".gdfTable .gdfColHeader").each(function () { + colSizes.push($(this).outerWidth()); + }); + + gridState.colSizes = colSizes; + + localStorage.setObject("TWPGanttGridState2", gridState); + } + } + + function loadGridState() { + //console.debug("loadGridState") + if (localStorage) { + if (localStorage.getObject("TWPGanttGridState2")) { + var gridState = localStorage.getObject("TWPGanttGridState2"); + if (gridState.colSizes) { + box.find(".gdfTable .gdfColHeader").each(function (i) { + $(this).width(gridState.colSizes[i]); + }); + } + } + } + } + + loadGridState(); + return box; +}; + + + + +$.splittify = { + init: function (where, first, second, perc) { + + //perc = perc || 50; + + var element = $("
").addClass("splitterContainer"); + var firstBox = $("
").addClass("splitElement splitBox1"); + var splitterBar = $("
").addClass("splitElement vSplitBar").attr("unselectable", "on").css("padding-top", where.height() / 2 + "px"); + var secondBox = $("
").addClass("splitElement splitBox2"); + + + var splitter = new Splitter(element, firstBox, secondBox, splitterBar); + splitter.perc = perc; + + //override with saved one + loadPosition(); + + var toLeft = $("
").addClass("toLeft").html("{").click(function () {splitter.resize(0.001, 300);}); + splitterBar.append(toLeft); + + var toCenter = $("
").addClass("toCenter").html("©").click(function () {splitter.resize(50, 300);}); + splitterBar.append(toCenter); + + var toRight = $("
").addClass("toRight").html("}").click(function () {splitter.resize(99.9999, 300);}); + splitterBar.append(toRight); + + + firstBox.append(first); + secondBox.append(second); + + element.append(firstBox).append(secondBox).append(splitterBar); + + where.append(element); + + var totalW = where.innerWidth(); + var splW = splitterBar.width(); + var fbw = totalW * perc / 100 - splW; + fbw = fbw > totalW - splW - splitter.secondBoxMinWidth ? totalW - splW - splitter.secondBoxMinWidth : fbw; + firstBox.width(fbw).css({left: 0}); + splitterBar.css({left: firstBox.width()}); + secondBox.width(totalW - fbw - splW).css({left: firstBox.width() + splW}); + + splitterBar.on("mousedown.gdf", function (e) { + + e.preventDefault(); + $("body").addClass("gdfHResizing"); + + $.splittify.splitterBar = $(this); + //on event for start resizing + //console.debug("start splitting"); + $("body").unselectable().on("mousemove.gdf", function (e) { + //manage resizing + e.preventDefault(); + + var sb = $.splittify.splitterBar; + var pos = e.pageX - sb.parent().offset().left; + var w = sb.parent().width(); + var fbw = firstBox; + + pos = pos > splitter.firstBoxMinWidth ? pos : splitter.firstBoxMinWidth; + //pos = pos < realW - 10 ? pos : realW - 10; + pos = pos > totalW - splW - splitter.secondBoxMinWidth ? totalW - splW - splitter.secondBoxMinWidth : pos; + sb.css({left: pos}); + firstBox.width(pos); + secondBox.css({left: pos + sb.width(), width: w - pos - sb.width()}); + splitter.perc = (firstBox.width() / splitter.element.width()) * 100; + + //on mouse up on body to stop resizing + }).on("mouseup.gdf", function () { + //console.debug("stop splitting"); + $(this).off("mousemove.gdf").off("mouseup.gdf").clearUnselectable(); + delete $.splittify.splitterBar; + + $("body").removeClass("gdfHResizing"); + + storePosition(); + }); + }); + + + // keep both side in synch when scroll + var stopScroll = false; + var fs = firstBox.add(secondBox); + var lastScrollTop=0; + fs.scroll(function (e) { + var el = $(this); + var top = el.scrollTop(); + + var firstBoxHeader = firstBox.find(".ganttFixHead"); + var secondBoxHeader = secondBox.find(".ganttFixHead"); + + if (el.is(".splitBox1") && stopScroll != "splitBox2") { + stopScroll = "splitBox1"; + secondBox.scrollTop(top); + } else if (el.is(".splitBox2") && stopScroll != "splitBox1") { + stopScroll = "splitBox2"; + firstBox.scrollTop(top); + } + + + if (Math.abs(top-lastScrollTop)>10) { + firstBoxHeader.css('top', top).hide(); + secondBoxHeader.css('top', top).hide(); + } + lastScrollTop=top; + + where.stopTime("reset").oneTime(100, "reset", function () { + + stopScroll = ""; + top = el.scrollTop(); + + firstBoxHeader.css('top', top).fadeIn(); + secondBoxHeader.css('top', top).fadeIn(); + + }); + + }); + + + firstBox.on('mousewheel MozMousePixelScroll', function (event) { + + event.preventDefault(); + + var deltaY = event.originalEvent.wheelDeltaY; + if (!deltaY) + deltaY = event.originalEvent.wheelDelta; + var deltaX = event.originalEvent.wheelDeltaX; + + if (event.originalEvent.axis) { + deltaY = event.originalEvent.axis == 2 ? -event.originalEvent.detail : null; + deltaX = event.originalEvent.axis == 1 ? -event.originalEvent.detail : null; + } + + deltaY = Math.abs(deltaY) < 40 ? 40 * (Math.abs(deltaY) / deltaY) : deltaY; + deltaX = Math.abs(deltaX) < 40 ? 40 * (Math.abs(deltaX) / deltaX) : deltaX; + + var scrollToY = secondBox.scrollTop() - deltaY; + var scrollToX = firstBox.scrollLeft() - deltaX; + +// console.debug( firstBox.scrollLeft(), Math.abs(deltaX), Math.abs(deltaY)); + + if (deltaY) secondBox.scrollTop(scrollToY); + if (deltaX) firstBox.scrollLeft(scrollToX); + + return false; + }); + + + function Splitter(element, firstBox, secondBox, splitterBar) { + this.element = element; + this.firstBox = firstBox; + this.secondBox = secondBox; + this.splitterBar = splitterBar; + this.perc = 0; + this.firstBoxMinWidth = 0; + this.secondBoxMinWidth = 30; + + this.resize = function (newPerc, anim) { + var animTime = anim ? anim : 0; + this.perc = newPerc ? newPerc : this.perc; + var totalW = this.element.width(); + var splW = this.splitterBar.width(); + var newW = totalW * this.perc / 100; + newW = newW > this.firstBoxMinWidth ? newW : this.firstBoxMinWidth; + newW = newW > totalW - splW - splitter.secondBoxMinWidth ? totalW - splW - splitter.secondBoxMinWidth : newW; + this.firstBox.animate({width: newW}, animTime, function () {$(this).css("overflow-x", "auto")}); + this.splitterBar.animate({left: newW}, animTime); + this.secondBox.animate({left: newW + this.splitterBar.width(), width: totalW - newW - splW}, animTime, function () {$(this).css("overflow", "auto")}); + + storePosition(); + }; + + var self = this; + this.splitterBar.on("dblclick", function () { + self.resize(50, true); + }) + } + + + function storePosition () { + //console.debug("storePosition",splitter.perc); + if (localStorage) { + localStorage.setItem("TWPGanttSplitPos",splitter.perc); + } + } + + function loadPosition () { + //console.debug("loadPosition"); + if (localStorage) { + if (localStorage.getItem("TWPGanttSplitPos")) { + splitter.perc=parseFloat(localStorage.getItem("TWPGanttSplitPos")); + } + } + } + + + + return splitter; + } + +}; + + +//<%------------------------------------------------------------------------ UTILITIES ---------------------------------------------------------------%> +// same dates returns 1 +function getDurationInUnits(start,end){ + return start.distanceInWorkingDays(end)+1; // working in days +} + +//con due date uguali ritorna 0: usata per cancolare la distanza effettiva tra due date +function getDistanceInUnits(date1,date2){ + return date1.distanceInWorkingDays(date2); // working in days +} + +function incrementDateByUnits(date,duration){ + date.incrementDateByWorkingDays(duration); // working in days + return date; +} + + +function computeStart(start) { + return computeStartDate(start).getTime(); +} + +/** + * @param start + * @returns {Date} the closes start date + */ +function computeStartDate(start) { + var d; + d = new Date(start + 3600000 * 12); + d.setHours(0, 0, 0, 0); + //move to next working day + while (isHoliday(d)) { + d.setDate(d.getDate() + 1); + } + d.setHours(0, 0, 0, 0); + return d; +} + +function computeEnd(end) { + return computeEndDate(end).getTime() +} + +/** + * @param end + * @returns {Date} the closest end date + */ +function computeEndDate(end) { + var d = new Date(end - 3600000 * 12); + d.setHours(23, 59, 59, 999); + //move to next working day + while (isHoliday(d)) { + d.setDate(d.getDate() + 1); + } + d.setHours(23, 59, 59, 999); + return d; +} + +function computeEndByDuration(start, duration) { +//console.debug("computeEndByDuration start ",d,duration) + var d = new Date(start); + var q = duration - 1; + while (q > 0) { + d.setDate(d.getDate() + 1); + if (!isHoliday(d)) + q--; + } + d.setHours(23, 59, 59, 999); + return d.getTime(); +} + + +function incrementDateByWorkingDays(date, days) { + var d = new Date(date); + d.incrementDateByWorkingDays(days); + return d.getTime(); +} + + +function recomputeDuration(start, end) { + //console.debug("recomputeDuration"); + return getDurationInUnits(new Date(start),new Date(end)); +} + +function resynchDates(leavingField, startField, startMilesField, durationField, endField, endMilesField) { + //console.debug("resynchDates",leavingField.prop("name"), "start. "+startField.val(),"durationField: "+ durationField.val(), "endField: "+endField.val()); + + function resynchDatesSetFields(command) { + //console.debug("resynchDatesSetFields",command); + var duration = stringToDuration(durationField.val()); + var start = computeStart(Date.parseString(startField.val()).getTime()); + + var end = endField.val(); + if (end.length > 0) { + end = Date.parseString(end); + end.setHours(23, 59, 59, 999); //this is necessary because compute end get the closest end, and parseString returns 00:00 + end = computeEnd(end.getTime()); + } + + var date = new Date(); + if ("CHANGE_END" == command) { + date.setTime(start); + var workingUnits = duration-1; // if we do not decremet a task lasting two days starting on 10 will end on 12 (at 00:00) instead of on (at 23:59) + incrementDateByUnits(date,workingUnits); + date.setHours(23, 59, 59, 999); //this is necessary because compute end get the closest end, and parseString returns 00:00 + end = computeEnd(date.getTime()); // not strictly necessary + } else if ("CHANGE_START" == command) { + date.setTime(end); + var workingUnits = duration - 1; // if we do not decremet a task lasting two days starting on 10 will end on 12 (at 00:00) instead of on (at 23:59) + incrementDateByUnits(date,-workingUnits); + date.setHours(0, 0, 0, 0); //this is necessary because decreasing end we are at 23:50 + start = computeStart(date.getTime()); //not strictly necessary + } else if ("CHANGE_DURATION" == command) { + duration = getDurationInUnits(new Date(start),new Date(end)) + 1; + } + + startField.val(new Date(start).format()); + endField.val(new Date(end).format()); + durationField.val(durationToString(duration)); + + return {start: start, end: end, duration: duration}; + } + + var leavingFieldName = leavingField.prop("name"); + var durIsFilled = durationField.val().length > 0; + var startIsFilled = startField.val().length > 0; + var endIsFilled = endField.val().length > 0; + var startIsMilesAndFilled = startIsFilled && (startMilesField.prop("checked") || startField.is("[readOnly]")); + var endIsMilesAndFilled = endIsFilled && (endMilesField.prop("checked") || endField.is("[readOnly]")); + + if (durIsFilled) { + durationField.val(durationToString(stringToDuration(durationField.val()))); + } + + if (leavingFieldName.indexOf("Milestone") > 0) { + if (startIsMilesAndFilled && endIsMilesAndFilled) { + durationField.prop("readOnly", true); + } else { + durationField.prop("readOnly", false); + } + return; + } + + //need at least two values to resynch the third + if ((durIsFilled ? 1 : 0) + (startIsFilled ? 1 : 0) + (endIsFilled ? 1 : 0) < 2) + return; + + var ret; + if (leavingFieldName == 'start' && startIsFilled) { + if (endIsMilesAndFilled && durIsFilled) { + ret = resynchDatesSetFields("CHANGE_DURATION"); + } else if (durIsFilled) { + ret = resynchDatesSetFields("CHANGE_END"); + } + + } else if (leavingFieldName == 'duration' && durIsFilled && !(endIsMilesAndFilled && startIsMilesAndFilled)) { + if (endIsMilesAndFilled && !startIsMilesAndFilled) { + ret = resynchDatesSetFields("CHANGE_START"); + } else if (!endIsMilesAndFilled) { + //document.title=('go and change end!!'); + ret = resynchDatesSetFields("CHANGE_END"); + } + + } else if (leavingFieldName == 'end' && endIsFilled) { + ret = resynchDatesSetFields("CHANGE_DURATION"); + } + return ret; +} + + +//This prototype is provided by the Mozilla foundation and +//is distributed under the MIT license. +//http://www.ibiblio.org/pub/Linux/LICENSES/mit.license + +if (!Array.prototype.filter) { + Array.prototype.filter = function (fun) { + var len = this.length; + if (typeof fun != "function") + throw new TypeError(); + + var res = new Array(); + var thisp = arguments[1]; + for (var i = 0; i < len; i++) { + if (i in this) { + var val = this[i]; // in case fun mutates this + if (fun.call(thisp, val, i, this)) + res.push(val); + } + } + return res; + }; +} + +function durationToString(d) { + return d; +} + +function stringToDuration(durStr) { + var duration = NaN; + duration = daysFromString(durStr, true) || 1; + return duration; +} + +function goToPage(url) { + if (!canILeave()) return; + window.location.href = url; +} diff --git a/jQueryGantt/jQueryGantt/ganttZoom.js b/jQueryGantt/jQueryGantt/ganttZoom.js new file mode 100644 index 0000000000000000000000000000000000000000..b18f960953f80860c194ebd43659c592dcac992c --- /dev/null +++ b/jQueryGantt/jQueryGantt/ganttZoom.js @@ -0,0 +1,258 @@ +/* + Copyright (c) 2012-2018 Open Lab + Written by Roberto Bicchierai and Silvia Chelazzi http://roberto.open-lab.com + 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. + +*/ + + Ganttalendar.prototype.initZoomlevels = function () { + //console.debug("Ganttalendar.prototype.initZoomlevels"); + + var self = this; + + // define the zoom level arrays + this.zoomLevels = []; + this.zoomDrawers = {}; + + + function _addZoom(zoom,zoomDrawer){ + self.zoomLevels.push(zoom); + self.zoomDrawers[zoom] = zoomDrawer; + + //compute the scale + self.zoomDrawers[zoom].computedScaleX=600/millisFromString(zoom); + } + + + //----------------------------- 3 DAYS 600px----------------------------- + _addZoom("3d", { + adjustDates: function (start, end) { + start.setFirstDayOfThisWeek(); + end.setFirstDayOfThisWeek(); + end.setDate(end.getDate() + 6); + }, + row1: function (date, ctxHead) { + var start = new Date(date.getTime()); + date.setDate(date.getDate() + 6); + self.createHeadCell(1,this,ctxHead,start.format("yyyy 年 MMM d") + " - " + date.format("MMM d")+ " ("+start.format("w")+"周)",7,"", start,date); + date.setDate(date.getDate() + 1); + }, + row2: function (date, ctxHead, ctxBody) { + var start = new Date(date.getTime()); + date.setDate(date.getDate() + 1); + var holyClass = isHoliday(start) ? "holy" : ""; + self.createHeadCell(2,this,ctxHead,start.format("EEE d"), 1, "headSmall "+holyClass, start,date); + self.createBodyCell(this,ctxBody,1, start.getDay() % 7 == (self.master.firstDayOfWeek + 6) % 7, holyClass); + } + }); + + + + //----------------------------- 1 WEEK 600px ----------------------------- + _addZoom("1w", { + adjustDates: function (start, end) { + //reset day of week + start.setFirstDayOfThisWeek(); + start.setDate(start.getDate() - 7); + end.setFirstDayOfThisWeek(); + end.setDate(end.getDate() + 13); + }, + row1: function (date, ctxHead) { + var start = new Date(date.getTime()); + date.setDate(date.getDate() + 6); + self.createHeadCell(1,this,ctxHead,start.format("yyyy 年 MMM d") + " - " + date.format("MMM d ")+" (" + GanttMaster.messages["GANTT_WEEK_SHORT"]+date.format("w")+"周)", 7,"",start,date); + date.setDate(date.getDate() + 1); + }, + row2: function (date, ctxHead, ctxBody) { + var start = new Date(date.getTime()); + date.setDate(date.getDate() + 1); + var holyClass = isHoliday(start) ? "holy" : ""; + self.createHeadCell(2,this,ctxHead,start.format("EEEE").substr(0, 1)+" ("+start.format("dd")+")", 1, "headSmall "+holyClass, start,date); + self.createBodyCell(this,ctxBody,1, start.getDay() % 7 == (self.master.firstDayOfWeek + 6) % 7, holyClass); + } + }); + + + //----------------------------- 2 WEEKS 600px ----------------------------- + _addZoom( "2w",{ + adjustDates: function (start, end) { + start.setFirstDayOfThisWeek(); + start.setDate(start.getDate() - 7); + end.setFirstDayOfThisWeek(); + end.setDate(end.getDate() + 20); + }, + row1: function (date, tr1) { + var start = new Date(date.getTime()); + date.setDate(date.getDate() + 6); + self.createHeadCell(1,this,tr1,start.format("yyyy 年 MMM d") + " - " + date.format("MMM d")+" (" + GanttMaster.messages["GANTT_WEEK_SHORT"]+date.format("w")+"周)", 7,"",start,date); + date.setDate(date.getDate() + 1); + }, + row2: function (date, tr2, trBody) { + var start = new Date(date.getTime()); + date.setDate(date.getDate() + 1); + var holyClass = isHoliday(start) ? "holy" : ""; + self.createHeadCell(2,this,tr2,start.format("EEEE").substr(0, 1), 1, "headSmall "+holyClass, start,date); + self.createBodyCell(this,trBody,1, start.getDay() % 7 == (self.master.firstDayOfWeek + 6) % 7, holyClass); + } + }); + + + //----------------------------- 1 MONTH 600px ----------------------------- + _addZoom( "1M",{ + adjustDates: function (start, end) { + start.setMonth(start.getMonth()-1); + start.setDate(15); + end.setDate(1); + end.setMonth(end.getMonth() + 1); + end.setDate(end.getDate() + 14); + }, + row1: function (date, tr1) { + var start = new Date(date.getTime()); + date.setDate(1); + date.setMonth(date.getMonth() + 1); + date.setDate(date.getDate() - 1); + var inc=date.getDate()-start.getDate()+1; + date.setDate(date.getDate() + 1); + self.createHeadCell(1,this,tr1,start.format("yyyy 年 MMM"), inc,"",start,date); //spans mumber of dayn in the month + }, + row2: function (date, tr2, trBody) { + var start = new Date(date.getTime()); + date.setDate(date.getDate() + 1); + var holyClass = isHoliday(start) ? "holy" : ""; + self.createHeadCell(2,this,tr2,start.format("d"), 1, "headSmall "+holyClass, start,date); + var nd = new Date(start.getTime()); + nd.setDate(start.getDate() + 1); + self.createBodyCell(this,trBody,1, nd.getDate() == 1, holyClass); + } + }); + + + + //----------------------------- 1 QUARTERS ----------------------------- + _addZoom( "1Q", { + adjustDates: function (start, end) { + start.setDate(1); + start.setMonth(Math.floor(start.getMonth() / 3) * 3 -1 ); + end.setDate(1); + end.setMonth(Math.floor(end.getMonth() / 3) * 3 + 4); + end.setDate(end.getDate() - 1); + }, + row1: function (date, tr1) { + var start = new Date(date.getTime()); + date.setMonth(Math.floor(date.getMonth() / 3) * 3 + 3); + var inc=(date.getMonth()-start.getMonth()); + inc=inc>0?inc:1; + var q = (Math.floor(start.getMonth() / 3) + 1); + self.createHeadCell(1,this,tr1,start.format("yyyy")+"年 第"+q+"季度 ", inc,"",start,date); + }, + row2: function (date, tr2, trBody) { + var start = new Date(date.getTime()); + date.setMonth(date.getMonth() + 1); + self.createHeadCell(2,this,tr2,start.format("MMMM"), 1, "headSmall", start,date); + self.createBodyCell(this,trBody,1, start.getMonth() % 3 == 2); + } + }); + + + //----------------------------- 2 QUARTERS ----------------------------- + _addZoom( "2Q", { + adjustDates: function (start, end) { + start.setDate(1); + start.setMonth(Math.floor(start.getMonth() / 3) * 3 -3); + end.setDate(1); + end.setMonth(Math.floor(end.getMonth() / 3) * 3 + 6); + end.setDate(end.getDate() - 1); + }, + row1: function (date, tr1) { + var start = new Date(date.getTime()); + date.setMonth(date.getMonth() + 3); + var q = (Math.floor(start.getMonth() / 3) + 1); + self.createHeadCell(1,this,tr1,start.format("yyyy")+"年 第"+q+"季度 ", 3,"",start,date); + }, + row2: function (date, tr2, trBody) { + var start = new Date(date.getTime()); + date.setMonth(date.getMonth() + 1); + var lbl = start.format("MMMM"); + self.createHeadCell(2,this,tr2,lbl, 1, "headSmall", start,date); + self.createBodyCell(this,trBody,1, start.getMonth() % 3 == 2); + } + }); + + + //----------------------------- 1 YEAR ----------------------------- + _addZoom( "1y", { + adjustDates: function (start, end) { + start.setDate(1); + start.setMonth(Math.floor(start.getMonth() / 6) * 6 -6); + end.setDate(1); + end.setMonth(Math.floor(end.getMonth() / 6) * 6 + 12); + end.setDate(end.getDate() - 1); + }, + row1: function (date, tr1) { + var start = new Date(date.getTime()); + date.setMonth(date.getMonth() + 6); + var sem = (Math.floor(start.getMonth() / 6) + 1); + + if(sem==1){ + self.createHeadCell(1,this,tr1,start.format("yyyy")+"年-上半年" , 6,"",start,date); + }else{ + self.createHeadCell(1,this,tr1,start.format("yyyy")+"年-下半年" , 6,"",start,date); + } + }, + row2: function (date, tr2, trBody) { + var start = new Date(date.getTime()); + date.setMonth(date.getMonth() + 1); + self.createHeadCell(2,this,tr2,start.format("MMM"), 1, "headSmall", start,date); + self.createBodyCell(this,trBody,1, (start.getMonth() + 1) % 6 == 0); + } + }); + + + //----------------------------- 2 YEAR ----------------------------- + _addZoom( "2y", { + adjustDates: function (start, end) { + start.setDate(1); + start.setMonth(-6); + end.setDate(30); + end.setMonth(17); + }, + row1: function (date, tr1) { + var start = new Date(date.getTime()); + var inc=12-start.getMonth(); + date.setMonth(date.getMonth() + inc); + self.createHeadCell(1,this,tr1,start.format("yyyy"), inc/6,"",start,date); + }, + row2: function (date, tr2, trBody) { + var start = new Date(date.getTime()); + date.setMonth(date.getMonth() + 6); + var sem = (Math.floor(start.getMonth() / 6) + 1); + if(sem==1){ + self.createHeadCell(2,this,tr2,"上半年", 1, "headSmall", start,date); + }else{ + self.createHeadCell(2,this,tr2,"下半年", 1, "headSmall", start,date); + } + self.createBodyCell(this,trBody,1, sem == 2); + } + }); + + + +}; + diff --git a/jQueryGantt/jQueryGantt/libs/date.js b/jQueryGantt/jQueryGantt/libs/date.js new file mode 100644 index 0000000000000000000000000000000000000000..13952611647db318bb6e9a52569b268bdaed0678 --- /dev/null +++ b/jQueryGantt/jQueryGantt/libs/date.js @@ -0,0 +1,860 @@ +/** + * Copyright (c)2005-2009 Matt Kruse (javascripttoolbox.com) + * Dual licensed under the MIT and GPL licenses. + * This basically means you can use this code however you want for + */ +/* +Date functions + +These functions are used to parse, format, and manipulate Date objects. +See documentation and examples at http://www.JavascriptToolbox.com/lib/date/ + +*/ +Date.$VERSION = 1.02; + +// Utility function to append a 0 to single-digit numbers +Date.LZ = function(x) {return(x<0||x>9?"":"0")+x}; +// Full month names. Change this for local month names +Date.monthNames = new Array('January','February','March','April','May','June','July','August','September','October','November','December'); +// Month abbreviations. Change this for local month names +Date.monthAbbreviations = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); +// Full day names. Change this for local month names +Date.dayNames = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); +// Day abbreviations. Change this for local month names +Date.dayAbbreviations = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); +// Used for parsing ambiguous dates like 1/2/2000 - default to preferring 'American' format meaning Jan 2. +// Set to false to prefer 'European' format meaning Feb 1 +Date.preferAmericanFormat = true; + +// Set to 0=SUn for American 1=Mon for european +Date.firstDayOfWeek = 0; + +//default +Date.defaultFormat="dd/MM/yyyy"; + +// If the getFullYear() method is not defined, create it +if (!Date.prototype.getFullYear) { + Date.prototype.getFullYear = function() { var yy=this.getYear(); return (yy<1900?yy+1900:yy); } ; +} + +// Parse a string and convert it to a Date object. +// If no format is passed, try a list of common formats. +// If string cannot be parsed, return null. +// Avoids regular expressions to be more portable. +Date.parseString = function(val, format,lenient) { + // If no format is specified, try a few common formats + if (typeof(format)=="undefined" || format==null || format=="") { + var generalFormats=new Array(Date.defaultFormat,'y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d','MMM-d','d-MMM'); + var monthFirst=new Array('M/d/y','M-d-y','M.d.y','M/d','M-d'); + var dateFirst =new Array('d/M/y','d-M-y','d.M.y','d/M','d-M'); + var checkList=new Array(generalFormats,Date.preferAmericanFormat?monthFirst:dateFirst,Date.preferAmericanFormat?dateFirst:monthFirst); + for (var i=0; i=minlength; x--) { + var token=str.substring(i,i+x); + if (token.length < minlength) { + return null; + } + if (this.isInteger(token)) { + return token; + } + } + return null; + }; + + + + + this.decodeShortcut=function(str){ + str=str?str:""; // just in case + var dateUpper = str.trim().toUpperCase(); + var ret=new Date(); + ret.clearTime(); + + if (["NOW","N"].indexOf(dateUpper)>=0) { + ret= new Date(); + + } else if (["TODAY","T"].indexOf(dateUpper)>=0) { + //do nothing + + } else if (["YESTERDAY","Y"].indexOf(dateUpper)>=0) { + ret.setDate(ret.getDate()-1); + + } else if (["TOMORROW","TO"].indexOf(dateUpper)>=0) { + ret.setDate(ret.getDate()+1); + + } else if (["W", "TW", "WEEK", "THISWEEK", "WEEKSTART", "THISWEEKSTART"].indexOf(dateUpper)>=0) { + ret.setFirstDayOfThisWeek(); + + } else if (["LW", "LASTWEEK", "LASTWEEKSTART"].indexOf(dateUpper)>=0) { + ret.setFirstDayOfThisWeek(); + ret.setDate(ret.getDate()-7); + + } else if (["NW", "NEXTWEEK", "NEXTWEEKSTART"].indexOf(dateUpper)>=0) { + ret.setFirstDayOfThisWeek(); + ret.setDate(ret.getDate()+7); + + } else if (["M", "TM", "MONTH", "THISMONTH", "MONTHSTART", "THISMONTHSTART"].indexOf(dateUpper)>=0) { + ret.setDate(1); + + } else if (["LM", "LASTMONTH", "LASTMONTHSTART"].indexOf(dateUpper)>=0) { + ret.setDate(1); + ret.setMonth(ret.getMonth()-1); + + } else if (["NM", "NEXTMONTH", "NEXTMONTHSTART"].indexOf(dateUpper)>=0) { + ret.setDate(1); + ret.setMonth(ret.getMonth()+1); + + } else if (["Q", "TQ", "QUARTER", "THISQUARTER", "QUARTERSTART", "THISQUARTERSTART"].indexOf(dateUpper)>=0) { + ret.setDate(1); + ret.setMonth(Math.floor((ret.getMonth()) / 3) * 3); + + } else if (["LQ", "LASTQUARTER", "LASTQUARTERSTART"].indexOf(dateUpper)>=0) { + ret.setDate(1); + ret.setMonth(Math.floor((ret.getMonth()) / 3) * 3-3); + + } else if (["NQ", "NEXTQUARTER", "NEXTQUARTERSTART"].indexOf(dateUpper)>=0) { + ret.setDate(1); + ret.setMonth(Math.floor((ret.getMonth()) / 3) * 3+3); + + + } else if (/^-?[0-9]+[DWMY]$/.test(dateUpper)) { + var lastOne = dateUpper.substr(dateUpper.length - 1); + var val = parseInt(dateUpper.substr(0, dateUpper.length - 1)); + if (lastOne=="W") + ret.setDate(ret.getDate()+val*7 ); + else if (lastOne=="M") + ret.setMonth(ret.getMonth()+val ); + else if (lastOne=="Y") + ret.setYear(ret.getYear()+val ); + } else { + ret=undefined; + } + + return ret; + }; + + var ret=this.decodeShortcut(val); + if (ret) + return ret; + + this._getDate = function(val, format) { + val = val + ""; + format = format + ""; + var i_val = 0; + var i_format = 0; + var c = ""; + var token = ""; + var token2 = ""; + var x,y; + var year = new Date().getFullYear(); + var month = 1; + var date = 1; + var hh = 0; + var mm = 0; + var ss = 0; + var ampm = ""; + while (i_format < format.length) { + // Get next token from format string + c = format.charAt(i_format); + token = ""; + while ((format.charAt(i_format) == c) && (i_format < format.length)) { + token += format.charAt(i_format++); + } + // Extract contents of value based on format token + if (token == "yyyy" || token == "yy" || token == "y") { + if (token == "yyyy") { + x = 4; + y = 4; + } + if (token == "yy") { + x = 2; + y = 2; + } + if (token == "y") { + x = 2; + y = 4; + } + year = this.getInt(val, i_val, x, y); + if (year == null) { + return null; + } + i_val += year.length; + if (year.length == 2) { + if (year > 70) { + year = 1900 + (year - 0); + } + else { + year = 2000 + (year - 0); + } + } + + // } else if (token=="MMM" || token=="NNN"){ + } else if (token == "MMM" || token == "MMMM") { + month = 0; + var names = (token == "MMMM" ? (Date.monthNames.concat(Date.monthAbbreviations)) : Date.monthAbbreviations); + for (var i = 0; i < names.length; i++) { + var month_name = names[i]; + if (val.substring(i_val, i_val + month_name.length).toLowerCase() == month_name.toLowerCase()) { + month = (i % 12) + 1; + i_val += month_name.length; + break; + } + } + if ((month < 1) || (month > 12)) { + return null; + } + } else if (token == "E" || token == "EE" || token == "EEE" || token == "EEEE") { + var names = (token == "EEEE" ? Date.dayNames : Date.dayAbbreviations); + for (var i = 0; i < names.length; i++) { + var day_name = names[i]; + if (val.substring(i_val, i_val + day_name.length).toLowerCase() == day_name.toLowerCase()) { + i_val += day_name.length; + break; + } + } + } else if (token == "MM" || token == "M") { + month = this.getInt(val, i_val, token.length, 2); + if (month == null || (month < 1) || (month > 12)) { + return null; + } + i_val += month.length; + } else if (token == "dd" || token == "d") { + date = this.getInt(val, i_val, token.length, 2); + if (date == null || (date < 1) || (date > 31)) { + return null; + } + i_val += date.length; + } else if (token == "hh" || token == "h") { + hh = this.getInt(val, i_val, token.length, 2); + if (hh == null || (hh < 1) || (hh > 12)) { + return null; + } + i_val += hh.length; + } else if (token == "HH" || token == "H") { + hh = this.getInt(val, i_val, token.length, 2); + if (hh == null || (hh < 0) || (hh > 23)) { + return null; + } + i_val += hh.length; + } else if (token == "KK" || token == "K") { + hh = this.getInt(val, i_val, token.length, 2); + if (hh == null || (hh < 0) || (hh > 11)) { + return null; + } + i_val += hh.length; + hh++; + } else if (token == "kk" || token == "k") { + hh = this.getInt(val, i_val, token.length, 2); + if (hh == null || (hh < 1) || (hh > 24)) { + return null; + } + i_val += hh.length; + hh--; + } else if (token == "mm" || token == "m") { + mm = this.getInt(val, i_val, token.length, 2); + if (mm == null || (mm < 0) || (mm > 59)) { + return null; + } + i_val += mm.length; + } else if (token == "ss" || token == "s") { + ss = this.getInt(val, i_val, token.length, 2); + if (ss == null || (ss < 0) || (ss > 59)) { + return null; + } + i_val += ss.length; + } else if (token == "a") { + if (val.substring(i_val, i_val + 2).toLowerCase() == "am") { + ampm = "AM"; + } else if (val.substring(i_val, i_val + 2).toLowerCase() == "pm") { + ampm = "PM"; + } else { + return null; + } + i_val += 2; + } else { + if (val.substring(i_val, i_val + token.length) != token) { + return null; + } else { + i_val += token.length; + } + } + } + // If there are any trailing characters left in the value, it doesn't match + if (i_val != val.length) { + return null; + } + // Is date valid for month? + if (month == 2) { + // Check for leap year + if (( (year % 4 == 0) && (year % 100 != 0) ) || (year % 400 == 0)) { // leap year + if (date > 29) { + return null; + } + } else { + if (date > 28) { + return null; + } + } + } + if ((month == 4) || (month == 6) || (month == 9) || (month == 11)) { + if (date > 30) { + return null; + } + } + // Correct hours value + if (hh < 12 && ampm == "PM") { + hh = hh - 0 + 12; + } + else if (hh > 11 && ampm == "AM") { + hh -= 12; + } + return new Date(year, month - 1, date, hh, mm, ss); + }; + + var theDate=this._getDate(val, format); + if (!theDate && lenient){ + //try with short format + var f=format.replace("MMMM","M").replace("MMM","M").replace("MM","M") + .replace("yyyy","y").replace("yyy","y").replace("yy","y") + .replace("dd","d"); + //console.debug("second round with format "+f); + return this._getDate(val, f); + } else { + return theDate; + } + +}; + +// Check if a date string is valid +Date.isValid = function(val,format,lenient) { + return (Date.parseString(val,format,lenient) != null); +}; + +// Check if a date object is before another date object +Date.prototype.isBefore = function(date2) { + if (date2==null) { + return false; + } + return (this.getTime()date2.getTime()); +}; + +Date.prototype.isOutOfRange = function (minDate, maxDate) { + + minDate = minDate || this; + maxDate = maxDate || this; + + if(typeof minDate == "string") + minDate = Date.parseString(minDate); + + if(typeof maxDate == "string") + maxDate = Date.parseString(maxDate); + + + /* + console.debug("date:: ", this); + console.debug("minDate:: ", minDate); + console.debug("maxDate:: ", maxDate); + console.debug("isDisabled:: ", this.isBefore(minDate) , this.isAfter(maxDate)); + */ + + return (this.isBefore(minDate) || this.isAfter(maxDate)); +}; + +// Check if two date objects have equal dates and times +Date.prototype.equals = function(date2) { + if (date2==null) { + return false; + } + return (this.getTime()==date2.getTime()); +}; + +// Check if two date objects have equal dates, disregarding times +Date.prototype.equalsIgnoreTime = function(date2) { + if (date2==null) { + return false; + } + var d1 = new Date(this.getTime()).clearTime(); + var d2 = new Date(date2.getTime()).clearTime(); + return (d1.getTime()==d2.getTime()); +}; + +/** + * Get week number in the year. + */ +Date.prototype.getWeekNumber = function() { + var d = new Date(+this); + d.setHours(0,0,0,0); + d.setDate(d.getDate()+4-(d.getDay()||7)); + return Math.ceil((((d-new Date(d.getFullYear(),0,1))/8.64e7)+1)/7); +}; + +// Format a date into a string using a given format string +Date.prototype.format = function(format) { + if (!format) + format=Date.defaultFormat; + format=format+""; + var result=""; + var i_format=0; + var c=""; + var token=""; + var y=this.getFullYear()+""; + var M=this.getMonth()+1; + var d=this.getDate(); + var E=this.getDay(); + var H=this.getHours(); + var m=this.getMinutes(); + var s=this.getSeconds(); + var w=this.getWeekNumber(); + // Convert real date parts into formatted versions + var value=new Object(); + if (y.length < 4) { + y=""+(+y+1900); + } + value["y"]=""+y; + value["yyyy"]=y; + value["yy"]=y.substring(2,4); + value["M"]=M; + value["MM"]=Date.LZ(M); + value["MMM"]=Date.monthAbbreviations[M-1]; + value["MMMM"]=Date.monthNames[M-1]; + value["d"]=d; + value["dd"]=Date.LZ(d); + value["E"]=Date.dayAbbreviations[E]; + value["EE"]=Date.dayAbbreviations[E]; + value["EEE"]=Date.dayAbbreviations[E]; + value["EEEE"]=Date.dayNames[E]; + value["H"]=H; + value["HH"]=Date.LZ(H); + value["w"]=w; + value["ww"]=Date.LZ(w); + if (H==0){ + value["h"]=12; + } + else if (H>12){ + value["h"]=H-12; + } + else { + value["h"]=H; + } + value["hh"]=Date.LZ(value["h"]); + value["K"]=value["h"]-1; + value["k"]=value["H"]+1; + value["KK"]=Date.LZ(value["K"]); + value["kk"]=Date.LZ(value["k"]); + if (H > 11) { + value["a"]="PM"; + } + else { + value["a"]="AM"; + } + value["m"]=m; + value["mm"]=Date.LZ(m); + value["s"]=s; + value["ss"]=Date.LZ(s); + while (i_format < format.length) { + c=format.charAt(i_format); + token=""; + while ((format.charAt(i_format)==c) && (i_format < format.length)) { + token += format.charAt(i_format++); + } + if (typeof(value[token])!="undefined") { + result=result + value[token]; + } + else { + result=result + token; + } + } + return result; +}; + +// Get the full name of the day for a date +Date.prototype.getDayName = function() { + return Date.dayNames[this.getDay()]; +}; + +// Get the abbreviation of the day for a date +Date.prototype.getDayAbbreviation = function() { + return Date.dayAbbreviations[this.getDay()]; +}; + +// Get the full name of the month for a date +Date.prototype.getMonthName = function() { + return Date.monthNames[this.getMonth()]; +}; + +// Get the abbreviation of the month for a date +Date.prototype.getMonthAbbreviation = function() { + return Date.monthAbbreviations[this.getMonth()]; +}; + +// Clear all time information in a date object +Date.prototype.clearTime = function() { + this.setHours(0); + this.setMinutes(0); + this.setSeconds(0); + this.setMilliseconds(0); + return this; +}; + +// Add an amount of time to a date. Negative numbers can be passed to subtract time. +Date.prototype.add = function(interval, number) { + if (typeof(interval)=="undefined" || interval==null || typeof(number)=="undefined" || number==null) { + return this; + } + number = +number; + if (interval=='y') { // year + this.setFullYear(this.getFullYear()+number); + } else if (interval=='M') { // Month + this.setMonth(this.getMonth()+number); + } else if (interval=='d') { // Day + this.setDate(this.getDate()+number); + } else if (interval=='w') { // Week + this.setDate(this.getDate()+number*7); + } else if (interval=='h') { // Hour + this.setHours(this.getHours() + number); + } else if (interval=='m') { // Minute + this.setMinutes(this.getMinutes() + number); + } else if (interval=='s') { // Second + this.setSeconds(this.getSeconds() + number); + } + return this; + +}; + +Date.prototype.toInt = function () { + return this.getFullYear()*10000+(this.getMonth()+1)*100+this.getDate(); +}; + +Date.fromInt=function (dateInt){ + var year = parseInt(dateInt/10000); + var month = parseInt((dateInt-year*10000)/100); + var day = parseInt(dateInt-year*10000-month*100); + return new Date(year,month-1,day,12,00,00); +}; + + +Date.prototype.isHoliday=function(){ + return isHoliday(this); +}; + +Date.prototype.isToday=function(){ + return this.toInt()==new Date().toInt(); +}; + + +Date.prototype.incrementDateByWorkingDays=function (days) { + //console.debug("incrementDateByWorkingDays start ",d,days) + var q = Math.abs(days); + while (q > 0) { + this.setDate(this.getDate() + (days > 0 ? 1 : -1)); + if (!this.isHoliday()) + q--; + } + return this; +}; + + +Date.prototype.distanceInDays= function (toDate){ + // Discard the time and time-zone information. + var utc1 = Date.UTC(this.getFullYear(), this.getMonth(), this.getDate()); + var utc2 = Date.UTC(toDate.getFullYear(), toDate.getMonth(), toDate.getDate()); + return Math.floor((utc2 - utc1) / (3600000*24)); +}; + +//low performances in case of long distance +/*Date.prototype.distanceInWorkingDays= function (toDate){ + var pos = new Date(this.getTime()); + pos.setHours(23, 59, 59, 999); + var days = 0; + var nd=new Date(toDate.getTime()); + nd.setHours(23, 59, 59, 999); + var end=nd.getTime(); + while (pos.getTime() <= end) { + days = days + (isHoliday(pos) ? 0 : 1); + pos.setDate(pos.getDate() + 1); + } + return days; +};*/ + +//low performances in case of long distance +// bicch 22/4/2016: modificato per far ritornare anche valori negativi, così come la controparte Java in CompanyCalendar. +// attenzione che prima tornava 1 per due date uguali adesso torna 0 +Date.prototype.distanceInWorkingDays= function (toDate){ + var pos = new Date(Math.min(this,toDate)); + pos.setHours(12, 0, 0, 0); + var days = 0; + var nd=new Date(Math.max(this,toDate)); + nd.setHours(12, 0,0, 0); + while (pos < nd) { + days = days + (isHoliday(pos) ? 0 : 1); + pos.setDate(pos.getDate() + 1); + } + days=days*(this>toDate?-1:1); + + //console.debug("distanceInWorkingDays",this,toDate,days); + return days; +}; + +Date.prototype.setFirstDayOfThisWeek= function (firstDayOfWeek){ + if (!firstDayOfWeek) + firstDayOfWeek=Date.firstDayOfWeek; + this.setDate(this.getDate() - this.getDay() +firstDayOfWeek - (this.getDay()==0 && firstDayOfWeek!=0 ?7:0)); + return this; +}; + + +/* ----- millis format --------- */ +/** + * @param str - Striga da riempire + * @param len - Numero totale di caratteri, comprensivo degli "zeri" + * @param ch - Carattere usato per riempire + */ + +function pad(str, len, ch) { + if ((str + "").length < len) { + return new Array(len - ('' + str).length + 1).join(ch) + str; + } else { + return str + } +} + +function getMillisInHours(millis) { + if (!millis) + return ""; + var hour = Math.floor(millis / 3600000); + return ( millis >= 0 ? "" : "-") + pad(hour, 1, "0"); +} +function getMillisInHoursMinutes(millis) { + if (typeof(millis) != "number") + return ""; + + var sgn = millis >= 0 ? 1 : -1; + millis = Math.abs(millis); + var hour = Math.floor(millis / 3600000); + var min = Math.floor((millis % 3600000) / 60000); + return (sgn > 0 ? "" : "-") + pad(hour, 1, "0") + ":" + pad(min, 2, "0"); +} + +function getMillisInDaysHoursMinutes(millis) { + if (!millis) + return ""; + // millisInWorkingDay is set on partHeaderFooter + var sgn = millis >= 0 ? 1 : -1; + millis = Math.abs(millis); + var days = Math.floor(millis / millisInWorkingDay); + var hour = Math.floor((millis % millisInWorkingDay) / 3600000); + var min = Math.floor((millis - days * millisInWorkingDay - hour * 3600000) / 60000); + return (sgn >= 0 ? "" : "-") + (days > 0 ? days + " " : "") + pad(hour, 1, "0") + ":" + pad(min, 2, "0"); +} + + +function millisToString(millis,considerWorkingdays) { + // console.debug("millisToString",millis) + if (!millis) + return ""; + // millisInWorkingDay is set on partHeaderFooter + var sgn=millis>=0?1:-1; + millis=Math.abs(millis); + var wm = (considerWorkingdays?millisInWorkingDay:3600000*24); + var days = Math.floor(millis / wm); + var hour = Math.floor((millis % wm) / 3600000); + var min = Math.floor((millis-days*wm-hour*3600000) / 60000); + var sec = Math.floor((millis-days*wm-hour*3600000-min*60000) / 1000); + //console.debug("millisToString",wm, millis,days,hour,min) + return (sgn>=0?"":"-")+(days > 0 ? days + "d " : "") + (hour>0? (days>0?" ":"")+hour+"h":"") +(min>0?(days>0||hour>0?" ":"")+min+"m":"")+ (sec>0?+sec+"s":""); +} + + + +function millisFromHourMinute(stringHourMinutes) { //All this format are valid: "12:58" "13.75" "63635676000" (this is already in milliseconds) + var semiColSeparator = stringHourMinutes.indexOf(":"); + if (semiColSeparator ==0) // :30 minutes + return millisFromHourMinuteSecond("00"+stringHourMinutes+":00"); + else if (semiColSeparator >0) // 1:15 hours:minutes + return millisFromHourMinuteSecond(stringHourMinutes+":00"); + else + return millisFromHourMinuteSecond(stringHourMinutes); + +} + +function millisFromHourMinuteSecond(stringHourMinutesSeconds) { //All this format are valid: "00:12:58" "12:58:55" "13.75" "63635676000" (this is already in milliseconds) + var result = 0; + stringHourMinutesSeconds.replace(",", "."); + var semiColSeparator = stringHourMinutesSeconds.indexOf(":"); + var dotSeparator = stringHourMinutesSeconds.indexOf("."); + + if (semiColSeparator < 0 && dotSeparator < 0 && stringHourMinutesSeconds.length > 5) { + return parseInt(stringHourMinutesSeconds, 10); //already in millis + } else { + + if (dotSeparator > -1) { + var d = parseFloat(stringHourMinutesSeconds); + result = d * 3600000; + } else { + var hour = 0; + var minute = 0; + var second= 0; + + if (semiColSeparator == -1) + hour = parseInt(stringHourMinutesSeconds, 10); + else { + + var units=stringHourMinutesSeconds.split(":") + + hour = parseInt(units[0],10); + minute = parseInt(units[1], 10); + second = parseInt(units[2], 10); + } + result = hour * 3600000 + minute * 60000+second*1000; + } + if (typeof(result) != "number") + result = NaN; + return result; + } +} + + +/** + * @param string "3y 4d", "4D:08:10", "12M/3d", "1.5D", "2H4D", "3M4d,2h", "12:30", "11", "3", "1.5", "2m/3D", "12/3d", "1234" + * by default 2 means 2 hours 1.5 means 1:30 + * @param considerWorkingdays if true day length is from global.properties CompanyCalendar.MILLIS_IN_WORKING_DAY otherwise in 24 + * @return milliseconds. 0 if invalid string + */ +function millisFromString(string, considerWorkingdays) { + if (!string) + return 0; + + //var regex = new RegExp("(\\d+[Yy])|(\\d+[M])|(\\d+[Ww])|(\\d+[Dd])|(\\d+[Hh])|(\\d+[m])|(\\d+[Ss])|(\\d+:\\d+)|(:\\d+)|(\\d*[\\.,]\\d+)|(\\d+)", "g"); // bicch 14/1/16 supporto per 1.5d + var regex = new RegExp("([0-9\\.,]+[Yy])|([0-9\\.,]+[Qq])|([0-9\\.,]+[M])|([0-9\\.,]+[Ww])|([0-9\\.,]+[Dd])|([0-9\\.,]+[Hh])|([0-9\\.,]+[m])|([0-9\\.,]+[Ss])|(\\d+:\\d+:\\d+)|(\\d+:\\d+)|(:\\d+)|(\\d*[\\.,]\\d+)|(\\d+)", "g"); + + var matcher = regex.exec(string); + var totMillis = 0; + + if (!matcher) + return NaN; + + while (matcher != null) { + for (var i = 1; i < matcher.length; i++) { + var match = matcher[i]; + if (match) { + var number = 0; + try { + //number = parseInt(match); // bicch 14/1/16 supporto per 1.5d + number = parseFloat(match.replace(',','.')); + } catch (e) { + } + if (i == 1) { // years + totMillis = totMillis + number * (considerWorkingdays ? millisInWorkingDay * workingDaysPerWeek * 52 : 3600000 * 24 * 365); + } else if (i == 2) { // quarter + totMillis = totMillis + number * (considerWorkingdays ? millisInWorkingDay * workingDaysPerWeek * 4 : 3600000 * 24 * 91); + } else if (i == 3) { // months + totMillis = totMillis + number * (considerWorkingdays ? millisInWorkingDay * workingDaysPerWeek * 4 : 3600000 * 24 * 30); + } else if (i == 4) { // weeks + totMillis = totMillis + number * (considerWorkingdays ? millisInWorkingDay * workingDaysPerWeek : 3600000 * 24 * 7); + } else if (i == 5) { // days + totMillis = totMillis + number * (considerWorkingdays ? millisInWorkingDay : 3600000 * 24); + } else if (i == 6) { // hours + totMillis = totMillis + number * 3600000; + } else if (i == 7) { // minutes + totMillis = totMillis + number * 60000; + } else if (i == 8) { // seconds + totMillis = totMillis + number * 1000; + } else if (i == 9) { // hour:minutes:seconds + totMillis = totMillis + millisFromHourMinuteSecond(match); + } else if (i == 10) { // hour:minutes + totMillis = totMillis + millisFromHourMinute(match); + } else if (i == 11) { // :minutes + totMillis = totMillis + millisFromHourMinute(match); + } else if (i == 12) { // hour.minutes + totMillis = totMillis + millisFromHourMinute(match); + } else if (i == 13) { // hours + totMillis = totMillis + number * 3600000; + } + } + } + matcher = regex.exec(string); + } + + return totMillis; +} + +/** + * @param string "3y 4d", "4D:08:10", "12M/3d", "2H4D", "3M4d,2h", "12:30", "11", "3", "1.5", "2m/3D", "12/3d", "1234" + * by default 2 means 2 hours 1.5 means 1:30 + * @param considerWorkingdays if true day length is from global.properties CompanyCalendar.MILLIS_IN_WORKING_DAY otherwise in 24 + * @return milliseconds. 0 if invalid string + */ +function daysFromString(string, considerWorkingdays) { + if (!string) + return undefined; + + //var regex = new RegExp("(\\d+[Yy])|(\\d+[Mm])|(\\d+[Ww])|(\\d+[Dd])|(\\d*[\\.,]\\d+)|(\\d+)", "g"); // bicch 14/1/16 supporto per 1.5d + //var regex = new RegExp("([0-9\\.,]+[Yy])|([0-9\\.,]+[Qq])|([0-9\\.,]+[Mm])|([0-9\\.,]+[Ww])|([0-9\\.,]+[Dd])|(\\d*[\\.,]\\d+)|(\\d+)", "g"); + var regex = new RegExp("([\\-]?[0-9\\.,]+[Yy])|([\\-]?[0-9\\.,]+[Qq])|([\\-]?[0-9\\.,]+[Mm])|([\\-]?[0-9\\.,]+[Ww])|([\\-]?[0-9\\.,]+[Dd])|([\\-]?\\d*[\\.,]\\d+)|([\\-]?\\d+)", "g"); + + var matcher = regex.exec(string); + var totDays = 0; + + if (!matcher) + return NaN; + + while (matcher != null) { + for (var i = 1; i < matcher.length; i++) { + var match = matcher[i]; + if (match) { + var number = 0; + try { + number = parseInt(match);// bicch 14/1/16 supporto per 1.5d + number = parseFloat(match.replace(',','.')); + } catch (e) { + } + if (i == 1) { // years + totDays = totDays + number * (considerWorkingdays ? workingDaysPerWeek * 52 : 365); + } else if (i == 2) { // quarter + totDays = totDays + number * (considerWorkingdays ? workingDaysPerWeek * 12 : 91); + } else if (i == 3) { // months + totDays = totDays + number * (considerWorkingdays ? workingDaysPerWeek * 4 : 30); + } else if (i == 4) { // weeks + totDays = totDays + number * (considerWorkingdays ? workingDaysPerWeek : 7); + } else if (i == 5) { // days + totDays = totDays + number; + } else if (i == 6) { // days.minutes + totDays = totDays + number; + } else if (i == 7) { // days + totDays = totDays + number; + } + } + } + matcher = regex.exec(string); + } + + return parseInt(totDays); +} diff --git a/jQueryGantt/jQueryGantt/libs/dialogs.js b/jQueryGantt/jQueryGantt/libs/dialogs.js new file mode 100644 index 0000000000000000000000000000000000000000..50c51b59c29f13b33f8a214c2dd10cad21e21a11 --- /dev/null +++ b/jQueryGantt/jQueryGantt/libs/dialogs.js @@ -0,0 +1,446 @@ +/* + Copyright (c) 2012-2017 Open Lab + 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. + */ + +function centerPopup(url, target, w, h, scroll, resiz) { + var winl = (screen.width - w) / 2; + var wint = (screen.height - h) / 2; + var winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl + ',scrollbars=' + scroll + ',resizable=' + resiz + ', toolbars=false, status=false, menubar=false'; + var win = window.open(url, target, winprops); + if (!win) + alert("A popup blocker was detected: please allow them for this application (check out the upper part of the browser window)."); + if (parseInt(navigator.appVersion) >= 4) { + win.window.focus(); + } +} + +function openCenteredWindow(url, target, winprops) { + var prop_array = winprops.split(","); + var i = 0; + var w = 800; + var h = 600; + if (winprops && winprops != '') { + while (i < prop_array.length) { + if (prop_array[i].indexOf('width') > -1) { + s = prop_array[i].substring(prop_array[i].indexOf('=') + 1); + w = parseInt(s); + } else if (prop_array[i].indexOf('height') > -1) { + s = prop_array[i].substring(prop_array[i].indexOf('=') + 1); + h = parseInt(s); + } + i += 1; + } + var winl = (screen.width - w) / 2; + var wint = (screen.height - h) / 2; + winprops = winprops + ",top=" + wint + ",left=" + winl; + } + win = window.open(url, target, winprops); + if (!win) + alert("A popup blocker was detected: please allow them for this application (check out the upper part of the browser window)."); + if (parseInt(navigator.appVersion) >= 4) { + win.window.focus(); + } +} + +function showFeedbackMessage(typeOrObject, message, title, autoCloseTime) { + + if(!autoCloseTime) + autoCloseTime = 0; + + //console.debug("showFeedbackMessage",typeOrObject, message, title); + var place = $("#__FEEDBACKMESSAGEPLACE"); + var mess; + if (typeof(typeOrObject)=="object" ) + mess=typeOrObject; + else + mess = {type:typeOrObject, message:message,title:title}; + //if exists append error message + var etm = $(".FFC_"+mess.type+":visible ._errorTemplateMessage"); + if(etm.length>0){ + etm.append("
"+(mess.title?""+mess.title+"
":"")+mess.message+"
"); + }else{ + etm = $.JST.createFromTemplate(mess, "errorTemplate"); + place.append(etm); + place.fadeIn(); + } + + if(autoCloseTime >0) + setTimeout(function(){ + etm.fadeOut(); + },autoCloseTime); + + $(".FFC_OK").stopTime("ffchide").oneTime(1500, "ffchide",function () {$(this).fadeOut(400,function(){$(this)})}); + $(".FFC_WARNING").stopTime("ffchide").oneTime(75000, "ffchide",function () {$(this).fadeOut(400,function(){$(this)})}); + $(".FFC_ERROR").stopTime("ffchide").oneTime(10000, "ffchide",function () {$(this).fadeOut(400,function(){$(this)})}); +} + +function showFeedbackMessageInDiv(type, message, divId) { + var place = $("#" + divId); + var mess = {type:type, message:message}; + place.prepend($.JST.createFromTemplate(mess, "errorTemplate")); + place.fadeIn(); + $("body").oneTime(1200, function () { + $(".FFC_OK").fadeOut(); + }); +} +function hideFeedbackMessages() { + $("#__FEEDBACKMESSAGEPLACE").empty(); +} + + +function submitInBlack(formId, actionHref, w, h) { + + if (!w) + w = $(window).width() - 100; + if (!h) + h = $(window).height() - 50; + + openBlackPopup('', w + "px", h + "px", null, formId + "_ifr"); + var form = $("#" + formId); + var oldAction = form.prop("action"); + var oldTarget = form.prop("target"); + form.prop("action", actionHref); + form.prop("target", formId + "_ifr"); + $(window).data("openerForm", form); + form.submit(); + form.prop("action", oldAction); + if (oldTarget) + form.prop("target", oldTarget); + else + form.removeAttr("target"); +} + + +var __popups = []; +function createModalPopup(width, height, onCloseCallBack, cssClass, element, popupOpener) { + //console.debug("createModalPopup"); + + + if (typeof(disableUploadize)=="function") + disableUploadize(); + + // se non diversamenete specificato l'openere è la window corrente; + popupOpener = popupOpener || window; + + if (!width) + width = "80%"; + + if (!height) + height = "80%"; + + var localWidth=width,localHeight=height; + + if (typeof (width)=="string" && width.indexOf("%")>0 ) { + localWidth = function () {return ($(window).width() * parseFloat(width)) / 100}; + } + + if (typeof (height)=="string" && height.indexOf("%")>0) + localHeight = function(){return ($(window).height() * parseFloat(height)) / 100}; + + var popupWidth = localWidth, popupHeight = localHeight; + + if(typeof localWidth == "function") + popupWidth = localWidth(); + + if(typeof localHeight == "function") + popupHeight = localHeight(); + + popupWidth = parseFloat(popupWidth); + popupHeight = parseFloat(popupHeight); + + if (typeof onCloseCallBack == "string") + cssClass = onCloseCallBack; + + //$("#__popup__").remove(); + + var popupN = __popups.length+1; + __popups.push("__popup__" + popupN); + + var isInIframe = isIframe(); + + var bg = $("
").prop("id", "__popup__" + popupN); + bg.addClass("modalPopup" + (isInIframe ? " inIframe" : "")).hide(); + + if (cssClass) + bg.addClass(cssClass); + + function getMarginTop(){ + var mt = ($(window).height() - popupHeight)/2 - 100; + return mt < 0 ? 10 : mt; + } + + var internalDiv=$("
").addClass("bwinPopupd").css({ width:popupWidth, minHeight:popupHeight, marginTop: getMarginTop(), maxHeight:$(window).height()-20, overflow: "auto" }); + + $(window).off("resize.popup"+popupN).on("resize.popup"+popupN, function(){ + + if(typeof localWidth == "function") + popupWidth = localWidth(); + + if(typeof localHeight == "function") + popupHeight = localHeight(); + + internalDiv.css({ width:popupWidth, minHeight:popupHeight }); + + var w = internalDiv.outerWidth() > $(window).width()-20 ? $(window).width()-20 : popupWidth; + var h = internalDiv.outerHeight() > $(window).height()-20 ? $(window).height()-20 : popupHeight; + + internalDiv.css({ marginTop: getMarginTop(), minHeight: h, maxHeight:$(window).height()-20,minWidth: w }); + + }); + + bg.append(internalDiv); + + var showBG = function(el, time, callback){ + + if (isInIframe) { + internalDiv.css({marginTop: -50 }); + el.show(); + internalDiv.animate({marginTop: 0}, (time/2), callback); + } else { + internalDiv.css({opacity: 0, top: -50}).show(); + el.fadeIn(time, function () { + internalDiv.animate({top: 0, opacity: 1}, time/3, callback); + }); + } + +/* + if(isInIframe) { + internalDiv.css({marginTop: -1000 }); + el.show(); + internalDiv.animate({marginTop: 0}, (time * 2), callback); + }else{ + internalDiv.css({opacity:0, top: -500}).show(); + el.fadeIn(time, function(){ + internalDiv.animate({top: 0, opacity:1}, time, callback); + }); + } +*/ + + return this; + }; + + if(!element) + $("#twMainContainer").addClass("blur"); + + showBG(bg, 300, function(){}) + bg.on("click",function(event){ + if ($(event.target).closest(".bwinPopupd").length <= 0) + bg.trigger("close"); + }); + + var close = $("x"); + internalDiv.append(close); + + close.click(function () { + bg.trigger("close"); + }); + + $("body").css({overflowY:"hidden"}); + + if(!element){ + $("body").append(bg); + }else{ + element.after(bg); + } + + //close call callback + bg.on("close", function () { + var callBackdata = $(this).data("callBackdata"); + var ndo=bg; + + if (typeof (enableUploadize)=="function") + enableUploadize(); + + //console.debug("ndo",ndo); + + var alertMsg; + var ifr=bg.find("iframe"); + + if (ifr.length>0){ + try { + alertMsg = ifr.get(0).contentWindow.alertOnUnload(); + }catch (e){} + } else { + alertMsg=alertOnUnload(ndo); + } + + if (alertMsg){ + if (!confirm(alertMsg)) + return; + } + + bg.fadeOut(100, function () { + + $(window).off("resize.popup"+popupN); + bg.remove(); + __popups.pop(); + + if (__popups.length == 0) + $("#twMainContainer").removeClass("blur"); + + if (typeof(onCloseCallBack) == "function") + onCloseCallBack(callBackdata); + + $("body").css({overflowY: "auto"}); + }); + + }); + + //destroy do not call callback + bg.on("destroy", function () { + bg.remove(); + $("body").css({overflowY: "auto"}); + }); + + //rise resize event in order to show buttons + $("body").oneTime(1000,"br",function(){$(this).resize();}); // con meno di 1000 non funziona + + + //si deposita l'popupOpener sul bg. Per riprenderlo si usa getBlackPopupOpener() + bg.data("__opener",popupOpener); + + return internalDiv; +} + +function changeModalSize(w,h){ + var newDim = {}; + if(w) + newDim.width = w; + if(h) + newDim.minHeight = h; + + var isInIframe = isIframe(); + var popUp = isInIframe ? window.parent.$(".bwinPopupd") : $(".bwinPopupd"); + + if(popUp.length) + popUp.delay(300).animate(newDim, 200); +} + +function openBlackPopup(url, width, height, onCloseCallBack, iframeId, cssClass) { + + if (!iframeId) + iframeId = "bwinPopupIframe"; + + //add black only if not already in blackpupup + var color= cssClass ? cssClass + " iframe" : "iframe"; + + var ndo = top.createModalPopup(width, height, onCloseCallBack, color,null,window); + + //ndo.closest(".modalPopup ").data("__opener",window); // si deposita il vero opener + + var isInIframe = isIframe(); + + ndo.append("
"); + ndo.find("iframe:first").prop("src", url).css({width:"100%", height:"100%", backgroundColor: isInIframe ? '#F9F9F9' : '#FFFFFF'}); +} + +function getBlackPopup() { + var ret=$([]); + if (__popups.length>0) { + var id = __popups[__popups.length - 1]; + ret = $("#" + id); + } + if (ret.length==0 && window!=top) { + ret = window.parent.getBlackPopup(); + } + return ret; +} + + +function getBlackPopupOpener(){ + return getBlackPopup().data("__opener") +} + +function closeBlackPopup(callBackdata) { + //console.debug("closeBlackPopup ",callBackdata); + var bp = getBlackPopup(); + + if (callBackdata) + bp.data("callBackdata",callBackdata); + bp.trigger("close"); +} + +function openPopUp(el,width,height){ + var popup=createModalPopup(width,height); + popup.append(el.clone().show()); +} + +//returns a jquery object where to write content + +function isIframe() { + var isIframe = false; + try{ + //try to access the document object + if (self.location.href != top.location.href) + isIframe = true; + }catch(e) { + //We don't have access, it's cross-origin! + isIframe = true; + } + return isIframe; +}; + + +function openBulkAction(bulkDivId){ + var popup=createModalPopup(500,300); + popup.append($("#"+bulkDivId).clone().show()); +} + + +function refreshBulk(el) { + //console.debug("refreshBulk") + + if (el.is(":checked")) + el.closest("tr").addClass("selected"); + else + el.closest("tr").removeClass("selected"); + + var table=el.closest(".dataTable"); + if (table.find(".selected :checked").length > 0) { + + $("#bulkOp #bulkRowSel").html(table.find("tbody > tr.selected").length + "/" + table.children("tbody").children("tr").length); + + var bukOpt = $("#bulkOp").clone().addClass("bulkOpClone"); + bukOpt.fadeIn(200, function(){ + $("#bulkPlace").html(bukOpt); + $.tableHF.refreshTfoot(); + }); + + } else { + $(".bulkOpClone").fadeOut(200, function(){ + $.tableHF.refreshTfoot(); + }); + } +} + +function selUnselAll(el){ + //var bulkCheckbox = $("#multi td [type='checkbox']"); + var bulkCheckbox = el.closest(".dataTable").find("[type='checkbox']"); + if (el.is(":checked")){ + bulkCheckbox.prop("checked", true); + bulkCheckbox.closest("tr").addClass("selected"); + } else { + bulkCheckbox.prop("checked", false); + bulkCheckbox.closest("tr").removeClass("selected"); + } + + refreshBulk(el); +} diff --git a/jQueryGantt/jQueryGantt/libs/forms.js b/jQueryGantt/jQueryGantt/libs/forms.js new file mode 100644 index 0000000000000000000000000000000000000000..2f0178a604981ea3370631f491a4c072400ff07a --- /dev/null +++ b/jQueryGantt/jQueryGantt/libs/forms.js @@ -0,0 +1,690 @@ +/* + Copyright (c) 2012-2017 Open Lab + 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. + */ + +var muteAlertOnChange = false; + + +// isRequired ---------------------------------------------------------------------------- + +//return true if every mandatory field is filled and highlight empty ones +jQuery.fn.isFullfilled = function () { + var canSubmit = true; + var firstErrorElement = ""; + + this.each(function () { + var theElement = $(this); + theElement.removeClass("formElementsError"); + //if (theElement.val().trim().length == 0 || theElement.attr("invalid") == "true") { //robicch 13/2/15 + if (theElement.is("[required]") && theElement.val().trim().length == 0 || theElement.attr("invalid") == "true") { + if (theElement.attr("type") == "hidden") { + theElement = theElement.prevAll("#" + theElement.prop("id") + "_txt:first"); + } else if (theElement.is("[withTinyMCE]")){ + if (tinymce.activeEditor.getContent()=="") + theElement=$("#"+theElement.attr("name")+"_tbl"); + else + return true;// in order to continue the loop + } + theElement.addClass("formElementsError"); + canSubmit = false; + + if (firstErrorElement == "") + firstErrorElement = theElement; + } + }); + + if (!canSubmit) { + // get the tabdiv + var theTabDiv = firstErrorElement.closest(".tabBox"); + if (theTabDiv.length > 0) + clickTab(theTabDiv.attr("tabId")); + + // highlight element + firstErrorElement.effect("highlight", { color:"red" }, 1500); + } + return canSubmit; + +}; + +function canSubmitForm(formOrId) { + //console.debug("canSubmitForm",formOrId); + if (typeof formOrId != "object") + formOrId=$("#" + formOrId); + return formOrId.find(":input[required],:input[invalid=true]").isFullfilled(); +} + +function showSavingMessage() { + $("#savingMessage:hidden").fadeIn(); + $("body").addClass("waiting"); + $(window).resize(); +} +function hideSavingMessage() { + $("#savingMessage:visible").fadeOut(); + $("body").removeClass("waiting"); + $(window).resize(); +} + + + +/* Types Function */ + +function isValidURL(url) { + var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/; + return RegExp.test(url); +} + +function isValidEmail(email) { + //var RegExp = /^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/; + var RegExp = /^.+@\S+\.\S+$/; + return RegExp.test(email); +} + +function isValidInteger(n) { + reg = new RegExp("^[-+]{0,1}[0-9]*$"); + return reg.test(n) || isNumericExpression(n); +} + +function isValidDouble(n) { + var sep = Number.decimalSeparator; + reg = new RegExp("^[-+]{0,1}[0-9]*[" + sep + "]{0,1}[0-9]*$"); + return reg.test(n) || isNumericExpression(n); +} + +function isValidTime(n) { + return !isNaN(millisFromHourMinute(n)); +} + +function isValidDurationDays(n) { + return !isNaN(daysFromString(n)); +} + +function isValidDurationMillis(n) { + return !isNaN(millisFromString(n)); +} + +function isNumericExpression(expr) { + try { + var a = eval(expr); + return typeof(a) == 'number'; + } catch (t) { + return false; + } + +} + +function getNumericExpression(expr) { + var ret; + try { + var a = eval(expr); + if (typeof(a) == 'number') + ret = a; + } catch (t) { + } + return ret; + +} + +/* + supports almost all Java currency format e.g.: ###,##0.00EUR €#,###.00 #,###.00€ -$#,###.00 $-#,###.00 + */ +function isValidCurrency(numStr) { + //first try to convert format in a regex + var regex = ""; + var format = Number.currencyFormat + ""; + + var minusFound = false; + var numFound = false; + var currencyString = ""; + var numberRegex = "[0-9\\" + Number.groupingSeparator + "]+[\\" + Number.decimalSeparator + "]?[0-9]*"; + + for (var i = 0; i < format.length; i++) { + var ch = format.charAt(i); + + if (ch == "." || ch == "," || ch == "0") { + //skip it + if (currencyString != "") { + regex = regex + "(?:" + RegExp.quote(currencyString) + ")?"; + currencyString = ""; + } + + } else if (ch == "#") { + if (currencyString != "") { + regex = regex + "(?:" + RegExp.quote(currencyString) + ")?"; + currencyString = ""; + } + + if (!numFound) { + numFound = true; + regex = regex + numberRegex; + } + + } else if (ch == "-") { + if (currencyString != "") { + regex = regex + "(?:" + RegExp.quote(currencyString) + ")?"; + currencyString = ""; + } + if (!minusFound) { + minusFound = true; + regex = regex + "[-]?"; + } + + } else { + currencyString = currencyString + ch; + } + } + if (!minusFound) + regex = "[-]?" + regex; + + if (currencyString != "") + regex = regex + "(?:" + RegExp.quote(currencyString) + ")?"; + + regex = "^" + regex + "$"; + + var rg = new RegExp(regex); + return rg.test(numStr) || isNumericExpression(numStr); +} + +function getCurrencyValue(numStr) { + if (!isValidCurrency(numStr)) + return NaN; + + var ripul = numStr.replaceAll(Number.groupingSeparator, "").replaceAll(Number.decimalSeparator, "."); + return getNumericExpression(ripul) || parseFloat(ripul.replace(/[^-0123456789.]/, "")); +} + + +function formatCurrency(numberString) { + return formatNumber(numberString, Number.currencyFormat); +} + + +function formatNumber(numberString, format) { + if (!format) + format = "##0.00"; + + var dec = Number.decimalSeparator; + var group = Number.groupingSeparator; + var neg = Number.minusSign; + + var round = true; + + var validFormat = "0#-,."; + + // strip all the invalid characters at the beginning and the end + // of the format, and we'll stick them back on at the end + // make a special case for the negative sign "-" though, so + // we can have formats like -$23.32 + var prefix = ""; + var negativeInFront = false; + for (var i = 0; i < format.length; i++) { + if (validFormat.indexOf(format.charAt(i)) == -1) { + prefix = prefix + format.charAt(i); + } else { + if (i == 0 && format.charAt(i) == '-') { + negativeInFront = true; + } else { + break; + } + } + } + var suffix = ""; + for (var i = format.length - 1; i >= 0; i--) { + if (validFormat.indexOf(format.charAt(i)) == -1) + suffix = format.charAt(i) + suffix; + else + break; + } + + format = format.substring(prefix.length); + format = format.substring(0, format.length - suffix.length); + + // now we need to convert it into a number + //while (numberString.indexOf(group) > -1) + // numberString = numberString.replace(group, ''); + //var number = new Number(numberString.replace(dec, ".").replace(neg, "-")); + var number = new Number(numberString); + + + var forcedToZero = false; + if (isNaN(number)) { + number = 0; + forcedToZero = true; + } + + // special case for percentages + if (suffix == "%") + number = number * 100; + + var returnString = ""; + if (format.indexOf(".") > -1) { + var decimalPortion = dec; + var decimalFormat = format.substring(format.lastIndexOf(".") + 1); + + // round or truncate number as needed + if (round) + number = new Number(number.toFixed(decimalFormat.length)); + else { + var numStr = number.toString(); + numStr = numStr.substring(0, numStr.lastIndexOf('.') + decimalFormat.length + 1); + number = new Number(numStr); + } + + var decimalValue = number % 1; + var decimalString = new String(decimalValue.toFixed(decimalFormat.length)); + decimalString = decimalString.substring(decimalString.lastIndexOf(".") + 1); + + for (var i = 0; i < decimalFormat.length; i++) { + if (decimalFormat.charAt(i) == '#' && decimalString.charAt(i) != '0') { + decimalPortion += decimalString.charAt(i); + } else if (decimalFormat.charAt(i) == '#' && decimalString.charAt(i) == '0') { + var notParsed = decimalString.substring(i); + if (notParsed.match('[1-9]')) { + decimalPortion += decimalString.charAt(i); + } else { + break; + } + } else if (decimalFormat.charAt(i) == "0") { + decimalPortion += decimalString.charAt(i); + } + } + returnString += decimalPortion; + } else { + number = Math.round(number); + } + var ones = Math.floor(number); + if (number < 0) + ones = Math.ceil(number); + + var onesFormat = ""; + if (format.indexOf(".") == -1) + onesFormat = format; + else + onesFormat = format.substring(0, format.indexOf(".")); + + var onePortion = ""; + if (!(ones == 0 && onesFormat.substr(onesFormat.length - 1) == '#') || forcedToZero) { + // find how many digits are in the group + var oneText = new String(Math.abs(ones)); + var groupLength = 9999; + if (onesFormat.lastIndexOf(",") != -1) + groupLength = onesFormat.length - onesFormat.lastIndexOf(",") - 1; + var groupCount = 0; + for (var i = oneText.length - 1; i > -1; i--) { + onePortion = oneText.charAt(i) + onePortion; + groupCount++; + if (groupCount == groupLength && i != 0) { + onePortion = group + onePortion; + groupCount = 0; + } + } + + // account for any pre-data padding + if (onesFormat.length > onePortion.length) { + var padStart = onesFormat.indexOf('0'); + if (padStart != -1) { + var padLen = onesFormat.length - padStart; + + // pad to left with 0's or group char + var pos = onesFormat.length - onePortion.length - 1; + while (onePortion.length < padLen) { + var padChar = onesFormat.charAt(pos); + // replace with real group char if needed + if (padChar == ',') + padChar = group; + onePortion = padChar + onePortion; + pos--; + } + } + } + } + + if (!onePortion && onesFormat.indexOf('0', onesFormat.length - 1) !== -1) + onePortion = '0'; + + returnString = onePortion + returnString; + + // handle special case where negative is in front of the invalid characters + if (number < 0 && negativeInFront && prefix.length > 0) + prefix = neg + prefix; + else if (number < 0) + returnString = neg + returnString; + + if (returnString.lastIndexOf(dec) == returnString.length - 1) { + returnString = returnString.substring(0, returnString.length - 1); + } + returnString = prefix + returnString + suffix; + return returnString; +} + + +//validation functions - used by textfield and datefield +jQuery.fn.validateField = function () { + var isValid = true; + + this.each(function () { + var el = $(this); + el.clearErrorAlert(); + + var value = el.val(); + if (value) { + var rett = true; + var type = (el.attr('entryType')+"").toUpperCase(); + var errParam; + + if (type == "INTEGER") { + rett = isValidInteger(value); + } else if (type == "DOUBLE") { + rett = isValidDouble(value); + } else if (type == "PERCENTILE") { + rett = isValidDouble(value); + } else if (type == "URL") { + rett = isValidURL(value); + } else if (type == "EMAIL") { + rett = isValidEmail(value); + } else if (type == "DURATIONMILLIS") { + rett = isValidDurationMillis(value); + } else if (type == "DURATIONDAYS") { + rett = isValidDurationDays(value); + } else if (type == "DATE") { + rett = Date.isValid(value, el.attr("format"), true); + if (!rett) + errParam = el.attr("format"); + } else if (type == "TIME") { + rett = isValidTime(value); + } else if (type == "CURRENCY") { + rett = isValidCurrency(value); + } + + if (!rett) { + el.createErrorAlert(i18n.ERROR_ON_FIELD, i18n.INVALID_DATA + (errParam ? " " + errParam : "")); + isValid=false; + } + + + //check limits minValue : maxValue + if (rett && (el.attr("minValue") || el.attr("maxValue"))){ + var val=value; + var min=el.attr("minValue"); + var max=el.attr("maxValue"); + if (type == "INTEGER") { + val=parseInt(value); + min=parseInt(min); + max=parseInt(max); + } else if (type == "DOUBLE" || type == "PERCENTILE") { + val=parseDouble(value); + min=parseDouble(min); + max=parseDouble(max); + } else if (type == "URL") { + val=value; + } else if (type == "EMAIL") { + val=value; + } else if (type == "DURATIONMILLIS") { + val=millisFromString(value); + min=millisFromString(min); + max=millisFromString(max); + + } else if (type == "DURATIONDAYS") { + val=daysFromString(value); + min=daysFromString(min); + max=daysFromString(max); + } else if (type == "DATE") { + val=Date.parseString(value, el.attr("format"),true).getTime(); + min=Date.parseString(min, el.attr("format"),true).getTime(); + max=Date.parseString(max, el.attr("format"),true).getTime(); + } else if (type == "TIME") { + val = millisFromHourMinute(value); + min = millisFromHourMinute(min); + max = millisFromHourMinute(max); + } else if (type == "CURRENCY") { + val=getCurrencyValue(value); + min=getCurrencyValue(min); + max=getCurrencyValue(max); + } + + if (el.attr("minValue") && valmax){ + el.createErrorAlert(i18n.ERROR_ON_FIELD, i18n.OUT_OF_BOUDARIES + " ("+(el.attr("minValue")?el.attr("minValue"):"--")+" : "+el.attr("maxValue")+")"); + rett=false; + isValid=false; + } + + } + + } + + }); + + return isValid; +}; + +jQuery.fn.clearErrorAlert = function () { + this.each(function () { + var el = $(this); + el.removeAttr("invalid").removeClass("formElementsError"); + $("#" + el.prop("id") + "error").remove(); + }); + return this; +}; + +jQuery.fn.createErrorAlert = function (errorCode, message) { + this.each(function () { + var el = $(this); + el.attr("invalid", "true").addClass("formElementsError"); + if ($("#" + el.prop("id") + "error").length <= 0) { + var errMess = (errorCode ? errorCode : "") + ": " + (message ? message : ""); + var err = " "; + err += "\n"; + err = $(err); + err.prop("title", errMess); + el.after(err); + } + }); + return this; +}; + + +// button submit support BEGIN ------------------ + +function saveFormValues(idForm) { + var formx = obj(idForm); + formx.setAttribute("savedAction", formx.action); + formx.setAttribute("savedTarget", formx.target); + var el = formx.elements; + for (i = 0; i < el.length; i++) { + if (el[i].getAttribute("savedValue") != null) { + el[i].setAttribute("savedValue", el[i].value); + } + } +} + +function restoreFormValues(idForm) { + var formx = obj(idForm); + formx.action = formx.getAttribute("savedAction"); + formx.target = formx.getAttribute("savedTarget"); + var el = formx.elements; + for (i = 0; i < el.length; i++) { + if (el[i].getAttribute("savedValue") != null) { + el[i].value = el[i].getAttribute("savedValue"); + } + } +} + +function changeActionAndSubmit(action,command){ + var f=$("form:first"); + f.prop("action",action); + f.find("[name=CM]").val(command); + f.submit(); +} + + + +// textarea limit size ------------------------------------------------- +function limitSize(ob) { + if (ob.getAttribute("maxlength")) { + var ml =parseInt(ob.getAttribute("maxlength")); + var val = ob.value;//.replace(/\r\n/g,"\n"); + if (val.length > ml) { + ob.value = val.substr(0, ml); + $(ob).createErrorAlert("Error",i18n.ERR_FIELD_MAX_SIZE_EXCEEDED); + } else { + $(ob).clearErrorAlert(); + } + } + return true; +} + + +// verify before unload BEGIN ---------------------------------------------------------------------------- + +function alertOnUnload(container) { + //console.debug("alertOnUnload",container,muteAlertOnChange); + if (!muteAlertOnChange) { + + //first try to call a function eventually defined on the page + if (typeof(managePageUnload) == "function") + managePageUnload(); + + container=container||$("body"); + var inps= $("[alertonchange=true]",container).find("[oldValue=1]"); + for (var j = 0; j < inps.length; j++) { + var anInput = inps.eq(j); + //console.debug(j,anInput,anInput.isValueChanged()) + var oldValue = anInput.getOldValue() + ""; + if (!('true' == '' + anInput.attr('excludeFromAlert'))) { + if (anInput.attr("maleficoTiny")) { + if (tinymce.EditorManager.get(anInput.prop("id")).isDirty()) { + return i18n.FORM_IS_CHANGED + " \"" + anInput.prop("name") + "\""; + } + + } else if (anInput.isValueChanged()) { + var inputLabel = $("label[for='" + anInput.prop("id") + "']").text(); //use label element + inputLabel = inputLabel ? inputLabel : anInput.prop("name"); + return i18n.FORM_IS_CHANGED + " \"" + inputLabel + "\""; + } + } + } + } + return undefined; +} + +function canILeave(){ + var ret = window.onbeforeunload(); + if (typeof(ret)!="undefined" && !confirm(ret+" \n"+i18n.PROCEED)) + return false; + else + return true; +} + +// ---------------------------------- oldvalues management +// update all values selected +jQuery.fn.updateOldValue = function () { + this.each(function () { + var el = $(this); + var val=(el.is(":checkbox,:radio")?el.prop("checked"):el.val())+""; + el.data("_oldvalue", val); + }); + return this; +}; + +// return true if at least one element has changed +jQuery.fn.isValueChanged = function () { + var ret = false; + this.each(function () { + var el = $(this); + var val=(el.is(":checkbox,:radio")?el.prop("checked"):el.val())+""; + if (val != el.data("_oldvalue") + "") { + //console.debug("io sono diverso "+el.prop("id")+ " :"+el.val()+" != "+el.data("_oldvalue")); + ret = true; + return false; + } + }); + return ret; +}; + +jQuery.fn.getOldValue = function () { + return $(this).data("_oldvalue"); +}; + +jQuery.fn.fillJsonWithInputValues = function (jsonObject) { + var inputs = this.find(":input"); + $.each(inputs.serializeArray(),function(){ + if (this.name) { + jsonObject[this.name] = this.value; + } + }); + + inputs.filter(":checkbox[name]").each(function () { + var el = $(this); + jsonObject[el.attr("name")] = el.is(":checked") ? "yes" : "no"; + + }) + + return this; +}; + + + +function enlargeTextArea(immediate) { + //console.debug("enlargeTextArea",immediate); + var el = $(this); + + var delay=immediate===true?1:300; + el.stopTime("taResizeApply"); + el.oneTime(delay,"taResizeApply",function(){ + + var miH = el.is("[minHeight]") ? parseInt(el.attr("minHeight")) : 30; + var maH = el.is("[maxHeight]") ? parseInt(el.attr("maxHeight")) : 400; + var inc = el.is("[lineHeight]") ? parseInt(el.attr("lineHeight")) : 30; + + //si copiano nel css per sicurezza + el.css({maxHeight:maH,minHeight:miH}); + + var domEl = el.get(0); + var pad = el.outerHeight()-el.height(); + //devo allargare + if (domEl.scrollHeight>el.outerHeight() && el.outerHeight()maH-pad?maH-pad:nh; + el.height(nh); + } else if (el.height()>miH){ + //devo stringere + el.height(el.height()-inc); + + while(el.outerHeight()-domEl.scrollHeight > 0 && el.height()>miH){ + el.height(el.height()-inc); + } + var newH=domEl.scrollHeight-pad +inc; + //newH=newH -1 || holidays.indexOf(md) > -1; +} + + + +var i18n = { + YES: "Yes", + NO: "No", + FLD_CONFIRM_DELETE: "confirm the deletion?", + INVALID_DATA: "The data inserted are invalid for the field format.", + ERROR_ON_FIELD: "Error on field", + OUT_OF_BOUDARIES: "Out of field admitted values:", + CLOSE_ALL_CONTAINERS:"close all?", + DO_YOU_CONFIRM: "Do you confirm?", + ERR_FIELD_MAX_SIZE_EXCEEDED: "Field max size exceeded", + WEEK_SHORT: "W.", + + FILE_TYPE_NOT_ALLOWED:"File type not allowed.", + FILE_UPLOAD_COMPLETED:"File upload completed.", + UPLOAD_MAX_SIZE_EXCEEDED:"Max file size exceeded", + ERROR_UPLOADING:"Error uploading", + UPLOAD_ABORTED:"Upload aborted", + DROP_HERE:"Drop files here", + + FORM_IS_CHANGED: "You have some unsaved data on the page!", + + PIN_THIS_MENU: "PIN_THIS_MENU", + UNPIN_THIS_MENU: "UNPIN_THIS_MENU", + OPEN_THIS_MENU: "OPEN_THIS_MENU", + CLOSE_THIS_MENU: "CLOSE_THIS_MENU", + PROCEED: "Proceed?", + + PREV: "Previous", + NEXT: "Next", + HINT_SKIP: "Got it, close this hint.", + + WANT_TO_SAVE_FILTER: "save this filter", + NEW_FILTER_NAME: "name of the new filter", + SAVE: "Save", + DELETE: "Delete", + HINT_SKIP: "Got it, close this hint.", + + COMBO_NO_VALUES: "no values available...?", + + FILTER_UPDATED:"Filter updated.", + FILTER_SAVED:"Filter correctly saved." + +}; + + diff --git a/jQueryGantt/jQueryGantt/libs/i18nJs_cn.js b/jQueryGantt/jQueryGantt/libs/i18nJs_cn.js new file mode 100644 index 0000000000000000000000000000000000000000..3e9278e6d4e1285d44d8896366e3f9b4ca2f5c9c --- /dev/null +++ b/jQueryGantt/jQueryGantt/libs/i18nJs_cn.js @@ -0,0 +1,195 @@ +/* + Copyright (c) 2012-2017 Open Lab + 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. + */ + + +function dateToRelative(localTime){ + var diff=new Date().getTime()-localTime; + var ret=""; + + var min=60000; + var hour=3600000; + var day=86400000; + var wee=604800000; + var mon=2629800000; + var yea=31557600000; + + if (diff<-yea*2) + ret ="in ## years".replace("##",(-diff/yea).toFixed(0)); + + else if (diff<-mon*9) + ret ="in ## months".replace("##",(-diff/mon).toFixed(0)); + + else if (diff<-wee*5) + ret ="in ## weeks".replace("##",(-diff/wee).toFixed(0)); + + else if (diff<-day*2) + ret ="in ## days".replace("##",(-diff/day).toFixed(0)); + + else if (diff<-hour) + ret ="in ## hours".replace("##",(-diff/hour).toFixed(0)); + + else if (diff<-min*35) + ret ="in about one hour"; + + else if (diff<-min*25) + ret ="in about half hour"; + + else if (diff<-min*10) + ret ="in some minutes"; + + else if (diff<-min*2) + ret ="in few minutes"; + + else if (diff<=min) + ret ="just now"; + + else if (diff<=min*5) + ret ="few minutes ago"; + + else if (diff<=min*15) + ret ="some minutes ago"; + + else if (diff<=min*35) + ret ="about half hour ago"; + + else if (diff<=min*75) + ret ="about an hour ago"; + + else if (diff<=hour*5) + ret ="few hours ago"; + + else if (diff<=hour*24) + ret ="## hours ago".replace("##",(diff/hour).toFixed(0)); + + else if (diff<=day*7) + ret ="## days ago".replace("##",(diff/day).toFixed(0)); + + else if (diff<=wee*5) + ret ="## weeks ago".replace("##",(diff/wee).toFixed(0)); + + else if (diff<=mon*12) + ret ="## months ago".replace("##",(diff/mon).toFixed(0)); + + else + ret ="## years ago".replace("##",(diff/yea).toFixed(0)); + + return ret; +} + +//override date format i18n + +Date.monthNames = ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]; +// Month abbreviations. Change this for local month names +Date.monthAbbreviations = ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]; +// Full day names. Change this for local month names +Date.dayNames =["日","一","二","三","四","五","六"]; +// Day abbreviations. Change this for local month names +Date.dayAbbreviations = ["日","一","二","三","四","五","六"]; +// Used for parsing ambiguous dates like 1/2/2000 - default to preferring 'American' format meaning Jan 2. +// Set to false to prefer 'European' format meaning Feb 1 +Date.preferAmericanFormat = false; + +Date.firstDayOfWeek =0; +Date.defaultFormat = "M/d/yyyy"; +Date.masks = { + fullDate: "EEEE, MMMM d, yyyy", + shortTime: "h:mm a" +}; +Date.today="Today"; + +Number.decimalSeparator = "."; +Number.groupingSeparator = ","; +Number.minusSign = "-"; +Number.currencyFormat = "###,##0.00"; + + + +var millisInWorkingDay =28800000; +var workingDaysPerWeek =5; + +function isHoliday(date) { + var friIsHoly =false; + var satIsHoly =true; + var sunIsHoly =true; + + var pad = function (val) { + val = "0" + val; + return val.substr(val.length - 2); + }; + + var holidays = "##"; + + var ymd = "#" + date.getFullYear() + "_" + pad(date.getMonth() + 1) + "_" + pad(date.getDate()) + "#"; + var md = "#" + pad(date.getMonth() + 1) + "_" + pad(date.getDate()) + "#"; + var day = date.getDay(); + + return (day == 5 && friIsHoly) || (day == 6 && satIsHoly) || (day == 0 && sunIsHoly) || holidays.indexOf(ymd) > -1 || holidays.indexOf(md) > -1; +} + + + +var i18n = { + YES: "确定", + NO: "取消", + FLD_CONFIRM_DELETE: "确认删除?", + INVALID_DATA: "录入的时间格式无效.", + ERROR_ON_FIELD: "字段上有错误,请检查", + OUT_OF_BOUDARIES: "超出字段最大允许值:", + CLOSE_ALL_CONTAINERS:"确认关闭所有?", + DO_YOU_CONFIRM: "你确认了吗?", + ERR_FIELD_MAX_SIZE_EXCEEDED: "超出最大可录入数量", + WEEK_SHORT: "累计周:", + + FILE_TYPE_NOT_ALLOWED:"文件类型不允许.", + FILE_UPLOAD_COMPLETED:"文件上传完成.", + UPLOAD_MAX_SIZE_EXCEEDED:"文件太大,超过最大值", + ERROR_UPLOADING:"上传错误", + UPLOAD_ABORTED:"上传中断", + DROP_HERE:"删除文件", + + FORM_IS_CHANGED: "页面上的内容没有保存!", + + PIN_THIS_MENU: "PIN_THIS_MENU", + UNPIN_THIS_MENU: "UNPIN_THIS_MENU", + OPEN_THIS_MENU: "OPEN_THIS_MENU", + CLOSE_THIS_MENU: "CLOSE_THIS_MENU", + PROCEED: "Proceed?", + + PREV: "上一步", + NEXT: "下一步", + HINT_SKIP: "好的,关闭提示。", + + WANT_TO_SAVE_FILTER: "保存这个过滤器", + NEW_FILTER_NAME: "新过滤器的名称", + SAVE: "保存", + DELETE: "删除", + HINT_SKIP: "好的,关闭提示。", + + COMBO_NO_VALUES: "没有可用的值?", + + FILTER_UPDATED:"过滤器更新。", + FILTER_SAVED:"过滤器正确保存。" + +}; + + + diff --git a/jQueryGantt/jQueryGantt/libs/jquery/JST/jquery.JST.js b/jQueryGantt/jQueryGantt/libs/jquery/JST/jquery.JST.js new file mode 100644 index 0000000000000000000000000000000000000000..78557168a44f14874bd516659945caa594a1a4f7 --- /dev/null +++ b/jQueryGantt/jQueryGantt/libs/jquery/JST/jquery.JST.js @@ -0,0 +1,174 @@ +$.fn.loadTemplates = function() { + $.JST.loadTemplates($(this)); + return this; +}; + +$.JST = { + _templates: new Object(), + _decorators:new Object(), + + loadTemplates: function(elems) { + elems.each(function() { + $(this).find(".__template__").each(function() { + var tmpl = $(this); + var type = tmpl.attr("type"); + + //template may be inside or not in case of ajax loaded templates + var found=false; + var el=tmpl.get(0).firstChild; + while (el && !found) { + if (el.nodeType == 8) { // 8==comment + var templateBody = el.nodeValue; // this is inside the comment + found=true; + break; + } + el=el.nextSibling; + } + if (!found) + var templateBody = tmpl.html(); // this is the whole template + + if (!templateBody.match(/##\w+##/)) { // is Resig' style? e.g. (#=id#) or (# ...some javascript code 'obj' is the alias for the object #) + var strFunc = + "var p=[],print=function(){p.push.apply(p,arguments);};" + + "with(obj){p.push('" + + templateBody.replace(/[\r\t\n]/g, " ") + .replace(/'(?=[^#]*#\))/g, "\t") + .split("'").join("\\'") + .split("\t").join("'") + .replace(/\(#=(.+?)#\)/g, "',$1,'") + .split("(#").join("');") + .split("#)").join("p.push('") + + "');}return p.join('');"; + + try { + $.JST._templates[type] = new Function("obj", strFunc); + } catch (e) { + console.error("JST error: "+type, e,strFunc); + } + + } else { //plain template e.g. ##id## + try { + $.JST._templates[type] = templateBody; + } catch (e) { + console.error("JST error: "+type, e,templateBody); + } + } + + tmpl.remove(); + + }); + }); + }, + + createFromTemplate: function(jsonData, template, transformToPrintable) { + var templates = $.JST._templates; + + var jsData=new Object(); + if (transformToPrintable){ + for (var prop in jsonData){ + var value = jsonData[prop]; + if (typeof(value) == "string") + value = (value + "").replace(/\n/g, "
"); + jsData[prop]=value; + } + } else { + jsData=jsonData; + } + + function fillStripData(strip, data) { + for (var prop in data) { + var value = data[prop]; + + strip = strip.replace(new RegExp("##" + prop + "##", "gi"), value); + } + // then clean the remaining ##xxx## + strip = strip.replace(new RegExp("##\\w+##", "gi"), ""); + return strip; + } + + var stripString = ""; + if (typeof(template) == "undefined") { + alert("Template is required"); + stripString = "
Template is required
"; + + } else if (typeof(templates[template]) == "function") { // resig template + try { + stripString = templates[template](jsData);// create a jquery object in memory + } catch (e) { + console.error("JST error: "+template,e.message); + stripString = "
ERROR: "+template+"
" + e.message + "
"; + } + + } else { + stripString = templates[template]; // recover strip template + if (!stripString || stripString.trim() == "") { + console.error("No template found for type '" + template + "'"); + return $("
"); + + } else { + stripString = fillStripData(stripString, jsData); //replace placeholders with data + } + } + + var ret = $(stripString);// create a jquery object in memory + ret.attr("__template", template); // set __template attribute + + //decorate the strip + var dec = $.JST._decorators[template]; + if (typeof (dec) == "function") + dec(ret, jsData); + + return ret; + }, + + + existsTemplate: function(template) { + return $.JST._templates[template]; + }, + + //decorate function is like function(domElement,jsonData){...} + loadDecorator:function(template, decorator) { + $.JST._decorators[template] = decorator; + }, + + getDecorator:function(template) { + return $.JST._decorators[template]; + }, + + decorateTemplate:function(element) { + var dec = $.JST._decorators[element.attr("__template")]; + if (typeof (dec) == "function") + dec(editor); + }, + + // asynchronous + ajaxLoadAsynchTemplates: function(templateUrl, callback) { + + $.get(templateUrl, function(data) { + + var div = $("
"); + div.html(data); + + $.JST.loadTemplates(div); + + if (typeof(callback == "function")) + callback(); + },"html"); + }, + + ajaxLoadTemplates: function(templateUrl) { + $.ajax({ + async:false, + url: templateUrl, + dataType: "html", + success: function(data) { + var div = $("
"); + div.html(data); + $.JST.loadTemplates(div); + } + }); + + } + + +}; diff --git a/jQueryGantt/jQueryGantt/libs/jquery/dateField/img/next.png b/jQueryGantt/jQueryGantt/libs/jquery/dateField/img/next.png new file mode 100644 index 0000000000000000000000000000000000000000..c9a9cc9ac22e59aeef5320ec801b4c2f5e5754c4 Binary files /dev/null and b/jQueryGantt/jQueryGantt/libs/jquery/dateField/img/next.png differ diff --git a/jQueryGantt/jQueryGantt/libs/jquery/dateField/img/prev.png b/jQueryGantt/jQueryGantt/libs/jquery/dateField/img/prev.png new file mode 100644 index 0000000000000000000000000000000000000000..9de575e01900c3c5f6036d3bfd83e229a857ac47 Binary files /dev/null and b/jQueryGantt/jQueryGantt/libs/jquery/dateField/img/prev.png differ diff --git a/jQueryGantt/jQueryGantt/libs/jquery/dateField/img/today.png b/jQueryGantt/jQueryGantt/libs/jquery/dateField/img/today.png new file mode 100644 index 0000000000000000000000000000000000000000..6e85c95d76dbb66c8050704717b8e3589af0ff59 Binary files /dev/null and b/jQueryGantt/jQueryGantt/libs/jquery/dateField/img/today.png differ diff --git a/jQueryGantt/jQueryGantt/libs/jquery/dateField/jquery.dateField.css b/jQueryGantt/jQueryGantt/libs/jquery/dateField/jquery.dateField.css new file mode 100644 index 0000000000000000000000000000000000000000..00029074a4241c4079d240dbf6d44979f8344536 --- /dev/null +++ b/jQueryGantt/jQueryGantt/libs/jquery/dateField/jquery.dateField.css @@ -0,0 +1,121 @@ +.calBox { + background-color: #999; + text-align: center; + color: white; + width:200px; + position:absolute; + padding-bottom: 10px; +} + +.calElement,.calDayHeader { + padding: 1px; + display: inline-block; + overflow:hidden; +} + +.calDayHeader { + padding: 4px; + display: inline-block; + background-color:#55b6c7 +} + +.calNav { + height: 20px; +} + +.calNavBar { + padding: 5px; + background-color: rgba(0, 0, 0, 0.25) +} + + +.calDay .calElement, .calDay .calDayHeader { + border: 1px solid transparent; +} + +.calDay .calElement.holy { + /*background-color: rgba(236, 195, 176, 0.40);*/ + color: #81d7e2; + +} + +.calDay .calDayHeader { + font-size: 8px; + text-transform: uppercase; +} + +.calElement.prev, +.calElement.goToday, +.calElement.next { + width: 16px; + height: 18px; + border: none; + margin-top: 0 +} +.calElement.prev { + background: transparent url(img/prev.png) no-repeat 5px center; + float:left; +} + +.calElement.goToday { + background: transparent url(img/today.png) no-repeat 5px center; + float:left; +} + +.calElement.next { + background: transparent url(img/next.png) no-repeat 5px center; + float:right; +} + +.calElement:hover{ + background-color: transparent; + border:none; + cursor: pointer; + opacity: 0.6 +} + +.calDay .calElement .dayNumber { + font-size: 20px; +} + +.calDay.calFullMonth .dayNumber { + font-size: 14px; +} +.calDay .calOutOfScope{ + color: #b1b0b0; +} + +.calElement.selected { + border: 1px solid #404040; +} + +.calElement:hover { + background-color: #404040; + border: 1px solid #404040; + cursor: pointer; +} + + +.calElement.today { + border: 1px solid #c84e48; +} + + +.shortCuts { + /*border-top: 1px solid rgba(0, 0, 0, 0.25);*/ + padding: 3px 0 6px; + background-color: rgba(97, 215, 232, 0.50) +} + +.shortCuts span{ + font-size: 11px; + border: 1px dotted #617777; + width: 23px; + display: inline-block; + cursor: pointer +} + +.shortCuts span:hover { + background-color: rgba(0, 0, 0, 0.25) +} + diff --git a/jQueryGantt/jQueryGantt/libs/jquery/dateField/jquery.dateField.js b/jQueryGantt/jQueryGantt/libs/jquery/dateField/jquery.dateField.js new file mode 100644 index 0000000000000000000000000000000000000000..b389b9cfe08fb6085fe45d9819eb0b0065f8b27d --- /dev/null +++ b/jQueryGantt/jQueryGantt/libs/jquery/dateField/jquery.dateField.js @@ -0,0 +1,335 @@ +/* + Copyright (c) 2009 Open Lab + Written by Roberto Bicchierai http://roberto.open-lab.com + 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. +*/ + +jQuery.fn.dateField = function(options) { + //console.debug("dateField",options); + //check if the input field is passed correctly + if (!options.inputField){ + console.error("You must supply an input field"); + return false; + } + + // -------------------------- start default option values -------------------------- + + if (typeof(options.firstDayOfWeek) == "undefined") + options.firstDayOfWeek=Date.firstDayOfWeek; + + if (typeof(options.useWheel) == "undefined") + options.useWheel=true; + + if (typeof(options.dateFormat) == "undefined") + options.dateFormat=Date.defaultFormat; + + if (typeof(options.todayLabel) == "undefined") + options.todayLabel=Date.today; + + /* optional + options.notBeforeMillis //disable buttons if before millis + options.notAfterMillis //disable buttons if after millis + options.width // imposta una larghezza al calendario + options.height + options.showToday // show "today" on the year or month bar + options.centerOnScreen //se true centra invece che usa nearBestPosition + options.useYears:0 // se >0 non disegna prev-next ma n anni prima e n anni dopo quello corrente + options.useMonths:0 // se >0 non disegna prev-next ma n mesi prima e n mesi dopo quello corrente + */ + // -------------------------- end default option values -------------------------- + + + + // ------------------ start + if(options.inputField.is("[readonly]") && !options.inputField.is(".noFocus") || options.inputField.is("[disabled]")) + return; + + var calendar = {currentDate: new Date()}; + calendar.options = options; + + //build the calendar on the first element in the set of matched elements. + var theOpener = this.eq(0); + var theDiv=$("
").addClass("calBox"); + + if(options.width) + theDiv.css("width",options.width); + + if(options.height) + theDiv.css("height",options.height); + + + //create calendar elements elements + var divNavBar = $("
").addClass("calNav"); + var divDays = $("
").addClass("calDay"); + + divDays.addClass("calFullMonth"); + theDiv.append(divNavBar).append(divDays); + + if (options.isSearchField){ + var divShortcuts=$("
").addClass("shortCuts").html("LQ LM M LW W Y TTONW NM Q NQ"); + divShortcuts.click(function(ev){ + var el=$(ev.target); + if(el.is("span")){ + if (!options.isSearchField) + options.inputField.val(Date.parseString(el.text().trim(),options.dateFormat,true).format(options.dateFormat)); + else + options.inputField.val(el.text().trim()); + calendar.closeCalendar() + } + }); + theDiv.append(divShortcuts); + } + + //mobile management + if ($("body").is(".mobile")){ + enableComponentOverlay(options.inputField,theDiv); + } + $("body").append(theDiv); + + + if (options.centerOnScreen){ + theDiv.oneTime(10,"ce",function(){$(this).centerOnScreen()}); + } else { + nearBestPosition(theOpener,theDiv); + } + theDiv.css("z-index",10000); + + + //register for click outside. Delayed to avoid it run immediately + $("body").oneTime(100, "regclibodcal", function() { + $("body").bind("click.dateField", function() { + calendar.closeCalendar(); + }); + }); + + + calendar.drawCalendar = function(date) { + calendar.currentDate = date; + //console.debug("drawCalendar",date); + + + var fillNavBar = function(date) { + //console.debug("fillNavBar",date); + var today = new Date();//today + divNavBar.empty(); + + var showToday = options.showToday; + //use the classic prev next bar + if (!options.useYears && !options.useMonths) { + var t = new Date(date.getTime()); + t.setDate(1); + t.setMonth(t.getMonth() - 1); + var spanPrev = $("").addClass("calElement noCallback prev").attr("millis", t.getTime()); + var spanToday = $("").addClass("calElement noCallback goToday").attr("millis", new Date().getTime()).attr("title", "today"); + t.setMonth(t.getMonth() + 1); + var spanMonth = $("").html(t.format("MMMM yyyy")); + t.setMonth(t.getMonth() + 1); + var spanNext = $("").addClass("calElement noCallback next").attr("millis", t.getTime()); + divNavBar.append(spanPrev, spanToday, spanMonth, spanNext); + + // use the year month bar + } else { + if (options.useYears>0){ + options.useMonths=options.useMonths||1; //if shows years -> shows also months + t = new Date(date.getTime()); + var yB= $("
"); + var w=100/(2*options.useYears+1+(showToday?1:0)); + t.setFullYear(t.getFullYear()-options.useYears); + if(showToday){ + var s = $("").addClass("calElement noCallback goToday").attr("millis", today.getTime()).append(options.todayLabel).css("width",w+"%"); + showToday=false; + yB.append(s); + } + for (var i=-options.useYears;i<=options.useYears;i++){ + var s = $("").addClass("calElement noCallback").attr("millis", t.getTime()).append(t.getFullYear()).css("width",w+"%"); + if (today.getFullYear()== t.getFullYear()) //current year + s.addClass("today"); + if (i==0) //selected year + s.addClass("selected"); + + yB.append(s); + t.setFullYear(t.getFullYear()+1); + } + divNavBar.append(yB); + } + if (options.useMonths>0){ + t = new Date(date.getTime()); + t.setDate(1); + var w=100/(2*options.useMonths+1+(showToday?1:0)); + t.setMonth(t.getMonth()-options.useMonths); + var yB= $("
"); + + if(showToday){ + var s = $("").addClass("calElement noCallback goToday").attr("millis", today.getTime()).append(options.todayLabel).css("width",w+"%"); + yB.append(s); + } + + for (var i=-options.useMonths;i<=options.useMonths;i++){ + var s = $("").addClass("calElement noCallback").attr("millis", t.getTime()).append(t.format("MMM")).css("width",w+"%"); + if (today.getFullYear()== t.getFullYear() && today.getMonth()== t.getMonth()) //current year + s.addClass("today"); + if (i==0) //selected month + s.addClass("selected"); + yB.append(s); + t.setMonth(t.getMonth()+1); + } + divNavBar.append(yB); + } + } + + }; + + var fillDaysFullMonth = function(date) { + divDays.empty(); + var today = new Date();//today + var w = 100/7; + // draw day headers + var d = new Date(date); + d.setFirstDayOfThisWeek(options.firstDayOfWeek); + for (var i = 0; i < 7; i++) { + var span = $("").addClass("calDayHeader").attr("day", d.getDay()); + if (d.isHoliday()) + span.addClass("holy"); + span.css("width",w+"%"); + span.html(Date.dayAbbreviations[d.getDay()]); + + //call the dayHeaderRenderer + if (typeof(options.dayHeaderRenderer) == "function") + options.dayHeaderRenderer(span,d.getDay()); + + divDays.append(span); + d.setDate(d.getDate()+1); + } + + //draw cells + d = new Date(date); + d.setDate(1); // set day to start of month + d.setFirstDayOfThisWeek(options.firstDayOfWeek);//go to first day of week + + var i=0; + + while ((d.getMonth()<=date.getMonth() && d.getFullYear()<=date.getFullYear()) || d.getFullYear()").addClass("calElement day").attr("millis", d.getTime()); + + span.html("" + d.getDate() + "").css("width",w+"%"); + if (d.getYear() == today.getYear() && d.getMonth() == today.getMonth() && d.getDate() == today.getDate()) + span.addClass("today"); + if (d.getYear() == date.getYear() && d.getMonth() == date.getMonth() && d.getDate() == date.getDate()) + span.addClass("selected"); + + if (d.isHoliday()) + span.addClass("holy"); + + if(d.getMonth()!=date.getMonth()) + span.addClass("calOutOfScope"); + + //call the dayRenderer + if (typeof(options.dayRenderer) == "function") + options.dayRenderer(span,d); + + divDays.append(span); + d.setDate(d.getDate()+1); + i++; + } + + }; + + fillNavBar(date); + fillDaysFullMonth(date); + + //disable all buttons out of validity period + if (options.notBeforeMillis ||options.notAfterMillis) { + var notBefore = options.notBeforeMillis ? options.notBeforeMillis : Number.MIN_VALUE; + var notAfter = options.notAfterMillis ? options.notAfterMillis : Number.MAX_VALUE; + divDays.find(".calElement[millis]").each(function(){ + var el=$(this); + var m=parseInt(el.attr("millis")); + if (m>notAfter || m 0) { + var millis = parseInt(el.attr("millis")); + var date = new Date(millis); + + if (el.is(".disabled")) { + ev.stopPropagation(); + return; + } + + if (el.hasClass("day")) { + calendar.closeCalendar(); + if (!el.is(".noCallback")) { + options.inputField.val(date.format(options.dateFormat)).attr("millis", date.getTime()).focus(); + if (typeof(options.callback) == "function") + options.callback.apply(options.inputField,[date]); // in callBack you can use "this" that refers to the input + } + } else { + calendar.drawCalendar(date); + } + } + ev.stopPropagation(); + }); + + + //if mousewheel + if ($.event.special.mousewheel && options.useWheel) { + divDays.mousewheel(function(event, delta) { + var d = new Date(calendar.currentDate.getTime()); + d.setMonth(d.getMonth() + delta); + calendar.drawCalendar(d); + return false; + }); + } + + + // start calendar to the date in the input + var dateStr=options.inputField.val(); + + if (!dateStr || !Date.isValid(dateStr,options.dateFormat,true)){ + calendar.drawCalendar(new Date()); + } else { + var date = Date.parseString(dateStr,options.dateFormat,true); + var newDateStr=date.format(options.dateFormat); + //set date string formatted if not equals + if (!options.isSearchField) { + options.inputField.attr("millis", date.getTime()); + if (dateStr != newDateStr) + options.inputField.val(newDateStr); + } + calendar.drawCalendar(date); + } + + return calendar; +}; diff --git a/jQueryGantt/jQueryGantt/libs/jquery/jquery-ui.min.js b/jQueryGantt/jQueryGantt/libs/jquery/jquery-ui.min.js new file mode 100644 index 0000000000000000000000000000000000000000..117cb35e4311c6b26cd903ad7e4af3e9cebb8db9 --- /dev/null +++ b/jQueryGantt/jQueryGantt/libs/jquery/jquery-ui.min.js @@ -0,0 +1,13 @@ +/*! jQuery UI - v1.12.1 - 2016-09-14 +* http://jqueryui.com +* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js +* Copyright jQuery Foundation and other contributors; Licensed MIT */ + +(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){for(var e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}function i(t){for(var e,i;t.length&&t[0]!==document;){if(e=t.css("position"),("absolute"===e||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}function s(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.regional.en=t.extend(!0,{},this.regional[""]),this.regional["en-US"]=t.extend(!0,{},this.regional.en),this.dpDiv=n(t("
"))}function n(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.on("mouseout",i,function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",i,o)}function o(){t.datepicker._isDisabledDatepicker(m.inline?m.dpDiv.parent()[0]:m.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))}function a(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}function r(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t.ui=t.ui||{},t.ui.version="1.12.1";var h=0,l=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},h=e.split(".")[0];e=e.split(".")[1];var l=h+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][l.toLowerCase()]=function(e){return!!t.data(e,l)},t[h]=t[h]||{},n=t[h][e],o=t[h][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:h,widgetName:e,widgetFullName:l}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,s,n=l.call(arguments,1),o=0,a=n.length;a>o;o++)for(i in n[o])s=n[o][i],n[o].hasOwnProperty(i)&&void 0!==s&&(e[i]=t.isPlainObject(s)?t.isPlainObject(e[i])?t.widget.extend({},e[i],s):t.widget.extend({},s):s);return e},t.widget.bridge=function(e,i){var s=i.prototype.widgetFullName||e;t.fn[e]=function(n){var o="string"==typeof n,a=l.call(arguments,1),r=this;return o?this.length||"instance"!==n?this.each(function(){var i,o=t.data(this,s);return"instance"===n?(r=o,!1):o?t.isFunction(o[n])&&"_"!==n.charAt(0)?(i=o[n].apply(o,a),i!==o&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+n+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+n+"'")}):r=void 0:(a.length&&(n=t.widget.extend.apply(null,[n].concat(a))),this.each(function(){var e=t.data(this,s);e?(e.option(n||{}),e._init&&e._init()):t.data(this,s,new i(n,this))})),r}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,i){i=t(i||this.defaultElement||this)[0],this.element=t(i),this.uuid=h++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},i!==this&&(t.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===i&&this.destroy()}}),this.document=t(i.style?i.ownerDocument:i.document||i),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-h,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}});var c="ui-effects-",u="ui-effects-style",d="ui-effects-animated",p=t;t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(t,o){var a,r=o.re.exec(i),h=r&&o.parse(r),l=o.space||"rgba";return h?(a=s[l](h),s[c[l].cache]=a[c[l].cache],n=s._rgba=a._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,o.transparent),s):o[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],l=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=l.support={},p=t("

")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),l.fn=t.extend(l.prototype,{parse:function(n,a,r,h){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(a),a=e);var u=this,d=t.type(n),p=this._rgba=[];return a!==e&&(n=[n,a,r,h],d="array"),"string"===d?this.parse(s(n)||o._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof l?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var o=s.cache;f(s.props,function(t,e){if(!u[o]&&s.to){if("alpha"===t||null==n[t])return;u[o]=s.to(u._rgba)}u[o][e.idx]=i(n[t],e,!0)}),u[o]&&0>t.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,s.from&&(u._rgba=s.from(u[o])))}),this):e},is:function(t){var i=l(t),s=!0,n=this;return f(c,function(t,o){var a,r=i[o.cache];return r&&(a=n[o.cache]||o.to&&o.to(n._rgba)||[],f(o.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===a[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=l(t),n=s._space(),o=c[n],a=0===this.alpha()?l("transparent"):this,r=a[o.cache]||o.to(a._rgba),h=r.slice();return s=s[o.cache],f(o.props,function(t,n){var o=n.idx,a=r[o],l=s[o],c=u[n.type]||{};null!==l&&(null===a?h[o]=l:(c.mod&&(l-a>c.mod/2?a+=c.mod:a-l>c.mod/2&&(a-=c.mod)),h[o]=i((l-a)*e+a,n)))}),this[n](h)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(e)._rgba;return l(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,o=t[2]/255,a=t[3],r=Math.max(s,n,o),h=Math.min(s,n,o),l=r-h,c=r+h,u=.5*c;return e=h===r?0:s===r?60*(n-o)/l+360:n===r?60*(o-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=u?l/c:l/(2-c),[Math.round(e)%360,i,u,null==a?1:a]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],o=t[3],a=.5>=s?s*(1+i):s+i-s*i,r=2*s-a;return[Math.round(255*n(r,a,e+1/3)),Math.round(255*n(r,a,e)),Math.round(255*n(r,a,e-1/3)),o]},f(c,function(s,n){var o=n.props,a=n.cache,h=n.to,c=n.from;l.fn[s]=function(s){if(h&&!this[a]&&(this[a]=h(this._rgba)),s===e)return this[a].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[a].slice();return f(o,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=l(c(d)),n[a]=d,n):l(d)},f(o,function(e,i){l.fn[e]||(l.fn[e]=function(n){var o,a=t.type(n),h="alpha"===e?this._hsla?"hsla":"rgba":s,l=this[h](),c=l[i.idx];return"undefined"===a?c:("function"===a&&(n=n.call(this,c),a=t.type(n)),null==n&&i.empty?this:("string"===a&&(o=r.exec(n),o&&(n=c+parseFloat(o[2])*("+"===o[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var o,a,r="";if("transparent"!==n&&("string"!==t.type(n)||(o=s(n)))){if(n=l(o||n),!d.rgba&&1!==n._rgba[3]){for(a="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&a&&a.style;)try{r=t.css(a,"backgroundColor"),a=a.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=l(e.elem,i),e.end=l(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},l.hook(a),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},o=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(p),function(){function e(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,o={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(o[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(o[i]=n[i]);return o}function i(e,i){var s,o,a={};for(s in i)o=i[s],e[s]!==o&&(n[s]||(t.fx.step[s]||!isNaN(parseFloat(o)))&&(a[s]=o));return a}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(p.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(n,o,a,r){var h=t.speed(o,a,r);return this.queue(function(){var o,a=t(this),r=a.attr("class")||"",l=h.children?a.find("*").addBack():a;l=l.map(function(){var i=t(this);return{el:i,start:e(this)}}),o=function(){t.each(s,function(t,e){n[e]&&a[e+"Class"](n[e])})},o(),l=l.map(function(){return this.end=e(this.el[0]),this.diff=i(this.start,this.end),this}),a.attr("class",r),l=l.map(function(){var e=this,i=t.Deferred(),s=t.extend({},h,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,l.get()).done(function(){o(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),h.complete.call(a[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,o):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(e){return function(i,s,n,o,a){return"boolean"==typeof s||void 0===s?n?t.effects.animateClass.call(this,s?{add:i}:{remove:i},n,o,a):e.apply(this,arguments):t.effects.animateClass.call(this,{toggle:i},s,n,o)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){function e(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function i(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}function s(t,e){var i=e.outerWidth(),s=e.outerHeight(),n=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,o=n.exec(t)||["",0,i,s,0];return{top:parseFloat(o[1])||0,right:"auto"===o[2]?i:parseFloat(o[2]),bottom:"auto"===o[3]?s:parseFloat(o[3]),left:parseFloat(o[4])||0}}t.expr&&t.expr.filters&&t.expr.filters.animated&&(t.expr.filters.animated=function(e){return function(i){return!!t(i).data(d)||e(i)}}(t.expr.filters.animated)),t.uiBackCompat!==!1&&t.extend(t.effects,{save:function(t,e){for(var i=0,s=e.length;s>i;i++)null!==e[i]&&t.data(c+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;n>s;s++)null!==e[s]&&(i=t.data(c+e[s]),t.css(e[s],i))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("

").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).trigger("focus"),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).trigger("focus")),e}}),t.extend(t.effects,{version:"1.12.1",define:function(e,i,s){return s||(s=i,i="effect"),t.effects.effect[e]=s,t.effects.effect[e].mode=i,s},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,n="vertical"!==i?(e||100)/100:1;return{height:t.height()*n,width:t.width()*s,outerHeight:t.outerHeight()*n,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();e>1&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(u,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(u)||"",t.removeData(u)},mode:function(t,e){var i=t.is(":hidden");return"toggle"===e&&(e=i?"show":"hide"),(i?"hide"===e:"show"===e)&&(e="none"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(e){var i,s=e.css("position"),n=e.position();return e.css({marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()),/^(static|relative)/.test(s)&&(s="absolute",i=t("<"+e[0].nodeName+">").insertAfter(e).css({display:/^(inline|ruby)/.test(e.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight"),"float":e.css("float")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).addClass("ui-effects-placeholder"),e.data(c+"placeholder",i)),e.css({position:s,left:n.left,top:n.top}),i},removePlaceholder:function(t){var e=c+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(e){t.effects.restoreStyle(e),t.effects.removePlaceholder(e)},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){function i(e){function i(){r.removeData(d),t.effects.cleanUp(r),"hide"===s.mode&&r.hide(),a()}function a(){t.isFunction(h)&&h.call(r[0]),t.isFunction(e)&&e()}var r=t(this);s.mode=c.shift(),t.uiBackCompat===!1||o?"none"===s.mode?(r[l](),a()):n.call(r[0],s,i):(r.is(":hidden")?"hide"===l:"show"===l)?(r[l](),a()):n.call(r[0],s,a)}var s=e.apply(this,arguments),n=t.effects.effect[s.effect],o=n.mode,a=s.queue,r=a||"fx",h=s.complete,l=s.mode,c=[],u=function(e){var i=t(this),s=t.effects.mode(i,l)||o;i.data(d,!0),c.push(s),o&&("show"===s||s===o&&"hide"===s)&&i.show(),o&&"none"===s||t.effects.saveStyle(i),t.isFunction(e)&&e()};return t.fx.off||!n?l?this[l](s.duration,h):this.each(function(){h&&h.call(this)}):a===!1?this.each(u).each(i):this.queue(r,u).queue(r,i)},show:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="show",this.effect.call(this,n) +}}(t.fn.show),hide:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(t.fn.hide),toggle:function(t){return function(s){if(i(s)||"boolean"==typeof s)return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):s(this.css("clip"),this)},transfer:function(e,i){var s=t(this),n=t(e.to),o="fixed"===n.css("position"),a=t("body"),r=o?a.scrollTop():0,h=o?a.scrollLeft():0,l=n.offset(),c={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("
").appendTo("body").addClass(e.className).css({top:u.top-r,left:u.left-h,height:s.innerHeight(),width:s.innerWidth(),position:o?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),t.isFunction(i)&&i()})}}),t.fx.step.clip=function(e){e.clipInit||(e.start=t(e.elem).cssClip(),"string"==typeof e.end&&(e.end=s(e.end,e.elem)),e.clipInit=!0),t(e.elem).cssClip({top:e.pos*(e.end.top-e.start.top)+e.start.top,right:e.pos*(e.end.right-e.start.right)+e.start.right,bottom:e.pos*(e.end.bottom-e.start.bottom)+e.start.bottom,left:e.pos*(e.end.left-e.start.left)+e.start.left})}}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}();var f=t.effects;t.effects.define("blind","hide",function(e,i){var s={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},n=t(this),o=e.direction||"up",a=n.cssClip(),r={clip:t.extend({},a)},h=t.effects.createPlaceholder(n);r.clip[s[o][0]]=r.clip[s[o][1]],"show"===e.mode&&(n.cssClip(r.clip),h&&h.css(t.effects.clipToBox(r)),r.clip=a),h&&h.animate(t.effects.clipToBox(r),e.duration,e.easing),n.animate(r,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("bounce",function(e,i){var s,n,o,a=t(this),r=e.mode,h="hide"===r,l="show"===r,c=e.direction||"up",u=e.distance,d=e.times||5,p=2*d+(l||h?1:0),f=e.duration/p,g=e.easing,m="up"===c||"down"===c?"top":"left",_="up"===c||"left"===c,v=0,b=a.queue().length;for(t.effects.createPlaceholder(a),o=a.css(m),u||(u=a["top"===m?"outerHeight":"outerWidth"]()/3),l&&(n={opacity:1},n[m]=o,a.css("opacity",0).css(m,_?2*-u:2*u).animate(n,f,g)),h&&(u/=Math.pow(2,d-1)),n={},n[m]=o;d>v;v++)s={},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g).animate(n,f,g),u=h?2*u:u/2;h&&(s={opacity:0},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g)),a.queue(i),t.effects.unshift(a,b,p+1)}),t.effects.define("clip","hide",function(e,i){var s,n={},o=t(this),a=e.direction||"vertical",r="both"===a,h=r||"horizontal"===a,l=r||"vertical"===a;s=o.cssClip(),n.clip={top:l?(s.bottom-s.top)/2:s.top,right:h?(s.right-s.left)/2:s.right,bottom:l?(s.bottom-s.top)/2:s.bottom,left:h?(s.right-s.left)/2:s.left},t.effects.createPlaceholder(o),"show"===e.mode&&(o.cssClip(n.clip),n.clip=s),o.animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("drop","hide",function(e,i){var s,n=t(this),o=e.mode,a="show"===o,r=e.direction||"left",h="up"===r||"down"===r?"top":"left",l="up"===r||"left"===r?"-=":"+=",c="+="===l?"-=":"+=",u={opacity:0};t.effects.createPlaceholder(n),s=e.distance||n["top"===h?"outerHeight":"outerWidth"](!0)/2,u[h]=l+s,a&&(n.css(u),u[h]=c+s,u.opacity=1),n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("explode","hide",function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),i()}var o,a,r,h,l,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=e.mode,g="show"===f,m=p.show().css("visibility","hidden").offset(),_=Math.ceil(p.outerWidth()/d),v=Math.ceil(p.outerHeight()/u),b=[];for(o=0;u>o;o++)for(h=m.top+o*v,c=o-(u-1)/2,a=0;d>a;a++)r=m.left+a*_,l=a-(d-1)/2,p.clone().appendTo("body").wrap("
").css({position:"absolute",visibility:"visible",left:-a*_,top:-o*v}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:_,height:v,left:r+(g?l*_:0),top:h+(g?c*v:0),opacity:g?0:1}).animate({left:r+(g?0:l*_),top:h+(g?0:c*v),opacity:g?1:0},e.duration||500,e.easing,s)}),t.effects.define("fade","toggle",function(e,i){var s="show"===e.mode;t(this).css("opacity",s?0:1).animate({opacity:s?1:0},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("fold","hide",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=e.size||15,h=/([0-9]+)%/.exec(r),l=!!e.horizFirst,c=l?["right","bottom"]:["bottom","right"],u=e.duration/2,d=t.effects.createPlaceholder(s),p=s.cssClip(),f={clip:t.extend({},p)},g={clip:t.extend({},p)},m=[p[c[0]],p[c[1]]],_=s.queue().length;h&&(r=parseInt(h[1],10)/100*m[a?0:1]),f.clip[c[0]]=r,g.clip[c[0]]=r,g.clip[c[1]]=0,o&&(s.cssClip(g.clip),d&&d.css(t.effects.clipToBox(g)),g.clip=p),s.queue(function(i){d&&d.animate(t.effects.clipToBox(f),u,e.easing).animate(t.effects.clipToBox(g),u,e.easing),i()}).animate(f,u,e.easing).animate(g,u,e.easing).queue(i),t.effects.unshift(s,_,4)}),t.effects.define("highlight","show",function(e,i){var s=t(this),n={backgroundColor:s.css("backgroundColor")};"hide"===e.mode&&(n.opacity=0),t.effects.saveStyle(s),s.css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("size",function(e,i){var s,n,o,a=t(this),r=["fontSize"],h=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],l=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=e.mode,u="effect"!==c,d=e.scale||"both",p=e.origin||["middle","center"],f=a.css("position"),g=a.position(),m=t.effects.scaledDimensions(a),_=e.from||m,v=e.to||t.effects.scaledDimensions(a,0);t.effects.createPlaceholder(a),"show"===c&&(o=_,_=v,v=o),n={from:{y:_.height/m.height,x:_.width/m.width},to:{y:v.height/m.height,x:v.width/m.width}},("box"===d||"both"===d)&&(n.from.y!==n.to.y&&(_=t.effects.setTransition(a,h,n.from.y,_),v=t.effects.setTransition(a,h,n.to.y,v)),n.from.x!==n.to.x&&(_=t.effects.setTransition(a,l,n.from.x,_),v=t.effects.setTransition(a,l,n.to.x,v))),("content"===d||"both"===d)&&n.from.y!==n.to.y&&(_=t.effects.setTransition(a,r,n.from.y,_),v=t.effects.setTransition(a,r,n.to.y,v)),p&&(s=t.effects.getBaseline(p,m),_.top=(m.outerHeight-_.outerHeight)*s.y+g.top,_.left=(m.outerWidth-_.outerWidth)*s.x+g.left,v.top=(m.outerHeight-v.outerHeight)*s.y+g.top,v.left=(m.outerWidth-v.outerWidth)*s.x+g.left),a.css(_),("content"===d||"both"===d)&&(h=h.concat(["marginTop","marginBottom"]).concat(r),l=l.concat(["marginLeft","marginRight"]),a.find("*[width]").each(function(){var i=t(this),s=t.effects.scaledDimensions(i),o={height:s.height*n.from.y,width:s.width*n.from.x,outerHeight:s.outerHeight*n.from.y,outerWidth:s.outerWidth*n.from.x},a={height:s.height*n.to.y,width:s.width*n.to.x,outerHeight:s.height*n.to.y,outerWidth:s.width*n.to.x};n.from.y!==n.to.y&&(o=t.effects.setTransition(i,h,n.from.y,o),a=t.effects.setTransition(i,h,n.to.y,a)),n.from.x!==n.to.x&&(o=t.effects.setTransition(i,l,n.from.x,o),a=t.effects.setTransition(i,l,n.to.x,a)),u&&t.effects.saveStyle(i),i.css(o),i.animate(a,e.duration,e.easing,function(){u&&t.effects.restoreStyle(i)})})),a.animate(v,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){var e=a.offset();0===v.opacity&&a.css("opacity",_.opacity),u||(a.css("position","static"===f?"relative":f).offset(e),t.effects.saveStyle(a)),i()}})}),t.effects.define("scale",function(e,i){var s=t(this),n=e.mode,o=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"effect"!==n?0:100),a=t.extend(!0,{from:t.effects.scaledDimensions(s),to:t.effects.scaledDimensions(s,o,e.direction||"both"),origin:e.origin||["middle","center"]},e);e.fade&&(a.from.opacity=1,a.to.opacity=0),t.effects.effect.size.call(this,a,i)}),t.effects.define("puff","hide",function(e,i){var s=t.extend(!0,{},e,{fade:!0,percent:parseInt(e.percent,10)||150});t.effects.effect.scale.call(this,s,i)}),t.effects.define("pulsate","show",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=o||a,h=2*(e.times||5)+(r?1:0),l=e.duration/h,c=0,u=1,d=s.queue().length;for((o||!s.is(":visible"))&&(s.css("opacity",0).show(),c=1);h>u;u++)s.animate({opacity:c},l,e.easing),c=1-c;s.animate({opacity:c},l,e.easing),s.queue(i),t.effects.unshift(s,d,h+1)}),t.effects.define("shake",function(e,i){var s=1,n=t(this),o=e.direction||"left",a=e.distance||20,r=e.times||3,h=2*r+1,l=Math.round(e.duration/h),c="up"===o||"down"===o?"top":"left",u="up"===o||"left"===o,d={},p={},f={},g=n.queue().length;for(t.effects.createPlaceholder(n),d[c]=(u?"-=":"+=")+a,p[c]=(u?"+=":"-=")+2*a,f[c]=(u?"-=":"+=")+2*a,n.animate(d,l,e.easing);r>s;s++)n.animate(p,l,e.easing).animate(f,l,e.easing);n.animate(p,l,e.easing).animate(d,l/2,e.easing).queue(i),t.effects.unshift(n,g,h+1)}),t.effects.define("slide","show",function(e,i){var s,n,o=t(this),a={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},r=e.mode,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h,u=e.distance||o["top"===l?"outerHeight":"outerWidth"](!0),d={};t.effects.createPlaceholder(o),s=o.cssClip(),n=o.position()[l],d[l]=(c?-1:1)*u+n,d.clip=o.cssClip(),d.clip[a[h][1]]=d.clip[a[h][0]],"show"===r&&(o.cssClip(d.clip),o.css(l,d[l]),d.clip=s,d[l]=n),o.animate(d,{queue:!1,duration:e.duration,easing:e.easing,complete:i})});var f;t.uiBackCompat!==!1&&(f=t.effects.define("transfer",function(e,i){t(this).transfer(e,i)})),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.widget("ui.accordion",{version:"1.12.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:"> li > :first-child, > :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t()}},_createIcons:function(){var e,i,s=this.options.icons;s&&(e=t(""),this._addClass(e,"ui-accordion-header-icon","ui-icon "+s.header),e.prependTo(this.headers),i=this.active.children(".ui-accordion-header-icon"),this._removeClass(i,s.header)._addClass(i,null,s.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),void 0)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),t(o).trigger("focus"),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),e.active===!1&&e.collapsible===!0||!this.headers.length?(e.active=!1,this.active=t()):e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var e,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var e=t(this),i=e.uniqueId().attr("id"),s=e.next(),n=s.uniqueId().attr("id");e.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(e=n.height(),this.element.siblings(":visible").each(function(){var i=t(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(e-=i.outerHeight(!0))}),this.headers.each(function(){e-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,e-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===s&&(e=0,this.headers.next().each(function(){var i=t(this).is(":visible");i||t(this).show(),e=Math.max(e,t(this).css("height","").height()),i||t(this).hide()}).height(e))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i,s,n=this.options,o=this.active,a=t(e.currentTarget),r=a[0]===o[0],h=r&&n.collapsible,l=h?t():a.next(),c=o.next(),u={oldHeader:o,oldPanel:c,newHeader:h?t():a,newPanel:l};e.preventDefault(),r&&!n.collapsible||this._trigger("beforeActivate",e,u)===!1||(n.active=h?!1:this.headers.index(a),this.active=r?t():a,this._toggle(u),this._removeClass(o,"ui-accordion-header-active","ui-state-active"),n.icons&&(i=o.children(".ui-accordion-header-icon"),this._removeClass(i,null,n.icons.activeHeader)._addClass(i,null,n.icons.header)),r||(this._removeClass(a,"ui-accordion-header-collapsed")._addClass(a,"ui-accordion-header-active","ui-state-active"),n.icons&&(s=a.children(".ui-accordion-header-icon"),this._removeClass(s,null,n.icons.header)._addClass(s,null,n.icons.activeHeader)),this._addClass(a.next(),"ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(t(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,e,i){var s,n,o,a=this,r=0,h=t.css("box-sizing"),l=t.length&&(!e.length||t.index()",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){var i=!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]));i&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),i=e.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),i.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&105>=e.keyCode?""+(e.keyCode-96):String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o,a=this,r=this.options.icons.submenu,h=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),s=h.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("").data("ui-menu-submenu-caret",!0);a._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(s,"ui-menu","ui-widget ui-widget-content ui-front"),e=h.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);a._isDivider(e)&&a._addClass(e,"ui-menu-divider","ui-widget-content")}),n=i.not(".ui-menu-item, .ui-menu-divider"),o=n.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(n,"ui-menu-item")._addClass(o,"ui-menu-item-wrapper"),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t+""),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n; +this.isMultiLine=o||!a&&this._isContentEditable(this.element),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("
    ").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("
    ").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,i){var s=i.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==t.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=s})),!1!==this._trigger("select",e,{item:s})&&this._value(s.value),this.term=this._value(),this.close(e),this.selectedItem=s}}),this.liveRegion=t("
    ",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length").append(t("
    ").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("
    ").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete;var g=/ui-corner-([a-z]){2,6}/g;t.widget("ui.controlgroup",{version:"1.12.1",defaultElement:"
    ",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var e=this,i=[];t.each(this.options.items,function(s,n){var o,a={};return n?"controlgroupLabel"===s?(o=e.element.find(n),o.each(function(){var e=t(this);e.children(".ui-controlgroup-label-contents").length||e.contents().wrapAll("")}),e._addClass(o,null,"ui-widget ui-widget-content ui-state-default"),i=i.concat(o.get()),void 0):(t.fn[s]&&(a=e["_"+s+"Options"]?e["_"+s+"Options"]("middle"):{classes:{}},e.element.find(n).each(function(){var n=t(this),o=n[s]("instance"),r=t.widget.extend({},a);if("button"!==s||!n.parent(".ui-spinner").length){o||(o=n[s]()[s]("instance")),o&&(r.classes=e._resolveClassesValues(r.classes,o)),n[s](r);var h=n[s]("widget");t.data(h[0],"ui-controlgroup-data",o?o:n[s]("instance")),i.push(h[0])}})),void 0):void 0}),this.childWidgets=t(t.unique(i)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var i=t(this),s=i.data("ui-controlgroup-data");s&&s[e]&&s[e]()})},_updateCornerClass:function(t,e){var i="ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all",s=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,i),this._addClass(t,null,s)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],s},_spinnerOptions:function(t){var e=this._buildSimpleOptions(t,"ui-spinner");return e.classes["ui-spinner-up"]="",e.classes["ui-spinner-down"]="",e},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e?"auto":!1,classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(e,i){var s={};return t.each(e,function(n){var o=i.options.classes[n]||"";o=t.trim(o.replace(g,"")),s[n]=(o+" "+e[n]).replace(/\s+/g," ")}),s},_setOption:function(t,e){return"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"===t?(this._callChildMethod(e?"disable":"enable"),void 0):(this.refresh(),void 0)},refresh:function(){var e,i=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),e=this.childWidgets,this.options.onlyVisible&&(e=e.filter(":visible")),e.length&&(t.each(["first","last"],function(t,s){var n=e[s]().data("ui-controlgroup-data");if(n&&i["_"+n.widgetName+"Options"]){var o=i["_"+n.widgetName+"Options"](1===e.length?"only":s);o.classes=i._resolveClassesValues(o.classes,n),n.element[n.widgetName](o)}else i._updateCornerClass(e[s](),s)}),this._callChildMethod("refresh"))}}),t.widget("ui.checkboxradio",[t.ui.formResetMixin,{version:"1.12.1",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var e,i,s=this,n=this._super()||{};return this._readType(),i=this.element.labels(),this.label=t(i[i.length-1]),this.label.length||t.error("No label found for checkboxradio widget"),this.originalLabel="",this.label.contents().not(this.element[0]).each(function(){s.originalLabel+=3===this.nodeType?t(this).text():this.outerHTML}),this.originalLabel&&(n.label=this.originalLabel),e=this.element[0].disabled,null!=e&&(n.disabled=e),n},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&(this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this.icon&&this._addClass(this.icon,null,"ui-state-hover")),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var e=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===e&&/radio|checkbox/.test(this.type)||t.error("Can't create checkboxradio on element.nodeName="+e+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var e,i=this.element[0].name,s="input[name='"+t.ui.escapeSelector(i)+"']";return i?(e=this.form.length?t(this.form[0].elements).filter(s):t(s).filter(function(){return 0===t(this).form().length}),e.not(this.element)):t([])},_toggleClasses:function(){var e=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",e),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",e)._toggleClass(this.icon,null,"ui-icon-blank",!e),"radio"===this.type&&this._getRadioGroup().each(function(){var e=t(this).checkboxradio("instance");e&&e._removeClass(e.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){return"label"!==t||e?(this._super(t,e),"disabled"===t?(this._toggleClass(this.label,null,"ui-state-disabled",e),this.element[0].disabled=e,void 0):(this.refresh(),void 0)):void 0},_updateIcon:function(e){var i="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=t(""),this.iconSpace=t(" "),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(i+=e?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,e?"ui-icon-blank":"ui-icon-check")):i+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",i),e||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),this.iconSpace&&(t=t.not(this.iconSpace[0])),t.remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]),t.ui.checkboxradio,t.widget("ui.button",{version:"1.12.1",defaultElement:"").addClass(this._triggerClass).html(o?t("").attr({src:o,alt:n,title:n}):n)),e[r?"before":"after"](i.trigger),i.trigger.on("click",function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,n,o){var r,h,l,c,u,d=this._dialogInst;return d||(this.uuid+=1,r="dp"+this.uuid,this._dialogInput=t(""),this._dialogInput.on("keydown",this._doKeyDown),t("body").append(this._dialogInput),d=this._dialogInst=this._newInst(this._dialogInput,!1),d.settings={},t.data(this._dialogInput[0],"datepicker",d)),a(d.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(d,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,c=document.documentElement.scrollLeft||document.body.scrollLeft,u=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+c,l/2-150+u]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),d.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],"datepicker",d),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,"datepicker");s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),m===n&&(m=null))},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,i,s){var n,o,r,h,l=this._getInst(e);return 2===arguments.length&&"string"==typeof i?"defaults"===i?t.extend({},t.datepicker._defaults):l?"all"===i?t.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),o=this._getDateDatepicker(e,!0),r=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),a(l.settings,n),null!==r&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,r)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(e):this._enableDatepicker(e)),this._attachments(t(e),l),this._autoSize(l),this._setDate(l,o),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv),n[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),i=t.datepicker._get(o,"onSelect"),i?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var i,s,n=t.datepicker._getInst(e.target);return t.datepicker._get(n,"constrainInput")?(i=t.datepicker._possibleChars(t.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),e.ctrlKey||e.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var s,n,o,r,h,l,c;s=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==s&&(t.datepicker._curInst.dpDiv.stop(!0,!0),s&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),n=t.datepicker._get(s,"beforeShow"),o=n?n.apply(e,[e,s]):{},o!==!1&&(a(s.settings,o),s.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(s),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),r=!1,t(e).parents().each(function(){return r|="fixed"===t(this).css("position"),!r}),h={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,s.dpDiv.empty(),s.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(s),h=t.datepicker._checkOffset(s,h,r),s.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":r?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),s.inline||(l=t.datepicker._get(s,"showAnim"),c=t.datepicker._get(s,"duration"),s.dpDiv.css("z-index",i(t(e))+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[l]?s.dpDiv.show(l,t.datepicker._get(s,"showOptions"),c):s.dpDiv[l||"show"](l?c:null),t.datepicker._shouldFocusInput(s)&&s.input.trigger("focus"),t.datepicker._curInst=s)) +}},_updateDatepicker:function(e){this.maxRows=4,m=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var i,s=this._getNumberOfMonths(e),n=s[1],a=17,r=e.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.trigger("focus"),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+o>l&&l>o?Math.abs(o+r):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,o,a=this._curInst;!a||e&&a!==t.data(e,"datepicker")||this._datepickerShowing&&(i=this._get(a,"showAnim"),s=this._get(a,"duration"),n=function(){t.datepicker._tidyDialog(a)},t.effects&&(t.effects.effect[i]||t.effects[i])?a.dpDiv.hide(i,t.datepicker._get(a,"showOptions"),s,n):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,o=this._get(a,"onClose"),o&&o.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(o,i+("M"===s?this._get(o,"showCurrentAtPos"):0),s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=t("a",n).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),s=this._get(o,"onSelect"),s?s.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(o).val(n))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(e,i,s){if(null==e||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,o,a,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,c="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),u=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,d=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,m=-1,_=-1,v=-1,b=!1,y=function(t){var i=e.length>n+1&&e.charAt(n+1)===t;return i&&n++,i},w=function(t){var e=y(t),s="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n="y"===t?s:1,o=RegExp("^\\d{"+n+","+s+"}"),a=i.substring(h).match(o);if(!a)throw"Missing number at position "+h;return h+=a[0].length,parseInt(a[0],10)},k=function(e,s,n){var o=-1,a=t.map(y(e)?n:s,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(a,function(t,e){var s=e[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(o=e[0],h+=s.length,!1):void 0}),-1!==o)return o+1;throw"Unknown name at position "+h},x=function(){if(i.charAt(h)!==e.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;e.length>n;n++)if(b)"'"!==e.charAt(n)||y("'")?x():b=!1;else switch(e.charAt(n)){case"d":_=w("d");break;case"D":k("D",u,d);break;case"o":v=w("o");break;case"m":m=w("m");break;case"M":m=k("M",p,f);break;case"y":g=w("y");break;case"@":r=new Date(w("@")),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"!":r=new Date((w("!")-this._ticksTo1970)/1e4),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"'":y("'")?x():b=!0;break;default:x()}if(i.length>h&&(a=i.substr(h),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c>=g?0:-100)),v>-1)for(m=1,_=v;;){if(o=this._getDaysInMonth(g,m-1),o>=_)break;m++,_-=o}if(r=this._daylightSavingAdjust(new Date(g,m-1,_)),r.getFullYear()!==g||r.getMonth()+1!==m||r.getDate()!==_)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},l=function(t,e,i){var s=""+e;if(h(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return h(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||h("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=l("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=l("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=l("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=h("y")?e.getFullYear():(10>e.getFullYear()%100?"0":"")+e.getFullYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":h("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,e){return void 0!==t.settings[e]?t.settings[e]:this._defaults[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(r){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},o=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,o=n.getFullYear(),a=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":a+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a))}l=h.exec(i)}return new Date(o,a,r)},a=null==i||""===i?s:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return a=a&&"Invalid Date"==""+a?s:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).on(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,h,l,c,u,d,p,f,g,m,_,v,b,y,w,k,x,C,D,I,T,P,M,S,H,z,O,A,N,W,E,F,L,R=new Date,B=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),Y=this._get(t,"isRTL"),j=this._get(t,"showButtonPanel"),q=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),V=this._get(t,"showCurrentAtPos"),$=this._get(t,"stepMonths"),X=1!==U[0]||1!==U[1],G=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),Q=this._getMinMaxDate(t,"min"),J=this._getMinMaxDate(t,"max"),Z=t.drawMonth-V,te=t.drawYear;if(0>Z&&(Z+=12,te--),J)for(e=this._daylightSavingAdjust(new Date(J.getFullYear(),J.getMonth()-U[0]*U[1]+1,J.getDate())),e=Q&&Q>e?Q:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-$,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?""+i+"":q?"":""+i+"",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+$,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,te,Z)?""+n+"":q?"":""+n+"",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?G:B,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,h=t.inline?"":"",l=j?"
    "+(Y?h:"")+(this._isInRange(t,r)?"":"")+(Y?"":h)+"
    ":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),g=this._get(t,"monthNamesShort"),m=this._get(t,"beforeShowDay"),_=this._get(t,"showOtherMonths"),v=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;U[0]>k;k++){for(x="",this.maxRows=4,C=0;U[1]>C;C++){if(D=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),I=" ui-corner-all",T="",X){if(T+="
    "}for(T+="
    "+(/all|left/.test(I)&&0===k?Y?o:s:"")+(/all|right/.test(I)&&0===k?Y?s:o:"")+this._generateMonthYearHeader(t,Z,te,Q,J,k>0||C>0,f,g)+"
"+"",P=u?"":"",w=0;7>w;w++)M=(w+c)%7,P+="";for(T+=P+"",S=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),H=(this._getFirstDayOfMonth(te,Z)-c+7)%7,z=Math.ceil((H+S)/7),O=X?this.maxRows>z?this.maxRows:z:z,this.maxRows=O,A=this._daylightSavingAdjust(new Date(te,Z,1-H)),N=0;O>N;N++){for(T+="",W=u?"":"",w=0;7>w;w++)E=m?m.apply(t.input?t.input[0]:null,[A]):[!0,""],F=A.getMonth()!==Z,L=F&&!v||!E[0]||Q&&Q>A||J&&A>J,W+="",A.setDate(A.getDate()+1),A=this._daylightSavingAdjust(A);T+=W+""}Z++,Z>11&&(Z=0,te++),T+="
"+this._get(t,"weekHeader")+"=5?" class='ui-datepicker-week-end'":"")+">"+""+p[M]+"
"+this._get(t,"calculateWeek")(A)+""+(F&&!_?" ":L?""+A.getDate()+"":""+A.getDate()+"")+"
"+(X?""+(U[0]>0&&C===U[1]-1?"
":""):""),x+=T}y+=x}return y+=l,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var h,l,c,u,d,p,f,g,m=this._get(t,"changeMonth"),_=this._get(t,"changeYear"),v=this._get(t,"showMonthAfterYear"),b="
",y="";if(o||!m)y+=""+a[e]+"";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,y+=""}if(v||(b+=y+(!o&&m&&_?"":" ")),!t.yearshtml)if(t.yearshtml="",o||!_)b+=""+i+"";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),g=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),v&&(b+=(!o&&m&&_?"":" ")+y),b+="
"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,h=this._get(t,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).on("mousedown",t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new s,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.12.1",t.datepicker,t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var _=!1;t(document).on("mouseup",function(){_=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!_){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,n="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),_=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,_=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blurActiveElement(e),this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("
").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=t.ui.safeActiveElement(this.document[0]),s=t(e.target);s.closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())} +},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),h=t.pageX,l=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.lefti[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,h=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(h=this.originalPageX),"x"===a.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY=0;d--)h=s.snapElements[d].left-s.margins.left,l=h+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,h-g>_||m>l+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(h-_),r=g>=Math.abs(l-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(h-m),r=g>=Math.abs(l-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("
").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("
"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("
"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&p>s.maxWidth,m=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),g&&(p-=l),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.dialog",{version:"1.12.1",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(e){var i=t(this).css(e).offset().top;0>i&&t(this).css("top",e.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&t.fn.draggable&&this._makeDraggable(),this.options.resizable&&t.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var e=this.options.appendTo;return e&&(e.jquery||e.nodeType)?t(e):this.document.find(e||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),t=e.parent.children().eq(e.index),t.length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog +},disable:t.noop,enable:t.noop,close:function(e){var i=this;this._isOpen&&this._trigger("beforeClose",e)!==!1&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||t.ui.safeBlur(t.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",e)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+t(this).css("z-index")}).get(),o=Math.max.apply(null,n);return o>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",o+1),s=!0),s&&!i&&this._trigger("focus",e),s},open:function(){var e=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=t(t.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){e._focusTabbable(),e._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var t=this._focusedElement;t||(t=this.element.find("[autofocus]")),t.length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).trigger("focus")},_keepFocus:function(e){function i(){var e=t.ui.safeActiveElement(this.document[0]),i=this.uiDialog[0]===e||t.contains(this.uiDialog[0],e);i||this._focusTabbable()}e.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=t("
").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(e){if(this.options.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===t.ui.keyCode.ESCAPE)return e.preventDefault(),this.close(e),void 0;if(e.keyCode===t.ui.keyCode.TAB&&!e.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");e.target!==n[0]&&e.target!==this.uiDialog[0]||e.shiftKey?e.target!==s[0]&&e.target!==this.uiDialog[0]||!e.shiftKey||(this._delay(function(){n.trigger("focus")}),e.preventDefault()):(this._delay(function(){s.trigger("focus")}),e.preventDefault())}},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var e;this.uiDialogTitlebar=t("
"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(e){t(e.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=t("").button({label:t("").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),e=t("").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(e,"ui-dialog-title"),this._title(e),this.uiDialogTitlebar.prependTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":e.attr("id")})},_title:function(t){this.options.title?t.text(this.options.title):t.html(" ")},_createButtonPane:function(){this.uiDialogButtonPane=t("
"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=t("
").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var e=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),t.isEmptyObject(i)||t.isArray(i)&&!i.length?(this._removeClass(this.uiDialog,"ui-dialog-buttons"),void 0):(t.each(i,function(i,s){var n,o;s=t.isFunction(s)?{click:s,text:i}:s,s=t.extend({type:"button"},s),n=s.click,o={icon:s.icon,iconPosition:s.iconPosition,showLabel:s.showLabel,icons:s.icons,text:s.text},delete s.click,delete s.icon,delete s.iconPosition,delete s.showLabel,delete s.icons,"boolean"==typeof s.text&&delete s.text,t("",s).button(o).appendTo(e.uiButtonSet).on("click",function(){n.apply(e.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function e(t){return{position:t.position,offset:t.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){i._addClass(t(this),"ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,e(n))},drag:function(t,s){i._trigger("drag",t,e(s))},stop:function(n,o){var a=o.offset.left-i.document.scrollLeft(),r=o.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(a>=0?"+":"")+a+" "+"top"+(r>=0?"+":"")+r,of:i.window},i._removeClass(t(this),"ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,e(o))}})},_makeResizable:function(){function e(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}var i=this,s=this.options,n=s.resizable,o=this.uiDialog.css("position"),a="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:a,start:function(s,n){i._addClass(t(this),"ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,e(n))},resize:function(t,s){i._trigger("resize",t,e(s))},stop:function(n,o){var a=i.uiDialog.offset(),r=a.left-i.document.scrollLeft(),h=a.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},i._removeClass(t(this),"ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,e(o))}}).css("position",o)},_trackFocus:function(){this._on(this.widget(),{focusin:function(e){this._makeFocusTarget(),this._focusedElement=t(e.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var e=this._trackingInstances(),i=t.inArray(this,e);-1!==i&&e.splice(i,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||(t=[],this.document.data("ui-dialog-instances",t)),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(e){var i=this,s=!1,n={};t.each(e,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,i){var s,n,o=this.uiDialog;"disabled"!==e&&(this._super(e,i),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:t("").text(""+this.options.closeText).html()}),"draggable"===e&&(s=o.is(":data(ui-draggable)"),s&&!i&&o.draggable("destroy"),!s&&i&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(n=o.is(":data(ui-resizable)"),n&&!i&&o.resizable("destroy"),n&&"string"==typeof i&&o.resizable("option","handles",i),n||i===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var e=t(this);return t("
").css({position:"absolute",width:e.outerWidth(),height:e.outerHeight()}).appendTo(e.parent()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(e){return t(e.target).closest(".ui-dialog").length?!0:!!t(e.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var e=!0;this._delay(function(){e=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(t){e||this._allowInteraction(t)||(t.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=t("
").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var t=this.document.data("ui-dialog-overlays")-1;t?this.document.data("ui-dialog-overlays",t):(this._off(this.document,"focusin"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null}}}),t.uiBackCompat!==!1&&t.widget("ui.dialog",t.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(t,e){"dialogClass"===t&&this.uiDialog.removeClass(this.options.dialogClass).addClass(e),this._superApply(arguments)}}),t.ui.dialog,t.widget("ui.droppable",{version:"1.12.1",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=t.isFunction(s)?s:function(t){return t.is(s)},this.proportions=function(){return arguments.length?(e=arguments[0],void 0):e?e:e={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this._addClass("ui-droppable")},_addToManager:function(e){t.ui.ddmanager.droppables[e]=t.ui.ddmanager.droppables[e]||[],t.ui.ddmanager.droppables[e].push(this)},_splice:function(t){for(var e=0;t.length>e;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var e=t.ui.ddmanager.droppables[this.options.scope];this._splice(e)},_setOption:function(e,i){if("accept"===e)this.accept=t.isFunction(i)?i:function(t){return t.is(i)};else if("scope"===e){var s=t.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(e,i)},_activate:function(e){var i=t.ui.ddmanager.current;this._addActiveClass(),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this._removeActiveClass(),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._addHoverClass(),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeHoverClass(),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var s=i||t.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=t(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&v(s,t.extend(i,{offset:i.element.offset()}),i.options.tolerance,e)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(s)),this.element):!1):!1},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}});var v=t.ui.intersect=function(){function t(t,e,i){return t>=e&&e+i>t}return function(e,i,s,n){if(!i.offset)return!1;var o=(e.positionAbs||e.position.absolute).left+e.margins.left,a=(e.positionAbs||e.position.absolute).top+e.margins.top,r=o+e.helperProportions.width,h=a+e.helperProportions.height,l=i.offset.left,c=i.offset.top,u=l+i.proportions().width,d=c+i.proportions().height;switch(s){case"fit":return o>=l&&u>=r&&a>=c&&d>=h;case"intersect":return o+e.helperProportions.width/2>l&&u>r-e.helperProportions.width/2&&a+e.helperProportions.height/2>c&&d>h-e.helperProportions.height/2;case"pointer":return t(n.pageY,c,i.proportions().height)&&t(n.pageX,l,i.proportions().width);case"touch":return(a>=c&&d>=a||h>=c&&d>=h||c>a&&h>d)&&(o>=l&&u>=o||r>=l&&u>=r||l>o&&r>u);default:return!1}}}();t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var s,n,o=t.ui.ddmanager.droppables[e.options.scope]||[],a=i?i.type:null,r=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(s=0;o.length>s;s++)if(!(o[s].options.disabled||e&&!o[s].accept.call(o[s].element[0],e.currentItem||e.element))){for(n=0;r.length>n;n++)if(r[n]===o[s].element[0]){o[s].proportions().height=0;continue t}o[s].visible="none"!==o[s].element.css("display"),o[s].visible&&("mousedown"===a&&o[s]._activate.call(o[s],i),o[s].offset=o[s].element.offset(),o[s].proportions({width:o[s].element[0].offsetWidth,height:o[s].element[0].offsetHeight}))}},drop:function(e,i){var s=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&v(e,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(e,i){e.element.parentsUntil("body").on("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,o,a=v(e,this,this.options.tolerance,i),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,o=this.element.parents(":data(ui-droppable)").filter(function(){return t(this).droppable("instance").options.scope===n}),o.length&&(s=t(o[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").off("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}},t.uiBackCompat!==!1&&t.widget("ui.droppable",t.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}}),t.ui.droppable,t.widget("ui.progressbar",{version:"1.12.1",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=t("
").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(t){return void 0===t?this.options.value:(this.options.value=this._constrainedValue(t),this._refreshValue(),void 0)},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=t===!1,"number"!=typeof t&&(t=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).width(i.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,e===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("
").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}}),t.widget("ui.selectable",t.ui.mouse,{version:"1.12.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e.elementPos=t(e.element[0]).offset(),e.selectees=t(e.options.filter,e.element[0]),e._addClass(e.selectees,"ui-selectee"),e.selectees.each(function(){var i=t(this),s=i.offset(),n={left:s.left-e.elementPos.left,top:s.top-e.elementPos.top};t.data(this,"selectable-item",{element:this,$element:i,left:n.left,top:n.top,right:n.left+i.outerWidth(),bottom:n.top+i.outerHeight(),startselected:!1,selected:i.hasClass("ui-selected"),selecting:i.hasClass("ui-selecting"),unselecting:i.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=t("
"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(e){var i=this,s=this.options;this.opos=[e.pageX,e.pageY],this.elementPos=t(this.element[0]).offset(),this.options.disabled||(this.selectees=t(s.filter,this.element[0]),this._trigger("start",e),t(s.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=t.data(this,"selectable-item");s.startselected=!0,e.metaKey||e.ctrlKey||(i._removeClass(s.$element,"ui-selected"),s.selected=!1,i._addClass(s.$element,"ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",e,{unselecting:s.element}))}),t(e.target).parents().addBack().each(function(){var s,n=t.data(this,"selectable-item");return n?(s=!e.metaKey&&!e.ctrlKey||!n.$element.hasClass("ui-selected"),i._removeClass(n.$element,s?"ui-unselecting":"ui-selected")._addClass(n.$element,s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",e,{selecting:n.element}):i._trigger("unselecting",e,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,o=this.opos[0],a=this.opos[1],r=e.pageX,h=e.pageY;return o>r&&(i=r,r=o,o=i),a>h&&(i=h,h=a,a=i),this.helper.css({left:o,top:a,width:r-o,height:h-a}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),l=!1,c={};i&&i.element!==s.element[0]&&(c.left=i.left+s.elementPos.left,c.right=i.right+s.elementPos.left,c.top=i.top+s.elementPos.top,c.bottom=i.bottom+s.elementPos.top,"touch"===n.tolerance?l=!(c.left>r||o>c.right||c.top>h||a>c.bottom):"fit"===n.tolerance&&(l=c.left>o&&r>c.right&&c.top>a&&h>c.bottom),l?(i.selected&&(s._removeClass(i.$element,"ui-selected"),i.selected=!1),i.unselecting&&(s._removeClass(i.$element,"ui-unselecting"),i.unselecting=!1),i.selecting||(s._addClass(i.$element,"ui-selecting"),i.selecting=!0,s._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,s._addClass(i.$element,"ui-selected"),i.selected=!0):(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,i.startselected&&(s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(s._removeClass(i.$element,"ui-selected"),i.selected=!1,s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",e,{unselected:s.element})}),t(".ui-selecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-selecting")._addClass(s.$element,"ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",e,{selected:s.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),t.widget("ui.selectmenu",[t.ui.formResetMixin,{version:"1.12.1",defaultElement:"",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e=this._super(),i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);null!=n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t),void 0)},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((e>0?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(e){function i(){var e=this.element[0]===t.ui.safeActiveElement(this.document[0]);e||(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===t.ui.safeActiveElement(this.document[0])?this.previous:this.element.val(),e.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(e)!==!1&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){return t(e.currentTarget).hasClass("ui-state-active")?this._start(e)===!1?!1:(this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("").parent().append("")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&this.uiSpinner.height()>0&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_start:function(t){return this.spinning||this._trigger("start",t)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&this._trigger("spin",e,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(e){var i=this.options.incremental;return i?t.isFunction(i)?i(e):Math.floor(e*e*e/5e4-e*e/500+17*e/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return e=null!==s.min?s.min:0,i=t-e,i=Math.round(i/s.step)*s.step,t=e+i,t=parseFloat(t.toFixed(this._precision())),null!==s.max&&t>s.max?s.max:null!==s.min&&s.min>t?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i,s,n;return"culture"===t||"numberFormat"===t?(i=this._parse(this.element.val()),this.options[t]=e,this.element.val(this._format(i)),void 0):(("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(s=this.buttons.first().find(".ui-icon"),this._removeClass(s,null,this.options.icons.up),this._addClass(s,null,e.up),n=this.buttons.last().find(".ui-icon"),this._removeClass(n,null,this.options.icons.down),this._addClass(n,null,e.down)),this._super(t,e),void 0)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:r(function(t){this._super(t)}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null===t?!1:t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&(i=this._parse(t),null!==i&&(e||(i=this._adjustValue(i)),t=this._format(i))),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:r(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:r(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:r(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:r(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){return arguments.length?(r(this._value).call(this,t),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),t.uiBackCompat!==!1&&t.widget("ui.spinner",t.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return""},_buttonHtml:function(){return""}}),t.ui.spinner,t.widget("ui.tabs",{version:"1.12.1",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var t=/#.*$/;return function(e){var i,s;i=e.href.replace(t,""),s=location.href.replace(t,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return e.hash.length>1&&i===s}}(),_create:function(){var e=this,i=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,i.collapsible),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var e=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===e&&(s&&this.tabs.each(function(i,n){return t(n).attr("aria-controls")===s?(e=i,!1):void 0}),null===e&&(e=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===e||-1===e)&&(e=this.tabs.length?0:!1)),e!==!1&&(e=this.tabs.index(this.tabs.eq(e)),-1===e&&(e=i?!1:0)),!i&&e===!1&&this.anchors.length&&(e=0),e},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(e){var i=t(t.ui.safeActiveElement(this.document[0])).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(e)){switch(e.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:s++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:n=!1,s--;break;case t.ui.keyCode.END:s=this.anchors.length-1;break;case t.ui.keyCode.HOME:s=0;break;case t.ui.keyCode.SPACE:return e.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case t.ui.keyCode.ENTER:return e.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}e.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),e.ctrlKey||e.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(e){return e.altKey&&e.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):e.altKey&&e.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e),void 0)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).attr({role:"presentation",tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=t(),this.anchors.each(function(i,s){var n,o,a,r=t(s).uniqueId().attr("id"),h=t(s).closest("li"),l=h.attr("aria-controls");e._isLocal(s)?(n=s.hash,a=n.substring(1),o=e.element.find(e._sanitizeSelector(n))):(a=h.attr("aria-controls")||t({}).uniqueId()[0].id,n="#"+a,o=e.element.find(n),o.length||(o=e._createPanel(a),o.insertAfter(e.panels[i-1]||e.tablist)),o.attr("aria-live","polite")),o.length&&(e.panels=e.panels.add(o)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":a,"aria-labelledby":r}),o.attr("aria-labelledby",r)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(e){return t("
").attr("id",e).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(e){var i,s,n;for(t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1),n=0;s=this.tabs[n];n++)i=t(s),e===!0||-1!==t.inArray(n,e)?(i.attr("aria-disabled","true"),this._addClass(i,null,"ui-state-disabled")):(i.removeAttr("aria-disabled"),this._removeClass(i,null,"ui-state-disabled"));this.options.disabled=e,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,e===!0)},_setupEvents:function(e){var i={};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,h=r?t():this._getPanelForTab(o),l=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:l,newTab:r?t():o,newPanel:h};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),l.length||h.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function s(){o.running=!1,o._trigger("activate",e,i)}function n(){o._addClass(i.newTab.closest("li"),"ui-tabs-active","ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){o._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n()}):(this._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+t.ui.escapeSelector(e)+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(e){var i=this.options.disabled;i!==!1&&(void 0===e?i=!1:(e=this._getIndex(e),i=t.isArray(i)?t.map(i,function(t){return t!==e?t:null}):t.map(this.tabs,function(t,i){return i!==e?i:null})),this._setOptionDisabled(i))},disable:function(e){var i=this.options.disabled;if(i!==!0){if(void 0===e)i=!0;else{if(e=this._getIndex(e),-1!==t.inArray(e,i))return;i=t.isArray(i)?t.merge([e],i).sort():[e]}this._setOptionDisabled(i)}},load:function(e,i){e=this._getIndex(e);var s=this,n=this.tabs.eq(e),o=n.find(".ui-tabs-anchor"),a=this._getPanelForTab(n),r={tab:n,panel:a},h=function(t,e){"abort"===e&&s.panels.stop(!1,!0),s._removeClass(n,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===s.xhr&&delete s.xhr};this._isLocal(o[0])||(this.xhr=t.ajax(this._ajaxSettings(o,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(n,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,n){setTimeout(function(){a.html(t),s._trigger("load",i,r),h(n,e)},1)}).fail(function(t,e){setTimeout(function(){h(t,e)},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href").replace(/#.*$/,""),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),t.uiBackCompat!==!1&&t.widget("ui.tabs",t.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}}),t.ui.tabs,t.widget("ui.tooltip",{version:"1.12.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var e=t(this).attr("title")||"";return t("").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))},_removeDescribedBy:function(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=t("
").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=t([])},_setOption:function(e,i){var s=this;this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s.element[0],e.close(n,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var e=t(this);return e.is("[title]")?e.data("ui-tooltip-title",e.attr("title")).removeAttr("title"):void 0}))},_enable:function(){this.disabledTitles.each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))}),this.disabledTitles=t([])},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(e,s),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null;return"string"==typeof s||s.nodeType||s.jquery?this._open(e,t,s):(i=s.call(t[0],function(i){n._delay(function(){t.data("ui-tooltip-open")&&(e&&(e.type=o),this._open(e,t,i))})}),i&&this._open(e,t,i),void 0)},_open:function(e,i,s){function n(t){l.of=t,a.is(":hidden")||a.position(l)}var o,a,r,h,l=t.extend({},this.options.position);if(s){if(o=this._find(i))return o.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(e&&"mouseover"===e.type?i.attr("title",""):i.removeAttr("title")),o=this._tooltip(i),a=o.tooltip,this._addDescribedBy(i,a.attr("id")),a.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),h=t("
").html(a.find(".ui-tooltip-content").html()),h.removeAttr("name").find("[name]").removeAttr("name"),h.removeAttr("id").find("[id]").removeAttr("id"),h.appendTo(this.liveRegion),this.options.track&&e&&/^mouse/.test(e.type)?(this._on(this.document,{mousemove:n}),n(e)):a.position(t.extend({of:i},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){a.is(":visible")&&(n(l.of),clearInterval(r))},t.fx.interval)),this._trigger("open",e,{tooltip:a})}},_registerCloseHandlers:function(e,i){var s={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var s=t.Event(e);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),e&&"mouseover"!==e.type||(s.mouseleave="close"),e&&"focusin"!==e.type||(s.focusout="close"),this._on(!0,i,s)},close:function(e){var i,s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);return o?(i=o.tooltip,o.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),o.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),o.closing=!0,this._trigger("close",e,{tooltip:i}),o.hiding||(o.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(e){var i=t("
").attr("role","tooltip"),s=t("
").appendTo(i),n=i.uniqueId().attr("id");return this._addClass(s,"ui-tooltip-content"),this._addClass(i,"ui-tooltip","ui-widget ui-widget-content"),i.appendTo(this._appendTo(e)),this.tooltips[n]={element:e,tooltip:i}},_find:function(t){var e=t.data("ui-tooltip-id");return e?this.tooltips[e]:null},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){var e=t.closest(".ui-front, dialog");return e.length||(e=this.document[0].body),e},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur"),o=s.element;n.target=n.currentTarget=o[0],e.close(n,!0),t("#"+i).remove(),o.data("ui-tooltip-title")&&(o.attr("title")||o.attr("title",o.data("ui-tooltip-title")),o.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),t.uiBackCompat!==!1&&t.widget("ui.tooltip",t.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}}),t.ui.tooltip}); \ No newline at end of file diff --git a/jQueryGantt/jQueryGantt/libs/jquery/jquery.livequery.1.1.1.min.js b/jQueryGantt/jQueryGantt/libs/jquery/jquery.livequery.1.1.1.min.js new file mode 100644 index 0000000000000000000000000000000000000000..fdefa6541921c48d66a75f64e7677fa5d4fc5ba7 --- /dev/null +++ b/jQueryGantt/jQueryGantt/libs/jquery/jquery.livequery.1.1.1.min.js @@ -0,0 +1,6 @@ +(function($){$.extend($.fn,{livequery:function(type,fn,fn2){var self=this,q;if($.isFunction(type))fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&type==query.type&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid))return(q=query)&&false});q=q||new $.livequery(this.selector,this.context,type,fn,fn2);q.stopped=false;q.run();return this},expire:function(type,fn,fn2){var self=this;if($.isFunction(type))fn2= + fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&(!type||type==query.type)&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)&&!this.stopped)$.livequery.stop(query.id)});return this}});$.livequery=function(selector,context,type,fn,fn2){this.selector=selector;this.context=context;this.type=type;this.fn=fn;this.fn2=fn2;this.elements=[];this.stopped=false;this.id=$.livequery.queries.push(this)- + 1;fn.$lqguid=fn.$lqguid||$.livequery.guid++;if(fn2)fn2.$lqguid=fn2.$lqguid||$.livequery.guid++;return this};$.livequery.prototype={stop:function(){var query=this;if(this.type)this.elements.unbind(this.type,this.fn);else if(this.fn2)this.elements.each(function(i,el){query.fn2.apply(el)});this.elements=[];this.stopped=true},run:function(){if(this.stopped)return;var query=this;var oEls=this.elements,els=$(this.selector,this.context),nEls=els.not(oEls);this.elements=els;if(this.type){nEls.bind(this.type, + this.fn);if(oEls.length>0)$.each(oEls,function(i,el){if($.inArray(el,els)<0)$.event.remove(el,query.type,query.fn)})}else{nEls.each(function(){query.fn.apply(this)});if(this.fn2&&oEls.length>0)$.each(oEls,function(i,el){if($.inArray(el,els)<0)query.fn2.apply(el)})}}};$.extend($.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if($.livequery.running&&$.livequery.queue.length){var length=$.livequery.queue.length;while(length--)$.livequery.queries[$.livequery.queue.shift()].run()}}, + pause:function(){$.livequery.running=false},play:function(){$.livequery.running=true;$.livequery.run()},registerPlugin:function(){$.each(arguments,function(i,n){if(!$.fn[n])return;var old=$.fn[n];$.fn[n]=function(){var r=old.apply(this,arguments);$.livequery.run();return r}})},run:function(id){if(id!=undefined){if($.inArray(id,$.livequery.queue)<0)$.livequery.queue.push(id)}else $.each($.livequery.queries,function(id){if($.inArray(id,$.livequery.queue)<0)$.livequery.queue.push(id)});if($.livequery.timeout)clearTimeout($.livequery.timeout); + $.livequery.timeout=setTimeout($.livequery.checkQueue,20)},stop:function(id){if(id!=undefined)$.livequery.queries[id].stop();else $.each($.livequery.queries,function(id){$.livequery.queries[id].stop()})}});$.livequery.registerPlugin("append","prepend","after","before","wrap","attr","removeAttr","addClass","removeClass","toggleClass","empty","remove","html");$(function(){$.livequery.play()})})(jQuery); \ No newline at end of file diff --git a/jQueryGantt/jQueryGantt/libs/jquery/jquery.min.js b/jQueryGantt/jQueryGantt/libs/jquery/jquery.min.js new file mode 100644 index 0000000000000000000000000000000000000000..4c5be4c0fbe230e81d95718a18829e965a2d14b2 --- /dev/null +++ b/jQueryGantt/jQueryGantt/libs/jquery/jquery.min.js @@ -0,0 +1,4 @@ +/*! jQuery v3.1.1 | (c) jQuery Foundation | jquery.org/license */ +!function(a,b){"use strict";"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){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(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 qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(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){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.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===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!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 ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.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},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.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=ga.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=ga.selectors={cacheLength:50,createPseudo:ia,match:V,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(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===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]||ga.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]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.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(_,aa).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("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.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.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},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,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(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),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).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:oa(!1),disabled:oa(!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 X.test(a.nodeName)},input:function(a){return W.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:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):C.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/[^\x20\t\r\n\f]+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R), +a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.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 V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length\x20\t\r\n\f]+)/i,ka=/^$|\/(?:java|ecma)script/i,la={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};la.optgroup=la.option,la.tbody=la.tfoot=la.colgroup=la.caption=la.thead,la.th=la.td;function ma(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function na(a,b){for(var c=0,d=a.length;c-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=ma(l.appendChild(f),"script"),j&&na(g),c){k=0;while(f=g[k++])ka.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var qa=d.documentElement,ra=/^key/,sa=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ta=/^([^.]*)(?:\.(.+)|)/;function ua(){return!0}function va(){return!1}function wa(){try{return d.activeElement}catch(a){}}function xa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)xa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=va;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(qa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i\x20\t\r\n\f]*)[^>]*)\/>/gi,za=/\s*$/g;function Da(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Ea(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Fa(a){var b=Ba.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ga(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c1&&"string"==typeof q&&!o.checkClone&&Aa.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ia(f,b,c,d)});if(m&&(e=pa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(ma(e,"script"),Ea),i=h.length;l")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=ma(h),f=ma(a),d=0,e=f.length;d0&&na(g,!i&&ma(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ja(this,a,!0)},remove:function(a){return Ja(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.appendChild(a)}})},prepend:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(ma(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!za.test(a)&&!la[(ja.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c1)}});function Ya(a,b,c,d,e){return new Ya.prototype.init(a,b,c,d,e)}r.Tween=Ya,Ya.prototype={constructor:Ya,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Ya.propHooks[this.prop];return a&&a.get?a.get(this):Ya.propHooks._default.get(this)},run:function(a){var b,c=Ya.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ya.propHooks._default.set(this),this}},Ya.prototype.init.prototype=Ya.prototype,Ya.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Ya.propHooks.scrollTop=Ya.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Ya.prototype.init,r.fx.step={};var Za,$a,_a=/^(?:toggle|show|hide)$/,ab=/queueHooks$/;function bb(){$a&&(a.requestAnimationFrame(bb),r.fx.tick())}function cb(){return a.setTimeout(function(){Za=void 0}),Za=r.now()}function db(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ba[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function eb(a,b,c){for(var d,e=(hb.tweeners[b]||[]).concat(hb.tweeners["*"]),f=0,g=e.length;f1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?ib:void 0)), +void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),ib={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=jb[b]||r.find.attr;jb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=jb[g],jb[g]=e,e=null!=c(a,b,d)?g:null,jb[g]=f),e}});var kb=/^(?:input|select|textarea|button)$/i,lb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):kb.test(a.nodeName)||lb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function mb(a){var b=a.match(K)||[];return b.join(" ")}function nb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,nb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&" "+mb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=mb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,nb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&" "+mb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=mb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,nb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=nb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(nb(c))+" ").indexOf(b)>-1)return!0;return!1}});var ob=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(ob,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:mb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ia.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Nb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,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":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,"$1"),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;if(o.cors||Pb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("