printCMSDoc.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. layout.addReady(function(){
  2. (function(layout){
  3. var uri = new URI(window.location.href);
  4. var options = uri.get("data");
  5. var form = uri.getData("form");
  6. if(form)options.printFormId = form;
  7. var documentId = uri.getData("documentid");
  8. if(documentId)options.documentId = documentId;
  9. var appNames = "cms.Document";
  10. var statusObj = null;
  11. var _load = function(){
  12. // layout.message = new MWF.xDesktop.MessageMobile();
  13. // layout.message.load();
  14. layout.apps = [];
  15. //layout.node = $("layout");
  16. layout.node = $("layout") || $("appContent") || document.body;
  17. var appName=appNames, m_status=statusObj, option=options;
  18. var topWindow = window.opener;
  19. if (topWindow){
  20. try{
  21. if (!appName) appName = topWindow.layout.desktop.openBrowserApp;
  22. if (!m_status) m_status = topWindow.layout.desktop.openBrowserStatus;
  23. if (!option) option = topWindow.layout.desktop.openBrowserOption;
  24. }catch(e){}
  25. }
  26. layout.openApplication(null, appName, option||{}, m_status);
  27. };
  28. if (layout.session && layout.session.user){
  29. _load();
  30. }else{
  31. if (layout.sessionPromise){
  32. layout.sessionPromise.then(function(){
  33. _load();
  34. },function(){});
  35. }
  36. }
  37. })(layout);
  38. });