app.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. layout.addReady(function(){
  2. (function(layout){
  3. debugger;
  4. var uri = new URI(window.location.href);
  5. var appNames = uri.getData("app");
  6. var optionsStr = uri.getData("option");
  7. var statusStr = uri.getData("status");
  8. var options = (optionsStr) ? JSON.decode(optionsStr) : null;
  9. var statusObj = (statusStr) ? JSON.decode(statusStr) : null;
  10. var _load = function(){
  11. //o2.require("MWF.xDesktop.MessageMobile", function(){
  12. // layout.message = new MWF.xDesktop.MessageMobile();
  13. // layout.message.load();
  14. //}.bind(this));
  15. layout.apps = [];
  16. //layout.node = $("layout");
  17. layout.node = $("layout") || $("appContent") || document.body;
  18. var appName=appNames, m_status=statusObj, option=options;
  19. var topWindow = window.opener;
  20. if (topWindow){
  21. try{
  22. if (!appName) appName = topWindow.layout.desktop.openBrowserApp;
  23. if (!m_status) m_status = topWindow.layout.desktop.openBrowserStatus;
  24. if (!option) option = topWindow.layout.desktop.openBrowserOption;
  25. }catch(e){}
  26. }
  27. layout.openApplication(null, appName, option||{}, m_status);
  28. if (layout.session.user.name === "anonymous"){
  29. o2.loadCss("../o2_core/o2/xDesktop/$Default/blue/style-skin.css");
  30. }else{
  31. o2.xDesktop.getUserLayout(function(){
  32. var style = layout.userLayout.flatStyle;
  33. o2.loadCss("../o2_core/o2/xDesktop/$Default/"+style+"/style-skin.css");
  34. });
  35. }
  36. };
  37. if (layout.session && layout.session.user){
  38. _load();
  39. }else{
  40. if (layout.sessionPromise){
  41. layout.sessionPromise.then(function(){
  42. _load();
  43. },function(){});
  44. }
  45. }
  46. //_load();
  47. })(layout);
  48. });