Monitor.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. MWF.xApplication.process.Xform.widget = MWF.xApplication.process.Xform.widget || {};
  2. //MWF.xDesktop.requireApp("process.Xform", "widget.RestActions", null, false);
  3. MWF.require("MWF.widget.Common", null, false);
  4. MWF.require("MWF.widget.MWFRaphael", null, false);
  5. MWF.xApplication.process.Xform.widget.Monitor = new Class({
  6. Implements: [Options, Events],
  7. Extends: MWF.widget.Common,
  8. options: {
  9. "style": "default"
  10. },
  11. initialize: function(container, worklog, recordList, processid, options, module){
  12. this.setOptions(options);
  13. this.path = "../x_component_process_Xform/widget/$Monitor/";
  14. this.cssPath = "../x_component_process_Xform/widget/$Monitor/"+this.options.style+"/css.wcss";
  15. this._loadCss();
  16. this.container = $(container);
  17. this.worklog = worklog;
  18. this.recordList = recordList;
  19. this.processid = processid;
  20. this.mobileScale = 2;
  21. this.module = module;
  22. this.load();
  23. },
  24. load: function(){
  25. this.logProcessChartNode = new Element("div", {"styles": this.css.logProcessChartNode}).inject(this.container);
  26. this.logPathChartNode = new Element("div", {"styles": this.css.logPathChartNode}).inject(this.container);
  27. this.checkMonitorOpen();
  28. },
  29. checkMonitorOpen: function(){
  30. var moduleNode = this.container;
  31. var module = moduleNode.retrieve("module");
  32. var isDisplayNode = false;
  33. var isTabContent = false;
  34. while (true){
  35. if (moduleNode.getStyle("display")==="none"){
  36. isDisplayNode = true;
  37. }
  38. if (module && module.json.type==="Tab$Content"){
  39. isTabContent = true;
  40. }
  41. if (isDisplayNode && isTabContent) break;
  42. moduleNode = moduleNode.getParent();
  43. if (!moduleNode) break;
  44. if (!isTabContent) module = moduleNode.retrieve("module");
  45. }
  46. if (isDisplayNode){
  47. if (isTabContent){
  48. for (var i=0; i<module.tab.tab.pages.length; i++){
  49. if (module.tab.tab.pages[i].contentNode === module.node) break;
  50. }
  51. module.tab.tab.pages[i].setOptions({
  52. "onPostShow": function(){
  53. this.openProcess();
  54. }.bind(this)
  55. });
  56. }else{
  57. this.openProcessChartAction = new Element("div", {"styles": this.css.openProcessChartAction, "text": "Show Process"}).inject(this.logProcessChartNode);
  58. this.openProcessChartAction.addEvent("click", function(e){
  59. this.openProcess(e);
  60. }.bind(this));
  61. }
  62. }else{
  63. this.openProcess();
  64. }
  65. },
  66. openProcess: function(){
  67. if (!this.process){
  68. this.logProcessChartNode.empty();
  69. this.loadToolbar();
  70. this.paperNode = new Element("div.paperNode", {"styles": (layout.mobile) ? this.css.paperNodeMobile : this.css.paperNode}).inject(this.logProcessChartNode);
  71. //this.paperNode.addEvent("scroll", function(){
  72. // this.setCountNodePosition();
  73. //}.bind(this));
  74. this.getProcess(function(json){
  75. this.processData = json.data;
  76. this.loadPaper();
  77. this.bindTabEvent();
  78. }.bind(this));
  79. }
  80. },
  81. loadToolbar: function(){
  82. MWF.require("MWF.widget.Toolbar", function(){
  83. this.toolbarNode = new Element("div").inject(this.logProcessChartNode);
  84. this.createToolbarNode("play.png", "logPlay", "");
  85. //this.createToolbarNode("pause.png", "logPause", "true");
  86. //this.createToolbarNode("stop.png", "playStop", "true");
  87. //this.createToolbarNode("prev.png", "logPrev", "true");
  88. //this.createToolbarNode("next.png", "logNext", "");
  89. this.toolbar = new MWF.widget.Toolbar(this.toolbarNode, {"style": this.options.style}, this);
  90. this.toolbar.load();
  91. }.bind(this));
  92. },
  93. createToolbarNode: function(img, action, disabled){
  94. new Element("div", {
  95. "MWFnodetype": "MWFToolBarButton",
  96. "MWFButtonImage": this.path+""+this.options.style+"/tools/"+img,
  97. "title": "",
  98. "MWFButtonAction": action,
  99. "MWFButtonText": "",
  100. "MWFButtonDisable": disabled
  101. }).inject(this.toolbarNode);
  102. },
  103. logPlay: function(){
  104. if (this.process){
  105. this.isPlaying = true;
  106. this.toolbar.childrenButton[0].setDisable(true);
  107. //this.toolbar.childrenButton[1].setDisable(false);
  108. //this.toolbar.childrenButton[2].setDisable(false);
  109. this.processReturnStyle();
  110. this.playBegin();
  111. this.playToNextActivity();
  112. }
  113. },
  114. playBegin: function(){
  115. var src = "../x_component_process_Xform/widget/$Monitor/"+this.options.style+"/fly.png";
  116. this.playIcon = this.paper.image(src, this.process.begin.center.x-16, this.process.begin.center.y-16, 32, 32);
  117. this.playLogNode = null;
  118. this.playsStatus = {
  119. "index": 0
  120. };
  121. this.isPlaying = true;
  122. },
  123. playGetNextActivity: function(){
  124. var log = this.worklog[this.playsStatus.index];
  125. var activityType = log.fromActivityType;
  126. var activity = (activityType.toLowerCase()=="begin") ? this.process.begin : this.process[activityType+"s"][log.fromActivity];
  127. return {"log": log, "activity": activity};
  128. },
  129. playToNextActivity: function(route){
  130. var activity = this.playGetNextActivity();
  131. if (this.playsStatus.index == 0){
  132. this.playToActivityStop(activity.activity, activity.log);
  133. }else{
  134. this.playMoveToActivity(activity.activity, activity.log, route);
  135. }
  136. },
  137. playMoveToActivity: function(activity, log, route){
  138. if (route){
  139. var points = [route.beginPoint];
  140. points = points.concat(route.positionPoints, [route.endPoint], [{"x": activity.center.x, "y": activity.center.y}]);
  141. this.playMoveByRoutePoint(points, function(){
  142. this.playToActivityStop(activity, log, route);
  143. }.bind(this));
  144. }else{
  145. this.playToActivityStop(activity, log, route);
  146. }
  147. },
  148. playMoveByRoutePoint: function(points, callback){
  149. var p = {"x": this.playIcon.attr("x").toFloat(), "y": this.playIcon.attr("y").toFloat()};
  150. var toP = points.shift();
  151. var d = MWFRaphael.getPointDistance(p, toP);
  152. var ms = d/0.2;
  153. this.playIcon.animate({"x": toP.x-16, "y": toP.y-16}, ms, "linear", function() {
  154. if (points.length) {
  155. this.playMoveByRoutePoint(points, callback);
  156. } else {
  157. if (callback) callback();
  158. }
  159. }.bind(this));
  160. },
  161. playToActivityStop: function(activity, log, prevRoute){
  162. this.playIcon.attr({
  163. "x": activity.center.x-16,
  164. "y": activity.center.y-16
  165. });
  166. if (log.connected){
  167. activity.shap.attr(this.css.passedActivityShap);
  168. }else{
  169. activity.shap.attr(this.css.currentActivityShap);
  170. }
  171. var route = this.process.routes[log.route];
  172. if (prevRoute){
  173. prevRoute.line.attr(this.css.passedRouteShap);
  174. prevRoute.point.attr(this.css.passedRouteFillShap);
  175. prevRoute.arrow.attr(this.css.passedRouteFillShap);
  176. }
  177. this.showPlayLog(activity,log);
  178. this.playsStatus.index++;
  179. window.setTimeout(function(){
  180. if (this.worklog.length<=this.playsStatus.index){
  181. this.playStop();
  182. }else{
  183. this.playLogNode.destroy();
  184. this.playLogNode = null;
  185. this.playToNextActivity(route);
  186. }
  187. }.bind(this), 2000);
  188. },
  189. showPlayLog: function(activity,log){
  190. var offset = this.paperNode.getPosition(this.paperNode.getOffsetParent());
  191. var size = this.paperNode.getSize();
  192. this.playLogNode = this.createWorkLogNode([log], activity);
  193. this.playLogNode.setStyle("display", "block");
  194. var p = this.getlogNodePosition(activity, this.playLogNode, offset, size);
  195. this.playLogNode.setPosition({"x": p.x, "y": p.y});
  196. },
  197. playStop: function(){
  198. this.playIcon.remove();
  199. if (this.playLogNode) this.playLogNode.destroy();
  200. this.playLogNode = null;
  201. this.playsStatus = {
  202. "index": 0
  203. };
  204. this.isPlaying = false;
  205. this.toolbar.childrenButton[0].setDisable(false);
  206. //this.toolbar.childrenButton[1].setDisable(true);
  207. //this.toolbar.childrenButton[2].setDisable(true);
  208. this.loadWorkLog();
  209. },
  210. processReturnStyle: function(){
  211. this.worklog.each(function(log){
  212. var activityType = log.fromActivityType;
  213. var activity = (activityType.toLowerCase()=="begin") ? this.process.begin : this.process[activityType+"s"][log.fromActivity];
  214. activity.shap.attr(activity.style.shap);
  215. activity.passedCount = 0;
  216. activity.worklogs = [];
  217. var route = this.process.routes[log.route];
  218. if (route){
  219. route.line.attr(this.process.css.route.line.normal);
  220. route.point.attr(this.process.css.route.decision.normal);
  221. route.arrow.attr(this.process.css.route.arrow.normal);
  222. }
  223. if (log.taskCompletedList && log.taskCompletedList.length){
  224. log.taskCompletedList.each(function(tc){
  225. if (tc.processingType === "appendTask"){
  226. if (activity.routes && activity.routes.length){
  227. activity.routes.each(function(r){
  228. if (tc.routeName === r.data.name){
  229. r.line.attr(this.process.css.route.line.normal);
  230. r.point.attr(this.process.css.route.decision.normal);
  231. r.arrow.attr(this.process.css.route.arrow.normal);
  232. }
  233. }.bind(this));
  234. }
  235. }
  236. }.bind(this));
  237. }
  238. if (activity.countSet) activity.countSet.remove();
  239. }.bind(this));
  240. },
  241. loadPaper: function(){
  242. MWFRaphael.load(function(){
  243. this.paperInNode = new Element("div", {"styles": this.css.paperInNode}).inject(this.paperNode);
  244. this.paper = Raphael(this.paperInNode, "98%", "99%");
  245. if (layout.mobile){
  246. var s = this.paper.canvas.getSize();
  247. var x = s.x*this.mobileScale;
  248. var y = s.y*this.mobileScale;
  249. this.paper.canvas.set({
  250. "viewBox": "0 0 "+x+" "+y+"",
  251. "preserveAspectRatio": "xMinYMin meet"
  252. });
  253. }
  254. this.paper.container = this.paperNode;
  255. MWF.xDesktop.requireApp("process.ProcessDesigner", "Process", function(){
  256. this.process = new MWF.APPPD.Process(this.paper, this.processData, this, {"style":"flat", "isView": true,
  257. "onPostLoad": function(){
  258. this.loadWorkLog();
  259. this.fireEvent("postLoad");
  260. }.bind(this)
  261. });
  262. this.process.load();
  263. }.bind(this));
  264. }.bind(this));
  265. },
  266. getProcess: function(callback){
  267. this.action = MWF.Actions.get("x_processplatform_assemble_surface");
  268. //this.action = new MWF.xApplication.process.Xform.widget.RestActions("x_processplatform_assemble_surface");
  269. //this.action = new MWF.xApplication.process.Xform.widget.RestActions("x_processplatform_assemble_designer");
  270. this.action.getProcess(function(json){
  271. if (callback) callback(json);
  272. }, null, this.processid)
  273. },
  274. loadWorkLog: function(){
  275. this.countNodes = [];
  276. var activitys = {};
  277. this.worklogToken = {};
  278. this.worklog.each(function(log){
  279. this.worklogToken[log.fromActivityToken] = log;
  280. var activityType = log.fromActivityType;
  281. var activity = (activityType.toLowerCase()=="begin") ? this.process.begin : this.process[activityType+"s"][log.fromActivity];
  282. if (log.connected){
  283. activity.shap.attr(this.css.passedActivityShap);
  284. }else{
  285. activity.shap.attr(this.css.currentActivityShap);
  286. }
  287. var route = this.process.routes[log.route];
  288. if (route){
  289. route.line.attr(this.css.passedRouteShap);
  290. route.point.attr(this.css.passedRouteFillShap);
  291. route.arrow.attr(this.css.passedRouteFillShap);
  292. }
  293. if (log.taskCompletedList && log.taskCompletedList.length){
  294. log.taskCompletedList.each(function(tc){
  295. if (tc.processingType === "appendTask"){
  296. if (activity.routes && activity.routes.length){
  297. activity.routes.each(function(r){
  298. if (tc.routeName === r.data.name){
  299. r.line.attr(this.css.passedRouteShap);
  300. r.point.attr(this.css.passedRouteFillShap);
  301. r.arrow.attr(this.css.passedRouteFillShap);
  302. }
  303. }.bind(this));
  304. }
  305. }
  306. }.bind(this));
  307. }
  308. var passedCount = log.taskCompletedList.length;
  309. //var passedCount = log.taskCompletedList.length || 1;
  310. if (passedCount) activity.passedCount = (activity.passedCount) ? activity.passedCount+passedCount : passedCount;
  311. if (!activity.worklogs) activity.worklogs = [];
  312. activity.worklogs.push(log);
  313. if (!activitys[log.fromActivity]) activitys[log.fromActivity] = activity
  314. }.bind(this));
  315. if (this.recordList){
  316. this.recordList.each(function (r, i){
  317. var activity = activitys[r.fromActivity];
  318. if (!activity.recordCount) activity.recordCount = 0
  319. activity.recordCount++;
  320. }.bind(this));
  321. }
  322. var offset = this.paperNode.getPosition(this.paperNode.getOffsetParent());
  323. var size = this.paperNode.getSize();
  324. Object.each(activitys, function(activity){
  325. this.writePassCount(activity);
  326. this.writeWorkLog(activity, offset, size);
  327. }.bind(this));
  328. },
  329. writePassCount: function(activity){
  330. if (activity.passedCount || activity.recordCount){
  331. var x = activity.point.x+activity.width;
  332. var y = activity.point.y;
  333. var shap = this.paper.circle(x, y, 9);
  334. shap.attr(this.css.activityPassedCount);
  335. text = this.paper.text(x, y, activity.recordCount || activity.passedCount);
  336. text.attr(this.css.activityPassedCountText);
  337. activity.countSet = this.paper.set();
  338. activity.countSet.push(shap, text);
  339. }
  340. },
  341. writeWorkLog: function(activity, offset, size){
  342. var _self = this;
  343. activity.set.click(function(e){
  344. if (!_self.isPlaying){
  345. if (this.process.selectedActivitys.length){
  346. if (!this.noselected){
  347. this.selected();
  348. _self.showWorklog(this, offset, size);
  349. }
  350. this.noselected = false;
  351. }
  352. if (this.countSet) this.countSet.toFront();
  353. }
  354. e.stopPropagation();
  355. }.bind(activity));
  356. activity.set.mousedown(function(e){
  357. if (!_self.isPlaying) {
  358. if (!this.process.selectedActivitys.length) {
  359. this.selected();
  360. _self.showWorklog(this, offset, size);
  361. }
  362. if (this.countSet) this.countSet.toFront();
  363. }
  364. e.stopPropagation();
  365. }.bind(activity));
  366. this.paper.canvas.addEvent("click", function(e){
  367. if (!_self.isPlaying) {
  368. if (this.unSelectedEvent) {
  369. if (this.currentSelected || this.selectedActivitys.length) {
  370. this.unSelected(e);
  371. _self.hideCurrentWorklog();
  372. }
  373. } else {
  374. this.unSelectedEvent = true;
  375. }
  376. }
  377. }.bind(this.process));
  378. },
  379. getlogNodePosition: function(activity, node, offset, psize){
  380. offset.x = 0;
  381. offset.y = 0;
  382. var size = node.getSize();
  383. var y = 0;
  384. var x = activity.point.x+activity.width+15+offset.x;
  385. tmpX = x + size.x;
  386. if (tmpX>offset.x+psize.x){
  387. x = activity.point.x - size.x - 15 + offset.x;
  388. if (x<offset.x){
  389. y = activity.point.y-size.y-15+offset.y;
  390. x = activity.center.x - (size.x/2) + offset.x;
  391. }else{
  392. y = activity.center.y - (size.y/2) + offset.y;
  393. if (y<offset.y){
  394. y = offset.y
  395. }
  396. }
  397. }else{
  398. y = activity.center.y - (size.y/2) + offset.y;
  399. if (y<offset.y){
  400. y = offset.y
  401. }
  402. }
  403. if( x + size.x > psize.x )x = psize.x - size.x;
  404. if( y + size.y > psize.y )y = psize.y - size.y;
  405. if( x < 0 )x = 0;
  406. if( y < 0 )y = 0;
  407. // var p = this.paperNode.getScroll();
  408. // var scrollY = 0;
  409. // var scrollX = 0;
  410. // var tmpNode = this.paperNode.getParent();
  411. // while (tmpNode){
  412. // var s = tmpNode.getScroll();
  413. // scrollY += s.y;
  414. // scrollX += s.x;
  415. // tmpNode = tmpNode.getParent();
  416. // }
  417. // y = y-p.y-scrollY;
  418. // x = x-p.x-scrollX;
  419. return {"x": x, "y": y};
  420. },
  421. showWorklog: function(activity, offset, psize){
  422. this.hideCurrentWorklog();
  423. if (!activity.worklogNode) activity.worklogNode = this.createWorkLogNode(activity.worklogs, activity);
  424. this.currentWorklogNode = activity.worklogNode;
  425. this.currentWorklogNode.setStyle("display", !!this.currentWorklogNode.get("html") ? "block" : "none");
  426. if( layout.mobile ){
  427. var pSize = this.paperNode.getSize();
  428. var bodySize = $(document.body).getSize();
  429. if( this.paperNode.getPosition().y + pSize.y > bodySize.y ){
  430. var mobileActionNode = document.body.getElement(".o2_form_mobile_actions");
  431. activity.worklogNode.inject( $(document.body) );
  432. activity.worklogNode.setStyles({
  433. "display": "block",
  434. "position": "absolute",
  435. "width": "calc( 100% - 4px )",
  436. "max-width": "500px",
  437. "bottom": mobileActionNode ? (mobileActionNode.getSize().y+1+"px") : "1px",
  438. "left": "0px"
  439. });
  440. activity.worklogNode.setStyle("left", (bodySize.x - activity.worklogNode.getSize().x)/2 + "px");
  441. }else{
  442. activity.worklogNode.inject( this.paperNode );
  443. activity.worklogNode.setStyles({
  444. "display": "block",
  445. "position": "absolute",
  446. "width": "calc( 100% - 4px )",
  447. "max-width": "500px",
  448. "bottom": "1px",
  449. "left": "0px"
  450. });
  451. activity.worklogNode.setStyle("left", (pSize.x - activity.worklogNode.getSize().x)/2 + "px");
  452. }
  453. }else{
  454. var p = this.getlogNodePosition(activity, activity.worklogNode, offset, psize)
  455. activity.worklogNode.setPosition({"x": p.x, "y": p.y});
  456. }
  457. },
  458. hideCurrentWorklog: function(){
  459. if (this.currentWorklogNode){
  460. this.currentWorklogNode.setStyle("display", "none");
  461. this.currentWorklogNode = null;
  462. }
  463. },
  464. bindTabEvent: function(){
  465. if( this.module ){
  466. var tab = this.module.getParentModule();
  467. if( tab && tab.page ){
  468. tab.page.addEvent("postHide", function () {
  469. if(this.currentWorklogNode)this.currentWorklogNode.hide()
  470. }.bind(this))
  471. }
  472. }
  473. },
  474. createWorkLogNode: function(worklogs, activity){
  475. var node = new Element("div", {"styles": this.css.workLogNode});
  476. if (this.recordList){
  477. var logs = this.recordList.filter(function(r){
  478. return r.fromActivity === activity.data.id;
  479. });
  480. logs.each(function(log, idx){
  481. var workNode = new Element("div", {"styles": this.css.workLogWorkNode}).inject(node);
  482. if ((idx % 2)==0){
  483. workNode.setStyle("background-color", "#FFF");
  484. }else{
  485. workNode.setStyle("background-color", "#EEE");
  486. }
  487. var router, opinion, arrivedActivitys, arrivedUsers;
  488. arrivedActivitys = log.properties.nextManualList.map(function(o){
  489. return o.activityName;
  490. }).join(",");
  491. arrivedUsers = (log.properties.nextManualTaskIdentityList && log.properties.nextManualTaskIdentityList.length) ? o2.name.cns(log.properties.nextManualTaskIdentityList).join(",") : "";
  492. switch (log.type) {
  493. case "empower":
  494. router = MWF.xApplication.process.Xform.LP.empower;
  495. var empowerTo = (log.properties.nextManualTaskIdentityList && log.properties.nextManualTaskIdentityList.length) ? o2.name.cns(log.properties.nextManualTaskIdentityList).join(",") : "";
  496. opinion = MWF.xApplication.process.Xform.LP.empowerTo + empowerTo;
  497. break;
  498. case "retract":
  499. router = MWF.xApplication.process.Xform.LP.retract;
  500. opinion = MWF.xApplication.process.Xform.LP.retract;
  501. break;
  502. case "reroute":
  503. router = log.properties.routeName || MWF.xApplication.process.Xform.LP.reroute;
  504. opinion = log.properties.opinion || MWF.xApplication.process.Xform.LP.rerouteTo+": "+arrivedActivitys;
  505. break;
  506. case "rollback":
  507. router = log.properties.routeName || MWF.xApplication.process.Xform.LP.rollback;
  508. opinion = log.properties.opinion || MWF.xApplication.process.Xform.LP.rollbackTo+": "+log.arrivedActivityName;
  509. break;
  510. case "reset":
  511. var resetUser = log.properties.nextManualTaskIdentityList.erase(log.identity);
  512. resetUserText = o2.name.cns(resetUser).join(",");
  513. router = MWF.xApplication.process.Xform.LP.resetTo+":"+resetUserText;
  514. opinion = log.properties.opinion || ""
  515. break;
  516. case "appendTask":
  517. case "back":
  518. case "addSplit":
  519. case "urge":
  520. case "expire":
  521. case "read":
  522. default:
  523. router = log.properties.routeName || "";
  524. opinion = log.properties.opinion || "";
  525. }
  526. if (log.type==="currentTask"){
  527. var taskNode = new Element("div", {"styles": this.css.workLogTaskNode}).inject(workNode);
  528. var html = "<div style='font-weight: bold; color: red'>"+log.person.substring(0, log.person.indexOf("@"))+" "+MWF.xApplication.process.Xform.LP.processing+" </div>";
  529. taskNode.set("html", html);
  530. }else{
  531. var taskNode = new Element("div", {"styles": this.css.workLogTaskNode}).inject(workNode);
  532. var html = "<div style='font-weight: bold'>"+log.person.substring(0, log.person.indexOf("@"))+": </div>";
  533. html += "<div style='margin-left: 10px'>["+router+"] "+o2.txt(opinion)+"</div>";
  534. html += "<div style='text-align: right'>"+log.recordTime+"</div>";
  535. taskNode.set("html", html);
  536. }
  537. }.bind(this));
  538. }else{
  539. worklogs.each(function(log, idx){
  540. var workNode = new Element("div", {"styles": this.css.workLogWorkNode}).inject(node);
  541. if ((idx % 2)==0){
  542. workNode.setStyle("background-color", "#FFF");
  543. }else{
  544. workNode.setStyle("background-color", "#EEE");
  545. }
  546. if (log.taskCompletedList.length+log.taskList.length<1){
  547. if (log.connected){
  548. var taskNode = new Element("div", {"styles": this.css.workLogTaskNode}).inject(workNode);
  549. var html = "<div style='font-weight: bold'>"+MWF.xApplication.process.Xform.LP.systemProcess+" </div>";
  550. html += "<div style='text-align: right'>"+log.arrivedTime+"</div>";
  551. taskNode.set("html", html);
  552. }else{
  553. var taskNode = new Element("div", {"styles": this.css.workLogTaskNode}).inject(workNode);
  554. var html = "<div style='font-weight: bold; color: red'>"+MWF.xApplication.process.Xform.LP.systemProcess+" </div>";
  555. taskNode.set("html", html);
  556. }
  557. }else{
  558. log.taskCompletedList.each(function(task){
  559. var taskNode = new Element("div", {"styles": this.css.workLogTaskNode}).inject(workNode);
  560. var html = "<div style='font-weight: bold'>"+task.person.substring(0, task.person.indexOf("@"))+": </div>";
  561. html += "<div style='margin-left: 10px'>["+(task.routeName || "")+"] "+o2.txt(task.opinion)+"</div>";
  562. html += "<div style='text-align: right'>"+task.completedTime+"</div>";
  563. taskNode.set("html", html);
  564. }.bind(this));
  565. log.taskList.each(function(task){
  566. var taskNode = new Element("div", {"styles": this.css.workLogTaskNode}).inject(workNode);
  567. var html = "<div style='font-weight: bold; color: red'>"+task.person.substring(0, task.person.indexOf("@"))+" "+MWF.xApplication.process.Xform.LP.processing+" </div>";
  568. taskNode.set("html", html);
  569. }.bind(this));
  570. }
  571. }.bind(this));
  572. }
  573. node.inject(this.paperNode);
  574. return node;
  575. }
  576. });
  577. MWF.xApplication.process.Xform.widget.Monitor.Animation = new Class({
  578. Implements: [Events],
  579. initialize: function(monitor, log){
  580. }
  581. });