framework.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. layout.app = true;
  2. layout.apps = [];
  3. layout.addReady(function(){
  4. // MWF.require("MWF.xScript.Environment", null, false);
  5. // MWF.require("MWF.xScript.PageEnvironment", null, false);
  6. MWF.require("MWF.xScript.Macro", null, false);
  7. var page = {
  8. "businessData": {},
  9. "json": {
  10. "application": ""
  11. },
  12. "options": {},
  13. "confirm": o2.xApplication.Common.Main.prototype.confirm,
  14. "alert": function(type, title, text, width, height){
  15. var p = o2.getCenterPosition(document.body, width, height);
  16. var e = {
  17. "event": {
  18. "x": p.x,
  19. "y": p.y,
  20. "clientX": p.x,
  21. "clientY": p.y
  22. }
  23. };
  24. o2.xApplication.Common.Main.prototype.alert(type, e, title, text, width, height);
  25. },
  26. "notice": function(content, type, target, where, offset, option){
  27. o2.xDesktop.notice(type, where, content, target, offset, option);
  28. },
  29. "app": {
  30. "desktop": layout,
  31. "content": document.body,
  32. "toPortal": function(portal, page, par, nohis){
  33. var url = "../x_desktop/portal.html?id="+portal;
  34. if (page) url += "&page="+page;
  35. if (par){
  36. if (o2.typeOf(par)==="object"){
  37. url += "&parameters="+JSON.stringify(par);
  38. }else{
  39. url += "&parameters="+par.toString();
  40. }
  41. }
  42. var a = document.createElement("a");
  43. a.setAttribute("href", o2.filterUrl(url));
  44. a.setAttribute("target", "_blank1");
  45. a.click();
  46. if (a.remove) a.remove();
  47. },
  48. "toPage": function(){}
  49. },
  50. addEvent: function(){}
  51. };
  52. var environment = {
  53. "form": page,
  54. "forms": page.forms,
  55. "all": page.all,
  56. "data": page.businessData.data,
  57. "status": page.businessData.status,
  58. "pageInfor": page.businessData.pageInfor,
  59. "target": null,
  60. "event": null
  61. };
  62. o2.env = new MWF.xScript.PageEnvironment(environment);
  63. });