コード例 #1
0
  public void handlerMenu(
      HttpServletRequest request,
      HttpServletResponse response,
      HttpSession session,
      AdminService admin,
      ExtendedMap formItems,
      ExtendedMap parameters,
      User user,
      Document verticalDoc)
      throws VerticalAdminException, TransformerException, IOException {

    // get resource tree xml
    ResourceFolder root = resourceService.getResourceRoot();
    ResourceXmlCreator xmlCreator = new ResourceXmlCreator();
    xmlCreator.setIncludeFullPath(true);
    xmlCreator.setListFolders(true);
    xmlCreator.setListResources(false);
    XMLDocument resourcesDoc = xmlCreator.createResourceTreeXml(root);

    Cookie cookie = CookieUtil.getCookie(request, "resourcePickerPath");
    if (cookie != null) {
      try {
        String resourcePickerPathBase64AndUrlEncoded = cookie.getValue();
        String resourcePickerPathBase64Encoded =
            UrlPathDecoder.decode(resourcePickerPathBase64AndUrlEncoded);
        String resourcePickerPath =
            new String(Base64Util.decode(resourcePickerPathBase64Encoded), "UTF-8");
        if (resourcePickerPath != null) {
          parameters.put("path", resourcePickerPath);
        }
      } catch (IllegalArgumentException e) {
        LOG.warn("Value in Cookie 'resourcePickerPath' is not base64 encoded ");
      }
    }

    // add popup parameters
    parameters.put("mimetype", formItems.get("mimetype", ""));
    parameters.put("extension", formItems.get("extension", ""));
    parameters.put("fieldname", formItems.get("fieldname"));
    parameters.put("subop", formItems.get("subop", ""));
    parameters.put("sourceKey", formItems.get("sourceKey", ""));
    parameters.put("destinationKey", formItems.get("destinationKey", ""));

    transformXML(
        request,
        response,
        resourcesDoc.getAsDOMDocument(),
        "resource_selector_frame1.xsl",
        parameters);
  }
コード例 #2
0
  public void handlerInUseBy(
      HttpServletRequest request,
      HttpServletResponse response,
      HttpSession session,
      AdminService admin,
      ExtendedMap formItems,
      ExtendedMap parameters,
      User user,
      Document verticalDoc)
      throws VerticalAdminException {

    ResourceKey resourceKey = ResourceKey.from(formItems.getString("resourcekey"));
    ResourceXmlCreator xmlCreator = new ResourceXmlCreator();
    ResourceFile resourceFile = resourceService.getResourceFile(resourceKey);
    Document doc = null;
    if (resourceFile != null) {
      xmlCreator.setUsedByMap(resourceService.getUsedBy(resourceFile.getResourceKey()));
      doc = xmlCreator.createResourceXml(resourceFile).getAsDOMDocument();
    }
    transformXML(request, response, doc, "resource_inuseby.xsl", parameters);
  }