ProjectSetting.js 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. //projectData 项目业务数据
  2. MWF.xApplication.TeamWork = MWF.xApplication.TeamWork || {};
  3. MWF.xApplication.TeamWork.ProjectSetting = new Class({
  4. Extends: MWF.xApplication.TeamWork.Common.Popup,
  5. options:{
  6. "closeByClickMask" : false
  7. },
  8. open: function (e) {
  9. //设置css 和 lp等
  10. var css = this.css;
  11. this.cssPath = "../x_component_TeamWork/$ProjectSetting/"+this.options.style+"/css.wcss";
  12. this._loadCss();
  13. if(css) this.css = Object.merge( css, this.css );
  14. this.rootActions = this.app.rootActions;
  15. this.actions = this.rootActions.ProjectAction;
  16. this.lp = this.app.lp.projectSetting;
  17. this.fireEvent("queryOpen");
  18. this.isNew = false;
  19. this.isEdited = false;
  20. this._open();
  21. this.fireEvent("postOpen");
  22. },
  23. _createTableContent: function () {
  24. this.projectInfor(function(rs){
  25. this.groups = rs.groups;
  26. this.groupsArr = [];
  27. this.projectSettingTop = new Element("div.projectSettingTop",{styles:this.css.projectSettingTop}).inject(this.formTableArea);
  28. this.projectSettingTopText = new Element("div.projectSettingTopText",{styles:this.css.projectSettingTopText,text:this.lp.title}).inject(this.projectSettingTop);
  29. this.projectSettingTopClose = new Element("div.projectSettingTopClose",{styles:this.css.projectSettingTopClose}).inject(this.projectSettingTop);
  30. this.projectSettingTopClose.addEvents({
  31. click:function(){this.close()}.bind(this)
  32. });
  33. this.projectSettingContent = new Element("div.projectSettingContent",{styles:this.css.projectSettingContent}).inject(this.formTableArea);
  34. this.projectSettingNaviLayout = new Element("div.projectSettingNaviLayout",{styles:this.css.projectSettingNaviLayout}).inject(this.projectSettingContent);
  35. this.projectSettingLayout = new Element("div.projectSettingLayout",{styles:this.css.projectSettingLayout}).inject(this.projectSettingContent);
  36. this.createNavi();
  37. }.bind(this));
  38. },
  39. createNavi:function(){
  40. var _self = this;
  41. this.projectSettingNaviLayout.empty();
  42. //概况
  43. this.naviGeneral = new Element("div.naviGeneral",{styles:this.css.naviItem}).inject(this.projectSettingNaviLayout);
  44. this.naviGeneralHover = new Element("div.naviItemHover",{styles:this.css.naviItemHover}).inject(this.naviGeneral);
  45. this.naviGeneralHover.setStyles({"height":"58px","margin-top":"2px"});
  46. this.naviGeneralIcon = new Element("div.naviItemIcon",{styles:this.css.naviItemIcon}).inject(this.naviGeneral);
  47. this.naviGeneralIcon.setStyles({"background-image":"url(../x_component_TeamWork/$ProjectSetting/default/icon/icon_general.png)"});
  48. this.naviGeneralText = new Element("div.naviItemText",{styles:this.css.naviItemText,text:this.lp.projectGeneral}).inject(this.naviGeneral);
  49. this.naviGeneral.addEvents({
  50. mouseover:function(){
  51. if(_self.curNavi == "general") return;
  52. this.getElements(".naviItemIcon").setStyles({"background-image":"url(../x_component_TeamWork/$ProjectSetting/default/icon/icon_general_click.png)"});
  53. this.getElements(".naviItemText").setStyles({"color":"#4a90e2"});
  54. },
  55. mouseout:function(){
  56. if(_self.curNavi == "general") return;
  57. this.getElement(".naviItemIcon").setStyles({"background-image":"url(../x_component_TeamWork/$ProjectSetting/default/icon/icon_general.png)"});
  58. this.getElement(".naviItemText").setStyles({"color":""});
  59. },
  60. click:function(){
  61. _self.curNavi = "general";
  62. _self.changeNavi(this);
  63. _self.loadGeneral();
  64. }
  65. });
  66. //项目详情
  67. this.naviDetail = new Element("div.naviGeneral",{styles:this.css.naviItem}).inject(this.projectSettingNaviLayout);
  68. this.naviDetailHover = new Element("div.naviItemHover",{styles:this.css.naviItemHover}).inject(this.naviDetail);
  69. this.naviDetailHover.setStyles({"height":"58px","margin-top":"2px"});
  70. this.naviDetailIcon = new Element("div.naviItemIcon",{styles:this.css.naviItemIcon}).inject(this.naviDetail);
  71. this.naviDetailIcon.setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_detail.png)"});
  72. this.naviDetailText = new Element("div.naviItemText",{styles:this.css.naviItemText,text:this.lp.projectDetail}).inject(this.naviDetail);
  73. this.naviDetail.addEvents({
  74. mouseover:function(){
  75. if(_self.curNavi == "detail") return;
  76. this.getElements(".naviItemIcon").setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_detail_click.png)"});
  77. this.getElements(".naviItemText").setStyles({"color":"#4a90e2"});
  78. },
  79. mouseout:function(){
  80. if(_self.curNavi == "detail") return;
  81. this.getElement(".naviItemIcon").setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_detail.png)"});
  82. this.getElement(".naviItemText").setStyles({"color":""});
  83. },
  84. click:function(){
  85. _self.curNavi = "detail";
  86. _self.changeNavi(this);
  87. _self.loadDetail();
  88. }
  89. });
  90. //权限设置
  91. this.naviAccess = new Element("div.naviAccess",{styles:this.css.naviItem}).inject(this.projectSettingNaviLayout);
  92. this.naviAccessHover = new Element("div.naviItemHover",{styles:this.css.naviItemHover}).inject(this.naviAccess);
  93. this.naviAccessHover.setStyles({"height":"58px","margin-top":"2px"});
  94. this.naviAccessIcon = new Element("div.naviItemIcon",{styles:this.css.naviItemIcon}).inject(this.naviAccess);
  95. this.naviAccessIcon.setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_access.png)"});
  96. this.naviAccessText = new Element("div.naviItemText",{styles:this.css.naviItemText,text:this.lp.projectAccess}).inject(this.naviAccess);
  97. this.naviAccess.addEvents({
  98. mouseover:function(){
  99. if(_self.curNavi == "access") return;
  100. this.getElements(".naviItemIcon").setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_access_click.png)"});
  101. this.getElements(".naviItemText").setStyles({"color":"#4a90e2"});
  102. },
  103. mouseout:function(){
  104. if(_self.curNavi == "access") return;
  105. this.getElement(".naviItemIcon").setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_access.png)"});
  106. this.getElement(".naviItemText").setStyles({"color":""});
  107. },
  108. click:function(){
  109. _self.curNavi = "access";
  110. _self.changeNavi(this);
  111. _self.loadAccess();
  112. }
  113. });
  114. //更多设置
  115. this.naviMore = new Element("div.naviMore",{styles:this.css.naviItem}).inject(this.projectSettingNaviLayout);
  116. this.naviMoreHover = new Element("div.naviItemHover",{styles:this.css.naviItemHover}).inject(this.naviMore);
  117. this.naviMoreHover.setStyles({"height":"58px","margin-top":"2px"});
  118. this.naviMoreIcon = new Element("div.naviItemIcon",{styles:this.css.naviItemIcon}).inject(this.naviMore);
  119. this.naviMoreIcon.setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_more.png)"});
  120. this.naviMoreText = new Element("div.naviItemText",{styles:this.css.naviItemText,text:this.lp.projectMore}).inject(this.naviMore);
  121. this.naviMore.addEvents({
  122. mouseover:function(){
  123. if(_self.curNavi == "more") return;
  124. this.getElements(".naviItemIcon").setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_more_click.png)"});
  125. this.getElements(".naviItemText").setStyles({"color":"#4a90e2"});
  126. },
  127. mouseout:function(){
  128. if(_self.curNavi == "more") return;
  129. this.getElement(".naviItemIcon").setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_more.png)"});
  130. this.getElement(".naviItemText").setStyles({"color":""});
  131. },
  132. click:function(){
  133. _self.curNavi = "more";
  134. _self.changeNavi(this);
  135. _self.loadMore();
  136. }
  137. });
  138. this.naviGeneral.click()
  139. /*
  140. //自定义字段
  141. this.naviCustom = new Element("div.naviCustom",{styles:this.css.naviItem}).inject(this.projectSettingNaviLayout);
  142. this.naviCustomHover = new Element("div.naviItemHover",{styles:this.css.naviItemHover}).inject(this.naviCustom);
  143. this.naviCustomIcon = new Element("div.naviItemIcon",{styles:this.css.naviItemIcon}).inject(this.naviCustom);
  144. this.naviCustomIcon.setStyles({"background-image":"url(../x_component_TeamWork/$ProjectSetting/default/icon/icon_custom.png)"});
  145. this.naviCustomText = new Element("div.naviItemText",{styles:this.css.naviItemText,text:this.lp.customField}).inject(this.naviCustom);
  146. this.naviCustom.addEvents({
  147. mouseover:function(){
  148. if(_self.curNavi == "custom") return;
  149. this.getElements(".naviItemIcon").setStyles({"background-image":"url(../x_component_TeamWork/$ProjectSetting/default/icon/icon_custom_click.png)"});
  150. this.getElements(".naviItemText").setStyles({"color":"#4a90e2"});
  151. },
  152. mouseout:function(){
  153. if(_self.curNavi == "custom") return;
  154. this.getElement(".naviItemIcon").setStyles({"background-image":"url(../x_component_TeamWork/$ProjectSetting/default/icon/icon_custom.png)"});
  155. this.getElement(".naviItemText").setStyles({"color":""});
  156. },
  157. click:function(){
  158. _self.curNavi = "custom";
  159. _self.changeNavi(this);
  160. _self.loadCustom()
  161. }
  162. });
  163. this.naviCustom = new Element("div.naviCustom",{styles:this.css.naviItem}).inject(this.projectSettingNaviLayout);
  164. this.naviCustomHover = new Element("div.naviItemHover",{styles:this.css.naviItemHover}).inject(this.naviCustom);
  165. this.naviCustomIcon = new Element("div.naviItemIcon",{styles:this.css.naviItemIcon}).inject(this.naviCustom);
  166. this.naviCustomIcon.setStyles({"background-image":"url(../x_component_TeamWork/$ProjectSetting/default/icon/icon_custom.png)"});
  167. this.naviCustomText = new Element("div.naviItemText",{styles:this.css.naviItemText,text:"任务设置"}).inject(this.naviCustom);
  168. this.naviCustom.addEvents({
  169. mouseover:function(){
  170. if(_self.curNavi == "custom") return;
  171. this.getElements(".naviItemIcon").setStyles({"background-image":"url(../x_component_TeamWork/$ProjectSetting/default/icon/icon_custom_click.png)"});
  172. this.getElements(".naviItemText").setStyles({"color":"#4a90e2"});
  173. },
  174. mouseout:function(){
  175. if(_self.curNavi == "custom") return;
  176. this.getElement(".naviItemIcon").setStyles({"background-image":"url(../x_component_TeamWork/$ProjectSetting/default/icon/icon_custom.png)"});
  177. this.getElement(".naviItemText").setStyles({"color":""});
  178. },
  179. click:function(){
  180. _self.curNavi = "custom";
  181. _self.changeNavi(this);
  182. _self.loadCustom()
  183. }
  184. });
  185. this.naviCustom = new Element("div.naviCustom",{styles:this.css.naviItem}).inject(this.projectSettingNaviLayout);
  186. this.naviCustomHover = new Element("div.naviItemHover",{styles:this.css.naviItemHover}).inject(this.naviCustom);
  187. this.naviCustomIcon = new Element("div.naviItemIcon",{styles:this.css.naviItemIcon}).inject(this.naviCustom);
  188. this.naviCustomIcon.setStyles({"background-image":"url(../x_component_TeamWork/$ProjectSetting/default/icon/icon_custom.png)"});
  189. this.naviCustomText = new Element("div.naviItemText",{styles:this.css.naviItemText,text:"更多设置"}).inject(this.naviCustom);
  190. this.naviCustom.addEvents({
  191. mouseover:function(){
  192. if(_self.curNavi == "custom") return;
  193. this.getElements(".naviItemIcon").setStyles({"background-image":"url(../x_component_TeamWork/$ProjectSetting/default/icon/icon_custom_click.png)"});
  194. this.getElements(".naviItemText").setStyles({"color":"#4a90e2"});
  195. },
  196. mouseout:function(){
  197. if(_self.curNavi == "custom") return;
  198. this.getElement(".naviItemIcon").setStyles({"background-image":"url(../x_component_TeamWork/$ProjectSetting/default/icon/icon_custom.png)"});
  199. this.getElement(".naviItemText").setStyles({"color":""});
  200. },
  201. click:function(){
  202. _self.curNavi = "custom";
  203. _self.changeNavi(this);
  204. _self.loadCustom()
  205. }
  206. });
  207. */
  208. },
  209. changeNavi:function(obj){
  210. this.projectSettingNaviLayout.getElements(".naviItemHover").setStyles({"background-color":"#ffffff"});
  211. this.projectSettingNaviLayout.getElements(".naviItemText").setStyles({"color":""});
  212. this.projectSettingNaviLayout.getElements(".naviItemIcon").each(function(dom){
  213. var bgurl = dom.getStyle("background-image");
  214. if(bgurl.indexOf("_click")>-1){
  215. bgurl = bgurl.replace("_click","");
  216. }
  217. dom.setStyles({"background-image":bgurl});
  218. }.bind(this));
  219. obj.getElement(".naviItemHover").setStyles({"background-color":"#4a90e2"});
  220. obj.getElement(".naviItemIcon").setStyles({"background-image":obj.getElement(".naviItemIcon").getStyle("background-image").replace(".png","_click.png")});
  221. obj.getElement(".naviItemText").setStyles({"color":"#4a90e2"});
  222. },
  223. loadCustom:function(){
  224. this.projectSettingLayout.empty();
  225. this.customTopLayout = new Element("div.customTopLayout",{styles:this.css.customTopLayout}).inject(this.projectSettingLayout);
  226. this.customTopText = new Element("div.customTopText",{styles:this.css.customTopText,text:this.lp.customTip}).inject(this.customTopLayout);
  227. this.customTopNew = new Element("div.customTopNew",{styles:this.css.customTopNew,text:this.lp.customNew}).inject(this.customTopLayout);
  228. this.customTopNew.addEvents({
  229. mouseover:function(){this.setStyles({"opacity":"0.7"})},
  230. mouseout:function(){this.setStyles({"opacity":"1"})},
  231. click:function(){
  232. MWF.xDesktop.requireApp("TeamWork", "ExtField", function(){
  233. var pc = new MWF.xApplication.TeamWork.ExtField(this,this.container, this.customTopNew, this.app, {projectId:this.data.id}, {
  234. axis : "x",
  235. position : { //node 固定的位置
  236. x : "left",
  237. y : "middle"
  238. },
  239. nodeStyles : {
  240. "min-width":"200px",
  241. "width":"300px",
  242. "padding":"2px",
  243. "border-radius":"5px",
  244. "box-shadow":"0px 0px 4px 0px #999999",
  245. "z-index" : "201"
  246. },
  247. onPostLoad:function(){
  248. pc.node.setStyles({"opacity":"0","top":(pc.node.getStyle("top").toInt())+"px"});
  249. var fx = new Fx.Tween(pc.node,{duration:400});
  250. fx.start(["opacity"] ,"0", "1");
  251. },
  252. onClose:function(rd){
  253. if(!rd) return;
  254. if(rd.value && rd.value !=""){
  255. this.chatTextarea.set("value",this.chatTextarea.get("value")+"["+rd.value+"]")
  256. }
  257. }.bind(this)
  258. });
  259. pc.load();
  260. }.bind(this));
  261. }.bind(this)
  262. });
  263. this.customContent = new Element("div.customContent",{styles:this.css.customContent}).inject(this.projectSettingLayout);
  264. this.createExtFieldList();
  265. },
  266. createExtFieldList:function(){
  267. this.customContent.empty();
  268. this.app.setLoading(this.customContent);
  269. this.rootActions.ProjectExtFieldReleAction.listFieldsWithProject(this.data.id,function(json){
  270. this.customContent.empty();
  271. json.data.each(function(data){
  272. this.createExtFieldItem(data);
  273. }.bind(this));
  274. }.bind(this))
  275. },
  276. createExtFieldItem:function(data){
  277. var _self = this;
  278. var customExtItem = new Element("div.customExtItem",{styles:this.css.customExtItem,id:data.id}).inject(this.customContent);
  279. customExtItem.addEvents({
  280. mouseover:function(){
  281. this.setStyles({"background-color":"#f5f5f5"});
  282. customExitItemRemove.show();
  283. customExitItemEdit.show();
  284. },
  285. mouseout:function(){
  286. this.setStyles({"background-color":""});
  287. customExitItemRemove.hide();
  288. customExitItemEdit.hide();
  289. }
  290. });
  291. var customExtItemTop = new Element("div.customExtItemTop",{styles:this.css.customExtItemTop}).inject(customExtItem);
  292. var customExtName = new Element("div.customExtName",{styles:this.css.customExtName,text:data.displayName}).inject(customExtItemTop);
  293. var customExitItemRemove = new Element("div.customExitItemRemove",{styles:this.css.customExitItemAction,text:this.lp.remove}).inject(customExtItemTop);
  294. customExitItemRemove.addEvents({
  295. click:function(e){
  296. _self.app.confirm("warn",e,_self.app.lp.common.confirm.removeTitle,_self.app.lp.common.confirm.removeContent,300,120,function(){
  297. _self.actions.projectExtFieldRemove(data.id,function(json){
  298. customExtItem.destroy();
  299. this.close();
  300. }.bind(this))
  301. },function(){
  302. this.close();
  303. });
  304. }
  305. });
  306. var customExitItemEdit = new Element("div.customExitItemEdit",{styles:this.css.customExitItemAction,text:this.lp.edit}).inject(customExtItemTop);
  307. customExitItemEdit.addEvents({
  308. click:function(){
  309. MWF.xDesktop.requireApp("TeamWork", "ExtField", function(){
  310. var pc = new MWF.xApplication.TeamWork.ExtField(this,this.container, this.customTopNew, this.app, {projectId:this.data.id,id:data.id}, {
  311. axis : "x",
  312. position : { //node 固定的位置
  313. x : "left",
  314. y : "middle"
  315. },
  316. nodeStyles : {
  317. "min-width":"200px",
  318. "width":"300px",
  319. "padding":"2px",
  320. "border-radius":"5px",
  321. "box-shadow":"0px 0px 4px 0px #999999",
  322. "z-index" : "201"
  323. },
  324. onPostLoad:function(){
  325. pc.node.setStyles({"opacity":"0","top":(pc.node.getStyle("top").toInt())+"px"});
  326. var fx = new Fx.Tween(pc.node,{duration:400});
  327. fx.start(["opacity"] ,"0", "1");
  328. },
  329. onClose:function(rd){
  330. if(!rd) return;
  331. if(rd.value && rd.value !=""){
  332. this.chatTextarea.set("value",this.chatTextarea.get("value")+"["+rd.value+"]")
  333. }
  334. }.bind(this)
  335. });
  336. pc.load();
  337. }.bind(this));
  338. }.bind(this)
  339. });
  340. var customExtValueList = new Element("div.customExtValueList",{styles:this.css.customExtValueList}).inject(customExtItem);
  341. new Element("span.customExtCreator",{styles:this.customExtText,text:this.lp.description+":"+data.description}).inject(customExtValueList);
  342. customExtValueList = new Element("div.customExtValueList",{styles:this.css.customExtValueList}).inject(customExtItem);
  343. new Element("span.customExtCreator",{styles:this.customExtText,text:this.lp.option + ":"+data.optionsData}).inject(customExtValueList);
  344. },
  345. loadGeneral:function(){
  346. this.projectSettingLayout.empty();
  347. this.groupsArr = [];
  348. this.projectSettingBgText = new Element("div.projectSettingBgText",{styles:this.css.projectSettingBgText,"text":this.lp.projectSettingBgText}).inject(this.projectSettingLayout);
  349. this.projectSettingBgContainer = new Element("div.projectSettingBgContainer",{styles:this.css.projectSettingBgContainer}).inject(this.projectSettingLayout);
  350. this.projectSettingBgImg = new Element("div.projectSettingBgImg",{styles:this.css.projectSettingBgImg}).inject(this.projectSettingBgContainer);
  351. if(this.data.icon && this.data.icon!=""){
  352. this.projectSettingBgImg.setStyles({
  353. "background-image":"url('"+MWF.xDesktop.getImageSrc( this.data.icon )+"')"
  354. });
  355. }
  356. this.projectSettingBgUpload = new Element("div.projectSettingBgUpload",{styles:this.css.projectSettingBgUpload,text:this.lp.upload}).inject(this.projectSettingBgContainer);
  357. this.projectSettingBgUpload.addEvents({
  358. click:function(){
  359. var data = {};
  360. MWF.xDesktop.requireApp("TeamWork", "UploadImage", function(){
  361. var ui = new MWF.xApplication.TeamWork.UploadImage(this, data, {
  362. documentId : this.data.id ||"",
  363. onPostOk : function( id ){
  364. this.data.icon = id;
  365. this.projectSettingBgImg.setStyles({
  366. "background-image":"url('"+MWF.xDesktop.getImageSrc( id )+"')"
  367. });
  368. }.bind(this)
  369. });
  370. ui.open()
  371. }.bind(this));
  372. }.bind(this)
  373. });
  374. this.projectSettingContainer = new Element("div.projectSettingContainer",{styles:this.css.projectSettingContainer}).inject(this.projectSettingLayout);
  375. this.projectSettingTitleContainer = new Element("div.projectSettingTitleContainer",{styles:this.css.projectSettingTitleContainer}).inject(this.projectSettingContainer);
  376. this.projectSettingTitleText = new Element("div.projectSettingTitleText",{styles:this.css.projectSettingTitleText,text:this.lp.projectTitle}).inject(this.projectSettingTitleContainer);
  377. this.projectSettingTitleDiv = new Element("div.projectSettingTitleDiv",{styles:this.css.projectSettingTitleDiv}).inject(this.projectSettingTitleContainer);
  378. this.projectSettingTitleIn = new Element("input.projectSettingTitleIn",{styles:this.css.projectSettingTitleIn,value:this.projectData.title || ""}).inject(this.projectSettingTitleDiv);
  379. this.projectSettingTitleIn.addEvents({
  380. focus:function(){
  381. this.projectSettingTitleIn.setStyles({"border":"1px solid #4A90E2"});
  382. }.bind(this),
  383. blur:function(){
  384. this.projectSettingTitleIn.setStyles({"border":"1px solid #A6A6A6"});
  385. }.bind(this)
  386. });
  387. // this.projectSettingContainer = new Element("div.projectSettingContainer",{styles:this.css.projectSettingContainer}).inject(this.formTableArea);
  388. this.projectSettingGroupContainer = new Element("div.projectSettingGroupContainer",{styles:this.css.projectSettingGroupContainer}).inject(this.projectSettingContainer);
  389. this.projectSettingGroupText = new Element("div.projectSettingGroupText",{styles:this.css.projectSettingGroupText,text:this.lp.projectGroup}).inject(this.projectSettingGroupContainer);
  390. this.projectSettingGroupDiv = new Element("div.projectSettingGroupDiv",{styles:this.css.projectSettingGroupDiv}).inject(this.projectSettingGroupContainer);
  391. this.projectSettingGroupDiv.addEvents({
  392. click:function(){
  393. var data = {groups:this.groups};
  394. MWF.xDesktop.requireApp("TeamWork", "GroupSelect", function(){
  395. var gs = new MWF.xApplication.TeamWork.GroupSelect(this.container, this.projectSettingGroupDiv, this.app, data, {
  396. axis : "y",
  397. nodeStyles : {
  398. "min-width":"190px",
  399. "z-index" : "102"
  400. },
  401. onClose:function(d){
  402. this.projectSettingGroupDiv.setStyles({"border":"1px solid #A6A6A6"});
  403. if(d){
  404. this.rootActions.ProjectGroupAction.listWithIds({ids:d},function(json){
  405. this.groups = json.data;
  406. var tmp = [];
  407. json.data.each(function(ddd){
  408. tmp.push(ddd.name);
  409. });
  410. this.projectSettingGroupValue.set("text",tmp.join());
  411. this.projectSettingGroupValue.set("title",tmp.join())
  412. }.bind(this));
  413. }else{
  414. this.groups = [];
  415. }
  416. //this.newProjectGroupValue.set("text",d)
  417. }.bind(this)
  418. });
  419. gs.load();
  420. }.bind(this));
  421. this.projectSettingGroupDiv.setStyles({"border":"1px solid #4A90E2"});
  422. }.bind(this)
  423. });
  424. this.projectSettingGroupValue = new Element("div.projectSettingGroupValue",{styles:this.css.projectSettingGroupValue}).inject(this.projectSettingGroupDiv);
  425. this.projectSettingGroupIcon = new Element("div.projectSettingGroupIcon",{styles:this.css.projectSettingGroupIcon}).inject(this.projectSettingGroupDiv);
  426. if(this.groups){
  427. this.groups.each(function(data){
  428. this.groupsArr.push(data.name);
  429. }.bind(this));
  430. }
  431. this.projectSettingGroupValue.set("text",this.groupsArr.join());
  432. this.projectSettingGroupValue.set("title",this.groupsArr.join());
  433. this.projectSettingContainer = new Element("div.projectSettingContainer",{styles:this.css.projectSettingContainer}).inject(this.projectSettingLayout);
  434. this.projectSettingContainer.setStyles({"height":"120px"});
  435. this.projectSettingDesText = new Element("div.projectSettingDesText",{styles:this.css.projectSettingDesText,text:this.lp.projectDes}).inject(this.projectSettingContainer);
  436. this.projectSettingDesContainer = new Element("div.projectSettingDesContainer",{styles:this.css.projectSettingDesContainer}).inject(this.projectSettingContainer);
  437. this.projectSettingDesIn = new Element("textarea.projectSettingDesIn",{styles:this.css.projectSettingDesIn,value:this.projectData.description||""}).inject(this.projectSettingDesContainer);
  438. this.projectSettingDesIn.addEvents({
  439. focus:function(){
  440. this.projectSettingDesIn.setStyles({"border":"1px solid #4A90E2"});
  441. }.bind(this),
  442. blur:function(){
  443. this.projectSettingDesIn.setStyles({"border":"1px solid #A6A6A6"});
  444. }.bind(this)
  445. });
  446. this.projectSettingContainer = new Element("div.projectSettingContainer",{styles:this.css.projectSettingContainer}).inject(this.projectSettingLayout);
  447. this.projectSettingConfirm = new Element("div.projectSettingConfirm",{styles:this.css.projectSettingConfirm,text:this.lp.confirm}).inject(this.projectSettingContainer);
  448. this.projectSettingConfirm.addEvents({
  449. click:function(){
  450. if(this.projectSettingTitleIn.get("value").trim()=="") return;
  451. var groups = [];
  452. if(this.groups){
  453. this.groups.each(function(d){
  454. groups.push(d.id);
  455. });
  456. }
  457. var data = {
  458. "id":this.data.id,
  459. "icon":this.data.icon || "",
  460. "title":this.projectSettingTitleIn.get("value").trim(),
  461. "description":this.projectSettingDesIn.get("value"),
  462. "groups":groups
  463. };
  464. this.actions.save(data,function(json){
  465. this.projectSettingLayout.empty();
  466. this.app.setLoading(this.projectSettingLayout);
  467. this.projectInfor(function(json){
  468. this.loadGeneral(json);
  469. if(this.explorer.currentListType == "block"){
  470. this.explorer.loadSingleBlockItem(this.explorer.container.getElementById(json.id),json)
  471. }else if(this.explorer.currentListType == "list"){
  472. this.explorer.loadSingleListItem(this.explorer.container.getElementById(json.id),json)
  473. }
  474. }.bind(this));
  475. }.bind(this));
  476. }.bind(this)
  477. });
  478. // this.projectSettingClose = new Element("div.projectSettingClose",{styles:this.css.projectSettingClose,text:this.lp.close}).inject(this.projectSettingContainer);
  479. // this.projectSettingClose.addEvents({
  480. // click:function(){
  481. // this.close();
  482. // }.bind(this)
  483. // });
  484. //this.projectSettingAction = new Element("div.projectSettingAction",{styles:this.css.projectSettingAction,text:this.lp.confirm}).inject(this.formTableArea);
  485. },
  486. loadDetail:function(){
  487. var _self = this;
  488. this.projectSettingLayout.empty();
  489. //var authTaskTitle = new Element("div.authTaskTitle",{styles:this.css.authTitle,text:this.lp.auth.task}).inject(this.projectSettingLayout);
  490. var tips = this.projectData.creatorPerson.split("@")[0] + " " + this.lp.projectDetails.at+this.projectData.createTime +this.lp.projectDetails.create;
  491. var detailTopContainer = new Element("div.detailTopContainer",{ styles: this.css.detailTopContainer, text:tips }).inject(this.projectSettingLayout);
  492. var detailStatTitle = new Element("div.detailStatTitle",{styles:this.css.detailStatTitle, text:this.lp.projectDetails.taskStat}).inject(this.projectSettingLayout);
  493. var detailStatContainer = new Element("div.detailStatContainer",{styles:this.css.detailStatContainer}).inject(this.projectSettingLayout);
  494. var detailStatTotal = new Element("div.detailStatTotal",{styles:this.css.detailStatTotal}).inject(detailStatContainer);
  495. new Element("div.detailStatTotalTitle",{styles:this.css.detailStatTotalTitle,text:this.lp.projectDetails.total}).inject(detailStatTotal);
  496. new Element("div.detailStatTotalCount",{styles:this.css.detailStatTotalCount,text:this.projectData.taskTotal}).inject(detailStatTotal);
  497. var tbar = new Element("div.detailStatTotalBar",{styles:this.css.detailStatTotalBar}).inject(detailStatTotal);
  498. tbar.setStyles({"background-color":"#95b9e4"});
  499. var detailStatProcess = new Element("div.detailStatTotal",{styles:this.css.detailStatTotal}).inject(detailStatContainer);
  500. new Element("div.detailStatTotalTitle",{styles:this.css.detailStatTotalTitle,text:this.lp.projectDetails.process}).inject(detailStatProcess);
  501. new Element("div.detailStatTotalCount",{styles:this.css.detailStatTotalCount,text:this.projectData.progressTotal}).inject(detailStatProcess);
  502. var pbar = new Element("div.detailStatTotalBar",{styles:this.css.detailStatTotalBar}).inject(detailStatProcess);
  503. pbar.setStyles({"background-color":"#ecedf4"});
  504. var detailStatCompleted = new Element("div.detailStatTotal",{styles:this.css.detailStatTotal}).inject(detailStatContainer);
  505. new Element("div.detailStatTotalTitle",{styles:this.css.detailStatTotalTitle,text:this.lp.projectDetails.complete}).inject(detailStatCompleted);
  506. new Element("div.detailStatTotalCount",{styles:this.css.detailStatTotalCount,text:this.projectData.completedTotal}).inject(detailStatCompleted);
  507. var cbar = new Element("div.detailStatTotalBar",{styles:this.css.detailStatTotalBar}).inject(detailStatCompleted);
  508. cbar.setStyles({"background-color":"#f1f9eb"});
  509. var detailStatOver = new Element("div.detailStatTotal",{styles:this.css.detailStatTotal}).inject(detailStatContainer);
  510. var detailStatTotalTitle = new Element("div.detailStatTotalTitle",{styles:this.css.detailStatTotalTitle,text:this.lp.projectDetails.over}).inject(detailStatOver);
  511. var detailStatTotalCount = new Element("div.detailStatTotalCount",{styles:this.css.detailStatTotalCount,text:this.projectData.overtimeTotal}).inject(detailStatOver);
  512. var detailStatTotalBar = new Element("div.detailStatTotalBar",{styles:this.css.detailStatTotalBar}).inject(detailStatOver);
  513. },
  514. loadAccess:function(){
  515. var _self = this;
  516. this.projectSettingLayout.empty();
  517. var authTaskTitle = new Element("div.authTaskTitle",{styles:this.css.authTitle,text:this.lp.auth.task}).inject(this.projectSettingLayout);
  518. authTaskTitle.setStyle("margin-top","20px");
  519. var authTaskContainer = new Element("div.authTaskContainer",{styles:this.css.authContainer}).inject(this.projectSettingLayout);
  520. this.getProjectAuth(this.projectData.id,function(){
  521. //alert(JSON.stringify(this.projectAuthData))
  522. //创建任务
  523. //var taskCreateFlag = true;
  524. taskCreateFlag=this.projectAuthData.hasOwnProperty("taskCreate") ? this.projectAuthData.taskCreate:true;
  525. var newTaskContainer = new Element("div.authItemContainer",{styles:this.css.authItemContainer}).inject(authTaskContainer);
  526. var newTaskIcon = new Element("div.authItemIcon",{styles:this.css.authItemIcon}).inject(newTaskContainer);
  527. var newTaskTitle = new Element("div.authItemTitle",{styles:this.css.authItemTitle,text:this.lp.auth.taskCreate}).inject(newTaskContainer);
  528. if(!taskCreateFlag) newTaskIcon.setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_unselected.png)"});
  529. else newTaskIcon.setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_selected.png)"});
  530. var isChanged = false;
  531. newTaskContainer.addEvents({
  532. mouseenter:function(){
  533. if(isChanged) return;
  534. if(taskCreateFlag){
  535. newTaskIcon.setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_selected_click.png)"});
  536. }else{
  537. newTaskIcon.setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_unselected_click.png)"});
  538. }
  539. },
  540. mouseleave:function(){
  541. if(isChanged) { isChanged = false ; return;}
  542. if(taskCreateFlag){
  543. newTaskIcon.setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_selected.png)"});
  544. }else{
  545. newTaskIcon.setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_unselected.png)"});
  546. }
  547. },
  548. click:function(){
  549. if(taskCreateFlag){
  550. this.projectAuthData.taskCreate = false;
  551. taskCreateFlag = false;
  552. newTaskIcon.setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_unselected.png)"});
  553. }else{
  554. this.projectAuthData.taskCreate = true;
  555. taskCreateFlag = true;
  556. newTaskIcon.setStyles({"background-image":"url(/x_component_TeamWork/$ProjectSetting/default/icon/icon_selected.png)"});
  557. }
  558. this.saveProjectAuth();
  559. isChanged = true;
  560. }.bind(this)
  561. });
  562. }.bind(this));
  563. },
  564. getProjectAuth:function(id,callback){
  565. this.rootActions.GlobalAction.projectConfigGetByProject(id,function(json){
  566. if(json.type == "error"){
  567. this.projectAuthData = {};
  568. }else{
  569. this.projectAuthData = json.data||{};
  570. }
  571. if(callback)callback(json)
  572. }.bind(this),function(json){
  573. this.projectAuthData = {};
  574. if(callback)callback(json)
  575. }.bind(this));
  576. },
  577. loadAccessItem:function(container,data){
  578. },
  579. saveProjectAuth:function(callback){
  580. var data = {
  581. id:this.projectAuthData.id||"",
  582. project:this.projectData.id,
  583. taskCreate:this.projectAuthData.taskCreate || false,
  584. taskCopy:this.projectAuthData.taskCopy || false,
  585. taskRemove:this.projectAuthData.taskRemove || false,
  586. laneCreate:this.projectAuthData.laneCreate || false,
  587. laneEdit:this.projectAuthData.laneEdit || false,
  588. laneRemove:this.projectAuthData.laneRemove || false,
  589. attachmentUpload:this.projectAuthData.attachmentUpload || false,
  590. comment:this.projectAuthData.comment || false
  591. };
  592. this.rootActions.GlobalAction.projectConfigSave(data,function(json){
  593. this.rootActions.GlobalAction.projectConfigGet(json.data.id,function(d){
  594. this.projectAuthData = d.data;
  595. if(callback)callback(json);
  596. }.bind(this))
  597. }.bind(this))
  598. },
  599. loadMore:function(){
  600. var _self = this;
  601. this.projectSettingLayout.empty();
  602. this.moreActionTitle = new Element("div.moreActionTitle",{styles:this.css.moreActionTitle,text:this.lp.moreActionTitle}).inject(this.projectSettingLayout);
  603. this.moreActionDescription = new Element("div.moreActionDescription",{styles:this.css.moreActionDescription,text:this.lp.moreActionDescription}).inject(this.projectSettingLayout);
  604. this.moreActionContainer = new Element("div.moreActionContainer",{ styles:this.css.moreActionContainer }).inject(this.projectSettingLayout);
  605. if(this.projectData.completed){
  606. this.moreActionUnComplete = new Element("div.moreActionUnComplete",{styles:this.css.moreActionUnComplete, text:this.lp.moreActionUnComplete}).inject(this.moreActionContainer);
  607. this.moreActionUnComplete.addEvents({
  608. mouseover:function(){
  609. this.setStyles({"background-color":"#ffeded"})
  610. },
  611. mouseout:function(){
  612. this.setStyles({"background-color":"#ffffff"})
  613. },
  614. click:function(e){
  615. _self.app.confirm("warn",e,_self.lp.moreActionUnComplete,_self.lp.moreActionUnCompleteTips,450,100,function(){
  616. _self.rootActions.ProjectAction.completeProject(_self.projectData.id,{completed:false},function(){
  617. this.close();
  618. _self.close({"action":"reload"});
  619. }.bind(this))
  620. },function(){
  621. this.close();
  622. });
  623. }
  624. });
  625. }else{
  626. this.moreActionComplete = new Element("div.moreActionComplete",{styles:this.css.moreActionComplete, text:this.lp.moreActionComplete}).inject(this.moreActionContainer);
  627. this.moreActionComplete.addEvents({
  628. mouseover:function(){
  629. this.setStyles({"background-color":"#ffeded"})
  630. },
  631. mouseout:function(){
  632. this.setStyles({"background-color":"#ffffff"})
  633. },
  634. click:function(e){
  635. _self.app.confirm("warn",e,_self.lp.moreActionComplete,_self.lp.moreActionCompleteTips,450,100,function(){
  636. _self.rootActions.ProjectAction.completeProject(_self.projectData.id,{completed:true},function(){
  637. this.close();
  638. _self.close({"action":"reload"});
  639. }.bind(this))
  640. },function(){
  641. this.close();
  642. });
  643. }
  644. });
  645. }
  646. if(this.projectData.deleted){
  647. this.moreActionRecover = new Element("div.moreActionRemove",{styles:this.css.moreActionRecover, text:this.lp.moreActionRecover}).inject(this.moreActionContainer);
  648. this.moreActionRecover.addEvents({
  649. mouseover:function(){
  650. this.setStyles({"background-color":"#c21c07"})
  651. },
  652. mouseout:function(){
  653. this.setStyles({"background-color":"#e62412"})
  654. },
  655. click:function(e){
  656. _self.app.confirm("warn",e,_self.lp.moreActionRecover,_self.lp.moreActionRecoverTips,450,100,function(){
  657. _self.rootActions.ProjectAction.recoveryProject(_self.projectData.id,function(){
  658. this.close();
  659. _self.close({"action":"reload"});
  660. }.bind(this))
  661. },function(){
  662. this.close();
  663. });
  664. }
  665. });
  666. }else{
  667. this.moreActionRemove = new Element("div.moreActionRemove",{styles:this.css.moreActionRemove, text:this.lp.moreActionRemove}).inject(this.moreActionContainer);
  668. this.moreActionRemove.addEvents({
  669. mouseover:function(){
  670. this.setStyles({"background-color":"#c21c07"})
  671. },
  672. mouseout:function(){
  673. this.setStyles({"background-color":"#e62412"})
  674. },
  675. click:function(e){
  676. _self.app.confirm("warn",e,_self.lp.moreActionRemove,_self.lp.moreActionRemoveTips,450,100,function(){
  677. _self.rootActions.ProjectAction.delete(_self.projectData.id,function(){
  678. this.close();
  679. _self.close({"action":"reload"});
  680. }.bind(this))
  681. },function(){
  682. this.close();
  683. });
  684. }
  685. });
  686. }
  687. },
  688. projectInfor:function(callback){
  689. if(this.data.id){
  690. this.actions.get(this.data.id,function(json){
  691. this.projectData = json.data;
  692. if(callback)callback(json.data)
  693. }.bind(this));
  694. }
  695. },
  696. groupInfor:function(ids){
  697. if(!ids) return;
  698. var resGroups = [];
  699. ids.each(function(data){
  700. this.rootActions.ProjectGroupAction.get(data,function(json){
  701. }.bind(this))
  702. }.bind(this))
  703. }
  704. });