MyWorkExplorer.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. MWF.xDesktop.requireApp("process.Application", "WorkExplorer", null, false);
  2. MWF.xApplication.process.Application.MyWorkExplorer = new Class({
  3. Extends: MWF.xApplication.process.Application.WorkExplorer,
  4. Implements: [Options, Events],
  5. createSearchElementNode: function(){
  6. this.toCompletedNode = new Element("div", {
  7. "styles": this.css.toCompletedNode,
  8. "text": this.app.lp.toCompleted
  9. }).inject(this.toolbarNode);
  10. this.toCompletedNode.addEvents({
  11. "mouseover": function(){
  12. this.toCompletedNode.setStyles(this.css.toCompletedNode_over);
  13. }.bind(this),
  14. "mouseout": function(){
  15. this.toCompletedNode.setStyles(this.css.toCompletedNode);
  16. }.bind(this),
  17. "click": function(){
  18. this.app.myWorkCompletedConfig();
  19. }.bind(this)
  20. });
  21. },
  22. _getFilterCount: function(callback){
  23. this.actions.listFilterAttribute(this.app.options.id, function(json){
  24. if (callback) callback(json);
  25. });
  26. },
  27. loadProcess: function(){
  28. this.actions.listProcess(this.app.options.id, function(json){
  29. json.data.each(function(process){
  30. this.loadProcessNode(process);
  31. }.bind(this));
  32. }.bind(this));
  33. },
  34. _getCurrentPageData: function(callback, count){
  35. var id = (this.items.length) ? this.items[this.items.length-1].data.id : "(0)";
  36. if (this.filter){
  37. var filterData = {};
  38. Object.each(this.filter, function(v, k){
  39. if (k!="key"){
  40. if (!filterData[k]) filterData[k] = [];
  41. v.each(function(o){
  42. filterData[k].push(o.value);
  43. });
  44. }else{
  45. filterData[k] = v;
  46. }
  47. });
  48. this.actions.listWorkFilter(id, count || this.pageCount, this.app.options.id, filterData, function(json){
  49. if (callback) callback(json);
  50. });
  51. }else{
  52. this.actions.listWorkNext(id, count || this.pageCount, this.app.options.id, function(json){
  53. if (callback) callback(json);
  54. });
  55. }
  56. },
  57. _createItem: function(data){
  58. return new MWF.xApplication.process.Application.WorkExplorer.Work(data, this);
  59. },
  60. removeWork: function(work, all){
  61. this.actions.removeWork(work.data.id, this.app.options.id, all, function(json){
  62. json.data.each(function(item){
  63. this.items.erase(this.works[item.id]);
  64. this.works[item.id].destroy();
  65. MWF.release(this.works[item.id]);
  66. delete this.works[item.id];
  67. }.bind(this));
  68. }.bind(this));
  69. }
  70. });