Main.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. MWF.xApplication.Report = MWF.xApplication.Report || {};
  2. MWF.xApplication.ReportDocument = MWF.xApplication.ReportDocument || {};
  3. MWF.require("MWF.widget.O2Identity", null,false);
  4. //MWF.xDesktop.requireApp("Report", "Actions.RestActions", null, false);
  5. MWF.xDesktop.requireApp("Report", "lp."+MWF.language, null, false);
  6. MWF.xDesktop.requireApp("Template", "Explorer", null, false);
  7. MWF.xDesktop.requireApp("Report", "Common", null, false);
  8. MWF.xDesktop.requireApp("Report", "Setting", null, false);
  9. MWF.xDesktop.requireApp("Report", "StrategyExplorer", null, false);
  10. MWF.xApplication.ReportDocument.options = {
  11. multitask: true,
  12. executable: true
  13. };
  14. MWF.xApplication.ReportDocument.Main = new Class({
  15. Extends: MWF.xApplication.Common.Main,
  16. Implements: [Options, Events],
  17. options: {
  18. "style": "default",
  19. "name": "ReportDocument",
  20. "icon": "icon.png",
  21. "width": "1324",
  22. "height": "720",
  23. "isResize": true,
  24. "isMax": true,
  25. "isNew" : false,
  26. "isEdited" : true,
  27. "title": MWF.xApplication.ReportDocument.LP.title,
  28. "id" : ""
  29. },
  30. onQueryLoad: function(){
  31. this.lp = MWF.xApplication.Report.LP;
  32. },
  33. onQueryClose: function(){
  34. },
  35. loadApplication: function(callback){
  36. this.userData = layout.desktop.session.user;
  37. this.userName = this.userData.distinguishedName;
  38. this.restActions = this.actions = MWF.Actions.get("x_report_assemble_control"); //new MWF.xApplication.Report.Actions.RestActions();
  39. this.common = new MWF.xApplication.Report.Common(this);
  40. this.path = "../x_component_ReportDocument/$Main/"+this.options.style+"/";
  41. if( this.status ){
  42. this.setOptions( this.status )
  43. }
  44. this.createNode();
  45. this.loadApplicationLayout();
  46. },
  47. createNode: function(){
  48. this.content.setStyle("overflow", "hidden");
  49. //this.node = new Element("div", {
  50. // "styles": this.css.node
  51. //}).inject(this.content);
  52. },
  53. clearContent : function(){
  54. this.content.empty();
  55. },
  56. reload : function(oldid, appid){
  57. this.content.empty();
  58. this.loadApplicationLayout();
  59. },
  60. loadApplicationLayout : function(){
  61. this.report = new MWF.xApplication.Report.StrategyExplorer(this.content, this, this.restActions, {
  62. id : this.options.id
  63. });
  64. this.report.load();
  65. },
  66. recordStatus: function(){
  67. return {
  68. "id" : this.options.id,
  69. "isEdited" : this.options.isEdited,
  70. "isNew" : this.options.isNew
  71. };
  72. },
  73. createNewDocument: function(){
  74. var _self = this;
  75. var appId = "ReportDocument"+this.sectionData.id;
  76. if (_self.desktop.apps[appId]){
  77. _self.desktop.apps[appId].setCurrent();
  78. }else {
  79. this.desktop.openApplication(null, "ReportDocument", {
  80. "sectionId": this.sectionData.id,
  81. "appId": appId,
  82. "isNew" : true,
  83. "isEdited" : true,
  84. "onPostPublish" : function(){
  85. //this.view.reload();
  86. }.bind(this)
  87. });
  88. }
  89. },
  90. edit : function(){
  91. var appId = "ReportDocument"+this.data.id;
  92. this.options.isEdited = true;
  93. this.reload(appId , appId );
  94. },
  95. delete : function( ev ){
  96. var _self = this;
  97. this.confirm("warn", ev, this.lp.deleteDocumentTitle, this.lp.deleteDocument, 350, 120, function(){
  98. _self.restActions.deleteSubject( _self.data.id, function(){
  99. _self.notice( _self.lp.deleteDocumentOK, "ok");
  100. _self.reloadAllParents();
  101. _self.close();
  102. }.bind(this) );
  103. this.close();
  104. }, function(){
  105. this.close();
  106. });
  107. }
  108. });