WorkExplorer.js 72 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658
  1. MWF.require("MWF.xAction.org.express.RestActions", null,false);
  2. MWF.require("MWF.widget.Mask", null, false);
  3. MWF.require("MWF.widget.Identity", null,false);
  4. MWF.xDesktop.requireApp("Organization", "Selector.package", null, false);
  5. MWF.xDesktop.requireApp("process.ProcessManager", "DictionaryExplorer", null, false);
  6. MWF.xApplication.process.Application.WorkExplorer = new Class({
  7. Extends: MWF.xApplication.process.ProcessManager.DictionaryExplorer,
  8. Implements: [Options, Events],
  9. initialize: function(node, actions, options){
  10. this.setOptions(options);
  11. this.setTooltip();
  12. this.path = "/x_component_process_Application/$WorkExplorer/";
  13. this.cssPath = "/x_component_process_Application/$WorkExplorer/"+this.options.style+"/css.wcss";
  14. this._loadCss();
  15. this.actions = actions;
  16. this.node = $(node);
  17. this.items=[];
  18. this.works = {};
  19. this.filter = null;
  20. this.isItemsLoaded = false;
  21. this.isItemLoadding = false;
  22. this.loadItemQueue = 0;
  23. this.pageCount = 20;
  24. if (!this.personActions) this.personActions = new MWF.xAction.org.express.RestActions();
  25. this.initData();
  26. },
  27. load: function(){
  28. this.loadToolbar();
  29. this.loadFilterNode();
  30. this.loadFilterConditionNode();
  31. this.loadContentNode();
  32. this.setNodeScroll();
  33. this.mask = new MWF.widget.Mask({"style": "desktop"});
  34. this.mask.loadNode(this.node);
  35. this.loadElementList();
  36. },
  37. createSearchElementNode: function(){
  38. this.toCompletedNode = new Element("div", {
  39. "styles": this.css.toCompletedNode,
  40. "text": this.app.lp.toCompleted
  41. }).inject(this.toolbarNode);
  42. this.toCompletedNode.addEvents({
  43. "mouseover": function(){
  44. this.toCompletedNode.setStyles(this.css.toCompletedNode_over);
  45. }.bind(this),
  46. "mouseout": function(){
  47. this.toCompletedNode.setStyles(this.css.toCompletedNode);
  48. }.bind(this),
  49. "click": function(){
  50. this.app.workCompletedConfig();
  51. }.bind(this)
  52. });
  53. },
  54. clearWorks: function(){
  55. MWF.release(this.items);
  56. this.works = null;
  57. this.items=[];
  58. this.works = {};
  59. this.elementContentListNode.empty();
  60. this.isItemsLoaded = false;
  61. this.isItemLoadding = false;
  62. this.loadItemQueue = 0;
  63. },
  64. loadFilterNode: function(){
  65. this.filterNode = new Element("div", {"styles": this.css.filterNode}).inject(this.node);
  66. this.filterAllProcessNode = new Element("div", {"styles": this.css.filterAllProcessNode, "text": this.app.lp.all}).inject(this.filterNode);
  67. new Element("span", {"styles": this.css.filterAllProcessCountNode}).inject(this.filterAllProcessNode);
  68. this.filterAllProcessNode.addEvent("click", function(){
  69. if (this.currentProcessNode) this.currentProcessNode.setStyles(this.css.filterProcessNode);
  70. this.currentProcessNode = null;
  71. this.filter = null;
  72. this.reloadWorks();
  73. }.bind(this));
  74. this.filterActionAreaNode = new Element("div", {"styles": this.css.filterActionAreaNode}).inject(this.filterNode);
  75. this.filterActionNode = new Element("div", {"styles": this.css.filterActionNode, "text": this.app.lp.filter}).inject(this.filterActionAreaNode);
  76. this.filterActionNode.addEvent("click", function(e){
  77. this.showOrHideFilter();e.stopPropagation();
  78. }.bind(this));
  79. this.filterProcessAreaNode = new Element("div", {"styles": this.css.filterProcessAreaNode}).inject(this.filterNode);
  80. this.filterProcessListNode = new Element("div", {"styles": this.css.filterProcessListNode}).inject(this.filterProcessAreaNode);
  81. this.loadProcess();
  82. },
  83. showOrHideFilter: function(){
  84. if (!this.isFilterOpen){
  85. if (!this.filterAreaMorph || !this.filterAreaMorph.isRunning()) this.showFilter();
  86. }else{
  87. if (this.filterAreaMorph || !this.filterAreaMorph.isRunning()) this.hideFilter();
  88. }
  89. },
  90. showFilter: function(){
  91. this.filterActionNode.setStyles(this.css.filterActionNode_over);
  92. if (!this.filterAreaNode) this.createFilterAreaNode();
  93. this.filterAreaTipNode.setStyle("display", "block");
  94. this.filterAreaNode.setStyle("display", "block");
  95. this.resizeFilterAreaNode();
  96. var toStyle = {
  97. "width": "460px",
  98. "height": "500px"
  99. };
  100. this.isFilterOpen = true;
  101. this.filterAreaMorph.start(toStyle).chain(function(){
  102. this.createFilterAreaTitle();
  103. this.createFilterAreaContent();
  104. this.hideFilterFun = this.hideFilter.bind(this);
  105. $(document.body).addEvent("click", this.hideFilterFun);
  106. }.bind(this));
  107. },
  108. hideFilter: function(){
  109. if (this.filterAreaNode){
  110. var toStyle = {
  111. "width": "460px",
  112. "height": "0px"
  113. }
  114. this.filterAreaNode.empty();
  115. this.isFilterOpen = false;
  116. this.filterAreaMorph.start(toStyle).chain(function(){
  117. this.filterAreaNode.eliminate("input");
  118. this.filterAreaNode.setStyle("display", "none");
  119. this.filterAreaTipNode.setStyle("display", "none");
  120. this.filterActionNode.setStyles(this.css.filterActionNode);
  121. $(document.body).removeEvent("click", this.hideFilterFun);
  122. }.bind(this));
  123. $(document.body).removeEvent("click", this.hideFilterFun);
  124. }
  125. },
  126. createFilterAreaNode: function(){
  127. this.filterAreaNode = new Element("div", {"styles": this.css.filterAreaNode}).inject(this.app.content);
  128. this.filterAreaNode.addEvent("click", function(e){e.stopPropagation();});
  129. this.filterAreaTipNode = new Element("div", {"styles": this.css.filterAreaTipNode}).inject(this.app.content);
  130. //var size = this.filterActionNode.getSize();
  131. this.filterAreaNode.setStyles({
  132. "width": "460px",
  133. "height": "0px"
  134. });
  135. this.filterAreaNode.position({
  136. relativeTo: this.filterNode,
  137. position: 'bottomRight',
  138. edge: 'upperRight',
  139. offset: {x:-20, y: -1}
  140. });
  141. this.filterAreaTipNode.position({
  142. relativeTo: this.filterNode,
  143. position: 'bottomRight',
  144. edge: 'bottomRight',
  145. offset: {x:-38, y: 0}
  146. });
  147. this.app.addEvent("resize", function(){
  148. this.resizeFilterAreaNode();
  149. }.bind(this));
  150. this.filterAreaMorph = new Fx.Morph(this.filterAreaNode, {
  151. duration: '100',
  152. transition: Fx.Transitions.Sine.easeInOut
  153. });
  154. },
  155. resizeFilterAreaNode: function(){
  156. if (this.filterAreaNode){
  157. this.filterAreaNode.position({
  158. relativeTo: this.filterNode,
  159. position: 'bottomRight',
  160. edge: 'upperRight',
  161. offset: {x:-20, y: -1}
  162. });
  163. if (this.filterAreaTipNode){
  164. this.filterAreaTipNode.position({
  165. relativeTo: this.filterNode,
  166. position: 'bottomRight',
  167. edge: 'bottomRight',
  168. offset: {x:-38, y: 0}
  169. });
  170. }
  171. }
  172. },
  173. createFilterAreaTitle: function(){
  174. var titleNode = new Element("div", {"styles": this.css.filterAreaTitleNode}).inject(this.filterAreaNode);
  175. var okNode = new Element("div", {"styles": this.css.filterAreaTitleActionOkNode, "text": this.app.lp.ok}).inject(titleNode);
  176. var clearNode = new Element("div", {"styles": this.css.filterAreaTitleActionClearNode, "text": this.app.lp.clear}).inject(titleNode);
  177. clearNode.addEvent("click", function(){
  178. this.filterAreaNode.getElements(".filterItem").each(function(el){
  179. this.unSelectedFilterItem(el);
  180. }.bind(this));
  181. var input = this.filterAreaNode.retrieve("input");
  182. input.set("value", "");
  183. this.filter = null;
  184. this.hideFilter();
  185. this.reloadWorks();
  186. }.bind(this));
  187. okNode.addEvent("click", function(){
  188. var input = this.filterAreaNode.retrieve("input");
  189. if (!this.filter) this.filter = {};
  190. var key = input.get("value");
  191. if (key && key!=this.app.lp.searchKey){
  192. this.filter.key = key;
  193. }else{
  194. this.filter.key = "";
  195. delete this.filter.key
  196. }
  197. this.hideFilter();
  198. this.reloadWorks();
  199. }.bind(this));
  200. var searchNode = new Element("div", {"styles": this.css.filterAreaTitleSearchNode}).inject(titleNode);
  201. var searchIconNode = new Element("div", {"styles": this.css.filterAreaTitleSearchIconNode}).inject(searchNode);
  202. var searchInputAreaNode = new Element("div", {"styles": this.css.filterAreaTitleSearchInputAreaNode}).inject(searchNode);
  203. var searchInputNode = new Element("input", {"styles": this.css.filterAreaTitleSearchInputNode, "value": this.app.lp.searchKey}).inject(searchInputAreaNode);
  204. if (this.filter){
  205. if (this.filter.key) searchInputNode.set("value", this.filter.key);
  206. }
  207. this.filterAreaNode.store("input", searchInputNode);
  208. var key = this.app.lp.searchKey;
  209. searchInputNode.addEvents({
  210. "blur": function(){if (!this.get("value")) this.set("value", key)},
  211. "focus": function(){if (this.get("value")==key) this.set("value", "")},
  212. "keydown": function(e){
  213. if (e.code==13){
  214. var input = this.filterAreaNode.retrieve("input");
  215. if (!this.filter) this.filter = {};
  216. var key = input.get("value");
  217. if (key && key!=this.app.lp.searchKey){
  218. this.filter.key = key;
  219. }else{
  220. this.filter.key = "";
  221. delete this.filter.key
  222. }
  223. this.hideFilter();
  224. this.reloadWorks();
  225. }
  226. }.bind(this)
  227. });
  228. },
  229. createFilterAreaContent: function(){
  230. var contentScrollNode = new Element("div", {"styles": this.css.applicationFilterAreaContentScrollNode}).inject(this.filterAreaNode);
  231. var contentNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(contentScrollNode);
  232. MWF.require("MWF.widget.ScrollBar", function(){
  233. new MWF.widget.ScrollBar(contentScrollNode, {
  234. "style":"xApp_filter", "where": "after", "distance": 30, "friction": 4, "axis": {"x": false, "y": true}
  235. });
  236. }.bind(this));
  237. var _self = this;
  238. this._getFilterCount(function(json){
  239. var obj = json.data;
  240. Object.each(obj, function(v, key){
  241. var categoryNode = new Element("div", {"styles": this.css.applicationFilterCategoryNode}).inject(contentNode);
  242. categoryNode.set("text", this.app.lp[key]);
  243. var itemAreaNode = new Element("div", {"styles": this.css.applicationFilterItemAreaNode}).inject(contentNode);
  244. // for (var x=0; x<10; x++){
  245. v.each(function(item){
  246. var itemNode = new Element("div", {"styles": this.css.applicationFilterItemNode}).inject(itemAreaNode);
  247. //itemNode.set("text", item.name+"("+item.count+")");
  248. itemNode.set("text", item.name);
  249. itemNode.store("value", item.value);
  250. itemNode.store("textname", item.name);
  251. itemNode.store("key", key);
  252. itemNode.addEvent("click", function(){
  253. if (this.hasClass("applicationFilterItemNode_over")){
  254. _self.unSelectedFilterItem(this);
  255. }else{
  256. _self.selectedFilterItem(this);
  257. }
  258. });
  259. if (this.filter){
  260. if (this.filter[key]){
  261. if (item.value == this.filter[key][0].value){
  262. this.selectedFilterItem(itemNode);
  263. }
  264. }
  265. }
  266. }.bind(this));
  267. // }
  268. }.bind(this));
  269. }.bind(this));
  270. },
  271. _getFilterCount: function(callback){
  272. this.actions.listFilterAttributeManage(this.app.options.id, function(json){
  273. if (callback) callback(json);
  274. });
  275. },
  276. unSelectedFilterItem: function(item){
  277. if (item.hasClass("applicationFilterItemNode_over")){
  278. var value = item.retrieve("value");
  279. var name = item.retrieve("textname");
  280. var key = item.retrieve("key");
  281. item.setStyles(this.css.applicationFilterItemNode);
  282. item.removeClass("applicationFilterItemNode_over");
  283. item.addClass("applicationFilterItemNode");
  284. if (!this.filter) this.filter = {};
  285. this.filter[key] = null;
  286. delete this.filter[key];
  287. item.getParent().eliminate("current");
  288. }
  289. },
  290. selectedFilterItem: function(item){
  291. if (!item.hasClass("applicationFilterItemNode_over")){
  292. var current = item.getParent().retrieve("current");
  293. if (current) this.unSelectedFilterItem(current);
  294. var value = item.retrieve("value");
  295. var key = item.retrieve("key");
  296. var name = item.retrieve("textname");
  297. item.setStyles(this.css.applicationFilterItemNode_over);
  298. item.removeClass("applicationFilterItemNode");
  299. item.addClass("applicationFilterItemNode_over");
  300. if (!this.filter) this.filter = {};
  301. this.filter[key] = [{"value": value, "name": name}];
  302. //this.filter[key] = [value];
  303. item.getParent().store("current", item);
  304. }
  305. },
  306. searchElement: function(){
  307. if (!this.filter) this.filter = {};
  308. var key = this.searchElementInputNode.get("value");
  309. if (key && key!=this.app.lp.searchKey){
  310. this.filter.key = key;
  311. this.hideFilter();
  312. this.reloadWorks();
  313. }
  314. },
  315. loadFilterConditionNode: function(){
  316. this.filterConditionNode = new Element("div", {"styles": this.css.filterConditionNode}).inject(this.node);
  317. this.setFilterConditions();
  318. },
  319. setFilterConditions: function(){
  320. debugger;
  321. this.filterConditionNode.empty();
  322. if (this.filter){
  323. Object.each(this.filter, function(v, key){
  324. if (key!="key"){
  325. this.createFilterItemNode(key, v[0]);
  326. }
  327. }.bind(this));
  328. if (this.filter.key){
  329. this.createFilterItemNode("key", {"name": this.filter.key});
  330. }
  331. }
  332. },
  333. createFilterItemNode: function(key, v){
  334. var _self = this;
  335. var node = new Element("div", {"styles": this.css.filterListItemNode}).inject(this.filterConditionNode);
  336. var actionNode = new Element("div", {"styles": this.css.filterListItemActionNode}).inject(node);
  337. var textNode = new Element("div", {"styles": this.css.filterListItemTextNode}).inject(node);
  338. textNode.set("text", this.app.lp[key]+": "+ v.name);
  339. actionNode.store("key", key);
  340. node.addEvents({
  341. "mouseover": function(){
  342. this.setStyles(_self.css.filterListItemNode_over);
  343. this.getLast().setStyles(_self.css.filterListItemTextNode_over);
  344. this.getFirst().setStyles(_self.css.filterListItemActionNode_over);
  345. },
  346. "mouseout": function(){
  347. this.setStyles(_self.css.filterListItemNode);
  348. this.getLast().setStyles(_self.css.filterListItemTextNode);
  349. this.getFirst().setStyles(_self.css.filterListItemActionNode);
  350. }
  351. });
  352. actionNode.addEvent("click", function(){
  353. var key = this.retrieve("key");
  354. if (_self.filter[key]) _self.filter[key] = null;
  355. delete _self.filter[key];
  356. this.destroy();
  357. _self.reloadWorks();
  358. });
  359. },
  360. loadProcess: function(){
  361. this.actions.listProcessManage(this.app.options.id, function(json){
  362. debugger;
  363. json.data.each(function(process){
  364. this.loadProcessNode(process);
  365. }.bind(this));
  366. }.bind(this));
  367. },
  368. loadProcessNode: function(process){
  369. var filterProcessNode = new Element("div", {"styles": this.css.filterProcessNode}).inject(this.filterProcessListNode);
  370. filterProcessNode.set("text", process.name+"("+process.count+")");
  371. filterProcessNode.store("process", process);
  372. var _self = this;
  373. filterProcessNode.addEvent("click", function(){
  374. _self.setCurrentProcess(this);
  375. _self.reloadWorks();
  376. });
  377. },
  378. setCurrentProcess: function(node){
  379. debugger;
  380. if (this.currentProcessNode) this.currentProcessNode.setStyles(this.css.filterProcessNode);
  381. node.setStyles(this.css.filterProcessNode_current);
  382. this.currentProcessNode = node;
  383. var process = node.retrieve("process");
  384. this.filter = {"processList": [{"name": process.name, "value": process.value}]};
  385. },
  386. reloadWorks: function(){
  387. this.clearWorks();
  388. this.setFilterConditions();
  389. this.createWorkListHead();
  390. this.loadElementList();
  391. },
  392. loadContentNode: function(){
  393. this.elementContentNode = new Element("div", {
  394. "styles": this.css.elementContentNode
  395. }).inject(this.node);
  396. this.elementContentListNode = new Element("div", {
  397. "styles": this.css.elementContentListNode
  398. }).inject(this.elementContentNode);
  399. this.createWorkListHead();
  400. this.setContentSize();
  401. this.app.addEvent("resize", function(){this.setContentSize();}.bind(this));
  402. },
  403. setNodeScroll: function(){
  404. //MWF.require("MWF.widget.DragScroll", function(){
  405. // new MWF.widget.DragScroll(this.elementContentNode);
  406. //}.bind(this));
  407. //MWF.require("MWF.widget.ScrollBar", function(){
  408. // new MWF.widget.ScrollBar(this.elementContentNode, {"indent": false});
  409. //}.bind(this));
  410. var _self = this;
  411. this.elementContentNode.addEvent("scroll", function(){
  412. var y = _self.elementContentNode.scrollTop.toFloat();
  413. var scrollSize = _self.elementContentNode.getScrollSize();
  414. var clientSize = _self.elementContentNode.getSize();
  415. var scrollHeight = scrollSize.y-clientSize.y;
  416. if (y+200>scrollHeight) {
  417. if (!_self.isItemsLoaded) _self.loadElementList();
  418. }
  419. });
  420. //
  421. //var _self = this;
  422. //MWF.require("MWF.widget.ScrollBar", function(){
  423. // new MWF.widget.ScrollBar(this.elementContentNode, {
  424. // "indent": false,"style":"xApp_TaskList", "where": "before", "distance": 30, "friction": 4, "axis": {"x": false, "y": true},
  425. // "onScroll": function(y){
  426. // var scrollSize = _self.elementContentNode.getScrollSize();
  427. // var clientSize = _self.elementContentNode.getSize();
  428. // var scrollHeight = scrollSize.y-clientSize.y;
  429. // if (y+200>scrollHeight) {
  430. // if (!_self.isItemsLoaded) _self.loadElementList();
  431. // }
  432. // }
  433. // });
  434. //}.bind(this));
  435. },
  436. createWorkListHead: function(){
  437. var headNode = new Element("div", {"styles": this.css.workItemHeadNode}).inject(this.elementContentListNode);
  438. var html = "<div class='headArea1Node'><div class='checkAreaHeadNode'></div><div class='iconAreaHeadNode'></div><div class='titleAreaHeadNode'>"+this.app.lp.workTitle+"</div></div>" +
  439. "<div class='headArea2Node'><div class='statusAreaHeadNode'>"+this.app.lp.status+"</div><div class='activityAreaHeadNode'>"+this.app.lp.activity+"</div></div>" +
  440. "<div class='headArea3Node'><div class='actionAreaHeadNode'>"+this.app.lp.action+"</div><div class='expireAreaHeadNode'>"+this.app.lp.expire+"</div><div class='personAreaHeadNode'>"+this.app.lp.person+"</div></div>";
  441. headNode.set("html", html);
  442. headNode.getElement(".headArea1Node").setStyles(this.css.headArea1Node);
  443. headNode.getElement(".headArea2Node").setStyles(this.css.headArea2Node);
  444. headNode.getElement(".headArea3Node").setStyles(this.css.headArea3Node);
  445. headNode.getElement(".checkAreaHeadNode").setStyles(this.css.checkAreaHeadNode);
  446. headNode.getElement(".iconAreaHeadNode").setStyles(this.css.iconAreaHeadNode);
  447. headNode.getElement(".titleAreaHeadNode").setStyles(this.css.titleAreaHeadNode);
  448. headNode.getElement(".statusAreaHeadNode").setStyles(this.css.statusAreaHeadNode);
  449. headNode.getElement(".activityAreaHeadNode").setStyles(this.css.activityAreaHeadNode);
  450. headNode.getElement(".personAreaHeadNode").setStyles(this.css.personAreaHeadNode);
  451. headNode.getElement(".actionAreaHeadNode").setStyles(this.css.actionAreaHeadNode);
  452. headNode.getElement(".expireAreaHeadNode").setStyles(this.css.expireAreaHeadNode);
  453. },
  454. createCreateElementNode: function(){},
  455. setContentSize: function(){
  456. var toolbarSize = this.toolbarNode.getSize();
  457. var nodeSize = this.node.getSize();
  458. var pt = this.elementContentNode.getStyle("padding-top").toFloat();
  459. var pb = this.elementContentNode.getStyle("padding-bottom").toFloat();
  460. var filterSize = this.filterNode.getSize();
  461. var filterConditionSize = this.filterConditionNode.getSize();
  462. var height = nodeSize.y-toolbarSize.y-pt-pb-filterSize.y-filterConditionSize.y;
  463. this.elementContentNode.setStyle("height", ""+height+"px");
  464. this.pageCount = (height/40).toInt()+5;
  465. if (this.items.length<this.pageCount){
  466. this.loadElementList(this.pageCount-this.items.length);
  467. }
  468. if (this.options.noCreate) this.createElementNode.destroy();
  469. },
  470. _getCurrentPageData: function(callback, count){
  471. var id = (this.items.length) ? this.items[this.items.length-1].data.id : "(0)";
  472. if (this.filter){
  473. var filterData = {};
  474. Object.each(this.filter, function(v, k){
  475. if (k!="key"){
  476. if (!filterData[k]) filterData[k] = [];
  477. v.each(function(o){
  478. filterData[k].push(o.value);
  479. });
  480. }else{
  481. filterData[k] = v;
  482. }
  483. });
  484. this.actions.listWorkFilterManage(id, count || this.pageCount, this.app.options.id, filterData, function(json){
  485. if (callback) callback(json);
  486. });
  487. }else{
  488. this.actions.listWorkNextManage(id, count || this.pageCount, this.app.options.id, function(json){
  489. if (callback) callback(json);
  490. });
  491. }
  492. },
  493. loadElementList: function(count){
  494. if (!this.isItemsLoaded){
  495. if (!this.isItemLoadding){
  496. this.isItemLoadding = true;
  497. this._getCurrentPageData(function(json){
  498. debugger;
  499. this.count = json.count;
  500. if (!this.isCountShow){
  501. this.filterAllProcessNode.getFirst("span").set("text", "("+this.count+")");
  502. this.isCountShow = true;
  503. }
  504. if (json.count<=this.items.length){
  505. this.isItemsLoaded = true;
  506. }
  507. json.data.each(function(data){
  508. if (!this.works[data.id]){
  509. var item = this._createItem(data);
  510. this.items.push(item);
  511. this.works[data.id] = item;
  512. }
  513. }.bind(this));
  514. this.isItemLoadding = false;
  515. if (this.loadItemQueue>0){
  516. this.loadItemQueue--;
  517. this.loadElementList();
  518. }
  519. this.mask.hide();
  520. }.bind(this), count);
  521. }else{
  522. this.loadItemQueue++;
  523. }
  524. }
  525. },
  526. _createItem: function(data){
  527. return new MWF.xApplication.process.Application.WorkExplorer.Work(data, this);
  528. },
  529. removeWork: function(work, all){
  530. this.actions.removeWork(work.data.id, this.app.options.id, all, function(json){
  531. json.data.each(function(item){
  532. this.items.erase(this.works[item.id]);
  533. this.works[item.id].destroy();
  534. MWF.release(this.works[item.id]);
  535. delete this.works[item.id];
  536. }.bind(this));
  537. }.bind(this));
  538. }
  539. });
  540. MWF.xApplication.process.Application.WorkExplorer.Work = new Class({
  541. initialize: function(data, explorer, relative){
  542. this.explorer = explorer;
  543. this.data = data;
  544. this.container = this.explorer.elementContentListNode;
  545. this.relative = relative;
  546. this.css = this.explorer.css;
  547. this.tasks = [];
  548. this.dones = [];
  549. this.reads = [];
  550. this.readeds = [];
  551. this.taskChildren = {};
  552. this.doneChildren = {};
  553. this.readChildren = {};
  554. this.readedChildren = {};
  555. this.relativeWorks = [];
  556. this.load();
  557. },
  558. load: function(){
  559. this.node = new Element("div", {"styles": this.css.workItemNode});
  560. if (this.relative){
  561. this.node.inject(this.relative.node, "after");
  562. }else{
  563. this.node.inject(this.container);
  564. }
  565. this.workAreaNode = new Element("div", {"styles": this.css.workItemWorkNode}).inject(this.node);
  566. //this.otherWorkAreaNode = new Element("div", {"styles": this.css.workItemWorkNode}).inject(this.node);
  567. var html = "<div class='area1Node'><div class='checkAreaNode'></div><div class='iconAreaNode'></div><div class='titleAreaNode'><div class='titleAreaTextNode'>"+this.data.title+"</div></div></div>" +
  568. "<div class='area2Node'><div class='statusAreaNode'></div><div class='activityAreaNode'><div class='activityAreaTextNode'>"+this.data.activityName+"</div></div></div>" +
  569. "<div class='area3Node'><div class='actionAreaNode'></div><div class='expireAreaNode'></div><div class='personAreaNode'></div></div>";
  570. this.workAreaNode.set("html", html);
  571. this.workAreaNode.getElement(".area1Node").setStyles(this.css.headArea1Node);
  572. this.workAreaNode.getElement(".area2Node").setStyles(this.css.headArea2Node);
  573. this.workAreaNode.getElement(".area3Node").setStyles(this.css.headArea3Node);
  574. this.checkAreaNode = this.workAreaNode.getElement(".checkAreaNode").setStyles(this.css.checkAreaHeadNode);
  575. this.iconAreaNode = this.workAreaNode.getElement(".iconAreaNode").setStyles(this.css.iconAreaHeadNode);
  576. this.titleAreaNode = this.workAreaNode.getElement(".titleAreaNode").setStyles(this.css.titleAreaHeadNode);
  577. this.statusAreaNode = this.workAreaNode.getElement(".statusAreaNode").setStyles(this.css.statusAreaHeadNode);
  578. this.activityAreaNode = this.workAreaNode.getElement(".activityAreaNode").setStyles(this.css.activityAreaHeadNode);
  579. this.personAreaNode = this.workAreaNode.getElement(".personAreaNode").setStyles(this.css.personAreaHeadNode);
  580. this.actionAreaNode = this.workAreaNode.getElement(".actionAreaNode").setStyles(this.css.actionAreaHeadNode);
  581. this.expireAreaNode = this.workAreaNode.getElement(".expireAreaNode").setStyles(this.css.expireAreaHeadNode);
  582. this.activityAreaTextNode = this.workAreaNode.getElement(".activityAreaTextNode").setStyles(this.css.activityAreaTextNode);
  583. this.titleAreaTextNode = this.workAreaNode.getElement(".titleAreaTextNode").setStyles(this.css.titleAreaTextNode);
  584. //expireAreaNode
  585. if (this.data.expireTime){
  586. var d = Date.parse(this.data.expireTime);
  587. var today = new Date();
  588. if (today.diff(d, "second")<0){
  589. this.expireAreaNode.setStyle("color", "#FF0000");
  590. }
  591. this.expireAreaNode.set("text", this.data.expireTime);
  592. }else{
  593. this.expireAreaNode.set("text", this.explorer.app.lp.noExpire);
  594. }
  595. this.expireAreaNode.setStyles(this.css.expireAreaNode);
  596. //这是一段测试----------------------
  597. //if (this.data.rank==1){
  598. // this.checkAreaNode.setStyles({
  599. // "min-height": "40px",
  600. // "height": "100%",
  601. // "background": "url("+"/x_component_process_Application/$WorkExplorer/default/icon/groupTop.png) no-repeat center bottom",
  602. // });
  603. //}
  604. //if (this.data.rank==2 || this.data.rank==3){
  605. // this.checkAreaNode.setStyles({
  606. // "min-height": "40px",
  607. // "height": "100%",
  608. // "background": "url("+"/x_component_process_Application/$WorkExplorer/default/icon/groupCenter.png) repeat center top",
  609. // });
  610. //}
  611. //if (this.data.rank==4){
  612. // this.checkAreaNode.setStyles({
  613. // "min-height": "40px",
  614. // "height": "100%",
  615. // "background": "url("+"/x_component_process_Application/$WorkExplorer/default/icon/groupBottom.png) no-repeat center top",
  616. // });
  617. //}
  618. //这是一段测试----------------------
  619. if (!this.data.control.allowVisit){
  620. this.node.setStyles(this.css.workItemNode_noread);
  621. this.checkAreaNode.setStyles(this.css.actionStopWorkNode);
  622. this.actionAreaNode.setStyles(this.css.actionStopWorkActionNode);
  623. }
  624. this.iconAreaNode.setStyles(this.css.iconWorkNode);
  625. this.titleAreaNode.setStyles(this.css.titleWorkNode);
  626. this.setPersonData();
  627. this.setStatusData();
  628. this.setActions();
  629. this.setEvents();
  630. if (!this.relative) this.listRelatives();
  631. },
  632. reload: function(callback){
  633. if (this.relative){
  634. this.relative.reload();
  635. }else{
  636. this.explorer.actions.getWork(this.data.id, this.explorer.app.options.id, function(json){
  637. this.data = json.data;
  638. this.titleAreaTextNode.set("text", this.data.title);
  639. this.activityAreaTextNode.set("text", this.data.activityName);
  640. this.statusAreaNode.empty();
  641. this.setStatusData();
  642. if (this.relativeWorks.length){
  643. this.relativeWorks.each(function(work){
  644. work.destroy();
  645. });
  646. }
  647. this.relativeWorks = [];
  648. this.listRelatives();
  649. if (callback) callback();
  650. }.bind(this));
  651. }
  652. },
  653. listRelatives: function() {
  654. if (this.data.splitting){
  655. this.explorer.actions.listRelatives(this.data.id, this.explorer.app.options.id, function(json){
  656. if (json.data){
  657. if (json.data.length) this.loadRelativeWorks(json.data);
  658. }
  659. }.bind(this));
  660. }
  661. },
  662. loadRelativeWorks: function(list){
  663. this.checkAreaNode.setStyles(this.css.relativeTop);
  664. this.workAreaNode.setStyle("height", "40px");
  665. for (var idx=list.length-1; idx>=0; idx--){
  666. var data = list[idx];
  667. var work = this.explorer.works[data.id];
  668. if (work){
  669. work.node.inject(this.node, "after");
  670. work.relative = this;
  671. }else{
  672. var work = new MWF.xApplication.process.Application.WorkExplorer.Work(data, this.explorer, this);
  673. this.explorer.works[data.id] = work
  674. }
  675. work.workAreaNode.setStyle("height", "40px");
  676. if (idx == (list.length-1)){
  677. work.checkAreaNode.setStyles(this.css.relativeBottom);
  678. }else{
  679. work.checkAreaNode.setStyles(this.css.relativeCenter);
  680. }
  681. this.relativeWorks.push(work);
  682. }
  683. },
  684. setEvents: function(){
  685. if (this.openNode){
  686. this.openNode.addEvents({
  687. "mouseover": function(){this.openNode.setStyles(this.css.actionOpenNode_over);}.bind(this),
  688. "mouseout": function(){this.openNode.setStyles(this.css.actionOpenNode);}.bind(this),
  689. "mousedown": function(){this.openNode.setStyles(this.css.actionOpenNode_down);}.bind(this),
  690. "mouseup": function(){this.openNode.setStyles(this.css.actionOpenNode_over);}.bind(this),
  691. "click": function(e){
  692. this.openWork(e);
  693. }.bind(this)
  694. });
  695. }
  696. if (this.processNode){
  697. this.processNode.addEvents({
  698. "mouseover": function(){this.processNode.setStyles(this.css.actionProcessNode_over);}.bind(this),
  699. "mouseout": function(){this.processNode.setStyles(this.css.actionProcessNode);}.bind(this),
  700. "mousedown": function(){this.processNode.setStyles(this.css.actionProcessNode_down);}.bind(this),
  701. "mouseup": function(){this.processNode.setStyles(this.css.actionProcessNode_over);}.bind(this),
  702. "click": function(e){
  703. this.processWork(e);
  704. }.bind(this)
  705. });
  706. }
  707. if (this.rerouteNode){
  708. this.rerouteNode.addEvents({
  709. "mouseover": function(){this.rerouteNode.setStyles(this.css.actionRerouteNode_over);}.bind(this),
  710. "mouseout": function(){this.rerouteNode.setStyles(this.css.actionRerouteNode);}.bind(this),
  711. "mousedown": function(){this.rerouteNode.setStyles(this.css.actionRerouteNode_down);}.bind(this),
  712. "mouseup": function(){this.rerouteNode.setStyles(this.css.actionRerouteNode_over);}.bind(this),
  713. "click": function(e){
  714. this.rerouteWork(e);
  715. }.bind(this)
  716. });
  717. }
  718. if (this.deleteNode){
  719. this.deleteNode.addEvents({
  720. "mouseover": function(){this.deleteNode.setStyles(this.css.actionDeleteNode_over);}.bind(this),
  721. "mouseout": function(){this.deleteNode.setStyles(this.css.actionDeleteNode);}.bind(this),
  722. "mousedown": function(){this.deleteNode.setStyles(this.css.actionDeleteNode_down);}.bind(this),
  723. "mouseup": function(){this.deleteNode.setStyles(this.css.actionDeleteNode_over);}.bind(this),
  724. "click": function(e){
  725. this.remove(e);
  726. }.bind(this)
  727. });
  728. }
  729. if (this.data.control.allowVisit) {
  730. this.workAreaNode.addEvents({
  731. "mouseover": function(){if (!this.readyRemove && !this.readyFlow) this.workAreaNode.setStyles(this.css.workItemWorkNode_over);}.bind(this),
  732. "mouseout": function(){if (!this.readyRemove && !this.readyFlow) this.workAreaNode.setStyles(this.css.workItemWorkNode);}.bind(this)
  733. });
  734. this.titleAreaNode.addEvent("click", function(){
  735. this.loadChild();
  736. }.bind(this));
  737. }
  738. },
  739. processWork: function(e){
  740. var lp = this.explorer.app.lp;
  741. var text = lp.flowWork.replace(/{title}/g, this.data.title);
  742. var _self = this;
  743. this.workAreaNode.setStyles(this.css.workItemWorkNode_action);
  744. this.readyFlow = true;
  745. this.explorer.app.confirm("warn", e, lp.flowWorkTitle, text, 380, 130, function(){
  746. _self.explorer.actions.flowWork(_self.data.id, _self.explorer.app.options.id, {}, function(){
  747. _self.explorer.actions.getWork(_self.data.id, "", function(workJson){
  748. _self.workAreaNode.setStyles(_self.css.workItemWorkNode);
  749. _self.readyFlow = false;
  750. _self.reload();
  751. }.bind(this));
  752. this.close();
  753. }.bind(this), function(){
  754. _self.workAreaNode.setStyles(_self.css.workItemWorkNode);
  755. _self.readyFlow = false;
  756. _self.reload();
  757. this.close();
  758. }.bind(this));
  759. }, function(){
  760. _self.workAreaNode.setStyles(_self.css.workItemWorkNode);
  761. _self.readyFlow = false;
  762. this.close();
  763. });
  764. },
  765. rerouteWork: function(){
  766. var lp = this.explorer.app.lp;
  767. this.workAreaNode.setStyles(this.css.workItemWorkNode_action);
  768. this.readyReroute = true;
  769. MWF.require("MWF.xDesktop.Dialog", function(){
  770. var width = 480;
  771. var height = 160;
  772. var p = MWF.getCenterPosition(this.explorer.app.content, width, height);
  773. var _self = this;
  774. var _self = this;
  775. var dlg = new MWF.xDesktop.Dialog({
  776. "title": lp.reroute,
  777. "style": "work",
  778. "top": p.y-100,
  779. "left": p.x,
  780. "fromTop": p.y-100,
  781. "fromLeft": p.x,
  782. "width": width,
  783. "height": height,
  784. "url": this.explorer.app.path+"reroute.html",
  785. "container": this.explorer.app.content,
  786. "isClose": true,
  787. "onPostShow": function(){
  788. $("rerouteWork_okButton").addEvent("click", function(){
  789. _self.doRerouteWork(this);
  790. }.bind(this));
  791. $("rerouteWork_cancelButton").addEvent("click", function(){
  792. this.close();
  793. }.bind(this));
  794. var select = $("rerouteWork_selectActivity");
  795. debugger;
  796. _self.explorer.actions.getRerouteTo(_self.data.process, function(json){
  797. json.data.agentList.each(function(activity){
  798. new Element("option", {
  799. "value": activity.id+"#agent",
  800. "text": activity.name
  801. }).inject(select);
  802. }.bind(_self));
  803. json.data.cancelList.each(function(activity){
  804. new Element("option", {
  805. "value": activity.id+"#cancel",
  806. "text": activity.name
  807. }).inject(select);
  808. }.bind(_self));
  809. json.data.choiceList.each(function(activity){
  810. new Element("option", {
  811. "value": activity.id+"#choice",
  812. "text": activity.name
  813. }).inject(select);
  814. }.bind(_self));
  815. json.data.conditionList.each(function(activity){
  816. new Element("option", {
  817. "value": activity.id+"#condition",
  818. "text": activity.name
  819. }).inject(select);
  820. }.bind(_self));
  821. json.data.delayList.each(function(activity){
  822. new Element("option", {
  823. "value": activity.id+"#delay",
  824. "text": activity.name
  825. }).inject(select);
  826. }.bind(_self));
  827. json.data.embedList.each(function(activity){
  828. new Element("option", {
  829. "value": activity.id+"#embed",
  830. "text": activity.name
  831. }).inject(select);
  832. }.bind(_self));
  833. json.data.endList.each(function(activity){
  834. new Element("option", {
  835. "value": activity.id+"#end",
  836. "text": activity.name
  837. }).inject(select);
  838. }.bind(_self));
  839. json.data.invokeList.each(function(activity){
  840. new Element("option", {
  841. "value": activity.id+"#invoke",
  842. "text": activity.name
  843. }).inject(select);
  844. }.bind(_self));
  845. json.data.manualList.each(function(activity){
  846. new Element("option", {
  847. "value": activity.id+"#manual",
  848. "text": activity.name
  849. }).inject(select);
  850. }.bind(_self));
  851. json.data.mergeList.each(function(activity){
  852. new Element("option", {
  853. "value": activity.id+"#merge",
  854. "text": activity.name
  855. }).inject(select);
  856. }.bind(_self));
  857. json.data.messageList.each(function(activity){
  858. new Element("option", {
  859. "value": activity.id+"#message",
  860. "text": activity.name
  861. }).inject(select);
  862. }.bind(_self));
  863. json.data.parallelList.each(function(activity){
  864. new Element("option", {
  865. "value": activity.id+"#parallel",
  866. "text": activity.name
  867. }).inject(select);
  868. }.bind(_self));
  869. json.data.serviceList.each(function(activity){
  870. new Element("option", {
  871. "value": activity.id+"#service",
  872. "text": activity.name
  873. }).inject(select);
  874. }.bind(_self));
  875. json.data.splitList.each(function(activity){
  876. new Element("option", {
  877. "value": activity.id+"#split",
  878. "text": activity.name
  879. }).inject(select);
  880. }.bind(_self));
  881. }.bind(_self));
  882. }
  883. });
  884. dlg.show();
  885. }.bind(this));
  886. },
  887. doRerouteWork: function(dlg){
  888. debugger;
  889. var opinion = $("rerouteWork_opinion").get("value");
  890. var select = $("rerouteWork_selectActivity");
  891. var activity = select.options[select.selectedIndex].get("value");
  892. var activityName = select.options[select.selectedIndex].get("text");
  893. var tmp = activity.split("#");
  894. activity = tmp[0];
  895. var type = tmp[1];
  896. MWF.require("MWF.widget.Mask", function(){
  897. this.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
  898. this.mask.loadNode(this.explorer.app.content);
  899. this.rerouteWorkToActivity(activity, type, opinion, function(){
  900. this.explorer.actions.getWork(this.data.id, "", function(workJson){
  901. this.data = workJson.data;
  902. this.workAreaNode.setStyles(this.css.workItemWorkNode);
  903. this.readyReroute = false;
  904. this.reload();
  905. }.bind(this));
  906. dlg.close();
  907. if (this.mask) {this.mask.hide(); this.mask = null;}
  908. }.bind(this), function(xhr, text, error){
  909. var errorText = error+":"+text;
  910. if (xhr) errorText = xhr.responseText;
  911. this.app.notice("request json error: "+errorText, "error", dlg.node);
  912. if (this.mask) {this.mask.hide(); this.mask = null;}
  913. }.bind(this));
  914. }.bind(this));
  915. },
  916. rerouteWorkToActivity: function(activity, type, opinion, success, failure){
  917. this.explorer.actions.rerouteWork(function(json){
  918. if (success) success();
  919. }.bind(this), function(xhr, text, error){
  920. if (failure) failure(xhr, text, error);
  921. }, this.data.id, activity, type);
  922. },
  923. openWork: function(e){
  924. var options = {"workId": this.data.id, "isControl": this.explorer.app.options.application.allowControl};
  925. this.explorer.app.desktop.openApplication(e, "process.Work", options);
  926. },
  927. remove: function(e){
  928. var lp = this.explorer.app.lp;
  929. var text = lp.deleteWork.replace(/{title}/g, this.data.title);
  930. var _self = this;
  931. this.workAreaNode.setStyles(this.css.workItemWorkNode_remove);
  932. this.readyRemove = true;
  933. this.explorer.app.confirm("warn", e, lp.deleteWorkTitle, text, 350, 120, function(){
  934. this.close();
  935. _self.explorer.app.confirm("warn", e, lp.deleteWorkTitle, {"html": lp.deleteAllWork}, 380, 180, function(){
  936. var inputs = this.content.getElements("input");
  937. var flag = "";
  938. for (var i=0; i<inputs.length; i++){
  939. if (inputs[i].checked){
  940. flag = inputs[i].get("value");
  941. break;
  942. }
  943. }
  944. if (flag){
  945. if (flag=="all"){
  946. _self.explorer.removeWork(_self, true);
  947. }else{
  948. _self.explorer.removeWork(_self, false);
  949. }
  950. this.close();
  951. }else{
  952. this.content.getElement("#deleteWork_checkInfor").set("text", lp.deleteAllWorkCheck).setStyle("color", "red");
  953. }
  954. }, function(){
  955. //_self.explorer.removeWork(_self, false);
  956. _self.workAreaNode.setStyles(_self.css.workItemWorkNode);
  957. this.close();
  958. });
  959. }, function(){
  960. _self.workAreaNode.setStyles(_self.css.workItemWorkNode);
  961. _self.readyRemove = false;
  962. this.close();
  963. });
  964. },
  965. destroy: function(){
  966. this.node.destroy();
  967. },
  968. loadChild: function(){
  969. if (!this.childNode){
  970. this.createChildNode();
  971. this.listAssignments();
  972. }else{
  973. if (this.childNode.getStyle("display")=="none"){
  974. this.childNode.setStyle("display", "block");
  975. }else{
  976. this.childNode.setStyle("display", "none");
  977. }
  978. }
  979. },
  980. createChildNode: function(){
  981. this.childNode = new Element("div", {"styles": this.css.workItemChildNode}).inject(this.node);
  982. this.taskAreaNode = new Element("div", {"styles": this.css.workItemTaskNode}).inject(this.childNode);
  983. this.doneAreaNode = new Element("div", {"styles": this.css.workItemDonwNode}).inject(this.childNode);
  984. this.readAreaNode = new Element("div", {"styles": this.css.workItemReadNode}).inject(this.childNode);
  985. this.readedAreaNode = new Element("div", {"styles": this.css.workItemReadedNode}).inject(this.childNode);
  986. this.taskAreaTitleAreaNode = new Element("div", {"styles": this.css.workItemListTitleNode}).inject(this.taskAreaNode);
  987. this.doneAreaTitleAreaNode = new Element("div", {"styles": this.css.workItemListTitleNode}).inject(this.doneAreaNode);
  988. this.readAreaTitleAreaNode = new Element("div", {"styles": this.css.workItemListTitleNode}).inject(this.readAreaNode);
  989. this.readedAreaTitleAreaNode = new Element("div", {"styles": this.css.workItemListTitleNode}).inject(this.readedAreaNode);
  990. var taskAreaTitleNode = new Element("div", {"styles": this.css.workItemTaskTitleNode, "text": this.explorer.app.lp.task}).inject(this.taskAreaTitleAreaNode);
  991. var doneAreaTitleNode = new Element("div", {"styles": this.css.workItemDoneTitleNode, "text": this.explorer.app.lp.done}).inject(this.doneAreaTitleAreaNode);
  992. var readAreaTitleNode = new Element("div", {"styles": this.css.workItemReadTitleNode, "text": this.explorer.app.lp.read}).inject(this.readAreaTitleAreaNode);
  993. var readedAreaTitleNode = new Element("div", {"styles": this.css.workItemReadedTitleNode, "text": this.explorer.app.lp.readed}).inject(this.readedAreaTitleAreaNode);
  994. this.taskAreaContentNode = new Element("div", {"styles": this.css.taskAreaContentNode}).inject(this.taskAreaNode);
  995. this.doneAreaContentNode = new Element("div", {"styles": this.css.doneAreaContentNode}).inject(this.doneAreaNode);
  996. this.readAreaContentNode = new Element("div", {"styles": this.css.readAreaContentNode}).inject(this.readAreaNode);
  997. this.readedAreaContentNode = new Element("div", {"styles": this.css.readedAreaContentNode}).inject(this.readedAreaNode);
  998. },
  999. listAssignments: function(){
  1000. this.explorer.actions.listAssignments(this.data.id, this.explorer.app.options.id, function(json){
  1001. this.listTasks(json.data.taskList);
  1002. this.listDones(json.data.taskCompletedList);
  1003. this.listReads(json.data.readList);
  1004. this.listReadeds(json.data.readCompletedList);
  1005. }.bind(this));
  1006. },
  1007. listTasks: function(list){
  1008. if (list.length){
  1009. list.each(function(data){
  1010. var item = new MWF.xApplication.process.Application.WorkExplorer.Task(data, this.taskAreaContentNode, this.explorer, this);
  1011. this.tasks.push(item);
  1012. this.taskChildren[data.id] = item;
  1013. }.bind(this));
  1014. }else{
  1015. new Element("div", {"styles": this.css.noListText, "text": "["+this.explorer.app.lp.noTask+"]"}).inject(this.taskAreaTitleAreaNode);
  1016. }
  1017. },
  1018. listDones: function(list){
  1019. if (list.length){
  1020. list.each(function(data){
  1021. var item = new MWF.xApplication.process.Application.WorkExplorer.Done(data, this.doneAreaContentNode, this.explorer, this);
  1022. this.dones.push(item);
  1023. this.doneChildren[data.id] = item;
  1024. }.bind(this));
  1025. }else{
  1026. new Element("div", {"styles": this.css.noListText, "text": "["+this.explorer.app.lp.noDone+"]"}).inject(this.doneAreaTitleAreaNode);
  1027. }
  1028. },
  1029. listReads: function(list){
  1030. if (list.length){
  1031. list.each(function(data){
  1032. var item = new MWF.xApplication.process.Application.WorkExplorer.Read(data, this.readAreaContentNode, this.explorer, this);
  1033. this.reads.push(item);
  1034. this.readChildren[data.id] = item;
  1035. }.bind(this));
  1036. }else{
  1037. new Element("div", {"styles": this.css.noListText, "text": "["+this.explorer.app.lp.noRead+"]"}).inject(this.readAreaTitleAreaNode);
  1038. }
  1039. },
  1040. listReadeds: function(list){
  1041. if (list.length){
  1042. list.each(function(data){
  1043. var item = new MWF.xApplication.process.Application.WorkExplorer.Readed(data, this.readedAreaContentNode, this.explorer, this);
  1044. this.readeds.push(item);
  1045. this.readedChildren[data.id] = item;
  1046. }.bind(this));
  1047. }else{
  1048. new Element("div", {"styles": this.css.noListText, "text": "["+this.explorer.app.lp.noReaded+"]"}).inject(this.readedAreaTitleAreaNode);
  1049. }
  1050. },
  1051. setPersonData: function(){
  1052. var explorer = {
  1053. "actions": this.explorer.personActions,
  1054. "app": {
  1055. "lp": this.explorer.app.lp
  1056. }
  1057. }
  1058. new MWF.widget.Identity({"name": this.data.creatorIdentity}, this.personAreaNode, explorer, false, null, {"style": "work"});
  1059. },
  1060. setStatusData: function(){
  1061. this.createStatusIcon("start");
  1062. this.createStatusIcon("processing");
  1063. this.createStatusIcon("hanging");
  1064. this.statusAreaNode.set("title", this.explorer.app.lp[this.data.workStatus]);
  1065. },
  1066. createStatusIcon: function(name){
  1067. var node = new Element("div", {"styles": this.css.statusIconNode}).inject(this.statusAreaNode);
  1068. var iconName = (this.data.workStatus==name) ? "status_"+name+"_red.png" : "status_"+name+".png";
  1069. var icon = "url("+"/x_component_process_Application/$WorkExplorer/"+this.explorer.options.style+"/icon/"+iconName+")"
  1070. node.setStyle("background-image", icon);
  1071. },
  1072. setActions: function(){
  1073. if (this.data.control.allowVisit){
  1074. this.openNode = new Element("div", {"styles": this.css.actionOpenNode, "title": this.explorer.app.lp.open}).inject(this.actionAreaNode);
  1075. }
  1076. if (this.data.control.allowProcessing){
  1077. this.processNode = new Element("div", {"styles": this.css.actionProcessNode, "title": this.explorer.app.lp.flow}).inject(this.actionAreaNode);
  1078. }
  1079. if (this.data.control.allowReroute){
  1080. this.rerouteNode = new Element("div", {"styles": this.css.actionRerouteNode, "title": this.explorer.app.lp.reroute}).inject(this.actionAreaNode);
  1081. }
  1082. //if (this.explorer.app.options.application.allowControl){
  1083. if (this.data.control.allowDelete){
  1084. this.deleteNode = new Element("div", {"styles": this.css.actionDeleteNode, "title": this.explorer.app.lp.delete}).inject(this.actionAreaNode);
  1085. }
  1086. },
  1087. removeTask: function(task){
  1088. var id = task.data.id;
  1089. this.explorer.actions.removeTask(id, this.explorer.app.options.id, function(json){
  1090. this.tasks.erase(this.taskChildren[id]);
  1091. this.taskChildren[id].destroy();
  1092. MWF.release(this.taskChildren[id]);
  1093. delete this.taskChildren[id];
  1094. }.bind(this));
  1095. },
  1096. removeDone: function(done){
  1097. var id = done.data.id;
  1098. this.explorer.actions.removeDone(id, this.explorer.app.options.id, function(json){
  1099. this.dones.erase(this.doneChildren[id]);
  1100. this.doneChildren[id].destroy();
  1101. MWF.release(this.doneChildren[id]);
  1102. delete this.doneChildren[id];
  1103. }.bind(this));
  1104. },
  1105. removeRead: function(read){
  1106. var id = read.data.id
  1107. this.explorer.actions.removeRead(id, this.explorer.app.options.id, function(json){
  1108. this.reads.erase(this.readChildren[id]);
  1109. this.readChildren[id].destroy();
  1110. MWF.release(this.readChildren[id]);
  1111. delete this.readChildren[id];
  1112. }.bind(this));
  1113. },
  1114. removeReaded: function(readed){
  1115. var id = readed.data.id
  1116. this.explorer.actions.removeReaded(id, this.explorer.app.options.id, function(json){
  1117. this.readeds.erase(this.readedChildren[id]);
  1118. this.readedChildren[id].destroy();
  1119. MWF.release(this.readedChildren[id]);
  1120. delete this.readedChildren[id];
  1121. }.bind(this));
  1122. }
  1123. });
  1124. MWF.xApplication.process.Application.WorkExplorer.Task = new Class({
  1125. initialize: function (data, container, explorer, work) {
  1126. this.explorer = explorer;
  1127. this.work = work;
  1128. this.data = data;
  1129. this.container = container;
  1130. this.css = this.explorer.css;
  1131. this.load();
  1132. },
  1133. load: function () {
  1134. this.node = new Element("div", {"styles": this.css.taskItemNode}).inject(this.container);
  1135. var taskArea1Node = new Element("div", {"styles": this.css.taskArea1Node}).inject(this.node);
  1136. var taskArea2Node = new Element("div", {"styles": this.css.taskArea2Node}).inject(this.node);
  1137. var taskArea3Node = new Element("div", {"styles": this.css.taskArea3Node}).inject(this.node);
  1138. this.iconAreaNode = new Element("div", {"styles": this.css.taskItemIconAreaNode}).inject(taskArea1Node);
  1139. this.personAreaNode = new Element("div", {"styles": this.css.taskItemPersonAreaNode}).inject(taskArea1Node);
  1140. this.timeAreaNode = new Element("div", {"styles": this.css.taskItemTimeAreaNode}).inject(taskArea2Node);
  1141. this.actionAreaNode = new Element("div", {"styles": this.css.taskItemActionNode}).inject(taskArea3Node);
  1142. this.activityAreaNode = new Element("div", {"styles": this.css.taskItemActivityNode}).inject(taskArea3Node);
  1143. this.setTaskContent();
  1144. this.setActions();
  1145. this.setEvents();
  1146. },
  1147. setTaskContent: function () {
  1148. var time = new Date().parse(this.data.startTime).format("%Y-%m-%d %H:%M");
  1149. var explorer = {
  1150. "actions": this.explorer.personActions,
  1151. "app": {
  1152. "lp": this.explorer.app.lp
  1153. }
  1154. }
  1155. new MWF.widget.Identity({"name": this.data.identity}, this.personAreaNode, explorer, false, null, {"style": "task"});
  1156. var time = new Date().parse(this.data.startTime).format("%Y-%m-%d %H:%M");
  1157. this.timeAreaNode.set("text", time);
  1158. this.activityAreaNode.set("text", this.data.activityName);
  1159. },
  1160. setActions: function () {
  1161. //if (this.explorer.app.options.application.allowControl || this.explorer.app.desktop.session.user.name == this.data.person) {
  1162. if (this.data.control.allowReset){
  1163. this.resetNode = new Element("div", {
  1164. "styles": this.css.taskActionResetNode,
  1165. "title": this.explorer.app.lp.reset
  1166. }).inject(this.actionAreaNode);
  1167. }
  1168. //if (this.explorer.app.options.application.allowControl) {
  1169. if (this.data.control.allowProcessing) {
  1170. this.flowNode = new Element("div", {
  1171. "styles": this.css.taskActionFlowNode,
  1172. "title": this.explorer.app.lp.flow
  1173. }).inject(this.actionAreaNode);
  1174. }
  1175. if (this.data.control.allowDelete){
  1176. this.deleteNode = new Element("div", {
  1177. "styles": this.css.taskActionDeleteNode,
  1178. "title": this.explorer.app.lp.delete
  1179. }).inject(this.actionAreaNode);
  1180. }
  1181. },
  1182. setEvents: function () {
  1183. if (this.resetNode) {
  1184. this.resetNode.addEvents({
  1185. "mouseover": function () {
  1186. this.resetNode.setStyles(this.css.taskActionResetNode_over);
  1187. }.bind(this),
  1188. "mouseout": function () {
  1189. this.resetNode.setStyles(this.css.taskActionResetNode);
  1190. }.bind(this),
  1191. "mousedown": function () {
  1192. this.resetNode.setStyles(this.css.taskActionResetNode_down);
  1193. }.bind(this),
  1194. "mouseup": function () {
  1195. this.resetNode.setStyles(this.css.taskActionResetNode_over);
  1196. }.bind(this),
  1197. "click": function () {
  1198. this.reset();
  1199. }.bind(this)
  1200. });
  1201. }
  1202. if (this.flowNode) {
  1203. this.flowNode.addEvents({
  1204. "mouseover": function () {
  1205. this.flowNode.setStyles(this.css.taskActionFlowNode_over);
  1206. }.bind(this),
  1207. "mouseout": function () {
  1208. this.flowNode.setStyles(this.css.taskActionFlowNode);
  1209. }.bind(this),
  1210. "mousedown": function () {
  1211. this.flowNode.setStyles(this.css.taskActionFlowNode_down);
  1212. }.bind(this),
  1213. "mouseup": function () {
  1214. this.flowNode.setStyles(this.css.taskActionFlowNode_over);
  1215. }.bind(this),
  1216. "click": function (e) {
  1217. this.flow(e);
  1218. }.bind(this)
  1219. });
  1220. }
  1221. if (this.deleteNode) {
  1222. this.deleteNode.addEvents({
  1223. "mouseover": function () {
  1224. this.deleteNode.setStyles(this.css.taskActionDeleteNode_over);
  1225. }.bind(this),
  1226. "mouseout": function () {
  1227. this.deleteNode.setStyles(this.css.taskActionDeleteNode);
  1228. }.bind(this),
  1229. "mousedown": function () {
  1230. this.deleteNode.setStyles(this.css.taskActionDeleteNode_down);
  1231. }.bind(this),
  1232. "mouseup": function () {
  1233. this.deleteNode.setStyles(this.css.taskActionDeleteNode_over);
  1234. }.bind(this),
  1235. "click": function (e) {
  1236. this.remove(e);
  1237. }.bind(this)
  1238. });
  1239. }
  1240. },
  1241. reset: function () {
  1242. this.node.setStyles(this.css.taskItemNode_action);
  1243. var options = {
  1244. "type": "identity",
  1245. "title": this.explorer.app.lp.reset,
  1246. "onComplete": function (items) {
  1247. if (items.length) {
  1248. this.resetPeople(items);
  1249. } else {
  1250. this.node.setStyles(this.css.taskItemNode);
  1251. }
  1252. }.bind(this),
  1253. "onCancel": function () {
  1254. this.node.setStyles(this.css.taskItemNode);
  1255. }.bind(this)
  1256. };
  1257. var selector = new MWF.OrgSelector(this.explorer.app.content, options);
  1258. },
  1259. resetPeople: function (items) {
  1260. var nameList = [];
  1261. items.each(function(item){
  1262. nameList.push(item.data.name);
  1263. });
  1264. var data = {
  1265. "routeName": this.explorer.app.lp.reset,
  1266. "opinion": this.explorer.app.lp.reset+": "+nameList.join(", "),
  1267. "identityList": nameList
  1268. };
  1269. this.explorer.actions.resetTask(this.data.id, this.explorer.app.options.id, data, function(){
  1270. this.work.childNode.destroy();
  1271. this.work.childNode = null;
  1272. this.work.loadChild();
  1273. }.bind(this));
  1274. },
  1275. flow: function(e){
  1276. this.node.setStyles(this.css.taskItemNode_action);
  1277. this.processNode = new Element("div", {"styles": this.css.taskItemFlowNode}).inject(this.explorer.app.content);
  1278. MWF.require("MWF.xDesktop.Dialog", function(){
  1279. var width = 540;
  1280. var height = 260;
  1281. var size = this.explorer.app.content.getSize();
  1282. var x = size.x/2-width/2;
  1283. var y = size.y/2-height/2;
  1284. if (x+parseFloat(width)>size.x){
  1285. x = x-parseFloat(width);
  1286. }
  1287. if (x<0) x = 0;
  1288. if (y+parseFloat(height)>size.y){
  1289. y = y-parseFloat(height);
  1290. }
  1291. if (y<0) y = 0;
  1292. var dlg = new MWF.xDesktop.Dialog({
  1293. "title": "",
  1294. "style": "application",
  1295. "top": y,
  1296. "left": x-20,
  1297. "fromTop":y,
  1298. "fromLeft": x-20,
  1299. "width": width,
  1300. "height": height,
  1301. "content": this.processNode,
  1302. "container": this.explorer.app.content,
  1303. "onPostShow": function(){
  1304. debugger;
  1305. var _self = this;
  1306. MWF.xDesktop.requireApp("process.Work", "Processor", function(){
  1307. new MWF.xApplication.process.Work.Processor(this.processNode, this.data, {
  1308. "style": "task",
  1309. "onCancel": function(){
  1310. dlg.close();
  1311. _self.node.setStyles(_self.css.taskItemNode);
  1312. delete this;
  1313. },
  1314. "onSubmit": function(routeName, opinion){
  1315. _self.submitTask(routeName, opinion, this, dlg);
  1316. delete this;
  1317. }
  1318. })
  1319. }.bind(this));
  1320. }.bind(this)
  1321. });
  1322. dlg.show();
  1323. }.bind(this));
  1324. },
  1325. submitTask: function(routeName, opinion, processer, dlg){
  1326. var data = {
  1327. "routeName": routeName,
  1328. "opinion": opinion
  1329. }
  1330. this.explorer.actions.flowTask(this.data.id, this.explorer.app.options.id, data, function(){
  1331. processer.destroy();
  1332. dlg.close();
  1333. this.work.childNode.destroy();
  1334. this.work.childNode = null;
  1335. this.work.reload(function(){
  1336. this.work.loadChild();
  1337. }.bind(this));
  1338. }.bind(this));
  1339. },
  1340. remove: function(e){
  1341. var lp = this.explorer.app.lp;
  1342. var text = lp.deleteTask.replace(/{people}/g, this.data.person);
  1343. var _self = this;
  1344. this.node.setStyles(this.css.taskItemNode_remove);
  1345. this.explorer.app.confirm("warn", e, lp.deleteTaskTitle, text, 350, 120, function(){
  1346. this.close();
  1347. _self.work.removeTask(_self);
  1348. }, function(){
  1349. _self.node.setStyles(_self.css.taskItemNode);
  1350. this.close();
  1351. });
  1352. },
  1353. destroy: function(){
  1354. this.node.destroy();
  1355. }
  1356. });
  1357. MWF.xApplication.process.Application.WorkExplorer.Done = new Class({
  1358. Extends: MWF.xApplication.process.Application.WorkExplorer.Task,
  1359. setActions: function(){
  1360. //if (this.explorer.app.options.application.allowControl){
  1361. if (this.data.control.allowDelete){
  1362. this.deleteNode = new Element("div", {"styles": this.css.taskActionDeleteNode, "title": this.explorer.app.lp.delete}).inject(this.actionAreaNode);
  1363. }
  1364. },
  1365. setEvents: function(){
  1366. if (this.deleteNode){
  1367. this.deleteNode.addEvents({
  1368. "mouseover": function(){this.deleteNode.setStyles(this.css.taskActionDeleteNode_over);}.bind(this),
  1369. "mouseout": function(){this.deleteNode.setStyles(this.css.taskActionDeleteNode);}.bind(this),
  1370. "mousedown": function(){this.deleteNode.setStyles(this.css.taskActionDeleteNode_down);}.bind(this),
  1371. "mouseup": function(){this.deleteNode.setStyles(this.css.taskActionDeleteNode_over);}.bind(this),
  1372. "click": function(e){
  1373. this.remove(e);
  1374. }.bind(this)
  1375. });
  1376. }
  1377. },
  1378. remove: function(e){
  1379. var lp = this.explorer.app.lp;
  1380. var text = lp.deleteDone.replace(/{people}/g, this.data.person);
  1381. var _self = this;
  1382. this.node.setStyles(this.css.taskItemNode_remove);
  1383. this.explorer.app.confirm("warn", e, lp.deleteDoneTitle, text, 350, 120, function(){
  1384. this.close();
  1385. _self.work.removeDone(_self);
  1386. }, function(){
  1387. _self.node.setStyles(_self.css.taskItemNode);
  1388. this.close();
  1389. });
  1390. }
  1391. });
  1392. MWF.xApplication.process.Application.WorkExplorer.Read = new Class({
  1393. Extends: MWF.xApplication.process.Application.WorkExplorer.Task,
  1394. setActions: function(){
  1395. //if (this.explorer.app.options.application.allowControl || this.explorer.app.desktop.session.user.name==this.data.person){
  1396. if (this.data.control.allowReadReset){
  1397. this.resetNode = new Element("div", {"styles": this.css.taskActionResetNode, "title": this.explorer.app.lp.reset}).inject(this.actionAreaNode);
  1398. }
  1399. if (this.data.control.allowRead){
  1400. this.flagNode = new Element("div", {"styles": this.css.readActionFlagNode, "title": this.explorer.app.lp.flag}).inject(this.actionAreaNode);
  1401. }
  1402. //if (this.explorer.app.options.application.allowControl){
  1403. if (this.data.control.allowDelete){
  1404. this.deleteNode = new Element("div", {"styles": this.css.taskActionDeleteNode, "title": this.explorer.app.lp.delete}).inject(this.actionAreaNode);
  1405. }
  1406. },
  1407. setEvents: function(){
  1408. if (this.resetNode){
  1409. this.resetNode.addEvents({
  1410. "mouseover": function(){this.resetNode.setStyles(this.css.taskActionResetNode_over);}.bind(this),
  1411. "mouseout": function(){this.resetNode.setStyles(this.css.taskActionResetNode);}.bind(this),
  1412. "mousedown": function(){this.resetNode.setStyles(this.css.taskActionResetNode_down);}.bind(this),
  1413. "mouseup": function(){this.resetNode.setStyles(this.css.taskActionResetNode_over);}.bind(this),
  1414. "click": function(){
  1415. this.reset();
  1416. }.bind(this)
  1417. });
  1418. }
  1419. if (this.flagNode){
  1420. this.flagNode.addEvents({
  1421. "mouseover": function(){this.flagNode.setStyles(this.css.readActionFlagNode_over);}.bind(this),
  1422. "mouseout": function(){this.flagNode.setStyles(this.css.readActionFlagNode);}.bind(this),
  1423. "mousedown": function(){this.flagNode.setStyles(this.css.readActionFlagNode_down);}.bind(this),
  1424. "mouseup": function(){this.flagNode.setStyles(this.css.readActionFlagNode_over);}.bind(this),
  1425. "click": function(){
  1426. this.flagRead();
  1427. }.bind(this)
  1428. });
  1429. }
  1430. if (this.deleteNode){
  1431. this.deleteNode.addEvents({
  1432. "mouseover": function(){this.deleteNode.setStyles(this.css.taskActionDeleteNode_over);}.bind(this),
  1433. "mouseout": function(){this.deleteNode.setStyles(this.css.taskActionDeleteNode);}.bind(this),
  1434. "mousedown": function(){this.deleteNode.setStyles(this.css.taskActionDeleteNode_down);}.bind(this),
  1435. "mouseup": function(){this.deleteNode.setStyles(this.css.taskActionDeleteNode_over);}.bind(this),
  1436. "click": function(e){
  1437. this.remove(e);
  1438. }.bind(this)
  1439. });
  1440. }
  1441. },
  1442. reset: function () {
  1443. this.node.setStyles(this.css.taskItemNode_action);
  1444. var options = {
  1445. "type": "identity",
  1446. "title": this.explorer.app.lp.reset,
  1447. "onComplete": function (items) {
  1448. if (items.length) {
  1449. this.resetPeople(items);
  1450. } else {
  1451. this.node.setStyles(this.css.taskItemNode);
  1452. }
  1453. }.bind(this),
  1454. "onCancel": function () {
  1455. this.node.setStyles(this.css.taskItemNode);
  1456. }.bind(this)
  1457. };
  1458. var selector = new MWF.OrgSelector(this.explorer.app.content, options);
  1459. },
  1460. resetPeople: function (items) {
  1461. var nameList = [];
  1462. items.each(function(item){
  1463. nameList.push(item.data.name);
  1464. });
  1465. var data = {
  1466. "routeName": this.explorer.app.lp.resetTo,
  1467. "opinion": this.explorer.app.lp.resetTo+": "+nameList.join(", "),
  1468. "identityList": nameList
  1469. };
  1470. this.explorer.actions.resetRead(this.data.id, this.explorer.app.options.id, data, function(){
  1471. this.work.childNode.destroy();
  1472. this.work.childNode = null;
  1473. this.work.loadChild();
  1474. }.bind(this));
  1475. },
  1476. remove: function(e){
  1477. var lp = this.explorer.app.lp;
  1478. var text = lp.deleteRead.replace(/{people}/g, this.data.person);
  1479. var _self = this;
  1480. this.node.setStyles(this.css.taskItemNode_remove);
  1481. this.explorer.app.confirm("warn", e, lp.deleteReadTitle, text, 350, 120, function(){
  1482. this.close();
  1483. _self.work.removeRead(_self);
  1484. }, function(){
  1485. _self.node.setStyles(_self.css.taskItemNode);
  1486. this.close();
  1487. });
  1488. },
  1489. flagRead: function(){
  1490. var lp = this.explorer.app.lp;
  1491. var text = lp.flagRead.replace(/{people}/g, this.data.person);
  1492. var _self = this;
  1493. this.node.setStyles(this.css.taskItemNode_action);
  1494. this.explorer.app.confirm("warn", e, lp.flagReadTitle, text, 350, 120, function(){
  1495. this.close();
  1496. _self.doFlagRead();
  1497. }, function(){
  1498. _self.node.setStyles(_self.css.taskItemNode);
  1499. this.close();
  1500. });
  1501. },
  1502. doFlagRead: function(){
  1503. this.explorer.actions.flagRead(this.data.id, this.explorer.app.options.id, {}, function(){
  1504. this.work.childNode.destroy();
  1505. this.work.childNode = null;
  1506. this.work.loadChild();
  1507. }.bind(this));
  1508. }
  1509. });
  1510. MWF.xApplication.process.Application.WorkExplorer.Readed = new Class({
  1511. Extends: MWF.xApplication.process.Application.WorkExplorer.Done,
  1512. remove: function(e){
  1513. var lp = this.explorer.app.lp;
  1514. var text = lp.deleteReaded.replace(/{people}/g, this.data.person);
  1515. var _self = this;
  1516. this.node.setStyles(this.css.taskItemNode_remove);
  1517. this.explorer.app.confirm("warn", e, lp.deleteReadedTitle, text, 350, 120, function(){
  1518. this.close();
  1519. _self.work.removeReaded(_self);
  1520. }, function(){
  1521. _self.node.setStyles(_self.css.taskItemNode);
  1522. this.close();
  1523. });
  1524. }
  1525. });