Project.js 74 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469
  1. /*
  2. this.data //project的数据
  3. this.currentProjectGroupData //当前taskgroup的数据
  4. */
  5. MWF.xApplication.TeamWork = MWF.xApplication.TeamWork || {};
  6. MWF.xDesktop.requireApp("TeamWork", "Common", null, false);
  7. MWF.xApplication.TeamWork.Project = new Class({
  8. Extends: MWF.widget.Common,
  9. Implements: [Options, Events],
  10. options: {
  11. "style": "default"
  12. },
  13. initialize: function (container, app, data, options) {
  14. this.setOptions(options);
  15. this.container = container;
  16. this.app = app;
  17. this.lp = this.app.lp.project;
  18. //this.actions = this.app.restActions;
  19. this.rootActions = this.app.rootActions;
  20. this.actions = this.rootActions.ProjectAction;
  21. //this.taskActions = this.rootActions.TaskAction;
  22. this.path = "/x_component_TeamWork/$Project/";
  23. this.cssPath = this.path+this.options.style+"/css.wcss";
  24. this._loadCss();
  25. this.data = data;
  26. },
  27. load: function () {
  28. this.container.setStyles({display:"flex"});
  29. this.container.empty();
  30. this.createTopBarLayout();
  31. this.createContentLayout();
  32. this.topBarTabItemTask.click();
  33. },
  34. createTopBarLayout:function(){
  35. var _self = this;
  36. this.topBarLayout = new Element("div.topBarLayout",{styles:this.css.topBarLayout}).inject(this.container);
  37. this.topBarBackContainer = new Element("div.topBarBackContainer",{styles:this.css.topBarBackContainer}).inject(this.topBarLayout);
  38. this.topBarBackHomeIcon = new Element("div.topBarBackHomeIcon",{styles:this.css.topBarBackHomeIcon}).inject(this.topBarBackContainer);
  39. this.topBarBackHomeIcon.addEvents({
  40. click:function(){
  41. var pl = new MWF.xApplication.TeamWork.ProjectList(this.container,this.app,this.actions,{});
  42. pl.load();
  43. }.bind(this),
  44. mouseover:function(){
  45. var opt={
  46. axis: "y" //箭头在x轴还是y轴上展现
  47. };
  48. this.app.showTips(this.topBarBackHomeIcon,{_html:"<div style='margin:2px 5px;'>"+this.lp.backProject+"</div>"},opt);
  49. }.bind(this)
  50. });
  51. this.topBarBackHomeNext = new Element("div.topBarBackHomeNext",{styles:this.css.topBarBackHomeNext}).inject(this.topBarBackContainer);
  52. this.topBarBackHomeTextContainer = new Element("div.topBarBackHomeTextContainer",{styles:this.css.topBarBackHomeTextContainer}).inject(this.topBarBackContainer);
  53. this.topBarBackHomeText = new Element("div.topBarBackHomeText",{styles:this.css.topBarBackHomeText,text:this.data.title}).inject(this.topBarBackHomeTextContainer);
  54. this.topBarBackHomeArrow = new Element("div.topBarBackHomeArrow",{styles:this.css.topBarBackHomeArrow}).inject(this.topBarBackHomeTextContainer);
  55. this.topBarBackHomeTextContainer.addEvents({
  56. click:function(){
  57. var plist = new MWF.xApplication.TeamWork.Project.ProjectList(this.container, this.topBarBackHomeTextContainer, this.app, this.data, {
  58. css:this.css,
  59. lp:this.lp,
  60. axis : "y",
  61. position : { //node 固定的位置
  62. x : "right", //x轴上left center right, auto 系统自动计算
  63. y : "auto" //y 轴上top middle bottom, auto 系统自动计算
  64. },
  65. priorityOfAuto :{
  66. x : [ "center", "right", "left" ], //当position x 为 auto 时候的优先级
  67. y : [ "middle", "bottom", "top" ] //当position y 为 auto 时候的优先级
  68. },
  69. nodeStyles : {
  70. "min-width":"300px",
  71. "padding":"2px",
  72. "border-radius":"5px",
  73. "z-index" : "101"
  74. }
  75. });
  76. plist.load();
  77. }.bind(this),
  78. mouseover:function(){this.getElements("div").setStyles({"color":"#4a90e2"})},
  79. mouseout:function () { this.getElements("div").setStyles({"color":"#333333"}) }
  80. });
  81. this.topBarTabsContainer = new Element("div.topBarTabsContainer",{styles:this.css.topBarTabsContainer}).inject(this.topBarLayout);
  82. this.topBarTabItemTask = new Element("div.topBarTabItemTask",{styles:this.css.topBarTabItemTask,text:this.lp.task}).inject(this.topBarTabsContainer);
  83. this.topBarTabItemTask.addEvents({
  84. click:function(){
  85. this.topBarTabItemTask.setStyles({"color":"#4A90E2","border-bottom":"2px solid #4A90E2"});
  86. this.topBarTabItemStat.setStyles({"color":"","border-bottom":"0px"});
  87. this.createTaskLayout();
  88. }.bind(this)
  89. });
  90. this.topBarTabItemStat = new Element("div.topBarTabItemStat",{styles:this.css.topBarTabItemStat,text:this.lp.stat}).inject(this.topBarTabsContainer);
  91. this.topBarTabItemStat.addEvents({
  92. click:function(){
  93. this.topBarTabItemTask.setStyles({"color":"","border-bottom":"0px"});
  94. this.topBarTabItemStat.setStyles({"color":"#4A90E2","border-bottom":"2px solid #4A90E2"});
  95. this.createStatLayout();
  96. }.bind(this)
  97. });
  98. //********************************
  99. //************************************
  100. this.topBarSettingContainer = new Element("div.topBarSettingContainer",{styles:this.css.topBarSettingContainer}).inject(this.topBarLayout);
  101. this.topBarSettingMenuContainer = new Element("div.topBarSettingMenuContainer",{styles:this.css.topBarSettingMenuContainer}).inject(this.topBarSettingContainer);
  102. this.topBarSettingMenuContainer.addEvents({
  103. click:function(){
  104. MWF.xDesktop.requireApp("TeamWork", "ProjectSetting", function(){
  105. var ps = new MWF.xApplication.TeamWork.ProjectSetting(this,this.data,
  106. {"width": "800","height": "80%",
  107. onPostOpen:function(){
  108. ps.formAreaNode.setStyles({"top":"10px"});
  109. var fx = new Fx.Tween(ps.formAreaNode,{duration:200});
  110. fx.start(["top"] ,"10px", "100px");
  111. },
  112. onPostClose:function(json){
  113. }
  114. },{
  115. container : this.container,
  116. lp : this.app.lp.projectSetting,
  117. css:_self.css
  118. }
  119. );
  120. ps.open();
  121. }.bind(this));
  122. }.bind(this),
  123. mouseover:function(){
  124. this.topBarSettingMenuContainer.getElements(".topBarSettingMenuIcon").setStyles({
  125. "background-image":"url(/x_component_TeamWork/$Project/default/icon/icon_caidan_click.png)"
  126. });
  127. this.topBarSettingMenuContainer.getElements(".topBarSettingMenuText").setStyles({
  128. "color":"#4A90E2"
  129. });
  130. }.bind(this),
  131. mouseout:function(){
  132. this.topBarSettingMenuContainer.getElements(".topBarSettingMenuIcon").setStyles({
  133. "background-image":"url(/x_component_TeamWork/$Project/default/icon/icon_caidan.png)"
  134. });
  135. this.topBarSettingMenuContainer.getElements(".topBarSettingMenuText").setStyles({
  136. "color":"#666666"
  137. });
  138. }.bind(this)
  139. });
  140. this.topBarSettingMenuIcon = new Element("div.topBarSettingMenuIcon",{styles:this.css.topBarSettingMenuIcon}).inject(this.topBarSettingMenuContainer);
  141. this.topBarSettingMenuText = new Element("div.topBarSettingMenuText",{styles:this.css.topBarSettingMenuText,text:this.lp.setting}).inject(this.topBarSettingMenuContainer);
  142. },
  143. createContentLayout:function(){
  144. this.contentLayout = new Element("div.contentLayout",{styles:this.css.contentLayout}).inject(this.container);
  145. },
  146. createTaskLayout:function(){
  147. if(this.contentLayout) this.contentLayout.empty();
  148. this.createNaviContent();
  149. this.createTaskContent();
  150. },
  151. createNaviContent:function(){
  152. if(this.naviLayout) this.naviLayout.destroy();
  153. this.naviLayout = new Element("div.naviLayout",{styles:this.css.naviLayout}).inject(this.contentLayout);
  154. this.app.setLoading(this.naviLayout);
  155. this.rootActions.TaskAction.statiticMyProject(this.data.id,function(json){
  156. this.projectGroupData = json.data;
  157. if(this.projectGroupData.groups && this.projectGroupData.groups.length>0){
  158. this.currentProjectGroupData = this.projectGroupData.groups[0]; //默认只有一个分组
  159. }
  160. this.naviLayout.empty();
  161. this.createNaviTask();
  162. this.createNaviView();
  163. this.naviTopMyTaskLayout.click();
  164. }.bind(this));
  165. },
  166. createNaviTask:function(){
  167. var _self = this;
  168. if(!this.currentProjectGroupData) return;
  169. if(this.naviTop) this.naviTop.destroy();
  170. this.naviTop = new Element("div.naviTop",{styles:this.css.naviTop}).inject(this.naviLayout);
  171. this.naviTopSearchContainer = new Element("div.naviTopSearchContainer",{styles:this.css.naviTopSearchContainer}).inject(this.naviTop);
  172. this.naviTopSearchIn = new Element("input.naviTopSearchIn",{styles:this.css.naviTopSearchIn,placeholder:this.lp.searchTask}).inject(this.naviTopSearchContainer);
  173. this.naviTopSearchIn.addEvents({
  174. keypress:function(e){
  175. this.searchLoading = true;
  176. var keycode = (e.event.keyCode ? e.event.keyCode : e.event.which);
  177. if (keycode == 13 || keycode == 10) {
  178. var key = this.naviTopSearchIn.get("value").trim();
  179. if(key=="") return;
  180. if(this.searchLoading) this.openSearch(key)
  181. }
  182. }.bind(this),
  183. focus:function(){
  184. this.naviTopSearchContainer.setStyles({"border":"1px solid #4A90E2"})
  185. }.bind(this),
  186. blur:function(){
  187. this.naviTopSearchContainer.setStyles({"border":"1px solid #DEDEDE"})
  188. }.bind(this)
  189. });
  190. this.naviTopTaskContainer = new Element("div.naviTopTaskContainer",{styles:this.css.naviTopTaskContainer}).inject(this.naviTop);
  191. this.naviTopTaskText = new Element("div.naviTopTaskText",{styles:this.css.naviTopTaskText,text:this.lp.task}).inject(this.naviTopTaskContainer);
  192. this.naviTopTaskAdd = new Element("div.naviTopTaskAdd",{styles:this.css.naviTopTaskAdd}).inject(this.naviTopTaskContainer);
  193. this.naviTopTaskAdd.addEvents({
  194. click:function(){
  195. var data = {
  196. projectObj:this,
  197. taskGroupId:this.currentProjectGroupData.id,
  198. //projectId:this.data.id,
  199. taskListIds:[]
  200. };
  201. var opt = {
  202. onCreateTask:function(){
  203. this.createTaskGroup();
  204. }.bind(this)
  205. };
  206. var newTask = new MWF.xApplication.TeamWork.Project.NewTask(this,data,opt,{});
  207. newTask.open();
  208. }.bind(this),
  209. mouseover:function(){
  210. this.naviTopTaskAdd.setStyles({
  211. "background-image":"url(/x_component_TeamWork/$Project/default/icon/icon_zengjia_blue2_click.png)"
  212. });
  213. this.app.showTips(this.naviTopTaskAdd,{_html:"<div style='margin:2px 5px;'>"+this.lp.taskAdd+"</div>"});
  214. }.bind(this),
  215. mouseout:function(){
  216. this.naviTopTaskAdd.setStyles({
  217. "background-image":"url(/x_component_TeamWork/$Project/default/icon/icon_jia.png)"
  218. });
  219. }.bind(this)
  220. });
  221. this.naviTopMyTaskLayout = new Element("div.naviTopMyTaskLayout",{styles:this.css.naviTopMyTaskLayout}).inject(this.naviTop);
  222. this.naviTopMyTaskLayout.addEvents({
  223. click:function(){
  224. this.curNaviItem = "group";
  225. this.naviTopMyTaskLayout.setStyles({"background-color":"#F2F5F7"});
  226. this.naviViewContainer.getElements(".naviItemContainer").each(function(d){
  227. this.naviItemChange(d,"leave")
  228. }.bind(this));
  229. this.createTaskGroup();
  230. }.bind(this),
  231. mouseover:function(){ if(_self.curNaviItem!="group") this.setStyles({"background-color":"#F2F5F7"}) },
  232. mouseout:function(){ if(_self.curNaviItem!="group") this.setStyles({"background-color":""}) }
  233. });
  234. this.naviTopMyTaskContainer = new Element("div.naviTopMyTaskContainer",{styles:this.css.naviTopMyTaskContainer}).inject(this.naviTopMyTaskLayout);
  235. this.naviTopMyTaskText = new Element("div.naviTopMyTaskText",{styles:this.css.naviTopMyTaskText,text:this.lp.myTask}).inject(this.naviTopMyTaskContainer);
  236. this.naviTopMyTaskCount = new Element("div.naviTopMyTaskCount",{styles:this.css.naviTopMyTaskCount,text:"("+this.currentProjectGroupData.completedTotal+"/"+this.currentProjectGroupData.taskTotal+")"}).inject(this.naviTopMyTaskContainer);
  237. this.naviTopTaskLineContainer = new Element("div.naviTopTaskLineContainer",{styles:this.css.naviTopTaskLineContainer}).inject(this.naviTopMyTaskLayout);
  238. this.naviTopTaskLine = new Element("div.naviTopTaskLine",{styles:this.css.naviTopTaskLine}).inject(this.naviTopTaskLineContainer);
  239. this.loadTaskLine();
  240. //this.naviTopMyTaskLayout.click();
  241. },
  242. loadTaskLine:function(){
  243. this.completeLine = new Element("div.completeLine",{styles:this.css.completeLine}).inject(this.naviTopTaskLine);
  244. this.completeLine.addEvents({
  245. mouseover:function(){
  246. this.app.showTips(this.completeLine,{_html:"<div style='margin:2px 5px;'>"+this.lp.taskCompleteText+":"+this.currentProjectGroupData.completedTotal+"</div>"});
  247. }.bind(this)
  248. });
  249. this.overLine = new Element("div.overLine",{styles:this.css.overLine}).inject(this.naviTopTaskLine);
  250. this.overLine.addEvents({
  251. mouseover:function(){
  252. this.app.showTips(this.overLine,{_html:"<div style='margin:2px 5px;'>"+this.lp.taskCompleteText+":"+this.currentProjectGroupData.overtimeTotal+"</div>"});
  253. }.bind(this)
  254. });
  255. if(this.currentProjectGroupData){
  256. var taskTotal = this.currentProjectGroupData.taskTotal;
  257. var completedTotal = this.currentProjectGroupData.completedTotal;
  258. var overtimeTotal = this.currentProjectGroupData.overtimeTotal;
  259. //alert(taskTotal);alert(completedTotal);alert(overtimeTotal);
  260. if(taskTotal){
  261. var _width = this.naviTopTaskLine.getWidth();
  262. var completePixel =_width * (completedTotal / taskTotal);
  263. var overPixel =_width * (overtimeTotal / taskTotal);
  264. this.completeLine.setStyles({"width":completePixel+"px"});
  265. this.overLine.setStyles({"width":overPixel+"px"});
  266. }
  267. }
  268. },
  269. createNaviView:function(){
  270. if(this.naviView) this.naviView.destroy();
  271. this.naviView = new Element("div.naviView",{styles:this.css.naviView}).inject(this.naviLayout);
  272. this.naviViewTitleContainer = new Element("div.naviViewTitleContainer",{styles:this.css.naviViewTitleContainer}).inject(this.naviView);
  273. this.naviViewTitle = new Element("div.naviViewTitle",{styles:this.css.naviViewTitle,text:this.lp.viewTitle}).inject(this.naviViewTitleContainer);
  274. /* 新增按钮
  275. this.naviViewAdd = new Element("div.naviViewAdd",{styles:this.css.naviViewAdd}).inject(this.naviViewTitleContainer);
  276. this.naviViewAdd.addEvents({
  277. click:function(){
  278. }.bind(this),
  279. mouseover:function(){
  280. this.naviViewAdd.setStyles({
  281. "background-image":"url(/x_component_TeamWork/$Project/default/icon/icon_zengjia_blue2_click.png)"
  282. });
  283. this.app.showTips(this.naviViewAdd,{_html:"<div style='margin:2px 5px;'>"+this.lp.viewAdd+"</div>"});
  284. }.bind(this),
  285. mouseout:function(){
  286. this.naviViewAdd.setStyles({
  287. "background-image":"url(/x_component_TeamWork/$Project/default/icon/icon_jia.png)"
  288. });
  289. }.bind(this)
  290. });
  291. */
  292. this.createNaviViewItem();
  293. },
  294. createNaviViewItem:function(){
  295. var _self = this;
  296. if(this.naviViewContainer) this.naviViewContainer.destroy();
  297. this.naviViewContainer = new Element("div.naviViewContainer",{styles:this.css.naviViewContainer}).inject(this.naviView);
  298. this.viewData = this.viewData || this.projectGroupData.views;
  299. this.viewData.each(function(json){
  300. if(json.name==this.lp.viewItemAll){//所有任务
  301. this.naviItemAllContainer = new Element("div.naviItemContainer",{styles:this.css.naviItemContainer}).inject(this.naviViewContainer);
  302. this.naviItemAllIcon = new Element("div.naviItemAllIcon",{styles:this.css.naviItemAllIcon}).inject(this.naviItemAllContainer);
  303. this.naviItemAllText = new Element("div.naviItemText",{styles:this.css.naviItemText,text:this.lp.viewItemAll}).inject(this.naviItemAllContainer);
  304. this.naviItemAllContainer.addEvents({
  305. click:function(){
  306. this.curNaviItem = json.name;
  307. this.openView(this.naviItemAllContainer);
  308. }.bind(this),
  309. mouseenter:function(){ if(_self.curNaviItem != json.name) _self.naviItemChange(this,"enter")},
  310. mouseleave:function(){ if(_self.curNaviItem != json.name) _self.naviItemChange(this,"leave")}
  311. });
  312. }else if(json.name==this.lp.viewItemMy){
  313. //我的任务
  314. this.naviItemMyContainer = new Element("div.naviItemContainer",{styles:this.css.naviItemContainer}).inject(this.naviViewContainer);
  315. this.naviItemMyIcon = new Element("div.naviItemMyIcon",{styles:this.css.naviItemMyIcon}).inject(this.naviItemMyContainer);
  316. this.naviItemMyText = new Element("div.naviItemText",{styles:this.css.naviItemText,text:this.lp.viewItemMy}).inject(this.naviItemMyContainer);
  317. // this.naviItemMyMore = new Element("div.naviItemMore",{styles:this.css.naviItemMore}).inject(this.naviItemMyContainer);
  318. // this.naviItemMyMore.addEvent(
  319. // "click",function(e){
  320. // this.openNaviViewMore(this.naviItemMyMore);
  321. // e.stopPropagation();
  322. // }.bind(this)
  323. // );
  324. this.naviItemMyContainer.addEvents({
  325. click:function(){
  326. this.curNaviItem = json.name;
  327. this.openView(this.naviItemMyContainer);
  328. }.bind(this),
  329. mouseenter:function(){ if(_self.curNaviItem != json.name) _self.naviItemChange(this,"enter")},
  330. mouseleave:function(){ if(_self.curNaviItem != json.name) _self.naviItemChange(this,"leave")}
  331. });
  332. }else if(json.name==this.lp.viewItemFlow){
  333. //未完成的任务
  334. this.naviItemFlowContainer = new Element("div.naviItemContainer",{styles:this.css.naviItemContainer}).inject(this.naviViewContainer);
  335. this.naviItemFlowIcon = new Element("div.naviItemFlowIcon",{styles:this.css.naviItemFlowIcon}).inject(this.naviItemFlowContainer);
  336. this.naviItemFlowText = new Element("div.naviItemText",{styles:this.css.naviItemText,text:this.lp.viewItemFlow}).inject(this.naviItemFlowContainer);
  337. //this.naviItemFlowMore = new Element("div.naviItemMore",{styles:this.css.naviItemMore}).inject(this.naviItemFlowContainer);
  338. // this.naviItemFlowMore.addEvent(
  339. // "click",function(e){
  340. // this.openNaviViewMore(this.naviItemFlowMore);
  341. // e.stopPropagation();
  342. // }.bind(this)
  343. // );
  344. this.naviItemFlowContainer.addEvents({
  345. click:function(){
  346. this.curNaviItem = json.name;
  347. this.openView(this.naviItemFlowContainer);
  348. }.bind(this),
  349. mouseenter:function(){ _self.naviItemChange(this,"enter")},
  350. mouseleave:function(){_self.naviItemChange(this,"leave")}
  351. });
  352. }else if(json.name==this.lp.viewItemComplete){
  353. //已完成任务
  354. this.naviItemCompleteContainer = new Element("div.naviItemContainer",{styles:this.css.naviItemContainer}).inject(this.naviViewContainer);
  355. this.naviItemCompleteIcon = new Element("div.naviItemCompleteIcon",{styles:this.css.naviItemCompleteIcon}).inject(this.naviItemCompleteContainer);
  356. this.naviItemCompleteText = new Element("div.naviItemText",{styles:this.css.naviItemText,text:this.lp.viewItemComplete}).inject(this.naviItemCompleteContainer);
  357. //this.naviItemCompleteMore = new Element("div.naviItemMore",{styles:this.css.naviItemMore}).inject(this.naviItemCompleteContainer);
  358. // this.naviItemCompleteMore.addEvent(
  359. // "click",function(e){
  360. // this.openNaviViewMore(this.naviItemCompleteMore);
  361. // e.stopPropagation();
  362. // }.bind(this)
  363. // );
  364. this.naviItemCompleteContainer.addEvents({
  365. click:function(){
  366. this.curNaviItem = json.name;
  367. this.openView(this.naviItemCompleteContainer);
  368. }.bind(this),
  369. mouseenter:function(){ _self.naviItemChange(this,"enter")},
  370. mouseleave:function(){_self.naviItemChange(this,"leave")}
  371. });
  372. }else if(json.name==this.lp.viewItemOver){
  373. //已逾期任务
  374. this.naviItemOverContainer = new Element("div.naviItemContainer",{styles:this.css.naviItemContainer}).inject(this.naviViewContainer);
  375. this.naviItemOverIcon = new Element("div.naviItemOverIcon",{styles:this.css.naviItemOverIcon}).inject(this.naviItemOverContainer);
  376. this.naviItemOverText = new Element("div.naviItemText",{styles:this.css.naviItemText,text:this.lp.viewItemOver}).inject(this.naviItemOverContainer);
  377. // this.naviItemOverMore = new Element("div.naviItemMore",{styles:this.css.naviItemMore}).inject(this.naviItemOverContainer);
  378. // this.naviItemOverMore.addEvent(
  379. // "click",function(e){
  380. // this.openNaviViewMore(this.naviItemOverMore);
  381. // e.stopPropagation();
  382. // }.bind(this)
  383. // );
  384. this.naviItemOverContainer.addEvents({
  385. click:function(){
  386. this.curNaviItem = json.name;
  387. this.openView(this.naviItemOverContainer);
  388. }.bind(this),
  389. mouseenter:function(){ _self.naviItemChange(this,"enter")},
  390. mouseleave:function(){_self.naviItemChange(this,"leave")}
  391. });
  392. }else{
  393. //自定义视图
  394. }
  395. }.bind(this));
  396. },
  397. naviItemChange:function(node,action){
  398. if(action == "enter"){
  399. node.setStyles({"background-color":"#F2F5F7"});
  400. divs = node.getElements("div");
  401. divs[0].setStyles({"background-image":divs[0].getStyle("background-image").replace(".png","_click.png")});
  402. divs[1].setStyles({"color":"#4A90E2"});
  403. if(divs[2]){
  404. divs[2].setStyles({"background-image":divs[2].getStyle("background-image").replace(".png","_click.png")});
  405. }
  406. }else if(action == "leave"){
  407. node.setStyles({"background-color":""});
  408. divs = node.getElements("div");
  409. divs[0].setStyles({"background-image":divs[0].getStyle("background-image").replace("_click.png",".png")});
  410. divs[1].setStyles({"color":"#2A2A2A"});
  411. if(divs[2]){
  412. divs[2].setStyles({"background-image":divs[2].getStyle("background-image").replace("_click.png",".png")});
  413. }
  414. }
  415. },
  416. openNaviViewMore:function(node){
  417. var tooltip = new MWF.xApplication.TeamWork.Project.NaviViewTip(this.container, node, this.app, {}, {
  418. css:this.css,
  419. lp:this.lp,
  420. axis : "y",
  421. nodeStyles : {
  422. "min-width":"100px",
  423. "padding":"2px",
  424. "border-radius":"5px",
  425. "z-index" : "101"
  426. },
  427. onPostLoad:function(){
  428. tooltip.node.setStyles({"opacity":"0"});
  429. var fx = new Fx.Tween(tooltip.node,{duration:200});
  430. fx.start(["opacity"] ,"0", "1");
  431. },
  432. onClose:function(rd){
  433. // customGroupItemContainer.set("atIn","no");
  434. // if(rd)_self.reloadProjectGroup();
  435. }
  436. });
  437. tooltip.load();
  438. },
  439. createTaskContent:function(){
  440. this.taskContentLayout = new Element("div.taskContentLayout",{styles:this.css.taskContentLayout}).inject(this.contentLayout);
  441. },
  442. createTaskGroup:function(){ //右侧内容
  443. if(this.currentProjectGroupData && this.currentProjectGroupData.id){
  444. this.app.setLoading(this.taskContentLayout);
  445. //this.actions.taskGroupList(this.currentProjectGroupData.id,function(json){
  446. this.rootActions.TaskListAction.listWithTaskGroup(this.currentProjectGroupData.id,function(json){
  447. this.taskContentLayout.empty();
  448. json.data.each(function(data,i){
  449. //if(i>0) return;
  450. var taskGroupLayout = new Element("div.taskGroupLayout",{styles:this.css.taskGroupLayout,id:data.id}).inject(this.taskContentLayout);
  451. taskGroupLayout.set("sortable",data.control.sortable); //控制是否能排序
  452. this.createTaskGroupItemLayout(taskGroupLayout,data);
  453. }.bind(this));
  454. //新建任务列表按钮
  455. this.newTaskGroupContainer = new Element("div.newTaskGroupContainer",{styles:this.css.newTaskGroupContainer}).inject(this.taskContentLayout);
  456. this.newTaskGroupContainer.addEvents({
  457. click:function(){
  458. var data = {
  459. isNew:true,
  460. taskGroupId:this.currentProjectGroupData.id,
  461. projectId:this.data.id
  462. };
  463. var opt = {
  464. onCreateTask:function(){
  465. this.createTaskGroup();
  466. }.bind(this)
  467. };
  468. var newTaskGroup = new MWF.xApplication.TeamWork.Project.NewTaskGroup(this,data,opt,{});
  469. newTaskGroup.open();
  470. }.bind(this),
  471. mouseover:function(){
  472. this.newTaskGroupIcon.setStyles({"background-image":"url(/x_component_TeamWork/$Project/default/icon/icon_jia_20_click.png)"});
  473. this.newTaskGroupText.setStyles({"color":"#4A90E2","font-size":"16px"});
  474. }.bind(this),
  475. mouseout:function(){
  476. this.newTaskGroupIcon.setStyles({"background-image":"url(/x_component_TeamWork/$Project/default/icon/icon_jia.png)"});
  477. this.newTaskGroupText.setStyles({"color":"#999999","font-size":"12px"});
  478. }.bind(this)
  479. });
  480. this.newTaskGroupIcon = new Element("div.newTaskGroupIcon",{styles:this.css.newTaskGroupIcon}).inject(this.newTaskGroupContainer);
  481. this.newTaskGroupText = new Element("div.newTaskGroupText",{styles:this.css.newTaskGroupText,text:this.lp.taskGroupAdd}).inject(this.newTaskGroupContainer);
  482. }.bind(this))
  483. }
  484. },
  485. createTaskGroupItemLayout:function(node,data){
  486. var _self = this;
  487. node.empty();
  488. var taskGroupItemTitleContainer = new Element("div.taskGroupItemTitleContainer",{styles:this.css.taskGroupItemTitleContainer}).inject(node);
  489. new Element("div.taskGroupItemTitleText",{styles:this.css.taskGroupItemTitleText,text:data.name}).inject(taskGroupItemTitleContainer);
  490. var titleCount = new Element("div.taskGroupItemTitleCount",{styles:this.css.taskGroupItemTitleCount,text:"(-)"}).inject(taskGroupItemTitleContainer);
  491. if(data.control.sortable){
  492. var taskGroupItemTitleMore = new Element("div.taskGroupItemTitleMore",{styles:this.css.taskGroupItemTitleMore}).inject(taskGroupItemTitleContainer);
  493. taskGroupItemTitleMore.addEvents({
  494. click:function(){
  495. data.projectObj = this;
  496. data.node = node;
  497. var menu = new MWF.xApplication.TeamWork.Project.TaskGroupMenu(this.container, taskGroupItemTitleMore, this.app, data, {
  498. css:this.css,
  499. lp:this.lp,
  500. axis : "y",
  501. nodeStyles : {
  502. "min-width":"100px",
  503. "padding":"2px",
  504. "border-radius":"5px",
  505. "z-index" : "101"
  506. },
  507. onPostLoad:function(){
  508. menu.node.setStyles({"opacity":"0","top":(menu.node.getStyle("top").toInt()-10)+"px"});
  509. var fx = new Fx.Tween(menu.node,{duration:200});
  510. fx.start(["opacity"] ,"0", "1");
  511. },
  512. onClose:function(rd){
  513. if(!rd)return;
  514. _self.createTaskGroup()
  515. }
  516. });
  517. menu.load();
  518. }.bind(this),
  519. mouseover:function(){this.setStyles({"background-image":"url(/x_component_TeamWork/$Project/default/icon/icon_more_click.png)"})},
  520. mouseout:function(){this.setStyles({"background-image":"url(/x_component_TeamWork/$Project/default/icon/icon_more.png)"})}
  521. });
  522. }
  523. var taskGroupItemTitleAdd = new Element("div.taskGroupItemTitleAdd",{styles:this.css.taskGroupItemTitleAdd}).inject(taskGroupItemTitleContainer);
  524. if(!data.control.sortable) taskGroupItemTitleAdd.setStyle("margin-right","20px");
  525. taskGroupItemTitleAdd.addEvents({
  526. click:function(){
  527. var pdata = {
  528. projectObj:this,
  529. taskGroupId:this.currentProjectGroupData.id,
  530. //projectId:this.data.id,
  531. taskListIds:[data.id]
  532. };
  533. var opt = {
  534. onCreateTask:function(){
  535. this.createTaskGroup();
  536. }.bind(this)
  537. };
  538. var newTask = new MWF.xApplication.TeamWork.Project.NewTask(this,pdata,opt,{});
  539. newTask.open();
  540. }.bind(this),
  541. mouseover:function(){this.setStyles({"background-image":"url(/x_component_TeamWork/$Project/default/icon/icon_zengjia_blue2_click.png)"})},
  542. mouseout:function(){this.setStyles({"background-image":"url(/x_component_TeamWork/$Project/default/icon/icon_jia.png)"})}
  543. });
  544. var taskGroupItemTitleReload = new Element("div.taskGroupItemTitleReload",{styles:this.css.taskGroupItemTitleReload, title:this.lp.reload}).inject(taskGroupItemTitleContainer);
  545. //if(!data.control.sortable) taskGroupItemTitleAdd.setStyle("margin-right","20px");
  546. taskGroupItemTitleReload.addEvents({
  547. click:function(){
  548. this.createTaskGroupItemLayout(node,data)
  549. }.bind(this)
  550. });
  551. var taskGroupItemContainer = new Element("div.taskGroupItemContainer",{styles:this.css.taskGroupItemContainer}).inject(node);
  552. var _h = node.getHeight().toInt()-taskGroupItemTitleContainer.getHeight().toInt() - 10 - 10;
  553. taskGroupItemContainer.setStyles({"height":_h+"px"});
  554. this.app.setScrollBar(taskGroupItemContainer);
  555. this.app.setLoading(taskGroupItemContainer);
  556. //this.actions.taskListByListId(this.data.id,data.id,function(json){
  557. this.rootActions.TaskAction.listMyTaskWithTaskListId(this.data.id,data.id,function(json){
  558. titleCount.set("text","("+json.count+")")
  559. taskGroupItemContainer.empty();
  560. var taskListData = json.data;
  561. //alert(JSON.stringify(taskListData));
  562. taskListData.each(function(d){
  563. //var taskItemContainerDrag = new Element("div.taskItemContainerDrag.dragin",{styles:this.css.taskItemContainerDrag}).inject(taskGroupItemContainer);
  564. var taskItemContainer = new Element("div.taskItemContainer.dragin",{styles:this.css.taskItemContainer}).inject(taskGroupItemContainer);
  565. taskItemContainer.set("id",d.id);
  566. this.loadTaskNode(taskItemContainer,d);
  567. var int;
  568. var upTime = 0;
  569. var time = 200;
  570. taskItemContainer.addEvents({
  571. click:function(e){
  572. this.openTask(d.id,function(){ taskItemContainer.destroy() }.bind(this));
  573. }.bind(this),
  574. mouseenter:function(){
  575. int = window.setInterval(function(){
  576. if(taskItemContainer.getElement(".taskItemHover").getWidth() == 10) return;
  577. taskItemContainer.getElement(".taskItemHover").setStyles({
  578. "width":(taskItemContainer.getElement(".taskItemHover").getWidth()+1)+"px"
  579. });
  580. }.bind(this),30)
  581. },
  582. mouseleave:function(){
  583. window.clearInterval(int);
  584. taskItemContainer.getElement(".taskItemHover").setStyles({"width":"5px"});
  585. }.bind(this),
  586. });
  587. var drag = new Drag(taskItemContainer, {
  588. "compensateScroll": true,
  589. //preventDefault:true,
  590. //stopPropagation:true,
  591. //container:this.contentLayout,
  592. //container: this.taskContentLayout,
  593. "onStart": function(el, e){
  594. this.dragMove(el,e);
  595. drag.stop();
  596. }.bind(this)
  597. });
  598. }.bind(this));
  599. //最后加一行占位
  600. var emptyDrag = new Element("div.empty.dragin",{name:"item",styles:{
  601. "width":"100%", "height":"50px"
  602. }}).inject(taskGroupItemContainer);
  603. }.bind(this));
  604. },
  605. dragMove:function(el,e){
  606. var _self = this;
  607. var taskItemContainer = el;
  608. var time = 200;
  609. //this.cloneTaskItem = new Element("").inject()
  610. var position = el.getPosition(this.taskContentLayout);
  611. //alert(JSON.stringify(position))
  612. //var clone = this.cloneTaskItem = el.clone(true,true).inject($(document.body));
  613. var clone = this.cloneTaskItem = el.clone(true,true).inject(this.taskContentLayout);
  614. this.cloneTaskItem.removeClass("dragin");
  615. this.cloneTaskItem.setStyles({
  616. "top":position.y+"px",
  617. "left":(position.x + this.taskContentLayout.getScrollLeft())+"px",
  618. "z-index":"9999",
  619. "margin":"0px",
  620. "position":"absolute",
  621. "cursor":"move"
  622. });
  623. el.setStyles({"border":"1px dotted #000000","opacity":"0.3"});
  624. var _height = this.cloneTaskItem.getHeight().toInt() - 2;
  625. this.ccc = 0;
  626. var drag = new Drag.Move(this.cloneTaskItem, {
  627. container: this.taskContentLayout,
  628. //container: this.contentLayout,
  629. //"stopPropagation": true,
  630. "compensateScroll": true,
  631. "droppables": $$(".dragin"),
  632. "onStart": function(){
  633. // this.topBarTabItemStat.set("text",JSON.stringify(el.getPosition()));
  634. }.bind(this),
  635. "onDrag": function(el,e){
  636. // this.topBarTabItemStat.set("text",JSON.stringify(el.getPosition()));
  637. //if(el.getPosition().x + el.getWidth() >1900){
  638. //this.topBarTabItemStat.set("text",JSON.stringify("treeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"));
  639. //drag.cancel();
  640. //e.stopPropagation();return;
  641. //this.taskContentLayout.scrollTo( this.taskContentLayout.getScrollLeft() +500,0);
  642. //el.setStyles({"margin-right":"-500px"})
  643. //this.topBarTabItemStat.set("text","000000000000000000");
  644. //}
  645. // var _width = el.getWidth().toInt();
  646. //
  647. // var _l= el.getPosition().x;
  648. // var _sl = this.taskContentLayout.getScrollLeft();
  649. // var _w = this.container.getWidth().toInt() + _sl;
  650. //
  651. //
  652. // //this.topBarTabItemStat.set("text",_width+p.x-_w_w);
  653. //
  654. // //this.taskContentLayout.scrollTo(this.taskContentLayout.getScrollLeft()+2,0);
  655. //
  656. // this.topBarTabItemStat.set("text",_l);
  657. // var p1 = this.taskContentLayout.getPosition();
  658. //
  659. // this.ccc ++;
  660. // //this.topBarTabItemStat.set("text",this.ccc);
  661. //
  662. // if(_l + _width == _w){ this.topBarTabItemStat.set("text","AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
  663. // //this.taskContentLayout.scrollTo(this.taskContentLayout.getScrollLeft()+100,0);
  664. // // scrInt = window.setInterval(function(){
  665. // // this.taskContentLayout.scrollTo(this.taskContentLayout.getScrollLeft()+500,0);
  666. // //
  667. // // this.ccc ++;
  668. // // this.topBarTabItemStat.set("text",this.ccc);
  669. // // }.bind(this),20)
  670. // }
  671. }.bind(this),
  672. "onEnter": function(el,dr){
  673. var pre = dr.getPrevious();
  674. if(!pre || (pre && pre.get("class")!="taskItemInsertLine")){
  675. if(el.get("id")!=dr.get("id")){
  676. new Element("div.taskItemInsertLine",{styles:_self.css.taskItemInsertLine}).inject(dr,"before");
  677. }
  678. }
  679. }.bind(this),
  680. "onLeave": function(el,dr){
  681. var pre = dr.getPrevious();
  682. if(pre && pre.get("class")=="taskItemInsertLine") {
  683. pre.destroy();
  684. }
  685. }.bind(this),
  686. "onDrop": function(el, dr, e){
  687. var taskId = el.get("id");
  688. var taskInId = null;
  689. var taskGroupInId = null;
  690. var taskGroupFromId = null;
  691. var taskGroupFromSortable = null;
  692. var taskGroupInSortable = null;
  693. el.setStyles({"cursor":""});
  694. if(!dr){
  695. //没有移入,还原
  696. var fx = new Fx.Tween(el,{duration:time});
  697. fx.start(["top"] ,(el.getPosition(this.taskContentLayout).y)+"px", taskItemContainer.getPosition(this.taskContentLayout).y+"px");
  698. var fx2 = new Fx.Tween(el,{duration:time});
  699. fx2.start(["left"] ,(el.getPosition(this.taskContentLayout).x + this.taskContentLayout.getScrollLeft())+"px", (taskItemContainer.getPosition(this.taskContentLayout).x + this.taskContentLayout.getScrollLeft())+"px");
  700. window.setTimeout(function(){
  701. taskItemContainer.setStyles({"border":"1px solid #e6e6e6","opacity":"1"});
  702. el.destroy()
  703. },time)
  704. }else{
  705. if(el.get("id")==dr.get("id")){ //如果移动的是本身的拷贝,恢复
  706. taskItemContainer.setStyles({"border":"1px solid #e6e6e6","opacity":"1"});
  707. el.destroy();
  708. }else{
  709. taskInId = dr.get("id");
  710. taskGroupFromId = taskItemContainer.getParent().getParent().get("id");
  711. taskGroupInId = dr.getParent().getParent().get("id");
  712. taskGroupFromSortable = taskItemContainer.getParent().getParent().get("sortable");
  713. taskGroupInSortable = dr.getParent().getParent().get("sortable");
  714. var pre = dr.getPrevious();
  715. if(pre && pre.get("class")=="taskItemInsertLine") { //this.topBarTabItemStat.set("text","change");
  716. //alert("taskid="+taskId+",taskInId="+taskInId+",taskgroupFromid="+taskGroupFromId+",taskGroupInId="+taskGroupInId);
  717. if(taskGroupInSortable == "false"){
  718. //未分类视图不允许移入,还原并删除el对象
  719. _self.app.notice("未分类列表不允许移入","error");
  720. taskItemContainer.setStyles({"border":"1px solid #e6e6e6","opacity":"1"});
  721. if(pre && pre.get("class")=="taskItemInsertLine"){
  722. pre.destroy();
  723. el.destroy();
  724. }
  725. return ;
  726. }
  727. var data = {
  728. taskId:taskId,
  729. behindTaskId:taskInId
  730. };
  731. _self.rootActions.TaskListAction.addTask2ListWithBehindTask(taskGroupInId,data,function(json){
  732. if(json.type == "success"){ //返回成功后再换位置
  733. //fx fx2 动画clone到移入位置
  734. var fx = new Fx.Tween(el,{duration:time});
  735. fx.start(["top"] ,el.getPosition(_self.taskContentLayout).y+"px", pre.getPosition(_self.taskContentLayout).y+"px");
  736. var fx2 = new Fx.Tween(el,{duration:time});
  737. fx2.start(["left"] ,(el.getPosition(_self.taskContentLayout).x + _self.taskContentLayout.getScrollLeft())+"px", (pre.getPosition(_self.taskContentLayout).x + _self.taskContentLayout.getScrollLeft())+"px");
  738. //利用pre撑大高度
  739. pre.setStyles({"border":"0px","background-color":"#ffffff"});
  740. //var fx3 = new Fx.Tween(pre,{duration:time});
  741. //fx3.start(["height"] ,"0px", _height+"px");
  742. //新建一个占用原来位置
  743. var tmpdiv = taskItemContainer.clone();
  744. tmpdiv.setStyles({"border":"0px","margin":"0px","height":(el.getHeight())+"px"});
  745. tmpdiv.empty();
  746. tmpdiv.inject(taskItemContainer,"before");
  747. //设置原有位置none
  748. taskItemContainer.setStyles({"display":"none"});
  749. var __height = tmpdiv.getHeight().toInt() - 2;
  750. //动画完成后插入真正的对象,恢复原位,并删除pre和clone
  751. window.setTimeout(function(){
  752. pre.destroy();
  753. taskItemContainer.setStyles({"border":"1px solid #e6e6e6","display":"block","opacity":"1"});
  754. taskItemContainer.inject(dr,"before");
  755. //fx4把临时占用的位置删除
  756. var fx4 = new Fx.Tween(tmpdiv,{duration:time});
  757. fx4.start(["height"] ,__height+"px", "0px");
  758. window.setTimeout(function(){
  759. if(tmpdiv) tmpdiv.destroy()
  760. },time);
  761. //删除clone即el对象
  762. el.destroy();
  763. },time);
  764. //刷新其他需要加载的位置,比如数量
  765. var taskGroupFrom = taskItemContainer.getParent().getParent();
  766. var taskGroupIn = dr.getParent().getParent();
  767. //_self.actions.taskGroupGet(_self.currentProjectGroupData.id,taskGroupFromId,function(json){
  768. _self.rootActions.TaskListAction.get(_self.currentProjectGroupData.id,taskGroupFromId,function(json){
  769. taskGroupFrom.getElement(".taskGroupItemTitleCount").set("text","("+json.data.taskCount +")")
  770. });
  771. _self.rootActions.TaskListAction.get(_self.currentProjectGroupData.id,taskGroupInId,function(json){
  772. taskGroupIn.getElement(".taskGroupItemTitleCount").set("text","("+json.data.taskCount +")")
  773. })
  774. }else{
  775. //返回失败,还原并删除el对象
  776. taskItemContainer.setStyles({"border":"1px solid #e6e6e6","opacity":"1"});
  777. if(pre && pre.get("class")=="taskItemInsertLine"){
  778. pre.destroy();
  779. el.destroy();
  780. }
  781. }
  782. },function(xhr,text,error){
  783. _self.app.showErrorMessage(xhr,text,error);
  784. taskItemContainer.setStyles({"border":"1px solid #e6e6e6","opacity":"1"});
  785. if(pre && pre.get("class")=="taskItemInsertLine"){
  786. pre.destroy();
  787. el.destroy();
  788. }
  789. });
  790. }
  791. }
  792. }
  793. }.bind(this),
  794. // "onCancel": function(el, e){ this._drag_cancel(dragging); }.bind(this),
  795. //"onComplete": function(el, e){ if(scrInt) window.clearInterval(scrInt);}.bind(this),
  796. });
  797. drag.start(e);
  798. },
  799. loadTaskNode:function(taskItemContainer,d){
  800. taskItemContainer.empty();
  801. var taskItemHover = new Element("div.taskItemHover",{styles:this.css.taskItemHover}).inject(taskItemContainer);
  802. if(d.priority == this.lp.urgency)taskItemHover.setStyle("background-color","#ffaf38");
  803. else if(d.priority == this.lp.emergency)taskItemHover.setStyle("background-color","#ff0000");
  804. var taskItemContent = new Element("div.taskItemContent",{styles:this.css.taskItemContent}).inject(taskItemContainer);
  805. var taskItemTitle = new Element("div.taskItemTitle",{styles:this.css.taskItemTitle,text:d.name}).inject(taskItemContent);
  806. var taskItemDetail = new Element("div.taskItemDetail",{styles:this.css.taskItemDetail}).inject(taskItemContent);
  807. //时限
  808. var taskItemLimit = new Element("div.taskItemLimit",{styles:this.css.taskItemLimit}).inject(taskItemDetail);
  809. taskItemLimit.set("text",this.app.formatDate(d.startTime) + " - " + this.app.formatDate(d.endTime));
  810. var intd = (this.app.compareWithNow(d.endTime)).intervalDay;
  811. //alert(d.endTime + "**************" + intd);
  812. if(intd==-1){
  813. taskItemLimit.setStyle("background-color","#E6240E");
  814. }else if(intd==0){
  815. taskItemLimit.setStyle("background-color","#fa8c15");
  816. }else{
  817. taskItemLimit.setStyle("background-color","#1b9aee");
  818. }
  819. //标签 taskTag等
  820. var taskItemTags = new Element("div.taskItemTags",{styles:this.css.taskItemTags}).inject(taskItemDetail);
  821. this.rootActions.TaskTagAction.listWithTask(d.id,function(json){
  822. json.data.each(function(data){
  823. var taskTagContent = new Element("div.taskTagContent",{styles:this.css.taskTagContent}).inject(taskItemTags);
  824. var taskTagColor = new Element("span",{styles:this.css.taskTagColor}).inject(taskTagContent);
  825. taskTagColor.setStyle("background-color",data.tagColor);
  826. new Element("span",{styles:this.css.taskTagText,text:data.tag}).inject(taskTagContent);
  827. }.bind(this));
  828. }.bind(this),null,false);
  829. taskItemHover.setStyles({"height":taskItemContainer.getHeight()});
  830. // var drag = new Drag(taskItemContainer, {
  831. // "stopPropagation": true,
  832. // "compensateScroll": true,
  833. // "onStart": function(el, e){
  834. // this.doDragMove(e,taskItemContainer);
  835. // drag.stop();
  836. // }.bind(this)
  837. // });
  838. },
  839. openTask:function(id,callback){
  840. var data = {
  841. taskId:id
  842. };
  843. var opt = {
  844. "onPostClose":function(dd){
  845. if(!dd) return;
  846. if(dd.act == "remove"){
  847. if(callback){
  848. callback()
  849. }
  850. //this.createTaskGroup();
  851. }
  852. }.bind(this)
  853. };
  854. MWF.xDesktop.requireApp("TeamWork", "Task", function(){
  855. var task = new MWF.xApplication.TeamWork.Task(this,data,opt);
  856. task.open();
  857. }.bind(this));
  858. },
  859. openView:function(obj){
  860. this.naviTopMyTaskLayout.setStyles({"background-color":""});
  861. var _self = this;
  862. this.naviViewContainer.getElements(".naviItemContainer").each(function(d){
  863. this.naviItemChange(d,"leave")
  864. }.bind(this));
  865. this.naviItemChange(obj,"enter");
  866. if(this.viewContainer) delete this.viewContainer;
  867. if(this.viewListContainer) delete this.viewListContainer;
  868. if(this.viewSearchInput) delete this.viewSearchInput;
  869. this.taskContentLayout.empty();
  870. var viewContainer = this.viewContainer = new Element("div.viewContainer",{styles:this.css.viewContainer}).inject(this.taskContentLayout);
  871. viewContainer.addEvents({
  872. scroll:function(){
  873. var sTop = this.getScrollTop();
  874. var sHeight = this.getScrollHeight();
  875. var cHeight = viewContainer.getHeight();
  876. if(sHeight - sTop < cHeight+10 ){ //偏移量
  877. if(_self.viewLoading){
  878. _self.loadView(_self.curViewTaskId)
  879. }
  880. }
  881. }
  882. });
  883. var viewSearchContainer = new Element("div.viewSearchContainer",{styles:this.css.viewSearchContainer}).inject(viewContainer);
  884. var viewSearchContent = new Element("div.viewSearchContent",{styles:this.css.viewSearchContent}).inject(viewSearchContainer);
  885. var viewSearchInput = this.viewSearchInput = new Element("input",{styles:this.css.viewSearchInput,"name":"viewSearchInput","placeholder":this.lp.searchTask}).inject(viewSearchContent);
  886. viewSearchInput.addEvents({
  887. keypress:function(e){
  888. this.searchLoading = true;
  889. var keycode = (e.event.keyCode ? e.event.keyCode : e.event.which);
  890. if (keycode == 13 || keycode == 10) {
  891. var key = viewSearchInput.get("value").trim();
  892. if(key=="") return;
  893. //alert(key)
  894. viewSearchReset.show();
  895. if(this.searchLoading) this.loadView()
  896. }
  897. }.bind(this),
  898. focus:function(){
  899. viewSearchContent.setStyles({"border":"1px solid #4A90E2"})
  900. }.bind(this),
  901. blur:function(){
  902. viewSearchContent.setStyles({"border":"1px solid #DEDEDE"})
  903. }.bind(this)
  904. })
  905. var viewSearchSearch = new Element("div",{styles:this.css.viewSearchSearch}).inject(viewSearchContent);
  906. viewSearchSearch.addEvents({
  907. click:function(){
  908. if(viewSearchInput.get("value").trim()=="") return;
  909. viewSearchReset.show();
  910. this.loadView();
  911. }.bind(this)
  912. });
  913. var viewSearchReset = new Element("div",{styles:this.css.viewSearchReset}).inject(viewSearchContent);
  914. viewSearchReset.addEvents({
  915. click:function(){
  916. viewSearchReset.hide();
  917. viewSearchInput.set("value","");
  918. this.loadView();
  919. }.bind(this)
  920. });
  921. var viewListContainer = this.viewListContainer = new Element("div.viewListContainer",{styles:this.css.viewListContainer}).inject(viewContainer);
  922. this.loadView()
  923. },
  924. openSearch:function(key){
  925. var _self = this;
  926. if(this.viewListContainer) delete this.viewListContainer;
  927. this.taskContentLayout.empty();
  928. var viewContainer = new Element("div.viewContainer",{styles:this.css.viewContainer}).inject(this.taskContentLayout);
  929. var viewListContainer = this.viewListContainer = new Element("div.viewListContainer",{styles:this.css.viewListContainer}).inject(viewContainer);
  930. //this.loadView()
  931. var data = {
  932. project:this.data.id,
  933. title:key
  934. };
  935. var tmpLoading = new Element("div.tmpLoading",{styles:{"background-color":"#ffffff"}}).inject(viewListContainer);
  936. this.app.setLoading(tmpLoading);
  937. this.searchLoading = false;
  938. var filter = {
  939. title:key
  940. };
  941. this.rootActions.TaskAction.listAllTaskNextWithFilter("(0)",100,this.data.id,filter,function(json){
  942. viewListContainer.empty();
  943. json.data.each(function(data){
  944. this.loadViewItem(data)
  945. }.bind(this));
  946. if(json.count==0){
  947. new Element("div.none",{styles:{
  948. "height":"100px",
  949. "line-height":"100px",
  950. "width":"100%",
  951. "text-align":"center",
  952. "background-color":"#ffffff",
  953. "font-size":"16px"
  954. },text:"未查找到数据"}).inject(this.viewListContainer);
  955. }
  956. this.searchLoading = true;
  957. }.bind(this))
  958. //this.actions.taskListNext("(0)",100,data,function(json){
  959. // viewListContainer.empty();
  960. // json.data.each(function(data){
  961. // this.loadViewItem(data)
  962. // }.bind(this));
  963. // if(json.count==0){
  964. // new Element("div.none",{styles:{
  965. // "height":"100px",
  966. // "line-height":"100px",
  967. // "width":"100%",
  968. // "text-align":"center",
  969. // "background-color":"#ffffff",
  970. // "font-size":"16px"
  971. // },text:"未查找到数据"}).inject(this.viewListContainer);
  972. // }
  973. // this.searchLoading = true;
  974. //}.bind(this))
  975. },
  976. loadView:function(id){
  977. //this.curNaviItem 所有工作,我负责的任务。。。。。
  978. //key 搜索关键字
  979. if(!(id)) {
  980. this.viewListContainer.empty();
  981. this.curCount = 0;
  982. }
  983. this.viewListContainer.getElements(".viewNext").destroy();
  984. var data = {
  985. project:this.data.id
  986. };
  987. if(this.viewSearchInput.get("value").trim()!=""){
  988. data.title = this.viewSearchInput.get("value").trim();
  989. }
  990. var tmpLoading = new Element("div.tmpLoading",{styles:{"background-color":"#ffffff"}}).inject(this.viewListContainer);
  991. this.app.setLoading(tmpLoading);
  992. this.viewLoading = false;
  993. // var filter = {
  994. // //"title":this.viewSearchInput.get("value")||""
  995. // }
  996. var action = "listAllTaskNextWithFilter";
  997. if(this.curNaviItem == this.lp.viewItemMy){ //我负责的任务
  998. action = "listMyExecutTaskNextWithFilter"
  999. }else if(this.curNaviItem == this.lp.viewItemFlow){ //未完成的任务
  1000. action = "listUncompletedTaskNextWithFilter"
  1001. }else if(this.curNaviItem == this.lp.viewItemComplete){ //已完成的任务
  1002. action = "listCompletedTaskNextWithFilter"
  1003. }else if(this.curNaviItem == this.lp.viewItemOver){ //逾期的任务
  1004. action = "listOverTimeTaskNextWithFilter"
  1005. }
  1006. this.rootActions.TaskAction[action](id||"(0)",10,this.data.id,data,function(json){
  1007. this.viewListContainer.getElements(".tmpLoading").destroy();
  1008. json.data.each(function(data){
  1009. this.loadViewItem(data);
  1010. this.curViewTaskId = data.id;
  1011. this.curCount = this.curCount + 1;
  1012. }.bind(this));
  1013. this.viewLoading = true;
  1014. if(json.count == 0){
  1015. new Element("div",{styles:this.css.taskSearchEmpty,text:this.lp.taskSearchEmpty}).inject(this.viewListContainer);
  1016. }
  1017. var sHeight = this.viewListContainer.getHeight();
  1018. var cHeight = this.viewContainer.getHeight();
  1019. if(sHeight<cHeight && this.curCount < json.count){
  1020. var viewNext = new Element("div.viewNext",{styles:this.css.viewNext,text:"下一页"}).inject(this.viewListContainer);
  1021. viewNext.addEvents({
  1022. click:function(){
  1023. this.loadView(this.curViewTaskId)
  1024. }.bind(this)
  1025. })
  1026. }
  1027. }.bind(this))
  1028. },
  1029. loadViewItem:function(data){
  1030. var viewItem = new Element("div.viewItem",{styles:this.css.viewItem}).inject(this.viewListContainer);
  1031. var viewName = new Element("div.viewName",{styles:this.css.viewName,text:data.name}).inject(viewItem);
  1032. var viewStatus = new Element("div.viewStatus",{styles:this.css.viewStatus,text:data.priority}).inject(viewItem);
  1033. var viewDuty = new Element("div.viewDuty",{styles:this.css.viewDuty}).inject(viewItem);
  1034. var viewDutyIcon = new Element("div.viewDutyIcon",{styles:this.css.viewDutyIcon}).inject(viewDuty);
  1035. if(data.executor && data.executor!=""){
  1036. viewDutyIcon.set("text",data.executor.split("@")[0].substr(0,1));
  1037. viewDutyIcon.set("title",data.executor.split("@")[0])
  1038. }
  1039. viewItem.addEvents({
  1040. mouseover:function(){ this.setStyles({"background-color":"#F2F5F7"}) },
  1041. mouseout:function(){ this.setStyles({"background-color":"#ffffff"}) },
  1042. click:function(){
  1043. this.openTask(data.id,function(){ viewItem.destroy() }.bind(this))
  1044. }.bind(this)
  1045. })
  1046. },
  1047. createStatLayout:function(){
  1048. MWF.xDesktop.requireApp("TeamWork", "Stat", function(){
  1049. var stat = new MWF.xApplication.TeamWork.Stat(this.contentLayout,this.app,this.data,{ });
  1050. stat.load();
  1051. }.bind(this));
  1052. },
  1053. test:function(){
  1054. }
  1055. });
  1056. MWF.xApplication.TeamWork.Project.NewTask = new Class({
  1057. Extends: MPopupForm,
  1058. options : {
  1059. "style": "default",
  1060. "width": 400,
  1061. "height": 250,
  1062. "top": null,
  1063. "left": null,
  1064. "bottom" : null,
  1065. "right" : null,
  1066. "minWidth" : 300,
  1067. "minHeight" : 220,
  1068. "closeByClickMask" : true,
  1069. "hasTopContent" : true,
  1070. "hasTop":true,
  1071. "hasBottom": false,
  1072. "hasIcon": false,
  1073. "title":""
  1074. },
  1075. _createTableContent:function(){
  1076. this.rootActions = this.app.rootActions;
  1077. if(this.formTopTextNode) this.formTopTextNode.set("text",this.lp.newTaskTitle);
  1078. //this.formTableArea
  1079. this.titleContainer = new Element("div.titleContainer",{styles:this.css.titleContainer}).inject(this.formTableArea);
  1080. this.titleValue = new Element("input.titleValue",{styles:this.css.titleValue,placeholder:this.lp.newTaskPlaceholder}).inject(this.titleContainer);
  1081. this.actionContainer = new Element("div.actionContainer",{styles:this.css.actionContainer}).inject(this.formTableArea);
  1082. this.okAction = new Element("div.okAction",{styles:this.css.okAction,text:this.lp.newTaskOk}).inject(this.actionContainer);
  1083. this.okAction.addEvents({
  1084. click:function(){
  1085. if(this.titleValue.get("value").trim()=="") return;
  1086. var data={
  1087. taskGroupId:this.data.taskGroupId,
  1088. taskListIds:this.data.taskListIds || [],
  1089. name: this.titleValue.get("value").trim()
  1090. };
  1091. this.rootActions.TaskAction.save(data,function(json){
  1092. if(json.data.id){
  1093. var data = {
  1094. projectObj:this.data.projectObj || null,
  1095. taskId:json.data.id
  1096. };
  1097. var opt = {
  1098. };
  1099. MWF.xDesktop.requireApp("TeamWork", "Task", function(){
  1100. var task = new MWF.xApplication.TeamWork.Task(this,data,opt);
  1101. task.open();
  1102. }.bind(this));
  1103. this.fireEvent("createTask");
  1104. this.close();
  1105. }
  1106. }.bind(this))
  1107. }.bind(this)
  1108. });
  1109. this.closeAction = new Element("div.closeAction",{styles:this.css.closeAction,text:this.lp.newTaskClose}).inject(this.actionContainer);
  1110. this.closeAction.addEvents({
  1111. click:function(){
  1112. this.close();
  1113. }.bind(this)
  1114. });
  1115. }
  1116. });
  1117. MWF.xApplication.TeamWork.Project.NewTaskGroup = new Class({
  1118. Extends: MPopupForm,
  1119. options : {
  1120. "style": "default",
  1121. "width": 400,
  1122. "height": 250,
  1123. "top": null,
  1124. "left": null,
  1125. "bottom" : null,
  1126. "right" : null,
  1127. "minWidth" : 300,
  1128. "minHeight" : 220,
  1129. "closeByClickMask" : true,
  1130. "hasTopContent" : true,
  1131. "hasTop":true,
  1132. "hasBottom": false,
  1133. "hasIcon": false,
  1134. "title":""
  1135. },
  1136. _createTableContent:function(){
  1137. this.rootActions = this.app.rootActions;
  1138. this.explorer = this.data.projectObj;
  1139. if(this.formTopTextNode) this.formTopTextNode.set("text",this.data.isNew?this.lp.taskGroupAdd:this.lp.taskGroupEdit);
  1140. //this.formTableArea
  1141. this.titleContainer = new Element("div.titleContainer",{styles:this.css.titleContainer}).inject(this.formTableArea);
  1142. this.titleValue = new Element("input.titleValue",{styles:this.css.titleValue,placeholder:this.lp.newTaskListPlaceholder}).inject(this.titleContainer);
  1143. var val = this.data.isNew?"":this.data.name;
  1144. this.titleValue.set("value",val);
  1145. this.actionContainer = new Element("div.actionContainer",{styles:this.css.actionContainer}).inject(this.formTableArea);
  1146. this.okAction = new Element("div.okAction",{styles:this.css.okAction,text:this.lp.newTaskOk}).inject(this.actionContainer);
  1147. this.okAction.addEvents({
  1148. click:function(){
  1149. if(this.titleValue.get("value").trim()=="") return;
  1150. var data={
  1151. id:this.data.id || "",
  1152. taskGroup:this.data.taskGroupId,
  1153. project:this.data.projectId,
  1154. name: this.titleValue.get("value").trim()
  1155. };
  1156. this.rootActions.TaskListAction.save(data,function(json){
  1157. this.fireEvent("createTask");
  1158. this.close(json);
  1159. if(this.explorer){
  1160. if(this.data.node){
  1161. if(json.data.id){
  1162. this.rootActions.TaskListAction.get(this.explorer.currentProjectGroupData.id,json.data.id,function(json){
  1163. this.explorer.createTaskGroupItemLayout(this.data.node,json.data)
  1164. }.bind(this));
  1165. }else{
  1166. this.explorer.createTaskGroup()
  1167. }
  1168. }else{
  1169. this.explorer.createTaskGroup()
  1170. }
  1171. }
  1172. }.bind(this))
  1173. }.bind(this)
  1174. });
  1175. this.closeAction = new Element("div.closeAction",{styles:this.css.closeAction,text:this.lp.newTaskClose}).inject(this.actionContainer);
  1176. this.closeAction.addEvents({
  1177. click:function(){
  1178. this.close();
  1179. }.bind(this)
  1180. });
  1181. }
  1182. });
  1183. MWF.xApplication.TeamWork.Project.TaskGroupMenu = new Class({
  1184. Extends: MWF.xApplication.TeamWork.Common.ToolTips,
  1185. options : {
  1186. // displayDelay : 300,
  1187. hasArrow:false,
  1188. event:"click"
  1189. },
  1190. _loadCustom : function( callback ){
  1191. var _self = this;
  1192. this.css = this.options.css;
  1193. this.lp = this.options.lp;
  1194. //this.data
  1195. this.menuTipLayout = new Element("div.menuTipLayout",{styles:this.css.menuTipLayout}).inject(this.contentNode);
  1196. this.menuTipTitle = new Element("div.menuTipTitle",{styles:this.css.menuTipTitle,text:this.lp.taskGroup}).inject(this.menuTipLayout);
  1197. this.menuTipEditContainer = new Element("div.menuTipContainer",{styles:this.css.menuTipContainer}).inject(this.menuTipLayout);
  1198. this.menuTipEditIcon = new Element("div.menuTipEditIcon",{styles:this.css.menuTipEditIcon}).inject(this.menuTipEditContainer);
  1199. this.menuTipEditText = new Element("div.menuTipEditText",{styles:this.css.menuTipText,text:this.lp.taskGroupEdit}).inject(this.menuTipEditContainer);
  1200. this.menuTipEditContainer.addEvents({
  1201. click:function(){
  1202. var data = this.data;
  1203. data.isNew = false;
  1204. var opt = {
  1205. };
  1206. var newTaskGroup = new MWF.xApplication.TeamWork.Project.NewTaskGroup(this,data,opt,{});
  1207. newTaskGroup.open();
  1208. this.close();
  1209. }.bind(this),
  1210. mouseover:function(){this.setStyles({"background-color":"#F7F7F7"})},
  1211. mouseout:function(){this.setStyles({"background-color":""})}
  1212. });
  1213. this.menuTipRemoveContainer = new Element("div.menuTipContainer",{styles:this.css.menuTipContainer}).inject(this.menuTipLayout);
  1214. this.menuTipRemoveIcon = new Element("div.menuTipRemoveIcon",{styles:this.css.menuTipRemoveIcon}).inject(this.menuTipRemoveContainer);
  1215. this.menuTipRemoveText = new Element("div.menuTipRemoveText",{styles:this.css.menuTipText,text:this.lp.taskGroupRemove}).inject(this.menuTipRemoveContainer);
  1216. this.menuTipRemoveContainer.addEvents({
  1217. click:function(e){
  1218. _self.app.confirm("warn",e,_self.app.lp.common.confirm.removeTitle,_self.app.lp.common.confirm.removeContent,300,120,function(){
  1219. if(_self.data.id){
  1220. _self.rootActions.TaskListAction.delete(_self.data.id,function(json){
  1221. this.close();
  1222. _self.close(json)
  1223. }.bind(this))
  1224. }
  1225. },function(){
  1226. this.close();
  1227. });
  1228. }.bind(this),
  1229. mouseover:function(){this.setStyles({"background-color":"#F7F7F7"})},
  1230. mouseout:function(){this.setStyles({"background-color":""})}
  1231. });
  1232. if(callback)callback();
  1233. }
  1234. });
  1235. MWF.xApplication.TeamWork.Project.NaviViewTip = new Class({
  1236. Extends: MWF.xApplication.TeamWork.Common.ToolTips,
  1237. options : {
  1238. // displayDelay : 300,
  1239. hasArrow:false,
  1240. event:"click"
  1241. },
  1242. _loadCustom : function( callback ){
  1243. var _self = this;
  1244. this.css = this.options.css;
  1245. this.lp = this.options.lp;
  1246. //this.data
  1247. this.menuTipLayout = new Element("div.menuTipLayout",{styles:this.css.menuTipLayout}).inject(this.contentNode);
  1248. this.menuTipTitle = new Element("div.menuTipTitle",{styles:this.css.menuTipTitle,text:this.lp.view}).inject(this.menuTipLayout);
  1249. this.menuTipEditContainer = new Element("div.menuTipContainer",{styles:this.css.menuTipContainer}).inject(this.menuTipLayout);
  1250. this.menuTipEditIcon = new Element("div.menuTipEditIcon",{styles:this.css.menuTipEditIcon}).inject(this.menuTipEditContainer);
  1251. this.menuTipEditText = new Element("div.menuTipEditText",{styles:this.css.menuTipText,text:this.lp.viewEdit}).inject(this.menuTipEditContainer);
  1252. this.menuTipEditContainer.addEvents({
  1253. click:function(){
  1254. }.bind(this),
  1255. mouseover:function(){this.setStyles({"background-color":"#F7F7F7"})},
  1256. mouseout:function(){this.setStyles({"background-color":""})}
  1257. });
  1258. this.menuTipRemoveContainer = new Element("div.menuTipContainer",{styles:this.css.menuTipContainer}).inject(this.menuTipLayout);
  1259. this.menuTipRemoveIcon = new Element("div.menuTipRemoveIcon",{styles:this.css.menuTipRemoveIcon}).inject(this.menuTipRemoveContainer);
  1260. this.menuTipRemoveText = new Element("div.menuTipRemoveText",{styles:this.css.menuTipText,text:this.lp.viewRemove}).inject(this.menuTipRemoveContainer);
  1261. this.menuTipRemoveContainer.addEvents({
  1262. click:function(e){
  1263. _self.app.confirm("warn",e,_self.app.lp.common.confirm.removeTitle,_self.app.lp.common.confirm.removeContent,300,120,function(){
  1264. },function(){
  1265. this.close();
  1266. });
  1267. }.bind(this),
  1268. mouseover:function(){this.setStyles({"background-color":"#F7F7F7"})},
  1269. mouseout:function(){this.setStyles({"background-color":""})}
  1270. });
  1271. if(callback)callback();
  1272. }
  1273. });
  1274. MWF.xApplication.TeamWork.Project.ProjectList = new Class({
  1275. Extends: MWF.xApplication.TeamWork.Common.ToolTips,
  1276. options : {
  1277. // displayDelay : 300,
  1278. hasArrow:false,
  1279. event:"click"
  1280. },
  1281. _loadCustom : function(callback){
  1282. var _self = this;
  1283. this.css = this.options.css;
  1284. this.lp = this.options.lp;
  1285. //this.data
  1286. //this.contentNode
  1287. this.itemLayout = new Element("div.itemLayout",{styles:this.css.itemLayout}).inject(this.contentNode);
  1288. this.app.setLoading(this.itemLayout);
  1289. this.rootActions.ProjectAction.listStarNextWithFilter("(0)",100,{},function(json){
  1290. this.app.setScrollBar(this.itemLayout);
  1291. this.itemLayout.empty();
  1292. if(json.data && json.data.length>0){
  1293. this.starText = new Element("div.starText",{styles:this.css.itemText,text:this.lp.starItem}).inject(this.itemLayout);
  1294. json.data.each(function(data){
  1295. var projectListContainer = new Element("div.projectListContainer",{styles:this.css.projectListContainer}).inject(this.itemLayout);
  1296. var projectListIcon = new Element("div.projectListIcon",{styles:this.css.projectListIcon}).inject(projectListContainer);
  1297. if(data.icon && data.icon!=""){
  1298. projectListIcon.setStyles({"background-image":"url('"+MWF.xDesktop.getImageSrc( data.icon )+"')"});
  1299. }
  1300. new Element("div.projectListText",{styles:this.css.projectListText,text:data.title}).inject(projectListContainer);
  1301. if(this.data.id == data.id){
  1302. new Element("div.projectListSelect",{styles:this.css.projectListSelect}).inject(projectListContainer);
  1303. }
  1304. projectListContainer.addEvents({
  1305. click:function(){
  1306. MWF.xDesktop.requireApp("TeamWork", "Project", function(){
  1307. var p = new MWF.xApplication.TeamWork.Project(this.container,this.app,data,{});
  1308. p.load();
  1309. }.bind(this));
  1310. }.bind(this),
  1311. mouseover:function () { this.setStyles({"background-color":"#F2F5F7"})},
  1312. mouseout:function () { this.setStyles({"background-color":""})}
  1313. });
  1314. }.bind(this))
  1315. }
  1316. var tmpContainer = new Element("div.tmpContainer").inject(this.itemLayout);
  1317. this.app.setLoading(tmpContainer);
  1318. this.rootActions.ProjectAction.listNextWithFilter("(0)",100,{},function(json){
  1319. tmpContainer.destroy();
  1320. this.allItemText = new Element("div.allItemText",{styles:this.css.itemText,text:this.lp.allItem}).inject(this.itemLayout);
  1321. json.data.each(function(data){
  1322. var projectListContainer = new Element("div.projectListContainer",{styles:this.css.projectListContainer}).inject(this.itemLayout);
  1323. var projectListIcon = new Element("div.projectListIcon",{styles:this.css.projectListIcon}).inject(projectListContainer);
  1324. if(data.icon && data.icon!=""){
  1325. projectListIcon.setStyles({"background-image":"url('"+MWF.xDesktop.getImageSrc( data.icon )+"')"});
  1326. }
  1327. new Element("div.projectListText",{styles:this.css.projectListText,text:data.title}).inject(projectListContainer);
  1328. if(this.data.id == data.id){
  1329. new Element("div.projectListSelect",{styles:this.css.projectListSelect}).inject(projectListContainer);
  1330. }
  1331. projectListContainer.addEvents({
  1332. click:function(){
  1333. MWF.xDesktop.requireApp("TeamWork", "Project", function(){
  1334. var p = new MWF.xApplication.TeamWork.Project(this.container,this.app,data,{});
  1335. p.load();
  1336. }.bind(this));
  1337. }.bind(this),
  1338. mouseover:function () { this.setStyles({"background-color":"#F2F5F7"})},
  1339. mouseout:function () { this.setStyles({"background-color":""})}
  1340. });
  1341. }.bind(this));
  1342. }.bind(this))
  1343. }.bind(this));
  1344. if(callback)callback();
  1345. }
  1346. });