Task.js 100 KB

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