private String getWindowCloser() { String result = ""; boolean isActiveForm = false; WebForm[] allForms = FormManager.getAll(); // remove all closed windows except the active window for (int i = 0; i < allForms.length; i++) { WebForm form = allForms[i]; if (form != FormManager.getActive()) { IWindow window = W4TContext.getWindowManager().findWindow(form); if (window != null && WindowManager.isClosing(window)) { NoscriptFormStack.getInstance().remove(form); } } } // 'close' active window IWindow activeWindow = WindowManager.getActive(); if (WindowManager.isClosing(activeWindow) && !WindowManager.isClosed(activeWindow)) { isActiveForm = true; NoscriptFormStack.getInstance().remove(FormManager.getActive()); WindowManager.setClosed(activeWindow, true); } // create meta tag to redirect to previous form if (isActiveForm && !NoscriptFormStack.getInstance().isEmpty()) { WebForm newForm = NoscriptFormStack.getInstance().pop(); result = "<meta http-equiv=\"refresh\" content=\"0; url=" + RenderUtil.createEncodedFormGetURL(newForm) + "\">"; } return result; }
/** * gets the redirect URL as workaround for opening a new window or refreshing a window (Noscript * version) */ private String getWindowOpener() { String result = ""; IServiceStateInfo stateInfo = ContextProvider.getStateInfo(); WebForm activeForm = FormManager.getActive(); WebForm[] allForms = FormManager.getAll(); boolean finished = false; for (int i = 0; !finished && i < allForms.length; i++) { WebForm form = allForms[i]; IFormAdapter formAdapter = WebFormUtil.getFormAdapter(form); if (stateInfo.isExpired()) { if (!formAdapter.getWindowOpenerBuffer().equals("")) { result = formAdapter.getWindowOpenerBuffer(); finished = true; } } else { if (WebComponentControl.openInNewWindow(form) || WebComponentControl.refreshWindow(form)) { result = "<meta http-equiv=\"refresh\" content=\"0; url=" + RenderUtil.createEncodedFormGetURL(form) + "\">"; formAdapter.addWindowOpenerBuffer(result); NoscriptFormStack.getInstance().push(activeForm); finished = true; } else { formAdapter.addWindowOpenerBuffer(""); } } } return result; }