framework.js 2.2 KB

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