Task.js 99 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050
  1. // this.taskData 任务对象
  2. MWF.xApplication.TeamWork = MWF.xApplication.TeamWork || {};
  3. MWF.xApplication.TeamWork.Task = new Class({
  4. Extends: MPopupForm,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "width": 1200,
  9. "height": "90%",
  10. "top": null,
  11. "left": null,
  12. "bottom" : null,
  13. "right" : null,
  14. "minWidth" : 300,
  15. "minHeight" : 220,
  16. "isLimitSize": true,
  17. "ifFade": false,
  18. "hasTop": false,
  19. "hasTopIcon" : false,
  20. "hasTopContent" : false,
  21. "hasIcon": false,
  22. "hasBottom": false,
  23. "hasMask" : true,
  24. "closeByClickMask" : false,
  25. "hasScroll" : false,
  26. "scrollType" : "",
  27. "title": "",
  28. "draggable": false,
  29. "resizeable" : false,
  30. "maxAction" : false,
  31. "closeAction": false,
  32. "relativeToApp" : true,
  33. "sizeRelateTo" : "app", //desktop
  34. "resultSeparator" : ","
  35. },
  36. initialize: function (explorer, data, options, para) {
  37. this.setOptions(options);
  38. if(this.options.type && this.options.type=="window"){
  39. // this.options.width = "100%";
  40. // this.options.height = "100%";
  41. this.explorer = explorer;
  42. this.app = explorer;
  43. this.container = this.app.content;
  44. this.openType = "window"
  45. }else{
  46. this.explorer = explorer;
  47. this.app = this.explorer.app;
  48. this.container = this.app.content;
  49. this.openType = "dialog"
  50. }
  51. // this.explorer = explorer;
  52. //
  53. // this.app = this.explorer.app;
  54. // this.container = this.app.content;
  55. this.rootActions = this.app.rootActions;
  56. this.actions = this.rootActions.TaskAction;
  57. this.data = data || {};
  58. this.css = {};
  59. this.cssPath = "/x_component_TeamWork/$Task/"+this.options.style+"/css.wcss";
  60. this.load();
  61. this.lp = this.app.lp.task;
  62. // this.lp = MWF.xApplication.TeamWork.LP.task;
  63. },
  64. close: function (data) {
  65. //愤愤愤愤
  66. this.fireEvent("queryClose");
  67. this._close();
  68. //if( this.form ){
  69. // this.form.destroy();
  70. //}
  71. if(this.setFormNodeSizeFun && this.app && this.app.removeEvent ){
  72. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  73. }
  74. if( this.formMaskNode )this.formMaskNode.destroy();
  75. if( this.formAreaNode )this.formAreaNode.destroy();
  76. this.fireEvent("postClose",[data]);
  77. delete this;
  78. },
  79. openTask:function(data){
  80. //this.data.taskId = data.id;
  81. //alert("id="+this.data.taskId)
  82. // this.formAreaNode.setStyles({"opacity":"1"});
  83. // var fx = new Fx.Tween(this.formAreaNode,{duration:400});
  84. // fx.start(["opacity"] ,"1", "0");
  85. var ef = new Fx.Morph(this.formAreaNode, {
  86. duration: 200,
  87. transition: Fx.Transitions.Sine.easeOut,
  88. onStart:function(){},
  89. onComplete:function(){
  90. this._createTableContent();
  91. }.bind(this)
  92. });
  93. ef.start({
  94. 'opacity': [1, 0]
  95. });
  96. //this.formAreaNode.setStyles({"opacity":0});
  97. //this._createTableContent();
  98. },
  99. _createTableContent: function () {
  100. //data { taskId:xxx }
  101. var _self = this;
  102. this.getTaskData(function(){
  103. if(this.openType == "window"){
  104. this.app.setTitle(this.taskData.name);
  105. }
  106. this.formTableArea.empty();
  107. this.topLayout = new Element("div.topLayout",{styles:this.css.topLayout}).inject(this.formTableArea);
  108. //this.topImage = new Element("div.topImage",{styles:this.css.topImage}).inject(this.topLayout);
  109. this.topContent = new Element("div.topContent",{styles:this.css.topContent,text:this.taskData.name}).inject(this.topLayout);
  110. if(this.isNew){
  111. this.topContent.set("text",this.lp.newTask)
  112. }
  113. this.topContent.addEvents({
  114. click:function(e){
  115. layout.openApplication(e,"TeamWork.Task",null,{"taskId":this.data.taskId})
  116. }.bind(this)
  117. })
  118. this.topIconContainer = new Element("div.topIconContainer",{styles:this.css.topIconContainer}).inject(this.topLayout);
  119. //更多
  120. this.topIconMore = new Element("div.topIconMore",{styles:this.css.topIconMore,title:this.lp.more}).inject(this.topIconContainer);
  121. this.topIconMore.addEvents({
  122. click:function(){
  123. var tm = new MWF.xApplication.TeamWork.Task.TaskMore(this.container, this.topIconMore, this.app, {data:this.taskData}, {
  124. css:this.css, lp:this.lp, axis : "y",
  125. position : { //node 固定的位置
  126. x : "auto",
  127. y : "middle"
  128. },
  129. nodeStyles : {
  130. "min-width":"200px",
  131. "padding":"2px",
  132. "border-radius":"5px",
  133. "box-shadow":"0px 0px 4px 0px #999999",
  134. "z-index" : "201"
  135. },
  136. onPostLoad:function(){
  137. tm.node.setStyles({"opacity":"0","top":(tm.node.getStyle("top").toInt()+4)+"px"});
  138. var fx = new Fx.Tween(tm.node,{duration:400});
  139. fx.start(["opacity"] ,"0", "1");
  140. },
  141. onClose:function(rd){
  142. if(!rd) return;
  143. if(rd.act == "remove"){
  144. this.close(rd);
  145. if(this.data.projectObj){ //reload project
  146. this.data.projectObj.createTaskGroup()
  147. }
  148. }
  149. }.bind(this)
  150. },null,this);
  151. tm.load();
  152. }.bind(this),
  153. mouseover:function(){
  154. this.setStyles({"background-image":"url(/x_component_TeamWork/$Task/default/icon/icon_more_click.png)"});
  155. },
  156. mouseout:function(){
  157. this.setStyles(_self.css.topIconMore)
  158. }
  159. });
  160. //关闭
  161. this.topIconClose = new Element("div.topIconClose",{styles:this.css.topIconClose,title:this.lp.close}).inject(this.topIconContainer);
  162. this.topIconClose.addEvents({
  163. click:function(){
  164. this.close();
  165. if(this.openType=="window"){
  166. this.app.close();
  167. }
  168. }.bind(this),
  169. mouseover:function(){
  170. this.setStyles({"background-image":"url(/x_component_TeamWork/$Task/default/icon/icon_off_click.png)"});
  171. },
  172. mouseout:function(){
  173. this.setStyles(_self.css.topIconClose)
  174. }
  175. });
  176. this.contentLayout = new Element("div.contentLayout",{styles:this.css.contentLayout}).inject(this.formTableArea);
  177. this.createContentLayout();
  178. this.createDetailLayout();
  179. this.formAreaNode.setStyles({"opacity":1})
  180. }.bind(this));
  181. },
  182. createContentLayout:function(){
  183. var _self = this;
  184. this.taskInforContainer = new Element("div.taskInforContainer",{styles:this.css.taskInforContainer}).inject(this.contentLayout);
  185. this.taskActionBar = new Element("div.taskActionBar",{styles:this.css.taskActionBar}).inject(this.taskInforContainer);
  186. if(this.taskData.parent!="0"){
  187. this.taskActionParentContent = new Element("div.taskActionParentContent").inject(this.taskActionBar);
  188. this.taskActionParentIcon = new Element("div.taskActionParentIcon",{styles:this.css.taskActionParentIcon}).inject(this.taskActionParentContent);
  189. this.taskActionParentText = new Element("div.taskActionParentText",{styles:this.css.taskActionParentText,text:this.lp.taskBelongText+":"}).inject(this.taskActionParentContent);
  190. this.taskActionParentValue = new Element("div.taskActionParentValue",{styles:this.css.taskActionParentValue}).inject(this.taskActionParentContent);
  191. this.actions.get(this.taskData.parent,function(json){
  192. this.taskActionParentValue.set("text",json.data.name);
  193. this.taskActionParentValue.addEvents({
  194. click:function(){
  195. this.data.taskId = json.data.id;
  196. this.openTask()
  197. }.bind(this)
  198. });
  199. }.bind(this))
  200. }
  201. // this.taskActionSave = new Element("div.taskActionSave",{styles:this.css.taskActionSave,text:this.lp.save}).inject(this.taskActionBar);
  202. // this.taskActionSave.addEvents({
  203. // click:function(){
  204. // this.saveTaskData();
  205. // }.bind(this),
  206. // mouseover:function(){
  207. // this.setStyles({
  208. // "color":"#ffffff",
  209. // "background-color":"#4A90E2",
  210. // "border":"1px solid #4A90E2"
  211. // })
  212. // },
  213. // mouseout:function(){
  214. // this.setStyles(_self.css.taskActionSave)
  215. // }
  216. // });
  217. this.taskInforLayout = new Element("div.taskInforLayout",{styles:this.css.taskInforLayout}).inject(this.taskInforContainer);
  218. this.taskInforContent = new Element("div.taskInforContent",{styles:this.css.taskInforContent}).inject(this.taskInforLayout);
  219. this.app.setScrollBar(this.taskInforContent);
  220. //名称
  221. this.taskNameContainer = Element("div.taskNameContainer",{styles:this.css.taskNameContainer}).inject(this.taskInforContent);
  222. //状态
  223. this.taskStatusContainer = Element("div.taskStatusContainer",{styles:this.css.taskStatusContainer}).inject(this.taskInforContent);
  224. this.taskStatusIcon = Element("div.taskStatusIcon",{styles:this.css.taskStatusIcon}).inject(this.taskStatusContainer);
  225. this.taskStatusText = Element("div.taskStatusText",{styles:this.css.taskStatusText,text:this.lp.taskStatus}).inject(this.taskStatusContainer);
  226. this.taskStatusValue = Element("div.taskStatusValue",{styles:this.css.taskStatusValue}).inject(this.taskStatusContainer);
  227. //责任人
  228. this.taskDutyContainer = Element("div.taskDutyContainer",{styles:this.css.taskDutyContainer}).inject(this.taskInforContent);
  229. this.taskDutyIcon = Element("div.taskDutyIcon",{styles:this.css.taskDutyIcon}).inject(this.taskDutyContainer);
  230. this.taskDutyText = Element("div.taskDutyText",{styles:this.css.taskDutyText,text:this.lp.taskDuty}).inject(this.taskDutyContainer);
  231. this.taskDutyValue = Element("div.taskDutyValue",{styles:this.css.taskDutyValue}).inject(this.taskDutyContainer);
  232. //时间
  233. this.taskTimeContainer = Element("div.taskTimeContainer",{styles:this.css.taskTimeContainer}).inject(this.taskInforContent);
  234. this.taskTimeIcon = Element("div.taskTimeIcon",{styles:this.css.taskTimeIcon}).inject(this.taskTimeContainer);
  235. this.taskTimeText = Element("div.taskTimeText",{styles:this.css.taskTimeText,text:this.lp.taskTime}).inject(this.taskTimeContainer);
  236. this.taskTimeValue = Element("div.taskTimeValue",{styles:this.css.taskTimeValue}).inject(this.taskTimeContainer);
  237. //备注
  238. this.taskRemarkContainer = Element("div.taskRemarkContainer",{styles:this.css.taskRemarkContainer}).inject(this.taskInforContent);
  239. this.taskRemarkIcon = Element("div.taskRemarkIcon",{styles:this.css.taskRemarkIcon}).inject(this.taskRemarkContainer);
  240. this.taskRemarkText = Element("div.taskRemarkText",{styles:this.css.taskRemarkText,text:this.lp.taskRemark}).inject(this.taskRemarkContainer);
  241. this.taskRemarkValue = Element("div.taskRemarkValue",{styles:this.css.taskRemarkValue}).inject(this.taskRemarkContainer);
  242. //优先级
  243. this.taskPriorityContainer = Element("div.taskPriorityContainer",{styles:this.css.taskPriorityContainer}).inject(this.taskInforContent);
  244. this.taskPriorityIcon = Element("div.taskPriorityIcon",{styles:this.css.taskPriorityIcon}).inject(this.taskPriorityContainer);
  245. this.taskPriorityText = Element("div.taskPriorityText",{styles:this.css.taskPriorityText,text:this.lp.taskPriority}).inject(this.taskPriorityContainer);
  246. this.taskPriorityValue = Element("div.taskPriorityValue",{styles:this.css.taskPriorityValue}).inject(this.taskPriorityContainer);
  247. //扩展字段
  248. if(this.taskData.extFieldConfigs && this.taskData.extFieldConfigs.length>0){
  249. this.taskExtFieldContainer = new Element("div.taskExtFieldContainer",{styles:this.css.taskExtFieldContainer}).inject(this.taskInforContent);
  250. this.loadTaskExtField();
  251. }
  252. //标签
  253. this.taskTagContainer = Element("div.taskTagContainer",{styles:this.css.taskTagContainer}).inject(this.taskInforContent);
  254. this.taskTagIcon = Element("div.taskTagIcon",{styles:this.css.taskTagIcon}).inject(this.taskTagContainer);
  255. this.taskTagText = Element("div.taskTagText",{styles:this.css.taskTagText,text:this.lp.taskTag}).inject(this.taskTagContainer);
  256. this.taskTagValue = Element("div.taskTagValue",{styles:this.css.taskTagValue}).inject(this.taskTagContainer);
  257. //附件 -- 换成其他样式
  258. // this.taskAttachmentContainer = Element("div.taskAttachmentContainer",{styles:this.css.taskAttachmentContainer}).inject(this.taskInforContent);
  259. // this.taskAttachmentIcon = Element("div.taskAttachmentIcon",{styles:this.css.taskAttachmentIcon}).inject(this.taskAttachmentContainer);
  260. // this.taskAttachmentText = Element("div.taskAttachmentText",{styles:this.css.taskAttachmentText,text:this.lp.taskAttachment}).inject(this.taskAttachmentContainer);
  261. // this.taskAttachmentValue = Element("div.taskAtchatBarEmojitachmentValue",{styles:this.css.taskAttachmentValue}).inject(this.taskAttachmentContainer);
  262. //附件
  263. this.taskAttachmentListContainer = new Element("div.taskAttachmentListContainer",{styles:this.css.taskAttachmentListContainer}).inject(this.taskInforContent);
  264. this.loadTaskAttachmentListContainer();
  265. this.setTaskData();
  266. //this.setAuth();
  267. //子任务
  268. this.subTaskContainer = new Element("div.subTaskContainer",{styles:this.css.subTaskContainer}).inject(this.taskInforContent);
  269. this.loadSubTaskContainer();
  270. //占位
  271. new Element("div",{styles:{"width":"100%","height":"100px"}}).inject(this.taskInforContent)
  272. },
  273. loadTaskExtField:function(){
  274. this.taskData.extFieldConfigs.each(function(data){
  275. this.loadTaskExtFieldItem(data);
  276. }.bind(this))
  277. },
  278. loadTaskExtFieldItem:function(data){
  279. var taskExtFieldItem = new Element("div.taskExtFieldItem",{styles:this.css.taskExtFieldItem}).inject(this.taskExtFieldContainer);
  280. var taskExtFieldIcon = new Element("div.taskExtFieldIcon",{styles:this.css.taskExtFieldIcon}).inject(taskExtFieldItem);
  281. var taskExtFieldText = new Element("div.taskExtFieldText",{styles:this.css.taskExtFieldText}).inject(taskExtFieldItem);
  282. new Element("p",{styles:{
  283. "justify-content": "center",
  284. "align-items":"center"
  285. },text:data.displayName}).inject(taskExtFieldText);
  286. if(data.displayType.toUpperCase() == "TEXT"){
  287. }
  288. },
  289. createDetailLayout:function(){
  290. this.taskDetailLayout = new Element("div.taskDetailLayout",{styles:this.css.taskDetailLayout}).inject(this.contentLayout);
  291. this.taskParticipateContainer = new Element("div.taskParticipateContainer",{styles:this.css.taskParticipateContainer}).inject(this.taskDetailLayout);
  292. this.createParticipateContainer();
  293. this.taskDynamicContainer = new Element("div.taskDynamicContainer",{styles:this.css.taskDynamicContainer}).inject(this.taskDetailLayout);
  294. this.createDynamicContainer();
  295. this.taskChatContainer = new Element("div.taskChatContainer",{styles:this.css.taskChatContainer}).inject(this.taskDetailLayout);
  296. this.createChatContainer();
  297. },
  298. createParticipateContainer:function(){
  299. this.taskParticipateContainer.empty();
  300. this.participateTitle = new Element("div.participateTitle",{styles:this.css.participateTitle}).inject(this.taskParticipateContainer);
  301. this.participateTitleText = new Element("div.participateTitleText",{styles:this.css.participateTitleText}).inject(this.participateTitle);
  302. this.participateTitleIcon = new Element("div.participateTitleIcon",{styles:this.css.participateTitleIcon,title:this.lp.taskReaderAdd}).inject(this.participateTitle);
  303. this.participateTitleIcon.addEvents({
  304. click:function(){
  305. this.selectPerson(this.participateTitleIcon,null,["identity","unit"],0,
  306. function(json){
  307. if(json.length>0){
  308. this.taskData.participantList = this.taskData.participantList.concat(json);
  309. //this.actions.updateParticipantList(this.taskData.id,{participantList:this.taskData.participantList},function(json){
  310. this.actions.updateParticipant(this.taskData.id,{participantList:this.taskData.participantList},function(json){
  311. if(json.data.dynamics){
  312. json.data.dynamics.each(function(dd){
  313. this.loadDynamicItem(dd,"bottom")
  314. }.bind(this))
  315. }
  316. this.dynamicContent.scrollTo(0,this.dynamicContent.getScrollSize().y);
  317. this.createParticipateContainer();
  318. }.bind(this))
  319. }
  320. }.bind(this)
  321. );
  322. }.bind(this)
  323. });
  324. this.participateValue = new Element("div.participateValue",{styles:this.css.participateValue}).inject(this.taskParticipateContainer);
  325. this.setScrollBar(this.participateValue);
  326. if(this.taskData.participantList){
  327. count = this.taskData.participantList.length;
  328. this.participateTitleText.set("text",this.lp.taskReader + " . " + count);
  329. this.taskData.participantList.each(function(d){
  330. var flag = true;
  331. if(this.taskData.executor){
  332. if(d === this.taskData.executor) flag = false
  333. }
  334. this.loadparticipantPerson(this.participateValue,d,flag);
  335. }.bind(this));
  336. }
  337. },
  338. createDynamicContainer:function(){
  339. var _self = this;
  340. this.taskDynamicContainer.empty();
  341. this.dynamicBar = new Element("div.dynamicBar",{styles:this.css.dynamicBar}).inject(this.taskDynamicContainer);
  342. this.dynamicBar.addEvents({
  343. mouseover:function(){
  344. this.dynamicText.setStyle("color","#4a90e2");
  345. this.dynamicIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/icon_dw_click.png)")
  346. }.bind(this),
  347. mouseout:function(){
  348. this.dynamicText.setStyle("color","#666666");
  349. this.dynamicIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/icon_dw.png)")
  350. }.bind(this),
  351. click:function(){
  352. var pc = new MWF.xApplication.TeamWork.Task.DynamicType(this.container, this.dynamicBar, this.app, {data:this.taskData}, {
  353. css:this.css, lp:this.lp, axis : "y",
  354. position : { //node 固定的位置
  355. x : "right",
  356. y : "middle"
  357. },
  358. nodeStyles : {
  359. "min-width":"150px",
  360. "padding":"2px",
  361. "border-radius":"5px",
  362. "box-shadow":"0px 0px 4px 0px #999999",
  363. "z-index" : "201"
  364. },
  365. onPostLoad:function(){
  366. pc.node.setStyles({"opacity":"0","top":(pc.node.getStyle("top").toInt()-6)+"px","left":(pc.node.getStyle("left").toInt()+10)+"px"});
  367. var fx = new Fx.Tween(pc.node,{duration:400});
  368. fx.start(["opacity"] ,"0", "1");
  369. },
  370. onClose:function(rd){
  371. if(!rd) return;
  372. if(rd.value == "all"){
  373. filter = {};
  374. this.dynamicText.set("text",this.lp.dynamicAll)
  375. }else if(rd.value == "chat"){
  376. filter = {objectType:"CHAT"};
  377. this.dynamicText.set("text",this.lp.dynamicChat)
  378. }else if(rd.value == "attachment"){
  379. this.dynamicText.set("text",this.lp.dynamicAttachment)
  380. filter = {objectType:"ATTACHMENT"};
  381. }
  382. this.dynamicContent.empty();
  383. this.dyncurCount = 0;
  384. this.createDynamicContent(null,filter,function(){
  385. this.dynamicContent.scrollTo(0,this.dynamicContent.getScrollSize().y);
  386. this.getDynamicStatus = false;
  387. }.bind(this))
  388. }.bind(this)
  389. });
  390. pc.load();
  391. }.bind(this),
  392. });
  393. this.dynamicText = new Element("div.dynamicText",{styles:this.css.dynamicText,text:this.lp.dynamicAll}).inject(this.dynamicBar);
  394. this.dynamicIcon = new Element("div.dynamicIcon",{styles:this.css.dynamicIcon}).inject(this.dynamicBar);
  395. this.dynamicContent = new Element("div.dynamicContent",{styles:this.css.dynamicContent}).inject(this.taskDynamicContainer);
  396. var filter = {};
  397. var _y = this.dynamicContent.getScrollSize().y;
  398. this.dynamicContent.addEvents({
  399. scroll:function(){
  400. if(this.getScrollTop()==0){
  401. //alert("top")
  402. //加载下一页
  403. if(_self.getDynamicStatus) return;
  404. if(_self.dyncurCount>=_self.dyntotal) return;
  405. _self.createDynamicContent(_self.curDynamicId,filter,function(){
  406. _self.dynamicContent.scrollTo(0,_y);
  407. _self.getDynamicStatus = false;
  408. });
  409. }
  410. }
  411. });
  412. this.createDynamicContent(null,filter,function(){
  413. this.dynamicContent.scrollTo(0,this.dynamicContent.getScrollSize().y);
  414. this.getDynamicStatus = false;
  415. }.bind(this));
  416. },
  417. createDynamicContent:function(id,data,callback){
  418. this.getDynamicStatus = true;
  419. var _self = this, id = id || "(0)", count = 15, taskId = this.taskData.id;
  420. this.curDynamicId = id;
  421. //this.dyntotal = 0;
  422. this.dyncurCount = this.dyncurCount || 0;
  423. this.tmpdynamicLoading = new Element("div").inject(this.dynamicContent,"top");
  424. this.app.setLoading(this.tmpdynamicLoading);
  425. this.rootActions.DynamicAction.listNextWithTask(id,count,taskId,data||{},function(json){
  426. //this.actions.taskDynamicListNext(id,count,taskId,data||{},function(json){
  427. if(this.tmpdynamicLoading)this.tmpdynamicLoading.destroy();
  428. //this.getDynamicStatus = false;
  429. if(json.type == "success"){
  430. this.dyntotal = json.count;
  431. json.data.each(function(d,i){
  432. this.curDynamicId = d.id;
  433. this.loadDynamicItem(d);
  434. }.bind(this));
  435. if(callback)callback(json)
  436. }
  437. }.bind(this))
  438. },
  439. loadDynamicItem:function(data,where){
  440. this.dyncurCount = this.dyncurCount + 1;
  441. var dynamicItem = new Element("div.dynamicItem",{styles:this.css.dynamicItem}).inject(this.dynamicContent,where||"top");
  442. var dynamicItemIcon = new Element("div.dynamicItemIcon",{styles:this.css.dynamicItemIcon}).inject(dynamicItem);
  443. var optType = data.optType.toUpperCase();
  444. var objectType = data.objectType.toUpperCase();
  445. if(objectType == "CHAT"){
  446. //if(optType.toUpperCase() == "PUBLISH"){
  447. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/dy_chat.png)")
  448. //}
  449. }else if(objectType == "ATTACHMENT"){
  450. if(optType == "DELETE"){ //UPLOAD、DOWNLOAD、DELETE
  451. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/dy_remove.png)")
  452. }else{
  453. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/dy_attachment.png)")
  454. }
  455. }else if(objectType == "TASK"){
  456. //UPDATE_NAME、UPDATE_EXECUTOR、UPDATE_STATUS、UPDATE_TIME、UPDATE_PROGRESS、ADD_TAGS、REMOVE_TAGS、
  457. //ADD_MANAGER、REMOVE_MANAGER、ADD_PARTICIPANTS、REMOVE_PARTICIPANTS、CREATE、DELETE
  458. if(optType=="SPLIT"){
  459. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/dy_subtask.png)")
  460. }else if(optType=="DELETE_SUBTASK"){
  461. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/dy_remove.png)")
  462. }else if(optType=="UPDATE_EXECUTOR"){
  463. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/dy_duty.png)")
  464. }else if(optType=="UPDATE_NAME"){
  465. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/dy_title.png)")
  466. }else if(optType=="UPDATE_WORKSTATUS"){
  467. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/dy_status.png)")
  468. }else if(optType=="UPDATE_WORKDATE"){
  469. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/dy_time.png)")
  470. }else if(optType=="UPDATE_DESCRIPTION"){
  471. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/dy_remark.png)")
  472. }else if(optType=="ADD_PARTICIPANTS" || optType == "REMOVE_PARTICIPANTS"){
  473. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/dy_participant.png)")
  474. }else if(optType=="CREATE"){
  475. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/icon_jia.png)")
  476. }else{
  477. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/icon_edit.png)")
  478. }
  479. }else if(objectType=="TASK_TAG"){
  480. if(optType=="REMOVE"){
  481. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/dy_remove.png)")
  482. }else{
  483. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/dy_tag.png)")
  484. }
  485. }
  486. var dynamicItemText = new Element("div.dynamicItemText",{styles:this.css.dynamicItemText}).inject(dynamicItem);
  487. if(objectType == "CHAT"){
  488. new Element("div.dynamicItemUser",{styles:this.css.dynamicItemUser,text:data.operator.split("@")[0]}).inject(dynamicItemText);
  489. var chattext = data.description.split("\n").join("<br/>");
  490. //转换表情
  491. for(var item in this.app.lp.emoji){
  492. var val = this.app.lp.emoji[item]; //alert(val)
  493. chattext = chattext.split("["+val+"]").join('<img style="margin:0px 2px; width:30px;height:30px;" src="/x_component_TeamWork/$Emoji/default/icon/'+item+'.png" />');
  494. }
  495. new Element("div.dynamicItemUserChat",{styles:{"margin-top":"5px"},html:chattext}).inject(dynamicItemText);
  496. }else{
  497. dynamicItemText.set("text",data.description);
  498. }
  499. var dynamicItemTime = new Element("div.dynamicItemTime",{styles:this.css.dynamicItemTime}).inject(dynamicItem);
  500. dynamicItemTime.set("text",this.compareWithNow(data.createTime).text);
  501. //最后加一层清除浮动
  502. new Element("div.dynamicItemTime",{styles:{"clear":"both"}}).inject(dynamicItem);
  503. },
  504. createChatContainer:function(){
  505. this.taskChatContainer.empty();
  506. var node = this.taskChatContainer;
  507. this.chatContent = new Element("div.chatContent",{styles:this.css.chatContent}).inject(node);
  508. this.chatTextarea = new Element("textarea.chatTextarea",{styles:this.css.chatTextarea,placeholder:this.lp.chatPlaceholder}).inject(this.chatContent);
  509. this.chatTextarea.addEvents({
  510. keypress:function(e){
  511. var keycode = (e.event.keyCode ? e.event.keyCode : e.event.which);
  512. if (e.event.ctrlKey && (keycode == 13 || keycode == 10)) {
  513. this.chatBarSend.click();
  514. }
  515. }.bind(this)
  516. });
  517. this.chatBarContent = new Element("div.chatBarContent",{styles:this.css.chatBarContent}).inject(node);
  518. this.chatBarTool = new Element("div.chatBarTool",{styles:this.css.chatBarTool}).inject(this.chatBarContent);
  519. this.chatBarEmoji = new Element("div.chatBarEmoji",{styles:this.css.chatBarEmoji,title:this.lp.chatInsertEmoji}).inject(this.chatBarTool);
  520. this.chatBarEmoji.addEvents({
  521. mouseover:function(){this.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/icon_emoji_click.png)")},
  522. mouseout:function(){this.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/icon_emoji.png)")},
  523. click:function(){
  524. MWF.xDesktop.requireApp("TeamWork", "Emoji", function(){
  525. var pc = new MWF.xApplication.TeamWork.Emoji(this,this.container, this.chatBarEmoji, this.app, {}, {
  526. css:this.css, lp:this.lp, axis : "y",
  527. position : { //node 固定的位置
  528. x : "right",
  529. y : "middle"
  530. },
  531. nodeStyles : {
  532. "min-width":"200px",
  533. "max-width":"350px",
  534. "height":"150px",
  535. "padding":"2px",
  536. "border-radius":"5px",
  537. "box-shadow":"0px 0px 4px 0px #999999",
  538. "z-index" : "201"
  539. },
  540. onPostLoad:function(){
  541. pc.node.setStyles({"opacity":"0","top":(pc.node.getStyle("top").toInt())+"px"});
  542. var fx = new Fx.Tween(pc.node,{duration:400});
  543. fx.start(["opacity"] ,"0", "1");
  544. },
  545. onClose:function(rd){
  546. if(!rd) return;
  547. if(rd.value && rd.value !=""){
  548. this.chatTextarea.set("value",this.chatTextarea.get("value")+"["+rd.value+"]");
  549. this.chatTextarea.focus();
  550. }
  551. }.bind(this)
  552. });
  553. pc.load();
  554. }.bind(this))
  555. }.bind(this)
  556. });
  557. this.chatBarSend = new Element("div.chatBarSend",{styles:this.css.chatBarSend,text:this.lp.chatSend}).inject(this.chatBarContent);
  558. this.chatBarSend.addEvents({
  559. click:function(){
  560. if(this.chatTextarea.get("value").trim()=="") return;
  561. var data = {
  562. taskId : this.taskData.id,
  563. content : this.chatTextarea.get("value").trim()
  564. };
  565. //this.actions.chatCreate(data,function(json){
  566. this.rootActions.ChatAction.create(data,function(json){
  567. if(json.data.id){
  568. this.rootActions.ChatAction.get(json.data.id,function(json){
  569. var person = json.data.sender;
  570. var content = json.data.content;
  571. var dynamicItem = new Element("div.dynamicItem",{styles:this.css.dynamicItem}).inject(this.dynamicContent);
  572. var dynamicItemIcon = new Element("div.dynamicItemIcon",{styles:this.css.dynamicItemIcon}).inject(dynamicItem);
  573. dynamicItemIcon.setStyle("background-image","url(/x_component_TeamWork/$Task/default/icon/icon_chat.png)")
  574. var dynamicItemText = new Element("div.dynamicItemText",{styles:this.css.dynamicItemText}).inject(dynamicItem);
  575. new Element("div.dynamicItemUser",{styles:this.css.dynamicItemUser,text:person.split("@")[0]}).inject(dynamicItemText);
  576. var chattext = content.split("\n").join("<br/>");
  577. for(var item in this.app.lp.emoji){
  578. var val = this.app.lp.emoji[item];
  579. chattext = chattext.split("["+val+"]").join('<img style="margin:0 2px; width:30px;height:30px;" src="/x_component_TeamWork/$Emoji/default/icon/'+item+'.png" />');
  580. }
  581. new Element("div.dynamicItemUserChat",{styles:{"margin-top":"5px"},html:chattext}).inject(dynamicItemText);
  582. var dynamicItemTime = new Element("div.dynamicItemTime",{styles:this.css.dynamicItemTime}).inject(dynamicItem);
  583. dynamicItemTime.set("text","刚刚");
  584. new Element("div.dynamicItemTime",{styles:{"clear":"both"}}).inject(dynamicItem);
  585. this.dynamicContent.scrollTo(0,this.dynamicContent.getScrollSize().y);
  586. }.bind(this))
  587. }
  588. this.createChatContainer()
  589. }.bind(this))
  590. }.bind(this)
  591. })
  592. },
  593. addDynamicItem:function(){
  594. },
  595. getTaskData:function(callback){
  596. if(this.data.taskId){
  597. //this.actions.taskGet(this.data.taskId,function(json){
  598. this.actions.get(this.data.taskId,function(json){
  599. if(json.data) {
  600. this.taskData = json.data;
  601. if(callback)callback()
  602. }
  603. }.bind(this))
  604. }
  605. },
  606. setTaskData:function(){
  607. var _self = this;
  608. //名称
  609. if(this.taskNameContainer){
  610. this.loadNameValue();
  611. }
  612. //状态
  613. if(this.taskStatusValue){
  614. this.loadStatusValue()
  615. }
  616. //负责人
  617. if(this.taskDutyValue){
  618. this.loadDutyValue()
  619. }
  620. //时间
  621. if(this.taskTimeContainer){
  622. this.loadTimeValue()
  623. }
  624. //备注
  625. if(this.taskRemarkContainer){
  626. this.loadRemarkValue()
  627. }
  628. //优先级
  629. if(this.taskPriorityValue){
  630. this.loadPriorityValue()
  631. }
  632. //标签
  633. if(this.taskTagValue){
  634. this.loadTagValue()
  635. }
  636. //附件
  637. if(this.taskAttachmentValue){
  638. this.loadAttachment(this.taskAttachmentValue)
  639. }
  640. },
  641. saveTaskData:function(callback) {
  642. if(this.editor){
  643. this.taskData.description = encodeURI(this.editor.getData());
  644. }
  645. this.actions.save(this.taskData,function(json){
  646. if(this.editor) delete this.editor;
  647. //alert(JSON.stringify(json));
  648. this.reload();
  649. //刷新project区域内的task,可能有更新,删除等 干脆直接载入区域
  650. var data = {
  651. "act":"save",
  652. "taskId":json.data.id
  653. };
  654. this.reloadOutContent(data);
  655. }.bind(this))
  656. },
  657. reloadOutContent:function(json){
  658. if(json.act == "save"){
  659. //保存操作,刷新task即可
  660. var taskNode = this.explorer.container.getElementById(json.taskId);
  661. if(!taskNode) return;
  662. this.actions.get(json.taskId,function(d){
  663. this.explorer.loadTaskNode(taskNode,d.data)
  664. }.bind(this));
  665. }
  666. },
  667. updateSingleProperty:function(data,callback){
  668. //this.actions.updateSingleProperty(data.taskId,data,function(json){
  669. this.actions.updateSingleProperty(data.taskId,data,function(json){
  670. if(json.data.dynamics){
  671. json.data.dynamics.each(function(dd){
  672. this.loadDynamicItem(dd,"bottom");
  673. }.bind(this))
  674. }
  675. this.dynamicContent.scrollTo(0,this.dynamicContent.getScrollSize().y);
  676. if(callback)callback(json.data)
  677. }.bind(this))
  678. },
  679. loadNameValue:function(){ //名称
  680. var _self = this;
  681. this.taskNameContainer.set("text",this.taskData.name);
  682. if(true){ //权限修改
  683. var node = this.taskNameContainer;
  684. var nameEdit = false;
  685. var overStatus = null;
  686. node.addEvents({
  687. mouseenter:function(){
  688. overStatus = window.setTimeout(function(){
  689. var opt={ axis: "y", position : { x : "auto", y : "top"} };
  690. //_self.app.showTips(node,{_html:"<div style='margin:2px 5px;'>"+_self.lp.editTip+"</div>"},opt);
  691. node.set("title",_self.lp.editTip);
  692. },300);
  693. if(this.getElement("input")) return;
  694. var name = this.get("text");
  695. node.empty();
  696. var input = new Element("input.taskNameInput",{type:"text",value:name,styles:_self.css.taskNameInput}).inject(node);
  697. input.addEvents({
  698. click:function(ev){
  699. nameEdit = true;
  700. if(_self.app.st&&_self.app.st.node)_self.app.st.node.destroy();
  701. delete _self.app.st;
  702. ev.stopPropagation()
  703. },
  704. blur:function(){
  705. var v = this.get("value").trim();
  706. if(v=="" || v == _self.taskData.name){
  707. _self.taskNameContainer.empty();
  708. _self.taskNameContainer.set("text",_self.taskData.name);
  709. _self.taskNameContainer.setStyles({"background-color":""});
  710. _self.taskData.name = v;
  711. }else{
  712. if(v != _self.taskData.name){
  713. var sd = {
  714. taskId:_self.taskData.id,
  715. property:"name",
  716. mainValue:v,
  717. secondaryValue:""
  718. }
  719. _self.updateSingleProperty(sd,function(json){
  720. _self.taskNameContainer.empty();
  721. _self.taskNameContainer.set("text",v);
  722. _self.taskNameContainer.setStyles({"background-color":""});
  723. _self.taskData.name = v;
  724. nameEdit = false;
  725. })
  726. }
  727. }
  728. }
  729. });
  730. },
  731. mouseleave:function(){
  732. window.clearTimeout(overStatus);
  733. if(!nameEdit){
  734. if(this.getElement("input")){
  735. var n = this.getElement("input").get("value");
  736. this.empty();
  737. this.set("text",n);
  738. }
  739. this.setStyles({"background-color":""})
  740. }
  741. }
  742. });
  743. }
  744. },
  745. loadStatusValue:function(){ //状态
  746. var _self = this;
  747. if(this.taskStatusValue) this.taskStatusValue.empty();
  748. this.taskStatusValueContainer = new Element("div.taskStatusValueContainer",{styles:this.css.taskStatusValueContainer}).inject(this.taskStatusValue);
  749. this.taskStatusValueIcon = new Element("div.taskStatusValueIcon",{styles:this.css.taskStatusValueIcon}).inject(this.taskStatusValueContainer);
  750. this.taskStatusValueText = new Element("div.taskStatusValueText",{styles:this.css.taskStatusValueText}).inject(this.taskStatusValueContainer);
  751. if(this.taskData.workStatus == "draft"){
  752. this.taskStatusValueContainer.setStyles({"color":"#666666"});
  753. this.taskStatusValueIcon.setStyles({"background-image":"url(/x_component_TeamWork/$Task/default/icon/icon_draft.png)"});
  754. this.taskStatusValueText.set("text",this.lp.status.draft);
  755. }else if(this.taskData.workStatus == "flow"){
  756. this.taskStatusValueContainer.setStyles({"color":"#666666"});
  757. this.taskStatusValueIcon.setStyles({"background-image":"url(/x_component_TeamWork/$Task/default/icon/icon_flow.png)"});
  758. this.taskStatusValueText.set("text",this.lp.status.flow);
  759. }else if(this.taskData.workStatus == "processing") {
  760. this.taskStatusValueContainer.setStyles({"color": "#666666"});
  761. this.taskStatusValueIcon.setStyles({"background-image": "url(/x_component_TeamWork/$Task/default/icon/icon_flow.png)"});
  762. this.taskStatusValueText.set("text",this.lp.status.processing);
  763. }else if(this.taskData.workStatus == "completed"){
  764. this.taskStatusValueContainer.setStyles({"color":"#69b439"});
  765. this.taskStatusValueIcon.setStyles({"background-image":"url(/x_component_TeamWork/$Task/default/icon/icon_complete.png)"});
  766. this.taskStatusValueText.set("text",this.lp.status.completed);
  767. }
  768. if(true){ //权限
  769. this.taskStatusValueContainer.addEvents({
  770. click:function(){
  771. var sc = new MWF.xApplication.TeamWork.Task.StatusCheck(this.container, this.taskStatusValueContainer, this.app, {data:this.taskData}, {
  772. css:this.css, lp:this.lp, axis : "y",
  773. position : { //node 固定的位置
  774. x : "right",
  775. y : "middle"
  776. },
  777. nodeStyles : {
  778. "min-width":"200px",
  779. "padding":"2px",
  780. "border-radius":"5px",
  781. "box-shadow":"0px 0px 4px 0px #999999",
  782. "z-index" : "201"
  783. },
  784. onPostLoad:function(){
  785. sc.node.setStyles({"opacity":"0","top":(sc.node.getStyle("top").toInt()+4)+"px"});
  786. var fx = new Fx.Tween(sc.node,{duration:400});
  787. fx.start(["opacity"] ,"0", "1");
  788. },
  789. onClose:function(rd){
  790. if(!rd) return;
  791. if(rd.status){
  792. if(rd.status != this.taskData.workStatus){
  793. var sd = {
  794. taskId:_self.taskData.id,
  795. property:"workStatus",
  796. mainValue:rd.status,
  797. secondaryValue:""
  798. };
  799. _self.updateSingleProperty(sd,function(){
  800. this.taskData.workStatus = rd.status;
  801. this.loadStatusValue();
  802. }.bind(this))
  803. }
  804. }
  805. }.bind(this)
  806. });
  807. sc.load();
  808. }.bind(this),
  809. mouseover:function(){
  810. this.setStyles({"background-color":"#efefef"});
  811. this.getElement(".taskStatusValueIcon").setStyles({ "background-image":"url(/x_component_TeamWork/$Task/default/icon/icon_down.png)"})
  812. },
  813. mouseout:function(){
  814. this.setStyles(_self.css.taskStatusValueContainer);
  815. var bgurl = "url(/x_component_TeamWork/$Task/default/icon/icon_draft.png)";
  816. if(_self.taskData.workStatus == "processing")bgurl = "url(/x_component_TeamWork/$Task/default/icon/icon_flow.png)";
  817. else if(_self.taskData.workStatus == "completed")bgurl = "url(/x_component_TeamWork/$Task/default/icon/icon_complete.png)";
  818. this.getElement(".taskStatusValueIcon").setStyles({"background-image":bgurl})
  819. }
  820. });
  821. }
  822. },
  823. loadDutyValue:function(){
  824. var _self = this;
  825. if(this.taskDutyValue) this.taskDutyValue.empty();
  826. this.taskDutyValueContainer = new Element("div.taskDutyValueContainer",{styles:this.css.taskDutyValueContainer}).inject(this.taskDutyValue);
  827. if(true){//权限
  828. if(this.taskData.executor==""){
  829. this.taskDutyAddIcon = new Element("div.taskDutyAddIcon",{styles:this.css.taskDutyAddIcon}).inject(this.taskDutyValueContainer);
  830. this.taskDutyAddText = new Element("div.taskDutyAddText",{styles:this.css.taskDutyAddText,text:this.lp.addDuty}).inject(this.taskDutyValueContainer);
  831. this.taskDutyAddText.addEvents({
  832. mouseover:function(){this.setStyles({"color":"#4a90e2"})},
  833. mouseout:function(){this.setStyles({"color":"#666666"})},
  834. click:function(){
  835. this.selectPerson(this.taskDutyAddText,"identity",null,1,
  836. function(json){
  837. if(json.length>0){
  838. this.taskData.executor = json[0];
  839. this.loadDutyValue()
  840. }
  841. }.bind(this));
  842. }.bind(this)
  843. })
  844. }else{
  845. this.loadTaskPerson(this.taskDutyValueContainer,this.taskData.executor,true);
  846. }
  847. }else{
  848. if(this.taskData.executor!=""){
  849. this.loadTaskPerson(this.taskDutyValueContainer,this.taskData.executor);
  850. }
  851. }
  852. },
  853. loadTimeValue:function(){
  854. var _self = this;
  855. this.taskStartTime = new Element("div.taskStartTime",{styles:this.css.taskStartTime}).inject(this.taskTimeContainer);
  856. this.taskTimeLine = new Element("div.taskTimeLine",{styles:this.css.taskTimeLine,text:"-"}).inject(this.taskTimeContainer);
  857. this.taskEndTime = new Element("div.taskEndTime",{styles:this.css.taskEndTime}).inject(this.taskTimeContainer);
  858. if(this.taskData.startTime && this.taskData.startTime!=""){
  859. this.taskStartTime.set("text",this.taskData.startTime);
  860. this.taskStartTime.setStyles({"color":"#333333"});
  861. }else{
  862. this.taskStartTime.set("text",this.lp.taskTimeStart);
  863. }
  864. if(this.taskData.endTime && this.taskData.endTime!=""){
  865. this.taskEndTime.set("text",this.taskData.endTime);
  866. this.taskEndTime.setStyles({"color":"#333333"});
  867. }else{
  868. this.taskEndTime.set("text",this.lp.taskTimeEnd);
  869. }
  870. if(true){ //权限
  871. this.taskStartTime.setStyles({"background-color":"#f5f5f5","cursor":"pointer"});
  872. this.taskEndTime.setStyles({"background-color":"#f5f5f5","cursor":"pointer"});
  873. this.taskStartTime.addEvents({
  874. click:function(){
  875. var opt = {
  876. type:"datetime"
  877. };
  878. this.app.selectCalendar(this.taskStartTime,this.container,opt,function(json){
  879. var sd = {
  880. taskId:_self.taskData.id,
  881. property:"startTime",
  882. secondaryValue:""
  883. };
  884. if(json.action == "ok"){
  885. this.taskStartTime.set("text",json.dateString+":00");
  886. sd.mainValue = json.dateString+":00"
  887. }else if(json.action == "clear"){
  888. this.taskStartTime.set("text",this.lp.taskTimeStart);
  889. sd.mainValue = ""
  890. }
  891. this.updateSingleProperty(sd)
  892. }.bind(this))
  893. }.bind(this)
  894. });
  895. this.taskEndTime.addEvents({
  896. click:function(){
  897. var opt = {
  898. type:"datetime"
  899. };
  900. this.app.selectCalendar(this.taskEndTime,this.container,opt,function(json){
  901. var sd = {
  902. taskId:_self.taskData.id,
  903. property:"endTime",
  904. secondaryValue:""
  905. };
  906. if(json.action == "ok"){
  907. this.taskEndTime.set("text",json.dateString+":00");
  908. sd.mainValue = json.dateString + ":00"
  909. }else if(json.action == "clear"){
  910. this.taskEndTime.set("text",this.lp.taskTimeEnd);
  911. sd.mainValue = ""
  912. }
  913. this.updateSingleProperty(sd)
  914. }.bind(this))
  915. }.bind(this)
  916. })
  917. }
  918. },
  919. loadRemarkValue:function(){
  920. var _self = this;
  921. var value = this.taskData.description || "";
  922. value = decodeURI(value);
  923. this.taskRemarkValue.set("html",value);
  924. if(this.taskRemarkValue.getFirst("p")){
  925. this.taskRemarkValue.getFirst("p").setStyles({"margin-top":"0px"})
  926. }
  927. if(this.editor) delete this.editor;
  928. if(true){ //权限
  929. if(value == ""){
  930. this.taskRemarkValue.set("text",this.lp.editTip);
  931. }
  932. this.taskRemarkValue.removeEvents(["click"])
  933. this.taskRemarkValue.addEvents({
  934. click:function(e){
  935. this.taskRemarkValue.setStyles({"background-color":"","color":""});
  936. this.taskRemarkValue.removeEvents(["mouseenter"]);
  937. if(!this.editor)this.taskRemarkValue.empty();
  938. this.loadRemarkEditor(this.taskRemarkValue,value,"taskRemark");
  939. e.stopPropagation();
  940. }.bind(this),
  941. mouseenter:function(){
  942. this.taskRemarkValue.setStyles({"background-color":"#f5f5f5","color":"#999999"})
  943. }.bind(this),
  944. mouseleave:function(){
  945. this.taskRemarkValue.setStyles({"background-color":"","color":""})
  946. }.bind(this)
  947. });
  948. }
  949. },
  950. loadPriorityValue:function(){
  951. if(this.taskPriorityValue)this.taskPriorityValue.empty();
  952. var node = new Element("div.taskPriorityValueText",{styles:this.css.taskPriorityValueText}).inject(this.taskPriorityValue);
  953. var curColor = "#999999";
  954. if(this.taskData.priority){
  955. node.set("text",this.taskData.priority);
  956. if(this.taskData.priority == this.lp.priority.urgency) curColor = "#ffaf38";
  957. else if(this.taskData.priority == this.lp.priority.emergency) curColor = "#ff4f3e";
  958. node.setStyles({"color":curColor,"border":"1px solid "+curColor+""})
  959. }else{
  960. node.set("text",this.lp.priority.normal)
  961. }
  962. node.addEvents({
  963. click:function(){
  964. var pc = new MWF.xApplication.TeamWork.Task.PriorityCheck(this.container, node, this.app, {data:this.taskData}, {
  965. css:this.css, lp:this.lp, axis : "y",
  966. position : { //node 固定的位置
  967. x : "right",
  968. y : "middle"
  969. },
  970. nodeStyles : {
  971. "min-width":"200px",
  972. "padding":"2px",
  973. "border-radius":"5px",
  974. "box-shadow":"0px 0px 4px 0px #999999",
  975. "z-index" : "201"
  976. },
  977. onPostLoad:function(){
  978. pc.node.setStyles({"opacity":"0","top":(pc.node.getStyle("top").toInt()+4)+"px"});
  979. var fx = new Fx.Tween(pc.node,{duration:400});
  980. fx.start(["opacity"] ,"0", "1");
  981. },
  982. onClose:function(rd){
  983. if(!rd) return;
  984. if(rd.value){
  985. if(rd.value != this.taskData.priority){
  986. var sd = {
  987. taskId:this.taskData.id,
  988. property:"priority",
  989. mainValue:rd.value,
  990. secondaryValue:""
  991. };
  992. this.updateSingleProperty(sd,function(){
  993. this.taskData.priority = rd.value;
  994. this.loadPriorityValue();
  995. }.bind(this))
  996. }
  997. }
  998. this.loadPriorityValue();
  999. }.bind(this)
  1000. });
  1001. pc.load();
  1002. }.bind(this),
  1003. mouseover:function(){
  1004. this.setStyles({"border":"1px solid #4A90E2","color":"#4A90E2"})
  1005. },
  1006. mouseout:function(){
  1007. this.setStyles({"border":"1px solid "+curColor+"","color":curColor})
  1008. }
  1009. })
  1010. },
  1011. loadTagValue:function(){
  1012. if(this.taskTagValue)this.taskTagValue.empty();
  1013. this.taskTagLayout = new Element("div.taskTagLayout",{styles:this.css.taskTagLayout}).inject(this.taskTagValue);
  1014. this.taskTagAddContainer = new Element("div.taskTagAddContainer",{styles:this.css.taskTagAddContainer}).inject(this.taskTagValue);
  1015. this.taskTagAddText = new Element("div.taskTagAddText",{styles:this.css.taskTagAddText,text:this.lp.taskTagAddText}).inject(this.taskTagAddContainer);
  1016. this.taskTagAddText.addEvents({
  1017. mouseover:function(){this.setStyles({"color":"#4A90E2"})},
  1018. mouseout:function(){this.setStyles({"color":"#666666"})},
  1019. click:function(){
  1020. this.loadTaskTag(this.taskTagAddText)
  1021. }.bind(this)
  1022. });
  1023. this.taskTagAdd = new Element("div.taskTagAdd",{styles:this.css.taskTagAdd}).inject(this.taskTagAddContainer);
  1024. this.taskTagAdd.addEvents({
  1025. mouseover:function(){this.setStyles({"background-image":"url(/x_component_TeamWork/$Task/default/icon/icon_subtask_add.png)"})},
  1026. mouseout:function(){this.setStyles({"background-image":"url(/x_component_TeamWork/$Task/default/icon/icon_jia.png)"})},
  1027. click:function(){
  1028. this.loadTaskTag(this.taskTagAdd)
  1029. }.bind(this)
  1030. });
  1031. if(!this.taskData.tags || this.taskData.tags.length==0){
  1032. this.taskTagAdd.hide();
  1033. }else{
  1034. this.taskTagAddText.hide();
  1035. this.taskData.tags.each(function(json){
  1036. this.loadTagItem(json)
  1037. }.bind(this))
  1038. }
  1039. },
  1040. loadTagItem:function(data){
  1041. var _self = this;
  1042. var tagItemContainer = new Element("div.tagItemContainer",{styles:this.css.tagItemContainer,id:data.id}).inject(this.taskTagLayout);
  1043. tagItemContainer.setStyles({"background-color":data.tagColor});
  1044. tagItemContainer.addEvents({
  1045. mouseenter:function(){
  1046. var tagItemClose = new Element("div.tagItemClose",{styles:_self.css.tagItemClose}).inject(tagItemContainer);
  1047. tagItemContainer.setStyles({"width":(tagItemContainer.getWidth().toInt()+2)+"px"});
  1048. tagItemText.setStyles({"margin-right":"5px"});
  1049. tagItemText.set("title",data.tag);
  1050. tagItemClose.addEvents({
  1051. click:function(){
  1052. _self.rootActions.TaskTagAction.removeTagRele(_self.taskData.id,data.id,function(json){
  1053. if(json.data.dynamics){
  1054. json.data.dynamics.each(function(dd){
  1055. _self.loadDynamicItem(dd,"bottom")
  1056. })
  1057. }
  1058. _self.dynamicContent.scrollTo(0,_self.dynamicContent.getScrollSize().y);
  1059. tagItemContainer.destroy();
  1060. _self.taskData.tags.each(function(ddd){
  1061. if(ddd.id == data.id){
  1062. _self.taskData.tags.erase(ddd)
  1063. }
  1064. })
  1065. })
  1066. }
  1067. })
  1068. },
  1069. mouseleave:function(){
  1070. //tagItemContainer.setStyles({"width":(tagItemContainer.getWidth().toInt()-this.getElement(".tagItemClose").getWidth()-2)+"px"});
  1071. tagItemContainer.setStyles({"width":""});
  1072. tagItemText.setStyles({"margin-right":"10px"});
  1073. this.getElement(".tagItemClose").destroy();
  1074. }
  1075. });
  1076. var tagItemText = new Element("div.tagItemText",{styles:this.css.tagItemText}).inject(tagItemContainer);
  1077. tagItemText.set("text",data.tag);
  1078. },
  1079. loadTaskTag:function(node){
  1080. MWF.xDesktop.requireApp("TeamWork", "TaskTag", function(){
  1081. //alert(JSON.stringify(this.taskData.tags))
  1082. var data = {
  1083. projectId:this.taskData.project,
  1084. taskId:this.taskData.id,
  1085. taskTags:this.taskData.tags||[]
  1086. };
  1087. var pc = new MWF.xApplication.TeamWork.TaskTag(this.container, node, this.app, data, {
  1088. axis : "y",
  1089. position : { //node 固定的位置
  1090. x : "right",
  1091. y : "middle"
  1092. },
  1093. nodeStyles : {
  1094. "min-width":"200px",
  1095. "width":"210px",
  1096. //"height":"80px",
  1097. "padding":"2px",
  1098. "border-radius":"2px",
  1099. "box-shadow":"0px 0px 4px 0px #999999",
  1100. "z-index" : "201"
  1101. },
  1102. onPostLoad:function(){
  1103. pc.node.setStyles({"opacity":"0","top":(pc.node.getStyle("top").toInt())+"px"});
  1104. var fx = new Fx.Tween(pc.node,{duration:400});
  1105. fx.start(["opacity"] ,"0", "1");
  1106. },
  1107. onClose:function(rd){
  1108. if(!rd) return;
  1109. // if(rd.value && rd.value !=""){
  1110. // this.chatTextarea.set("value",this.chatTextarea.get("value")+"["+rd.value+"]")
  1111. // }
  1112. }.bind(this)
  1113. },null,this);
  1114. pc.load();
  1115. }.bind(this))
  1116. },
  1117. loadRemarkEditor:function(parent,value,name){
  1118. if(this.editor)return;
  1119. COMMON.AjaxModule.load("ckeditor", function(){
  1120. //CKEDITOR.disableAutoInline = true;
  1121. var item = new Element("div",{
  1122. "name" : name,
  1123. "id" : name
  1124. });
  1125. //item.set( attr );
  1126. if(parent)item.inject(parent);
  1127. //if( value )item.set("html", value);
  1128. var editorConfig = {
  1129. "autoGrow_maxHeight": 400,
  1130. //"autoGrow_minHeight": 300,
  1131. "resize_enabled": true,
  1132. //"resize_maxHeight": "3000",
  1133. //"resize_minHeight": "200",
  1134. "autoParagraph": true,
  1135. "autoUpdateElement": true,
  1136. "enterMode": 1,
  1137. "height": 100,
  1138. "width": 580,
  1139. "readOnly": false,
  1140. "startupFocus" : true,
  1141. toolbar : [
  1142. //{ name: 'document', items : [ 'Preview' ] },
  1143. //{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
  1144. { name: 'basicstyles', items : [ 'Bold','Underline','Strike','-','RemoveFormat' ] },
  1145. //{ name: 'paragraph', items : [ 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock' ] },
  1146. { name: 'styles', items : [ 'Font','FontSize' ] },
  1147. { name: 'colors', items : [ 'TextColor' ] },
  1148. { name: 'links', items : [ 'Link','Unlink' ] },
  1149. //{ name: 'insert', items : [ 'Image' ] },
  1150. { name: 'tools', items : [ 'Maximize','-' ] }
  1151. ]
  1152. };
  1153. if( this.options.RTFConfig ){
  1154. editorConfig = Object.merge( editorConfig, this.options.RTFConfig )
  1155. }
  1156. if( editorConfig.skin )editorConfig.skin = "moono-lisa";
  1157. this.editor = CKEDITOR.replace(item, editorConfig);
  1158. //this.items.push( this.editor );
  1159. this.editor.setData(value);
  1160. this.editor.on('instanceReady', function (e) {
  1161. this.editor.focus();
  1162. var range = this.editor.createRange();
  1163. range.moveToElementEditEnd(this.editor.editable());
  1164. this.editor.getSelection().selectRanges([range]);
  1165. this.taskRemarkActionContainer = new Element("div.taskRemarkActionContainer",{styles:this.css.taskRemarkActionContainer}).inject(parent);
  1166. this.taskRemarkActionOk = new Element("div.taskRemarkActionOk",{styles:this.css.taskRemarkActionOk,text:this.lp.save}).inject(this.taskRemarkActionContainer);
  1167. this.taskRemarkActionOk.addEvents({
  1168. mouseover:function(){this.setStyles({"opacity":"0.9"})},
  1169. mouseout:function(){this.setStyles({"opacity":"1"})},
  1170. click:function(e){
  1171. var sd = {
  1172. taskId:this.taskData.id,
  1173. property:"description",
  1174. dataType:"RichText",
  1175. mainValue:encodeURI(this.editor.getData()),
  1176. secondaryValue:this.editor.document.getBody().getText()
  1177. }
  1178. this.updateSingleProperty(sd,function(json){
  1179. this.taskData.description = encodeURI(this.editor.getData());
  1180. this.loadRemarkValue()
  1181. delete this.editor;
  1182. }.bind(this))
  1183. e.stopPropagation();
  1184. //this.taskData.description = encodeURI(this.editor.getData());
  1185. }.bind(this)
  1186. });
  1187. this.taskRemarkActionCancel = new Element("div.taskRemarkActionCancel",{styles:this.css.taskRemarkActionCancel,text:this.lp.cancel}).inject(this.taskRemarkActionContainer);
  1188. this.taskRemarkActionCancel.addEvents({
  1189. mouseover:function(){this.setStyles({"color":"#4A90E2"})},
  1190. mouseout:function(){this.setStyles({"color":"#999999"})},
  1191. click:function(e){
  1192. this.loadRemarkValue();
  1193. e.stopPropagation()
  1194. }.bind(this)
  1195. })
  1196. }.bind(this))
  1197. }.bind(this));
  1198. },
  1199. loadAttachment: function( area ){
  1200. MWF.xDesktop.requireApp("TeamWork", "TaskAttachment", function(){
  1201. this.attachment = new MWF.xApplication.TeamWork.TaskAttachment( area, this.app, this.actions, this.app.lp, {
  1202. size:"max",
  1203. documentId : this.taskData.id,
  1204. //isNew : this.options.isNew,
  1205. //isEdited : this.options.isEdited,
  1206. onQueryUploadAttachment : function(){
  1207. this.attachment.isQueryUploadSuccess = true;
  1208. if( !this.taskData.id || this.taskData.id=="" ){
  1209. }
  1210. }.bind(this)
  1211. });
  1212. this.attachment.load();
  1213. }.bind(this));
  1214. },
  1215. loadTaskAttachmentListContainer:function(){
  1216. MWF.xDesktop.requireApp("TeamWork", "TaskAttachmentList", function(){
  1217. var data = {
  1218. id:this.taskData.id
  1219. };
  1220. var opt = {};
  1221. this.attachment = new MWF.xApplication.TeamWork.TaskAttachmentList( this,this.taskAttachmentListContainer, data, opt);
  1222. this.attachment.load();
  1223. }.bind(this));
  1224. },
  1225. loadSubTaskContainer:function(){
  1226. this.subTaskContainer.empty();
  1227. this.subTaskTitleContent = new Element("div.subTaskTitleContent",{styles:this.css.subTaskTitleContent}).inject(this.subTaskContainer);
  1228. this.subTaskTitleIcon = new Element("div.subTaskTitleIcon",{styles:this.css.subTaskTitleIcon}).inject(this.subTaskTitleContent);
  1229. this.subTaskTitleText = new Element("div.subTaskTitleText",{styles:this.css.subTaskTitleText,text:this.lp.taskSubName+""}).inject(this.subTaskTitleContent);
  1230. this.subTaskValueContent = new Element("div.subTaskValueContent",{styles:this.css.subTaskValueContent}).inject(this.subTaskContainer);
  1231. this.subTaskAddContainer = new Element("div.subTaskAddContainer",{styles:this.css.subTaskAddContainer}).inject(this.subTaskValueContent);
  1232. //子任务列表
  1233. this.subTaskListContent = new Element("div.subTaskListContent",{styles:this.css.subTaskListContent}).inject(this.subTaskAddContainer);
  1234. this.loadSubTask();
  1235. //添加子任务
  1236. this.subTaskNewContent = new Element("div.subTaskNewContent",{styles:this.css.subTaskNewContent}).inject(this.subTaskAddContainer);
  1237. this.subTaskNewIcon = new Element("div.subTaskNewIcon",{styles:this.css.subTaskNewIcon}).inject(this.subTaskNewContent);
  1238. this.subTaskNewText = new Element("div.subTaskNewText",{styles:this.css.subTaskNewText,text:this.lp.taskSubText}).inject(this.subTaskNewContent);
  1239. this.subTaskNewContent.addEvents({
  1240. click:function(){
  1241. this.subTaskNewContent.hide();
  1242. if(this.subTaskNewContainer)this.subTaskNewContainer.destroy();
  1243. this.subTaskNewContainer = new Element("div.subTaskNewContainer",{styles:this.css.subTaskNewContainer}).inject(this.subTaskAddContainer);
  1244. this.subTaskNewValue = new Element("div.subTaskNewValue",{styles:this.css.subTaskNewValue}).inject(this.subTaskNewContainer);
  1245. this.subTaskNewInput = new Element("input.subTaskNewInput",{styles:this.css.subTaskNewInput,placeholder:this.lp.taskSubNamePlaceholder}).inject(this.subTaskNewValue);
  1246. this.subTaskNewPerson = new Element("div.subTaskNewPerson",{styles:this.css.subTaskNewPerson}).inject(this.subTaskNewValue);
  1247. this.subTaskNewPerson.addEvent("click",function(){
  1248. this.selectPerson(this.subTaskNewPerson,"identity",null,1,
  1249. function(json){
  1250. if(json.length>0){
  1251. this.taskSubNewPerson = json[0];
  1252. this.loadSubTaskPerson(this.subTaskNewPerson,json[0],true)
  1253. }
  1254. }.bind(this)
  1255. );
  1256. }.bind(this));
  1257. this.subTaskNewAction = new Element("div.subTaskNewAction",{styles:this.css.subTaskNewAction}).inject(this.subTaskNewContainer);
  1258. this.subTaskNewCancel = new Element("div.subTaskNewCancel",{styles:this.css.subTaskNewCancel,text:this.lp.cancel}).inject(this.subTaskNewAction);
  1259. this.subTaskNewCancel.addEvents({
  1260. click:function(){
  1261. this.subTaskNewContent.show();
  1262. this.subTaskNewContainer.destroy()
  1263. }.bind(this),
  1264. mouseover:function(){
  1265. this.setStyles({"color":"#4A90E2"})
  1266. },
  1267. mouseout:function(){
  1268. this.setStyles({"color":"#666666"})
  1269. }
  1270. });
  1271. this.subTaskNewOK = new Element("div.subTaskNewOK",{styles:this.css.subTaskNewOK,text:this.lp.save}).inject(this.subTaskNewAction);
  1272. this.subTaskNewOK.addEvents({
  1273. click:function(){
  1274. if(this.subTaskNewInput.get("value").trim()=="") return;
  1275. var data = {
  1276. name:this.subTaskNewInput.get("value").trim(),
  1277. project:this.taskData.project,
  1278. parent:this.taskData.id,
  1279. executor:this.taskSubNewPerson || ""
  1280. };
  1281. this.actions.save(data,function(json){
  1282. this.taskSubNewPerson = "";
  1283. if(json.data.id){
  1284. //this.actions.taskGet(json.data.id,function(d){
  1285. this.actions.get(json.data.id,function(d){
  1286. this.loadSubTaskItem(this.subTaskListContent,d.data);
  1287. }.bind(this))
  1288. }
  1289. this.subTaskNewContent.show();
  1290. this.subTaskNewContainer.destroy();
  1291. if(json.data.dynamics){
  1292. json.data.dynamics.each(function(dd){
  1293. this.loadDynamicItem(dd,"bottom")
  1294. }.bind(this));
  1295. }
  1296. this.dynamicContent.scrollTo(0,this.dynamicContent.getScrollSize().y);
  1297. }.bind(this))
  1298. }.bind(this)
  1299. })
  1300. }.bind(this)
  1301. });
  1302. },
  1303. loadSubTask:function(){
  1304. var node = this.subTaskListContent;
  1305. node.empty();
  1306. this.actions.listSubTaskWithTaskId(this.taskData.id,function(json){
  1307. json.data.each(function(data){
  1308. this.loadSubTaskItem(node,data);
  1309. }.bind(this))
  1310. }.bind(this))
  1311. },
  1312. loadSubTaskItem:function(node,data){
  1313. var subTaskItemContainer = new Element("div.subTaskItemContainer",{styles:this.css.subTaskItemContainer,id:data.id}).inject(node);
  1314. var subTaskItemText = new Element("div.subTaskItemText",{styles:this.css.subTaskItemText,text:data.name,title:this.lp.taskSubDes}).inject(subTaskItemContainer);
  1315. subTaskItemText.addEvents({
  1316. mouseover:function(){
  1317. this.setStyles({"background-color":"#f5f5f5"})
  1318. },
  1319. mouseout:function(){
  1320. this.setStyles({"background-color":""})
  1321. },
  1322. click:function(){
  1323. var id = subTaskItemContainer.get("id");
  1324. if(id && id!=""){
  1325. this.data.taskId = id;
  1326. this.openTask()
  1327. }
  1328. }.bind(this)
  1329. });
  1330. var subTaskItemPerson = new Element("div.subTaskItemPerson",{styles:this.css.subTaskItemPerson}).inject(subTaskItemContainer);
  1331. // subTaskItemPerson.addEvent("click",function(){
  1332. // this.selectPerson(subTaskItemPerson,"identity",null,1,
  1333. // function(json){
  1334. // if(json.length>0){
  1335. // this.loadSubTaskPerson(subTaskItemPerson,json[0],true)
  1336. // }
  1337. // }.bind(this)
  1338. // );
  1339. // }.bind(this));
  1340. if(data.executor && data.executor!=""){
  1341. this.loadSubTaskPerson(subTaskItemPerson,data.executor)
  1342. }
  1343. },
  1344. loadSubTaskPerson:function(node,identity,flag){
  1345. if(flag==null) flag=false;
  1346. node.empty();
  1347. var taskSubNewPerson = identity;
  1348. var _self = this
  1349. var name = identity.split("@")[0];
  1350. var container = new Element("div",{styles:{"height":"30px","padding":"0px 8px 0px 2px","border-radius":"4px","float":"left","position":"relative"}}).inject(node);
  1351. container.set("title",name);
  1352. var circleStyles={
  1353. "width":"24px","height":"24px","border-radius":"20px","float":"left",
  1354. "background-color":"#4A90E2","color":"#ffffff","line-height":"22px",
  1355. "text-align":"center","margin-top":"3px","font-size":"12px"
  1356. };
  1357. var closeStyles={
  1358. "width":"16px","height":"16px","position":"absolute","right":"-5px","top":"-2px",
  1359. "background":"url(/x_component_TeamWork/$Task/default/icon/icon_off.png) no-repeat center"
  1360. };
  1361. var circleDiv = new Element("div",{styles:circleStyles,text:name.substr(0,1)}).inject(container);
  1362. if(flag){ //权限
  1363. container.addEvents({
  1364. mouseenter:function(){
  1365. var closeIcon = new Element("div.closeIcon",{styles:closeStyles}).inject(this);
  1366. closeIcon.addEvents({
  1367. click:function(e){
  1368. node.empty();
  1369. node.setStyles(_self.css.subTaskNewPerson);
  1370. container.destroy();
  1371. e.stopPropagation();
  1372. }
  1373. });
  1374. this.setStyles({"background-color":"#efefef","cursor":"pointer"});
  1375. },
  1376. mouseleave:function(){
  1377. if(this.getElement(".closeIcon"))this.getElement(".closeIcon").destroy();
  1378. this.setStyles({"background-color":""})
  1379. },
  1380. click:function(e){
  1381. this.selectPerson(this.subTaskNewPerson,"identity",null,1,
  1382. function(json){
  1383. if(json.length>0){
  1384. taskSubNewPerson = json[0];
  1385. this.loadSubTaskPerson(this.subTaskNewPerson,json[0],true)
  1386. }
  1387. }.bind(this)
  1388. );
  1389. e.stopPropagation();
  1390. }.bind(this)
  1391. })
  1392. }
  1393. },
  1394. loadTaskPerson:function(node,identity,flag){
  1395. var _self = this
  1396. var name = identity.split("@")[0];
  1397. var container = new Element("div",{styles:{"height":"30px","padding":"0 0px","border-radius":"4px","float":"left","position":"relative"}}).inject(node);
  1398. var circleStyles={
  1399. "width":"24px","height":"24px","border-radius":"20px","float":"left",
  1400. "background-color":"#4A90E2","color":"#ffffff","line-height":"22px",
  1401. "text-align":"center","margin-top":"3px","font-size":"12px"
  1402. };
  1403. var nameStyles={
  1404. "height":"24px","float":"left","margin-left":"2px","margin-right":"10px",
  1405. "color":"#333333","line-height":"22px","margin-top":"3px"
  1406. };
  1407. var closeStyles={
  1408. "width":"16px","height":"16px","position":"absolute","right":"0px",
  1409. "background":"url(/x_component_TeamWork/$Task/default/icon/icon_off.png) no-repeat center"
  1410. };
  1411. var circleDiv = new Element("div",{styles:circleStyles,text:name.substr(0,1)}).inject(container);
  1412. var nameDiv = new Element("div",{styles:nameStyles,text:name}).inject(container);
  1413. if(flag){ //权限
  1414. container.addEvents({
  1415. mouseenter:function(){
  1416. // var closeIcon = new Element("div.closeIcon",{styles:closeStyles}).inject(this);
  1417. // closeIcon.addEvents({
  1418. // click:function(e){
  1419. // // _self.taskData.executor = "";
  1420. // // _self.loadDutyValue();
  1421. //
  1422. // var sd = {
  1423. // taskId:_self.taskData.id,
  1424. // property:"executor",
  1425. // mainValue:"",
  1426. // secondaryValue:""
  1427. // };
  1428. // _self.updateSingleProperty(sd,function(){
  1429. // _self.taskData.executor = "";
  1430. // _self.loadDutyValue()
  1431. // })
  1432. //
  1433. // e.stopPropagation();
  1434. // }
  1435. // });
  1436. this.setStyles({"background-color":"#efefef","cursor":"pointer"});
  1437. },
  1438. mouseleave:function(){
  1439. if(this.getElement(".closeIcon"))this.getElement(".closeIcon").destroy();
  1440. this.setStyles({"background-color":""})
  1441. },
  1442. click:function(e){
  1443. _self.selectPerson(_self.taskDutyAddText,"identity",null,1,
  1444. function(json){
  1445. if(json.length>0){
  1446. if(_self.taskData.executor!=json[0]){
  1447. var sd = {
  1448. taskId:_self.taskData.id,
  1449. property:"executor",
  1450. mainValue:json[0],
  1451. secondaryValue:""
  1452. };
  1453. _self.updateSingleProperty(sd,function(){
  1454. _self.taskData.executor = json[0];
  1455. _self.loadDutyValue()
  1456. })
  1457. }
  1458. }
  1459. }
  1460. );
  1461. }
  1462. })
  1463. }
  1464. },
  1465. loadparticipantPerson:function(node,identity,flag){
  1466. var _self = this;
  1467. var name = identity.split("@")[0];
  1468. var container = new Element("div",{styles:{"height":"30px","padding":"0 0px","border-radius":"4px","float":"left","position":"relative"}}).inject(node);
  1469. var circleStyles={
  1470. "width":"24px","height":"24px","border-radius":"20px","float":"left",
  1471. "background-color":"#4A90E2","color":"#ffffff","line-height":"22px",
  1472. "text-align":"center","margin-top":"3px","font-size":"12px"
  1473. };
  1474. var nameStyles={
  1475. "height":"24px","float":"left","margin-left":"2px","margin-right":"16px",
  1476. "color":"#333333","line-height":"22px","margin-top":"3px"
  1477. };
  1478. var closeStyles={
  1479. "width":"16px","height":"16px","position":"absolute","right":"0px",
  1480. "background":"url(/x_component_TeamWork/$Task/default/icon/icon_off.png) no-repeat center"
  1481. };
  1482. var circleDiv = new Element("div",{styles:circleStyles,text:name.substr(0,1)}).inject(container);
  1483. var nameDiv = new Element("div",{styles:nameStyles,text:name}).inject(container);
  1484. if(flag){ //权限
  1485. container.addEvents({
  1486. mouseenter:function(){
  1487. var closeIcon = new Element("div.closeIcon",{styles:closeStyles}).inject(this);
  1488. closeIcon.addEvents({
  1489. click:function(e){
  1490. var index = _self.taskData.participantList.indexOf(identity);
  1491. if(index>-1){
  1492. _self.taskData.participantList.erase(identity)
  1493. }
  1494. _self.actions.updateParticipant(_self.taskData.id,{participantList:_self.taskData.participantList},function(json){
  1495. _self.createParticipateContainer();
  1496. if(json.data.dynamics){
  1497. json.data.dynamics.each(function(dd){
  1498. _self.loadDynamicItem(dd,"bottom")
  1499. })
  1500. }
  1501. _self.dynamicContent.scrollTo(0,_self.dynamicContent.getScrollSize().y);
  1502. });
  1503. e.stopPropagation();
  1504. }
  1505. });
  1506. this.setStyles({"background-color":"#efefef","cursor":"pointer"});
  1507. },
  1508. mouseleave:function(){
  1509. if(this.getElement(".closeIcon"))this.getElement(".closeIcon").destroy();
  1510. this.setStyles({"background-color":""})
  1511. }
  1512. })
  1513. }
  1514. },
  1515. setAuth:function(){
  1516. var _self = this;
  1517. //名称
  1518. },
  1519. reload : function( keepData ){
  1520. // if( keepData ){
  1521. // this.data = this.form.getResult(false, this.options.resultSeparator, false, false, true);
  1522. // }
  1523. this.formTopNode = null;
  1524. if(this.setFormNodeSizeFun && this.app && this.app.removeEvent){
  1525. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  1526. }
  1527. if( this.formMaskNode )this.formMaskNode.destroy();
  1528. if( this.formAreaNode )this.formAreaNode.destroy();
  1529. if( this.isNew ){
  1530. this.create();
  1531. }else if( this.isEdited ){
  1532. this.edit();
  1533. }else{
  1534. this.open();
  1535. }
  1536. },
  1537. selectPerson: function( item, type,types,count,callback ) {
  1538. MWF.xDesktop.requireApp("Selector", "package", null, false);
  1539. this.fireEvent("querySelect", this);
  1540. var value = [];
  1541. var options = {
  1542. "type": type,
  1543. "types":types,
  1544. "title": "选人",
  1545. "count": count,
  1546. "values": value || [],
  1547. "onComplete": function (items) {
  1548. var arr = [];
  1549. items.each(function (item) {
  1550. arr.push(item.data.distinguishedName);
  1551. }.bind(this));
  1552. if(callback)callback(arr);
  1553. }.bind(this)
  1554. };
  1555. var selector = new MWF.O2Selector(this.app.content, options);
  1556. },
  1557. compareWithNow:function(dstr){
  1558. var result = {};
  1559. try{
  1560. var ct = Date.parse(dstr);
  1561. var intervalDay = 0;
  1562. var now = new Date();
  1563. var sep = now.getTime()-ct.getTime();
  1564. sep = sep/1000; //毫秒
  1565. //一分钟内,刚刚,一小时内,多少分钟前,2小时内,显示一小时前,2小时到今天00:00:00 显示 今天几点,本周内,显示本周几,几点几分,其他显示几月几日
  1566. var cttext = "";
  1567. if(sep<60){
  1568. cttext = "刚刚"
  1569. }else if(sep<3600){
  1570. cttext = Math.floor(sep/60)+"分钟前"
  1571. }else if(sep<7200){
  1572. cttext = "1小时前"
  1573. }else if(sep>7200 && ct.getFullYear() == now.getFullYear() && ct.getMonth()==now.getMonth() && ct.getDate() == now.getDate()){
  1574. cttext = "今天"+(ct.getHours()<10?("0"+ct.getHours()):ct.getHours())+":"+(ct.getMinutes()<10?"0"+ct.getMinutes():ct.getMinutes())
  1575. }else if(ct.getFullYear() == now.getFullYear() && ct.getMonth()==now.getMonth() && ct.getDate() == now.getDate()-1){
  1576. cttext = "昨天"+(ct.getHours()<10?("0"+ct.getHours()):ct.getHours())+":"+(ct.getMinutes()<10?"0"+ct.getMinutes():ct.getMinutes());
  1577. }else{
  1578. cttext = (ct.getMonth()+1) + "月"+ct.getDay()+"日"
  1579. }
  1580. var sepd = ct.getTime() - now.getTime();
  1581. sepd = sepd/1000;
  1582. if(sepd<0){
  1583. intervalDay = -1 //超时
  1584. }else if(sepd /(3600*24)<2){
  1585. intervalDay = 0 //一两天内
  1586. }else{
  1587. intervalDay = 1 //正常
  1588. }
  1589. result.intervalDay = intervalDay;
  1590. result.text = cttext;
  1591. }catch(e){
  1592. result.text = dstr;
  1593. }
  1594. //alert(dstr + "##############" + result.intervalDay)
  1595. return result;
  1596. },
  1597. });
  1598. MWF.xApplication.TeamWork.Task.TaskMore = new Class({
  1599. Extends: MWF.xApplication.TeamWork.Common.ToolTips,
  1600. options : {
  1601. // displayDelay : 300,
  1602. hasArrow:false,
  1603. event:"click"
  1604. },
  1605. _loadCustom : function( callback ){
  1606. this.rootActions = this.app.rootActions;
  1607. var _self = this;
  1608. this.css = this.options.css;
  1609. this.lp = this.options.lp;
  1610. //this.data
  1611. //this.contentNode
  1612. //debugger;
  1613. var topMoreTitle = new Element("div.topMoreTitle",{styles:this.css.topMoreTitle,text:this.lp.taskMenu}).inject(this.contentNode);
  1614. var copyTask = new Element("div.copyTask",{styles:this.css.topMoreItem}).inject(this.contentNode);
  1615. copyTask.addEvents({
  1616. mouseenter:function(){this.setStyles({"background-color":"#F7F7F7"})},
  1617. mouseleave:function(){this.setStyles({"background-color":""})},
  1618. click:function(e){
  1619. _self.app.confirm("warn",e,_self.lp.taskCopy,_self.lp.taskContent,300,120,function(){
  1620. _self.rootActions.TaskAction.copyTask(_self.explorer.data.taskId,function(json){ debugger;
  1621. if(json.type == "success"){
  1622. _self.explorer.data.taskId = json.data.id;
  1623. _self.explorer._createTableContent();
  1624. }
  1625. this.close();
  1626. _self.close();
  1627. }.bind(this))
  1628. // _self.rootActions.TaskAction.delete(_self.data.data.id,function(){
  1629. // var rd = {"act":"remove"};
  1630. // _self.close(rd);
  1631. // this.close()
  1632. // }.bind(this))
  1633. },function(){
  1634. this.close();
  1635. });
  1636. }.bind(this)
  1637. });
  1638. var copyTaskIcon = new Element("div.copyTaskIcon",{styles:this.css.topMoreItemIcon}).inject(copyTask);
  1639. copyTaskIcon.setStyles({"background":"url(/x_component_TeamWork/$Task/default/icon/taskcopy.png) no-repeat center"});
  1640. var copyTaskText = new Element("div.copyTaskText",{styles:this.css.topMoreItemText,text:this.lp.taskCopy}).inject(copyTask);
  1641. var moveTask = new Element("div.moveTask",{styles:this.css.topMoreItem}).inject(this.contentNode);
  1642. moveTask.addEvents({
  1643. mouseenter:function(){this.setStyles({"background-color":"#F7F7F7"})},
  1644. mouseleave:function(){this.setStyles({"background-color":""})},
  1645. click:function(){
  1646. var data = this.data;
  1647. var opt = {};
  1648. MWF.xDesktop.requireApp("TeamWork", "TaskMove", function(){
  1649. var taskmove = new MWF.xApplication.TeamWork.TaskMove(this.explorer,data,opt);
  1650. taskmove.open();
  1651. var fx = new Fx.Tween(this.node,{duration:200});
  1652. fx.start(["opacity"] ,"1", "0").chain(function(){this.close()}.bind(this));
  1653. }.bind(this));
  1654. }.bind(this)
  1655. });
  1656. var moveTaskIcon = new Element("div.moveTaskIcon",{styles:this.css.topMoreItemIcon}).inject(moveTask);
  1657. moveTaskIcon.setStyles({"background":"url(/x_component_TeamWork/$Task/default/icon/taskmove.png) no-repeat center"});
  1658. var moveTaskText = new Element("div.moveTaskText",{styles:this.css.topMoreItemText,text:this.lp.taskMove}).inject(moveTask);
  1659. // var favTask = new Element("div.favTask",{styles:this.css.topMoreItem}).inject(this.contentNode);
  1660. // favTask.addEvents({
  1661. // mouseenter:function(){this.setStyles({"background-color":"#F7F7F7"})},
  1662. // mouseleave:function(){this.setStyles({"background-color":""})}
  1663. // });
  1664. // var favTaskIcon = new Element("div.favTaskIcon",{styles:this.css.topMoreItemIcon}).inject(favTask);
  1665. // favTaskIcon.setStyles({"background":"url(/x_component_TeamWork/$Task/default/icon/taskfav.png) no-repeat center"});
  1666. // var favTaskText = new Element("div.favTaskText",{styles:this.css.topMoreItemText,text:this.lp.taskFav}).inject(favTask);
  1667. var subTask = new Element("div.subTask",{styles:this.css.topMoreItem}).inject(this.contentNode);
  1668. subTask.addEvents({
  1669. click:function(){
  1670. var data = this.data;
  1671. MWF.xDesktop.requireApp("TeamWork", "TaskSub", function(){
  1672. var opt = {
  1673. "onPostOpen":function(){
  1674. //tasksub.formAreaNode.setStyles({"height":"0px","width":"0px","overflow":"hidden"})
  1675. //tasksub.formAreaNode.setStyles({"top":"10px"});
  1676. var fx = new Fx.Tween(tasksub.formAreaNode,{duration:200});
  1677. fx.start(["top"] ,"10px", "100px");
  1678. }
  1679. };
  1680. var tasksub = new MWF.xApplication.TeamWork.TaskSub(this.explorer,data,opt);
  1681. tasksub.open();
  1682. var fx = new Fx.Tween(this.node,{duration:200});
  1683. fx.start(["opacity"] ,"1", "0").chain(function(){this.close()}.bind(this));
  1684. }.bind(this));
  1685. }.bind(this),
  1686. mouseenter:function(){this.setStyles({"background-color":"#F7F7F7"})},
  1687. mouseleave:function(){this.setStyles({"background-color":""})}
  1688. });
  1689. var subTaskIcon = new Element("div.subTaskIcon",{styles:this.css.topMoreItemIcon}).inject(subTask);
  1690. subTaskIcon.setStyles({"background":"url(/x_component_TeamWork/$Task/default/icon/tasksub.png) no-repeat center"});
  1691. var subTaskText = new Element("div.subTaskText",{styles:this.css.topMoreItemText,text:this.lp.taskSub}).inject(subTask);
  1692. var removeTask = new Element("div.removeTask",{styles:this.css.topMoreItem}).inject(this.contentNode);
  1693. removeTask.addEvents({
  1694. click:function(e){
  1695. _self.app.confirm("warn",e,_self.app.lp.common.confirm.removeTitle,_self.app.lp.common.confirm.removeContent,300,120,function(){
  1696. _self.rootActions.TaskAction.delete(_self.data.data.id,function(){
  1697. var rd = {"act":"remove"};
  1698. _self.close(rd);
  1699. this.close()
  1700. }.bind(this))
  1701. },function(){
  1702. this.close();
  1703. });
  1704. },
  1705. mouseenter:function(){this.setStyles({"background-color":"#F7F7F7"})},
  1706. mouseleave:function(){this.setStyles({"background-color":""})}
  1707. });
  1708. var removeTaskIcon = new Element("div.removeTaskIcon",{styles:this.css.topMoreItemIcon}).inject(removeTask);
  1709. removeTaskIcon.setStyles({"background":"url(/x_component_TeamWork/$Task/default/icon/taskremove.png) no-repeat center"});
  1710. var removeTaskText = new Element("div.removeTaskText",{styles:this.css.topMoreItemText,text:this.lp.taskRemove}).inject(removeTask);
  1711. if(callback)callback();
  1712. }
  1713. });
  1714. MWF.xApplication.TeamWork.Task.StatusCheck = new Class({
  1715. Extends: MWF.xApplication.TeamWork.Common.ToolTips,
  1716. options : {
  1717. // displayDelay : 300,
  1718. hasArrow:false,
  1719. event:"click"
  1720. },
  1721. _loadCustom : function( callback ){
  1722. var _self = this;
  1723. this.css = this.options.css;
  1724. this.lp = this.options.lp;
  1725. //this.data
  1726. var container = {
  1727. "cursor":"pointer",
  1728. "height":"40px",
  1729. "width":"100%"
  1730. };
  1731. var text={
  1732. "height":"30px","line-height":"30px","float":"left",
  1733. "padding-left":"10px","padding-right":"10px","margin-left":"6px","margin-top":"5px",
  1734. "font-size":"13px","color":"#666666","border-radius":"2px"
  1735. };
  1736. var icon = {
  1737. "float":"right","width":"24px","height":"24px",
  1738. "margin-top":"6px","margin-right":"8px",
  1739. "background":"url(/x_component_TeamWork/$Task/default/icon/icon_dagou.png) no-repeat center"
  1740. };
  1741. var flowContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1742. var flowText = new Element("div",{styles:text,text:this.lp.status.processing}).inject(flowContainer);
  1743. flowText.setStyles({"background-color":"#f0f0f0"});
  1744. if(this.data.data.workStatus == "processing"){
  1745. var flowIcon = new Element("div",{styles:icon}).inject(flowContainer);
  1746. }
  1747. flowContainer.addEvents({
  1748. click:function(){
  1749. var data = {"status":"processing"};
  1750. this.close(data)
  1751. }.bind(this),
  1752. mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1753. mouseout:function(){this.setStyles({"background-color":""})}
  1754. });
  1755. var completeContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1756. var completeText = new Element("div",{styles:text,text:this.lp.status.completed}).inject(completeContainer);
  1757. completeText.setStyles({"color":"#69b439","background-color":"#f1f9ec"});
  1758. if(this.data.data.workStatus == "completed"){
  1759. var completeIcon = new Element("div",{styles:icon}).inject(completeContainer);
  1760. }
  1761. completeContainer.addEvents({
  1762. click:function(){
  1763. var data = {"status":"completed"};
  1764. this.close(data)
  1765. }.bind(this),
  1766. mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1767. mouseout:function(){this.setStyles({"background-color":""})}
  1768. });
  1769. if(callback)callback();
  1770. }
  1771. });
  1772. MWF.xApplication.TeamWork.Task.PriorityCheck = new Class({
  1773. Extends: MWF.xApplication.TeamWork.Common.ToolTips,
  1774. options : {
  1775. // displayDelay : 300,
  1776. hasArrow:false,
  1777. event:"click"
  1778. },
  1779. _loadCustom : function( callback ){
  1780. var _self = this;
  1781. this.css = this.options.css;
  1782. this.lp = this.options.lp;
  1783. //this.data
  1784. //this.contentNode
  1785. var container = {
  1786. "cursor":"pointer",
  1787. "height":"40px",
  1788. "width":"100%"
  1789. };
  1790. var text={
  1791. "height":"25px","line-height":"25px","float":"left","width":"50px","text-align":"center",
  1792. "margin-left":"6px","margin-top":"8px",
  1793. "font-size":"13px","color":"#666666","border-radius":"2px"
  1794. };
  1795. var icon = {
  1796. "float":"right","width":"24px","height":"24px",
  1797. "margin-top":"6px","margin-right":"8px",
  1798. "background":"url(/x_component_TeamWork/$Task/default/icon/icon_dagou.png) no-repeat center"
  1799. };
  1800. var normalContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1801. var normalText = new Element("div",{styles:text,text:this.lp.priority.normal}).inject(normalContainer);
  1802. normalText.setStyles({"color":"#999999","border":"1px solid #999999"});
  1803. if(this.data.data.priority == this.lp.priority.normal){
  1804. new Element("div",{styles:icon}).inject(normalContainer);
  1805. }
  1806. normalContainer.addEvents({
  1807. click:function(){
  1808. var data = {"value":this.lp.priority.normal};
  1809. this.close(data)
  1810. }.bind(this),
  1811. mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1812. mouseout:function(){this.setStyles({"background-color":""})}
  1813. });
  1814. var urgencyContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1815. var urgencyText = new Element("div",{styles:text,text:this.lp.priority.urgency}).inject(urgencyContainer);
  1816. urgencyText.setStyles({"color":"#ffaf38","border":"1px solid #ffaf38"});
  1817. if(this.data.data.priority == this.lp.priority.urgency){
  1818. new Element("div",{styles:icon}).inject(urgencyContainer);
  1819. }
  1820. urgencyContainer.addEvents({
  1821. click:function(){
  1822. var data = {"value":this.lp.priority.urgency};
  1823. this.close(data)
  1824. }.bind(this),
  1825. mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1826. mouseout:function(){this.setStyles({"background-color":""})}
  1827. });
  1828. var emergencyContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1829. var emergencyText = new Element("div",{styles:text,text:this.lp.priority.emergency}).inject(emergencyContainer);
  1830. emergencyText.setStyles({"color":"#ff4f3e","border":"1px solid #ff4f3e"});
  1831. if(this.data.data.priority == this.lp.priority.emergency){
  1832. new Element("div",{styles:icon}).inject(emergencyContainer);
  1833. }
  1834. emergencyContainer.addEvents({
  1835. click:function(){
  1836. var data = {"value":this.lp.priority.emergency};
  1837. this.close(data)
  1838. }.bind(this),
  1839. mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1840. mouseout:function(){this.setStyles({"background-color":""})}
  1841. });
  1842. if(callback)callback();
  1843. }
  1844. });
  1845. MWF.xApplication.TeamWork.Task.DynamicType = new Class({
  1846. Extends: MWF.xApplication.TeamWork.Common.ToolTips,
  1847. options : {
  1848. // displayDelay : 300,
  1849. hasArrow:false,
  1850. event:"click"
  1851. },
  1852. _loadCustom : function( callback ){
  1853. var _self = this;
  1854. this.css = this.options.css;
  1855. this.lp = this.options.lp;
  1856. //this.data
  1857. //this.contentNode
  1858. var container = {
  1859. "cursor":"pointer",
  1860. "height":"40px",
  1861. "width":"100%"
  1862. };
  1863. var text={
  1864. "height":"25px","line-height":"25px","float":"left","width":"100%",
  1865. "margin-left":"6px","margin-top":"8px",
  1866. "font-size":"13px","color":"#666666","border-radius":"2px"
  1867. };
  1868. var icon = {
  1869. "float":"right","width":"24px","height":"24px",
  1870. "margin-top":"6px","margin-right":"8px",
  1871. "background":"url(/x_component_TeamWork/$Task/default/icon/icon_dagou.png) no-repeat center"
  1872. };
  1873. var allContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1874. var allText = new Element("div",{styles:text,text:this.lp.dynamicAll}).inject(allContainer);
  1875. allText.setStyles({"color":"#999999","border":"0px solid #999999"});
  1876. allContainer.addEvents({
  1877. click:function(){
  1878. var data = {"value":"all"};
  1879. this.close(data)
  1880. }.bind(this),
  1881. mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1882. mouseout:function(){this.setStyles({"background-color":""})}
  1883. });
  1884. var attachmentContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1885. var attachmentText = new Element("div",{styles:text,text:this.lp.dynamicAttachment}).inject(attachmentContainer);
  1886. attachmentText.setStyles({"color":"#999999","border":"0px solid #999999"});
  1887. attachmentContainer.addEvents({
  1888. click:function(){
  1889. var data = {"value":"attachment"};
  1890. this.close(data)
  1891. }.bind(this),
  1892. mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1893. mouseout:function(){this.setStyles({"background-color":""})}
  1894. });
  1895. var chatContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1896. var chatText = new Element("div",{styles:text,text:this.lp.dynamicChat}).inject(chatContainer);
  1897. chatText.setStyles({"color":"#999999","border":"0px solid #999999"});
  1898. chatContainer.addEvents({
  1899. click:function(){
  1900. var data = {"value":"chat"};
  1901. this.close(data)
  1902. }.bind(this),
  1903. mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1904. mouseout:function(){this.setStyles({"background-color":""})}
  1905. });
  1906. if(callback)callback();
  1907. }
  1908. });