Overview.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. MWF.xApplication.BAM.summary = MWF.xApplication.BAM.summary || {};
  2. MWF.xApplication.BAM.summary.Overview = new Class({
  3. Extends: MWF.widget.Common,
  4. Implements: [Options, Events],
  5. options: {
  6. "style": "default"
  7. },
  8. initialize: function(summary, node, data, options){
  9. this.setOptions(options);
  10. this.path = "../x_component_BAM/summary/$Overview/";
  11. this.cssPath = "../x_component_BAM/summary/$Overview/"+this.options.style+"/css.wcss";
  12. this._loadCss();
  13. this.summary = summary;
  14. this.app = this.summary.app;
  15. this.container = $(node);
  16. this.data = data;
  17. this.load();
  18. },
  19. load: function(){
  20. this.node = new Element("div", {"styles": this.css.node}).inject(this.container);
  21. var html = "<table border='0' cellpadding='0' cellSpacing='0' align='center'><tr>" +
  22. "<td></td><td></td><td></td><td></td><tr></tr><td></td><td></td><td></td><td></td>" +
  23. "</tr></table>"
  24. this.node.set("html", html);
  25. this.table = this.node.getElement("table");
  26. this.cells = this.node.getElements("td");
  27. this.table.setStyles(this.css.table);
  28. this.cells.setStyles(this.css.cells);
  29. for (var i=0; i<4; i++){
  30. this.cells[i].setStyle("border-top", "0px");
  31. }
  32. for (var i=4; i<this.cells.length; i++){
  33. this.cells[i].setStyle("border-bottom", "0px");
  34. }
  35. this.cells[0].setStyle("border-left", "0px");
  36. this.cells[4].setStyle("border-left", "0px");
  37. this.cells[3].setStyle("border-right", "0px");
  38. this.cells[7].setStyle("border-right", "0px");
  39. this.loadData();
  40. },
  41. loadData: function(){
  42. this.loadItem(0, "application.png", this.data.applicationCount, this.app.lp.applicationCount);
  43. this.loadItem(1, "process.png", this.data.processCount, this.app.lp.processCount);
  44. this.loadItem(2, "task.png", this.data.taskCount, this.app.lp.taskCount);
  45. this.loadItem(3, "taskCompleted.png", this.data.taskCompletedCount, this.app.lp.taskCompletedCount);
  46. this.loadItem(4, "work.png", this.data.workCount, this.app.lp.workCount);
  47. this.loadItem(5, "workCompleted.png", this.data.workCompletedCount, this.app.lp.workCompletedCount);
  48. this.loadItem(6, "read.png", this.data.readCount, this.app.lp.readCount);
  49. this.loadItem(7, "readCompleted.png", this.data.readCompletedCount, this.app.lp.readCompletedCount);
  50. },
  51. loadItem: function(idx, icon, number, title){
  52. var itemNode = new Element("div", {"styles": this.css.itemNode}).inject(this.cells[idx]);
  53. var itemIconNode = new Element("div", {"styles": this.css.itemIconNode}).inject(itemNode);
  54. var itemTextNode = new Element("div", {"styles": this.css.itemTextNode}).inject(itemNode);
  55. var itemNumberNode = new Element("div", {"styles": this.css.itemNumberNode}).inject(itemTextNode);
  56. var itemTitleNode = new Element("div", {"styles": this.css.itemTitleNode}).inject(itemTextNode);
  57. itemIconNode.setStyle("background-image", "url(../x_component_BAM/summary/$Overview/"+this.options.style+"/icon/"+icon+")");
  58. itemNumberNode.set("text", number || 0);
  59. itemTitleNode.set("text", title);
  60. },
  61. destroy: function(){
  62. this.node.destroy();
  63. MWF.release(this);
  64. }
  65. });