protected void writeContents() throws IOException {
    getDataRepository().waitForCalculations();

    String prefix = getPrefix();
    PropertyKey projectRootKey = getStartingKey();
    String projectRoot = projectRootKey.path();
    String currentFilter = SelectLabelFilter.getCurrentFilter(getDataRepository(), projectRoot);
    boolean isSnippet = (env.containsKey(SnippetEnvironment.SNIPPET_ID));
    boolean isIndiv = (getID(getPSPProperties(), projectRootKey).indexOf("Indiv") != -1);
    boolean useData = SelectWBSFilterTeamData.usesDataBasedFilter(getDataRepository(), projectRoot);

    out.println("<html><head>");
    out.println("<link rel=stylesheet type='text/css' href='/style.css'>");
    if (isSnippet && StringUtils.hasValue(currentFilter))
      out.println("<link rel=stylesheet type='text/css' href='/reports/filter-style.css'>");
    out.println("<style>");
    out.println(" body { margin: 0pt; padding: 2px }");
    out.println(" h1   { margin: 0pt; padding: 0pt }");
    out.println(" h2   { margin: 0pt; padding: 0pt }");
    out.println("</style></head><body>");
    out.print("<h1 style='margin-top:0pt'><!-- editLink -->");
    out.print(HTMLUtils.escapeEntities(projectRoot));
    out.println("</h1>");
    out.print("<h2>");

    writeFilterIcon(projectRoot, currentFilter);
    if (isIndiv) writeHierarchyIconIndiv(projectRoot);
    else if (useData) writeHierarchyIconData(projectRoot);
    else writeHierarchyIconFrame(prefix, projectRoot);

    out.println("</h2>");
    String cmsPageTitle = (String) env.get("cmsPageTitle");
    if (cmsPageTitle != null) {
      out.print("<h2>");
      out.print(HTMLUtils.escapeEntities(cmsPageTitle));
      out.println("</h2>");
    }
    out.println("</body></html>");
  }
Exemplo n.º 2
0
  private void repairMasterProjectLinks() {
    if (!StringUtils.hasValue(masterPrefix)) return;

    String masterTagDataName = masterPrefix + "/" + processID + " Master Root Tag";
    Object tag = ctx.getData().getSimpleValue(masterTagDataName);
    if (!(tag instanceof TagData)) {
      couldNotRepairMasterLinks();
      return;
    }

    String url =
        WebServer.DASHBOARD_PROTOCOL
            + ":"
            + WebServer.urlEncodePath(masterPrefix)
            + "//"
            + processID
            + "/setup/subprojectEdit?do=update";
    try {
      InputStream in = new URL(url).openStream();
      while (in.read() != -1) ;
    } catch (Exception e) {
      couldNotRepairMasterLinks();
    }
  }