framework.js 2.2 KB

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