MyWorkExplorer.js 2.8 KB

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