docs: protected void appendWorkplaceOpenerScript(
          StringBuffer html,
          String requestedResource,
          CmsMessageContainer message) {
  
          String winId = "OpenCms" + System.currentTimeMillis();
  
          html.append("<script type=\"text/javascript\">\n");
  
          html.append("function doOnload() {\n");
  
          // display missing resource warning if required
          if (message != null) {
              html.append("\talert(\"");
              html.append(CmsStringUtil.escapeJavaScript(message.key(m_locale)));
              html.append("\");\n");
          }
  
          // display login message if required
          CmsLoginMessage loginMessage = OpenCms.getLoginManager().getLoginMessage();
          if ((loginMessage != null) && (loginMessage.isActive())) {
              String msg;
              if (loginMessage.isLoginForbidden()) {
                  // login forbidden for normal users, current user must be Administrator
                  msg = Messages.get().container(
                      Messages.GUI_LOGIN_SUCCESS_WITH_MESSAGE_2,
                      loginMessage.getMessage(),
                      new Date(loginMessage.getTimeEnd())).key(m_locale);
              } else {
                  // just display the message
                  msg = loginMessage.getMessage();
              }
              html.append("\talert(\"");
              html.append(CmsStringUtil.escapeJavaScript(msg));
              html.append("\");\n");
          }
  
          String openResource = requestedResource;
  
          // check if user agreement should be shown
          CmsLoginUserAgreement agreementInfo = new CmsLoginUserAgreement(this);
          if (agreementInfo.isShowUserAgreement()) {
              openResource = agreementInfo.getConfigurationVfsPath()
                  + "?"
                  + CmsLoginUserAgreement.PARAM_WPRES
                  + "="
                  + requestedResource;
          }
  
          html.append("\tvar openUri = \"");
          html.append(link(openResource));
          html.append("\";\n");
          html.append("\tvar workplaceWin = openWorkplace(openUri, \"");
          html.append(winId);
          html.append("\");\n");
          html.append("\tif (window.name != \"");
          html.append(winId);
          html.append("\") {\n");
          html.append("\t\twindow.opener = workplaceWin;\n");
          html.append("\t\tif (workplaceWin != null) {\n");
          html.append("\t\t\twindow.close();\n");
          html.append("\t\t}\n");
          html.append("\t}\n");
          html.append("}\n");
  
          html.append("function openWorkplace(url, name) {\n");
  
          Cookie wpDataCookie = getCookie(getRequest(), COOKIE_WP_DATA);
          boolean useCookieData = false;
          if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(wpDataCookie.getValue())) {
              String[] winValues = CmsStringUtil.splitAsArray(wpDataCookie.getValue(), '|');
              if (winValues.length == 4) {
                  useCookieData = true;
                  html.append("\tvar winLeft = ").append(winValues[0]).append(";\n");
                  html.append("\tvar winTop = ").append(winValues[1]).append(";\n");
                  html.append("\tvar winWidth = ").append(winValues[2]).append(";\n");
                  html.append("\tvar winHeight = ").append(winValues[3]).append(";\n");
              }
          }
  
          if (!useCookieData) {
              html.append("\tvar isInWin = (window.name.match(/^OpenCms\\d+$/) != null);\n");
              html.append("\tvar winHeight = 0, winWidth = 0, winTop = 0, winLeft = 0;\n");
              html.append("\tif (window.innerHeight) {\n");
              // Mozilla
              html.append("\t\twinHeight = window.innerHeight;\n");
              html.append("\t\twinWidth = window.innerWidth;\n");
              html.append("\t} else if (document.documentElement && document.documentElement.clientHeight) {\n");
              // IE 6 "strict" mode
              html.append("\t\twinHeight = document.documentElement.clientHeight;\n");
              html.append("\t\twinWidth = document.documentElement.clientWidth;\n");
              html.append("\t} else if (document.body && document.body.clientHeight) {\n");
              // IE 5, IE 6 "relaxed" mode
              html.append("\t\twinHeight = document.body.clientWidth;\n");
              html.append("\t\twinWidth = document.body.clientHeight;\n");
              html.append("\t}\n");
              html.append("\tif (window.screenY) {\n");
              // Mozilla
              html.append("\t\twinTop = window.screenY;\n");
              html.append("\t\twinLeft = window.screenX;\n");
              html.append("\t\tif (! isInWin) {\n");
              html.append("\t\t\twinTop += 25;\n");
              html.append("\t\t\twinLeft += 25;\n");
              html.append("\t\t}\n");
              html.append("\t} else if (window.screenTop) {\n");
              // IE
              html.append("\t\twinTop = window.screenTop;\n");
              html.append("\t\twinLeft = window.screenLeft;\n");
              html.append("\t}\n");
              html.append("\n");
          }
  
          if (requestedResource.startsWith(CmsWorkplace.VFS_PATH_WORKPLACE)) {
              html.append(
                  "\tvar openerStr = \"width=\" + winWidth + \",height=\" + winHeight + \",left=\" + winLeft + \",top=\" + winTop + \",scrollbars=no,location=no,toolbar=no,menubar=no,directories=no,status=yes,resizable=yes\";\n");
          } else {
              html.append(
                  "\tvar openerStr = \"width=\" + winWidth + \",height=\" + winHeight + \",left=\" + winLeft + \",top=\" + winTop + \",scrollbars=yes,location=yes,toolbar=yes,menubar=yes,directories=no,status=yes,resizable=yes\";\n");
          }
          html.append("\tvar OpenCmsWin = window.open(url, name, openerStr);\n");
          html.append("\n");
          html.append("\ttry{\n");
          html.append("\t\tif (! OpenCmsWin.opener) {\n");
          html.append("\t\t\tOpenCmsWin.opener = self;\n");
          html.append("\t\t}\n");
          html.append("\t\tif (OpenCmsWin.focus) {\n");
          html.append("\t\t\tOpenCmsWin.focus();\n");
          html.append("\t\t}\n");
          html.append("\t} catch (e) {}\n");
          html.append("\n");
          html.append("\treturn OpenCmsWin;\n");
          html.append("}\n");
  
          html.append("</script>\n");
      }