docs: public String openGallery() {
  
          StringBuffer jsOpener = new StringBuffer(32);
          String galleryType = null;
          try {
              CmsResource res = getCms().readResource(getParamResource());
              if (res != null) {
                  // get gallery path
                  String galleryPath = getParamResource();
                  if (!galleryPath.endsWith("/")) {
                      galleryPath += "/";
                  }
                  // get the matching gallery type name
                  galleryType = OpenCms.getResourceManager().getResourceType(res.getTypeId()).getTypeName();
                  StringBuffer galleryUri = new StringBuffer(256);
                  galleryUri.append(A_CmsAjaxGallery.PATH_GALLERIES);
                  String width = "650";
                  String height = "700";
                  // path to the gallery dialog with the required request parameters
                  galleryUri.append(galleryType);
                  galleryUri.append("/index.jsp?");
                  galleryUri.append(A_CmsAjaxGallery.PARAM_DIALOGMODE);
                  galleryUri.append("=");
                  galleryUri.append(A_CmsAjaxGallery.MODE_VIEW);
                  galleryUri.append("&");
                  galleryUri.append(A_CmsAjaxGallery.PARAM_PARAMS);
                  galleryUri.append("=");
                  JSONObject jsonObj = new JSONObject();
                  try {
                      jsonObj.putOpt(A_CmsAjaxGallery.PARAM_STARTUPFOLDER, galleryPath);
                      jsonObj.putOpt(A_CmsAjaxGallery.PARAM_STARTUPTYPE, A_CmsAjaxGallery.LISTMODE_GALLERY);
                  } catch (JSONException e) {
                      // ignore, because it should not happen!
                  }
                  galleryUri.append(jsonObj.toString());
                  // open new gallery dialog
                  jsOpener.append("window.open('");
                  jsOpener.append(getJsp().link(galleryUri.toString()));
  
                  jsOpener.append("', '");
                  jsOpener.append(galleryType);
                  jsOpener.append("','width=");
                  jsOpener.append(width);
                  jsOpener.append(", height=");
                  jsOpener.append(height);
                  jsOpener.append(", resizable=yes, top=100, left=270, status=yes');");
              }
          } catch (CmsException e) {
              // requested type is not configured
              CmsMessageContainer message = Messages.get().container(Messages.ERR_OPEN_GALLERY_1, galleryType);
              LOG.error(message.key(), e);
              throw new CmsRuntimeException(message, e);
          }
  
          return jsOpener.toString();
      }