Examples of HTMLNode


Examples of freenet.support.HTMLNode

        getHTML(disabledNotBlown, msg),
        UserAlert.CRITICAL_ERROR, true, null, false, null);
  }
 
  private static HTMLNode getHTML(boolean disabledNotBlown, String msg) {
    HTMLNode div = new HTMLNode("div");
    if(disabledNotBlown) {
      div.addChild("p", NodeL10n.getBase().getString("RevocationKeyFoundUserAlert.textDisabled"));
      div.addChild("p", NodeL10n.getBase().getString("RevocationKeyFoundUserAlert.textDisabledDetail", "message", msg));
    } else {
      div.addChild("p", NodeL10n.getBase().getString("RevocationKeyFoundUserAlert.text"));
      div.addChild("p", NodeL10n.getBase().getString("RevocationKeyFoundUserAlert.textDetail", "message", msg));
    }
    return div;
  }
View Full Code Here

Examples of freenet.support.HTMLNode

    return true;
  }

  @Override
  public HTMLNode getHTMLText() {
    HTMLNode textNode = new HTMLNode("div");
    SubConfig sc = node.config.get("node");
    Option<?> o = sc.getOption("tempIPAddressHint");
   
    NodeL10n.getBase().addL10nSubstitution(textNode, "IPUndetectedUserAlert."+(node.ipDetector.isDetecting() ? "detectingWithConfigLink" : "unknownAddressWithConfigLink"),
        new String[] { "link" },
        new HTMLNode[] { HTMLNode.link("/config/"+sc.getPrefix()) });
   
    int peers = node.peers.getDarknetPeers().length;
    if(peers > 0)
      textNode.addChild("p", l10n("noIPMaybeFromPeers", "number", Integer.toString(peers)));
   
    if(node.ipDetector.noDetectPlugins()) {
      HTMLNode p = textNode.addChild("p");
      NodeL10n.getBase().addL10nSubstitution(p, "IPUndetectedUserAlert.loadDetectPlugins", new String[] { "plugins", "config", },
          new HTMLNode[] { HTMLNode.link("/plugins/"), HTMLNode.link("/config/node") });
    } else if(!node.ipDetector.hasJSTUN() && !node.ipDetector.isDetecting()) {
      HTMLNode p = textNode.addChild("p");
      NodeL10n.getBase().addL10nSubstitution(p, "IPUndetectedUserAlert.loadJSTUN", new String[] { "plugins" },
          new HTMLNode[] { HTMLNode.link("/plugins/") });
    }
   
    addPortForwardSuggestion(textNode);
   
    HTMLNode formNode = textNode.addChild("form", new String[] { "action", "method" }, new String[] { "/config/"+sc.getPrefix(), "post" });
    formNode.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "formPassword", node.clientCore.formPassword });
    formNode.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "subconfig", sc.getPrefix() });
    HTMLNode listNode = formNode.addChild("ul", "class", "config");
    HTMLNode itemNode = listNode.addChild("li");
    itemNode.addChild("span", "class", "configshortdesc", o.getLocalisedShortDesc()).addChild("input", new String[] { "type", "name", "value" }, new String[] { "text", sc.getPrefix() + ".tempIPAddressHint", o.getValueDisplayString() });
    itemNode.addChild("span", "class", "configlongdesc", o.getLocalisedLongDesc());
    formNode.addChild("input", new String[] { "type", "value" }, new String[] { "submit", NodeL10n.getBase().getString("UserAlert.apply") });
    formNode.addChild("input", new String[] { "type", "value" }, new String[] { "reset", NodeL10n.getBase().getString("UserAlert.reset") });
   
    return textNode;
  }
View Full Code Here

Examples of freenet.support.HTMLNode

        }
    }

    @Override
    public HTMLNode getHTMLText() {
        return new HTMLNode("#", getText());
    }
View Full Code Here

Examples of freenet.support.HTMLNode

   * @return
   */
  public HTMLNode getConfirmWarning(NETWORK_THREAT_LEVEL newThreatLevel, String checkboxName) {
    if(newThreatLevel == networkThreatLevel)
      return null; // Not going to be changed.
    HTMLNode parent = new HTMLNode("div");
    if((newThreatLevel == NETWORK_THREAT_LEVEL.HIGH && networkThreatLevel != NETWORK_THREAT_LEVEL.MAXIMUM) ||
        newThreatLevel == NETWORK_THREAT_LEVEL.MAXIMUM) {
      if(node.peers.getDarknetPeers().length == 0) {
        parent.addChild("p", l10n("noFriendsWarning"));
        if(newThreatLevel == NETWORK_THREAT_LEVEL.MAXIMUM) {
          HTMLNode p = parent.addChild("p");
          NodeL10n.getBase().addL10nSubstitution(p, "SecurityLevels.maximumNetworkThreatLevelWarning", new String[] { "bold" },
              new HTMLNode[] { HTMLNode.STRONG });
        }
        parent.addChild("input", new String[] { "type", "name", "value" }, new String[] { "checkbox", checkboxName, "off" }, l10n("noFriendsCheckbox"));
        return parent;
      } else if(node.peers.countConnectedDarknetPeers() == 0) {
        parent.addChild("p", l10n("noConnectedFriendsWarning", "added", Integer.toString(node.peers.getDarknetPeers().length)));
        if(newThreatLevel == NETWORK_THREAT_LEVEL.MAXIMUM) {
          HTMLNode p = parent.addChild("p");
          NodeL10n.getBase().addL10nSubstitution(p, "SecurityLevels.maximumNetworkThreatLevelWarning", new String[] { "bold" },
              new HTMLNode[] { HTMLNode.STRONG });
        }
        parent.addChild("input", new String[] { "type", "name", "value" }, new String[] { "checkbox", checkboxName, "off" }, l10n("noConnectedFriendsCheckbox"));
        return parent;
      } else if(node.peers.countConnectedDarknetPeers() < 10) {
        parent.addChild("p", l10n("fewConnectedFriendsWarning", new String[] { "connected", "added" }, new String[] { Integer.toString(node.peers.countConnectedDarknetPeers()), Integer.toString(node.peers.getDarknetPeers().length)}));
        if(newThreatLevel == NETWORK_THREAT_LEVEL.MAXIMUM) {
          HTMLNode p = parent.addChild("p");
          NodeL10n.getBase().addL10nSubstitution(p, "SecurityLevels.maximumNetworkThreatLevelWarning", new String[] { "bold" },
              new HTMLNode[] { HTMLNode.STRONG });
        }
        parent.addChild("input", new String[] { "type", "name", "value" }, new String[] { "checkbox", checkboxName, "off" }, l10n("fewConnectedFriendsCheckbox"));
        return parent;
      }
    } else if(newThreatLevel == NETWORK_THREAT_LEVEL.LOW) {
      parent.addChild("p", l10n("networkThreatLevelLowWarning"));
      parent.addChild("input", new String[] { "type", "name", "value" }, new String[] { "checkbox", checkboxName, "off" }, l10n("networkThreatLevelLowCheckbox"));
      return parent;
    } // Don't warn on switching to NORMAL.
    if(newThreatLevel == NETWORK_THREAT_LEVEL.MAXIMUM) {
      HTMLNode p = parent.addChild("p");
      NodeL10n.getBase().addL10nSubstitution(p, "SecurityLevels.maximumNetworkThreatLevelWarning", new String[] { "bold" },
          new HTMLNode[] { HTMLNode.STRONG });
      p.addChild("#", " ");
      NodeL10n.getBase().addL10nSubstitution(p, "SecurityLevels.maxSecurityYouNeedFriends", new String[] { "bold" },
          new HTMLNode[] { HTMLNode.STRONG });
      parent.addChild("input", new String[] { "type", "name", "value" }, new String[] { "checkbox", checkboxName, "off" }, l10n("maximumNetworkThreatLevelCheckbox"));
      return parent;
    }
View Full Code Here

Examples of freenet.support.HTMLNode

  }

  private void downloadDisallowedPage (NotAllowedException e, String downloadPath, ToadletContext ctx)
          throws IOException, ToadletContextClosedException {
    PageNode page = ctx.getPageMaker().getPageNode(l10n("downloadFiles"), ctx);
    HTMLNode pageNode = page.outer;
    HTMLNode contentNode = page.content;
    Logger.warning(this, e.toString());
    HTMLNode alert = ctx.getPageMaker().getInfobox("infobox-alert",
      l10n("downloadFiles"), contentNode, "grouped-downloads", true);
    alert.addChild("ul", l10n("downloadDisallowed", "directory", downloadPath));
    alert.addChild("a", "href", path(),
      NodeL10n.getBase().getString("Toadlet.returnToQueuepage"));
    writeHTMLReply(ctx, 200, "OK", pageNode.generate());
  }
View Full Code Here

Examples of freenet.support.HTMLNode

    writeHTMLReply(ctx, 200, "OK", WelcomeToadlet.sendRestartingPageInner(ctx).generate());
  }

  private void sendConfirmPanicPage(ToadletContext ctx) throws ToadletContextClosedException, IOException {
    PageNode page = ctx.getPageMaker().getPageNode(l10n("confirmPanicButtonPageTitle"), ctx);
    HTMLNode pageNode = page.outer;
    HTMLNode contentNode = page.content;

    HTMLNode content = ctx.getPageMaker().getInfobox("infobox-error",
            l10n("confirmPanicButtonPageTitle"), contentNode, "confirm-panic", true).
            addChild("div", "class", "infobox-content");

    content.addChild("p", l10n("confirmPanicButton"));

    HTMLNode form = ctx.addFormChild(content, path(), "confirmPanicButton");
    form.addChild("p").addChild("input",
            new String[] { "type", "name", "value" },
            new String[] { "submit", "confirmpanic", l10n("confirmPanicButtonYes") });
    form.addChild("p").addChild("input",
            new String[] { "type", "name", "value" },
            new String[] { "submit", "noconfirmpanic", l10n("confirmPanicButtonNo") });

    if(uploads)
      content.addChild("p").addChild("a", "href", path(), l10n("backToUploadsPage"));
View Full Code Here

Examples of freenet.support.HTMLNode

  private void sendPersistenceDisabledError(ToadletContext ctx) throws ToadletContextClosedException, IOException {
    String title = l10n("awaitingPasswordTitle"+(uploads ? "Uploads" : "Downloads"));
    if(core.node.awaitingPassword()) {
      PageNode page = ctx.getPageMaker().getPageNode(title, ctx);
      HTMLNode pageNode = page.outer;
      HTMLNode contentNode = page.content;

      HTMLNode infoboxContent = ctx.getPageMaker().getInfobox("infobox-error", title, contentNode, null, true);

      SecurityLevelsToadlet.generatePasswordFormPage(false, container, infoboxContent, false, false, false, null, path());

      addHomepageLink(infoboxContent);
View Full Code Here

Examples of freenet.support.HTMLNode

  }

  private void writeError(String header, String message, ToadletContext context, boolean returnToQueuePage, boolean returnToInsertPage) throws ToadletContextClosedException, IOException {
    PageMaker pageMaker = context.getPageMaker();
    PageNode page = pageMaker.getPageNode(header, context);
    HTMLNode pageNode = page.outer;
    HTMLNode contentNode = page.content;
    if(context.isAllowedFullAccess())
      contentNode.addChild(context.getAlertManager().createSummary());
    HTMLNode infoboxContent = pageMaker.getInfobox("infobox-error", header, contentNode, "queue-error", false);
    infoboxContent.addChild("#", message);
    if(returnToQueuePage)
      NodeL10n.getBase().addL10nSubstitution(infoboxContent.addChild("div"), "QueueToadlet.returnToQueuePage", new String[] { "link" }, new HTMLNode[] { HTMLNode.link(path()) });
    else if(returnToInsertPage)
      NodeL10n.getBase().addL10nSubstitution(infoboxContent.addChild("div"), "QueueToadlet.tryAgainUploadFilePage", new String[] { "link" }, new HTMLNode[] { HTMLNode.link(FileInsertWizardToadlet.PATH) });
    writeHTMLReply(context, 400, "Bad request", pageNode.generate());
  }
View Full Code Here

Examples of freenet.support.HTMLNode

   
    if(!(count || keys)) {
      try {
        RequestStatus[] reqs = fcp.getGlobalRequests();
        MultiValueTable<String, String> pageHeaders = new MultiValueTable<String, String>();
        HTMLNode pageNode = handleGetInner(pageMaker, reqs, core.clientContext, request, ctx);
        writeHTMLReply(ctx, 200, "OK", pageHeaders, pageNode.generate());
        return;
      } catch (PersistenceDisabledException e) {
        sendPersistenceDisabledError(ctx);
        return;
      }
    }

    try {
      core.clientContext.jobRunner.queue(new PersistentJob() {

        @Override
        public String toString() {
          return "QueueToadlet ShowQueue";
        }

        @Override
        public boolean run(ClientContext context) {
          HTMLNode pageNode = null;
          String plainText = null;
          try {
            if(count) {
              long queued = core.requestStarters.chkFetchSchedulerBulk.countPersistentWaitingKeys() + core.requestStarters.chkFetchSchedulerRT.countPersistentWaitingKeys();
              Logger.minor(this, "Total waiting CHKs: "+queued);
              long reallyQueued = core.requestStarters.chkFetchSchedulerBulk.countQueuedRequests() + core.requestStarters.chkFetchSchedulerRT.countQueuedRequests();
              Logger.minor(this, "Total queued CHK requests (including transient): "+reallyQueued);
              PageNode page = pageMaker.getPageNode(l10n("title"), ctx);
              pageNode = page.outer;
              HTMLNode contentNode = page.content;
              /* add alert summary box */
              if(ctx.isAllowedFullAccess())
                contentNode.addChild(ctx.getAlertManager().createSummary());
              HTMLNode infoboxContent = pageMaker.getInfobox("infobox-information", "Queued requests status", contentNode, null, false);
              infoboxContent.addChild("p", "Total awaiting CHKs: "+queued);
              infoboxContent.addChild("p", "Total queued CHK requests: "+reallyQueued);
              return false;
            } else /*if(keys)*/ {
              try {
                plainText = makeFetchKeysList(context);
              } catch (PersistenceDisabledException e) {
                plainText = null;
              }
              return false;
            }
          } finally {
            synchronized(ow) {
              ow.done = true;
              ow.pageNode = pageNode;
              ow.plainText = plainText;
              ow.notifyAll();
            }
          }
        }
      // Do not use maximal priority: There may be exceptional cases which have higher priority than the UI, to get rid of excessive garbage for example.
      }, NativeThread.HIGH_PRIORITY);
    } catch (PersistenceDisabledException e1) {
      sendPersistenceDisabledError(ctx);
      return;
    }

    HTMLNode pageNode;
    String plainText;
    synchronized(ow) {
      while(true) {
        if(ow.done) {
          pageNode = ow.pageNode;
          plainText = ow.plainText;
          break;
        }
        try {
          ow.wait();
        } catch (InterruptedException e) {
          // Ignore
        }
      }
    }

    MultiValueTable<String, String> pageHeaders = new MultiValueTable<String, String>();
    if(pageNode != null)
      writeHTMLReply(ctx, 200, "OK", pageHeaders, pageNode.generate());
    else if(plainText != null)
      this.writeReply(ctx, 200, "text/plain", "OK", plainText);
    else {
      if(core.killedDatabase())
        sendPersistenceDisabledError(ctx);
View Full Code Here

Examples of freenet.support.HTMLNode

        '/' + failedDownload.size() +
        '/' + (completedDownloadToDisk.size() + completedDownloadToTemp.size()) +
        ") "+l10n("titleDownloads");

    PageNode page = pageMaker.getPageNode(pageName, ctx);
    HTMLNode pageNode = page.outer;
    HTMLNode contentNode = page.content;

    /* add alert summary box */
    if(ctx.isAllowedFullAccess())
      contentNode.addChild(ctx.getAlertManager().createSummary());

    /* navigation bar */
    InfoboxNode infobox = pageMaker.getInfobox("navbar", l10n("requestNavigation"), null, false);
    HTMLNode navigationBar = infobox.outer;
    HTMLNode navigationContent = infobox.content.addChild("ul");
    boolean includeNavigationBar = false;
    if (!completedDownloadToTemp.isEmpty()) {
      navigationContent.addChild("li").addChild("a", "href", "#completedDownloadToTemp", l10n("completedDtoTemp", new String[]{ "size" }, new String[]{ String.valueOf(completedDownloadToTemp.size()) }));
      includeNavigationBar = true;
    }
    if (!completedDownloadToDisk.isEmpty()) {
      navigationContent.addChild("li").addChild("a", "href", "#completedDownloadToDisk", l10n("completedDtoDisk", new String[]{ "size" }, new String[]{ String.valueOf(completedDownloadToDisk.size()) }));
      includeNavigationBar = true;
    }
    if (!completedUpload.isEmpty()) {
      navigationContent.addChild("li").addChild("a", "href", "#completedUpload", l10n("completedU", new String[]{ "size" }, new String[]{ String.valueOf(completedUpload.size()) }));
      includeNavigationBar = true;
    }
    if (!completedDirUpload.isEmpty()) {
      navigationContent.addChild("li").addChild("a", "href", "#completedDirUpload", l10n("completedDU", new String[]{ "size" }, new String[]{ String.valueOf(completedDirUpload.size()) }));
      includeNavigationBar = true;
    }
    if (!failedDownload.isEmpty()) {
      navigationContent.addChild("li").addChild("a", "href", "#failedDownload", l10n("failedD", new String[]{ "size" }, new String[]{ String.valueOf(failedDownload.size()) }));
      includeNavigationBar = true;
    }
    if (!failedUpload.isEmpty()) {
      navigationContent.addChild("li").addChild("a", "href", "#failedUpload", l10n("failedU", new String[]{ "size" }, new String[]{ String.valueOf(failedUpload.size()) }));
      includeNavigationBar = true;
    }
    if (!failedDirUpload.isEmpty()) {
      navigationContent.addChild("li").addChild("a", "href", "#failedDirUpload", l10n("failedDU", new String[]{ "size" }, new String[]{ String.valueOf(failedDirUpload.size()) }));
      includeNavigationBar = true;
    }
    if (failedUnknownMIMEType.size() > 0) {
      String[] types = failedUnknownMIMEType.keySet().toArray(new String[failedUnknownMIMEType.size()]);
      Arrays.sort(types);
      for(String type : types) {
        String atype = type.replace("-", "--").replace('/', '-');
        navigationContent.addChild("li").addChild("a", "href", "#failedDownload-unknowntype-"+atype, l10n("failedDUnknownMIME", new String[]{ "size", "type" }, new String[]{ String.valueOf(failedUnknownMIMEType.get(type).size()), type }));
      }
    }
    if (failedBadMIMEType.size() > 0) {
      String[] types = failedBadMIMEType.keySet().toArray(new String[failedBadMIMEType.size()]);
      Arrays.sort(types);
      for(String type : types) {
        String atype = type.replace("-", "--").replace('/', '-');
        navigationContent.addChild("li").addChild("a", "href", "#failedDownload-badtype-"+atype, l10n("failedDBadMIME", new String[]{ "size", "type" }, new String[]{ String.valueOf(failedBadMIMEType.get(type).size()), type }));
      }
    }
    if (!uncompletedDownload.isEmpty()) {
      navigationContent.addChild("li").addChild("a", "href", "#uncompletedDownload", l10n("DinProgress", new String[]{ "size" }, new String[]{ String.valueOf(uncompletedDownload.size()) }));
      includeNavigationBar = true;
    }
    if (!uncompletedUpload.isEmpty()) {
      navigationContent.addChild("li").addChild("a", "href", "#uncompletedUpload", l10n("UinProgress", new String[]{ "size" }, new String[]{ String.valueOf(uncompletedUpload.size()) }));
      includeNavigationBar = true;
    }
    if (!uncompletedDirUpload.isEmpty()) {
      navigationContent.addChild("li").addChild("a", "href", "#uncompletedDirUpload", l10n("DUinProgress", new String[]{ "size" }, new String[]{ String.valueOf(uncompletedDirUpload.size()) }));
      includeNavigationBar = true;
    }
    if (totalQueuedDownloadSize > 0) {
      navigationContent.addChild("li", l10n("totalQueuedDownloads", "size", SizeUtil.formatSize(totalQueuedDownloadSize)));
      includeNavigationBar = true;
    }
    if (totalQueuedUploadSize > 0) {
      navigationContent.addChild("li", l10n("totalQueuedUploads", "size", SizeUtil.formatSize(totalQueuedUploadSize)));
      includeNavigationBar = true;
    }

        navigationContent.addChild("li").addChild("a", "href", FETCH_KEY_LIST_LOCATION,
                                                  l10n("openKeyList"));

    if (includeNavigationBar) {
      contentNode.addChild(navigationBar);
    }

    final String[] priorityClasses = new String[] {
        l10n("priority0"),
        l10n("priority1"),
        l10n("priority2"),
        l10n("priority3"),
        l10n("priority4"),
        l10n("priority5"),
        l10n("priority6")
    };

    boolean advancedModeEnabled = pageMaker.advancedMode(request, this.container);

    HTMLNode legendContent = pageMaker.getInfobox("legend", l10n("legend"), contentNode, "queue-legend", true);
    HTMLNode legendTable = legendContent.addChild("table", "class", "queue");
    HTMLNode legendRow = legendTable.addChild("tr");
    for(int i=0; i<7; i++){
        if(i > RequestStarter.INTERACTIVE_PRIORITY_CLASS || advancedModeEnabled || i <= lowestQueuedPrio)
            legendRow.addChild("td", "class", "priority" + i, priorityClasses[i]);
    }

    if (SimpleToadletServer.isPanicButtonToBeShown) {
        // There may be persistent downloads etc under other PersistentRequestClient's, so still show it.
      contentNode.addChild(createPanicBox(pageMaker, ctx));
    }

    final QueueColumn[] advancedModeFailure = new QueueColumn[] {
            QueueColumn.IDENTIFIER,
            QueueColumn.FILENAME,
            QueueColumn.SIZE,
            QueueColumn.MIME_TYPE,
            QueueColumn.PROGRESS,
            QueueColumn.REASON,
            QueueColumn.PERSISTENCE,
            QueueColumn.KEY };
   
    final QueueColumn[] simpleModeFailure = new QueueColumn[] {
            QueueColumn.FILENAME,
            QueueColumn.SIZE,
            QueueColumn.PROGRESS,
            QueueColumn.REASON,
            QueueColumn.KEY };

    if (!completedDownloadToTemp.isEmpty()) {
      contentNode.addChild("a", "id", "completedDownloadToTemp");
      HTMLNode completedDownloadsToTempContent = pageMaker.getInfobox("completed_requests", l10n("completedDinTempDirectory", new String[]{ "size" }, new String[]{ String.valueOf(completedDownloadToTemp.size()) }), contentNode, "request-completed", false);
      if (advancedModeEnabled) {
        completedDownloadsToTempContent.addChild(createRequestTable(pageMaker, ctx, completedDownloadToTemp, new QueueColumn[] { QueueColumn.IDENTIFIER, QueueColumn.SIZE, QueueColumn.MIME_TYPE, QueueColumn.PERSISTENCE, QueueColumn.KEY, QueueColumn.COMPAT_MODE }, priorityClasses, advancedModeEnabled, false, "completed-temp", true, true));
      } else {
        completedDownloadsToTempContent.addChild(createRequestTable(pageMaker, ctx, completedDownloadToTemp, new QueueColumn[] { QueueColumn.SIZE, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, false, "completed-temp", true, true));
      }
    }

    if (!completedDownloadToDisk.isEmpty()) {
      contentNode.addChild("a", "id", "completedDownloadToDisk");
      HTMLNode completedToDiskInfoboxContent = pageMaker.getInfobox("completed_requests", l10n("completedDinDownloadDirectory", new String[]{ "size" }, new String[]{ String.valueOf(completedDownloadToDisk.size()) }), contentNode, "request-completed", false);
      if (advancedModeEnabled) {
        completedToDiskInfoboxContent.addChild(createRequestTable(pageMaker, ctx, completedDownloadToDisk, new QueueColumn[] { QueueColumn.IDENTIFIER, QueueColumn.FILENAME, QueueColumn.SIZE, QueueColumn.MIME_TYPE, QueueColumn.PERSISTENCE, QueueColumn.KEY, QueueColumn.COMPAT_MODE }, priorityClasses, advancedModeEnabled, false, "completed-disk", false, true));
      } else {
        completedToDiskInfoboxContent.addChild(createRequestTable(pageMaker, ctx, completedDownloadToDisk, new QueueColumn[] { QueueColumn.FILENAME, QueueColumn.SIZE, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, false, "completed-disk", false, true));
      }
    }

    if (!completedUpload.isEmpty()) {
      contentNode.addChild("a", "id", "completedUpload");
      HTMLNode completedUploadInfoboxContent = pageMaker.getInfobox("completed_requests", l10n("completedU", new String[]{ "size" }, new String[]{ String.valueOf(completedUpload.size()) }), contentNode, "download-completed", false);
      if (advancedModeEnabled) {
        completedUploadInfoboxContent.addChild(createRequestTable(pageMaker, ctx, completedUpload, new QueueColumn[] { QueueColumn.IDENTIFIER, QueueColumn.FILENAME, QueueColumn.SIZE, QueueColumn.MIME_TYPE, QueueColumn.PERSISTENCE, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, true, "completed-upload-file", false, true));
      } else  {
        completedUploadInfoboxContent.addChild(createRequestTable(pageMaker, ctx, completedUpload, new QueueColumn[] { QueueColumn.FILENAME, QueueColumn.SIZE, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, true, "completed-upload-file", false, true));
      }
    }

    if (!completedDirUpload.isEmpty()) {
      contentNode.addChild("a", "id", "completedDirUpload");
      HTMLNode completedUploadDirContent = pageMaker.getInfobox("completed_requests", l10n("completedUDirectory", new String[]{ "size" }, new String[]{ String.valueOf(completedDirUpload.size()) }), contentNode, "download-completed", false);
      if (advancedModeEnabled) {
        completedUploadDirContent.addChild(createRequestTable(pageMaker, ctx, completedDirUpload, new QueueColumn[] { QueueColumn.IDENTIFIER, QueueColumn.FILES, QueueColumn.TOTAL_SIZE, QueueColumn.PERSISTENCE, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, true, "completed-upload-dir", false, true));
      } else {
        completedUploadDirContent.addChild(createRequestTable(pageMaker, ctx, completedDirUpload, new QueueColumn[] { QueueColumn.FILES, QueueColumn.TOTAL_SIZE, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, true, "completed-upload-dir", false, true));
      }
    }

    if (!failedDownload.isEmpty()) {
      contentNode.addChild("a", "id", "failedDownload");
      HTMLNode failedContent = pageMaker.getInfobox("failed_requests", l10n("failedD", new String[]{ "size" }, new String[]{ String.valueOf(failedDownload.size()) }), contentNode, "download-failed", false);
      if (advancedModeEnabled) {
        failedContent.addChild(createRequestTable(pageMaker, ctx, failedDownload, advancedModeFailure, priorityClasses, advancedModeEnabled, false, "failed-download", false, true, false, false, null));
      } else {
        failedContent.addChild(createRequestTable(pageMaker, ctx, failedDownload, simpleModeFailure, priorityClasses, advancedModeEnabled, false, "failed-download", false, true, false, false, null));
      }
    }

    if (!failedUpload.isEmpty()) {
      contentNode.addChild("a", "id", "failedUpload");
      HTMLNode failedContent = pageMaker.getInfobox("failed_requests", l10n("failedU", new String[]{ "size" }, new String[]{ String.valueOf(failedUpload.size()) }), contentNode, "upload-failed", false);
      if (advancedModeEnabled) {
        failedContent.addChild(createRequestTable(pageMaker, ctx, failedUpload, advancedModeFailure, priorityClasses, advancedModeEnabled, true, "failed-upload-file", false, true, false, false, null));
      } else {
        failedContent.addChild(createRequestTable(pageMaker, ctx, failedUpload, simpleModeFailure, priorityClasses, advancedModeEnabled, true, "failed-upload-file", false, true, false, false, null));
      }
    }

    if (!failedDirUpload.isEmpty()) {
      contentNode.addChild("a", "id", "failedDirUpload");
      HTMLNode failedContent = pageMaker.getInfobox("failed_requests", l10n("failedU", new String[]{ "size" }, new String[]{ String.valueOf(failedDirUpload.size()) }), contentNode, "upload-failed", false);
      if (advancedModeEnabled) {
        failedContent.addChild(createRequestTable(pageMaker, ctx, failedDirUpload, new QueueColumn[] { QueueColumn.IDENTIFIER, QueueColumn.FILES, QueueColumn.TOTAL_SIZE, QueueColumn.PROGRESS, QueueColumn.REASON, QueueColumn.PERSISTENCE, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, true, "failed-upload-dir", false, true, false, false, null));
      } else {
        failedContent.addChild(createRequestTable(pageMaker, ctx, failedDirUpload, new QueueColumn[] { QueueColumn.FILES, QueueColumn.TOTAL_SIZE, QueueColumn.PROGRESS, QueueColumn.REASON, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, true, "failed-upload-dir", false, true, false, false, null));
      }
    }

    if(!failedBadMIMEType.isEmpty()) {
      String[] types = failedBadMIMEType.keySet().toArray(new String[failedBadMIMEType.size()]);
      Arrays.sort(types);
      for(String type : types) {
        LinkedList<DownloadRequestStatus> getters = failedBadMIMEType.get(type);
        String atype = type.replace("-", "--").replace('/', '-');
        contentNode.addChild("a", "id", "failedDownload-badtype-"+atype);
        FilterMIMEType typeHandler = ContentFilter.getMIMEType(type);
        HTMLNode failedContent = pageMaker.getInfobox("failed_requests", l10n("failedDBadMIME", new String[]{ "size", "type" }, new String[]{ String.valueOf(getters.size()), type }), contentNode, "download-failed-"+atype, false);
        // FIXME add a class for easier styling.
        KnownUnsafeContentTypeException e = new KnownUnsafeContentTypeException(typeHandler);
        failedContent.addChild("p", l10n("badMIMETypeIntro", "type", type));
        List<String> detail = e.details();
        if(detail != null && !detail.isEmpty()) {
          HTMLNode list = failedContent.addChild("ul");
          for(String s : detail)
            list.addChild("li", s);
        }
        failedContent.addChild("p", l10n("mimeProblemFetchAnyway"));
        Collections.sort(getters, jobComparator);
        if (advancedModeEnabled) {
          failedContent.addChild(createRequestTable(pageMaker, ctx, getters, new QueueColumn[] { QueueColumn.IDENTIFIER, QueueColumn.FILENAME, QueueColumn.SIZE, QueueColumn.PERSISTENCE, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, false, "failed-download-file-badmime", false, true, true, false, type));
        } else {
          failedContent.addChild(createRequestTable(pageMaker, ctx, getters, new QueueColumn[] { QueueColumn.FILENAME, QueueColumn.SIZE, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, false, "failed-download-file-badmime", false, true, true, false, type));
        }
      }
    }

    if(!failedUnknownMIMEType.isEmpty()) {
      String[] types = failedUnknownMIMEType.keySet().toArray(new String[failedUnknownMIMEType.size()]);
      Arrays.sort(types);
      for(String type : types) {
        LinkedList<DownloadRequestStatus> getters = failedUnknownMIMEType.get(type);
        String atype = type.replace("-", "--").replace('/', '-');
        contentNode.addChild("a", "id", "failedDownload-unknowntype-"+atype);
        HTMLNode failedContent = pageMaker.getInfobox("failed_requests", l10n("failedDUnknownMIME", new String[]{ "size", "type" }, new String[]{ String.valueOf(getters.size()), type }), contentNode, "download-failed-"+atype, false);
        // FIXME add a class for easier styling.
        failedContent.addChild("p", NodeL10n.getBase().getString("UnknownContentTypeException.explanation", "type", type));
        failedContent.addChild("p", l10n("mimeProblemFetchAnyway"));
        Collections.sort(getters, jobComparator);
        if (advancedModeEnabled) {
          failedContent.addChild(createRequestTable(pageMaker, ctx, getters, new QueueColumn[] { QueueColumn.IDENTIFIER, QueueColumn.FILENAME, QueueColumn.SIZE, QueueColumn.PERSISTENCE, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, false, "failed-download-file-unknownmime", false, true, true, false, type));
        } else {
          failedContent.addChild(createRequestTable(pageMaker, ctx, getters, new QueueColumn[] { QueueColumn.FILENAME, QueueColumn.SIZE, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, false, "failed-download-file-unknownmime", false, true, true, false, type));
        }
      }

    }

    if (!uncompletedDownload.isEmpty()) {
      contentNode.addChild("a", "id", "uncompletedDownload");
      HTMLNode uncompletedContent = pageMaker.getInfobox("requests_in_progress", l10n("wipD", new String[]{ "size" }, new String[]{ String.valueOf(uncompletedDownload.size()) }), contentNode, "download-progressing", false);
      if (advancedModeEnabled) {
        uncompletedContent.addChild(createRequestTable(pageMaker, ctx, uncompletedDownload, new QueueColumn[] { QueueColumn.IDENTIFIER, QueueColumn.PRIORITY, QueueColumn.SIZE, QueueColumn.MIME_TYPE, QueueColumn.PROGRESS, QueueColumn.LAST_ACTIVITY, QueueColumn.PERSISTENCE, QueueColumn.FILENAME, QueueColumn.KEY, QueueColumn.COMPAT_MODE }, priorityClasses, advancedModeEnabled, false, "uncompleted-download", false, false));
      } else {
        uncompletedContent.addChild(createRequestTable(pageMaker, ctx, uncompletedDownload, new QueueColumn[] { QueueColumn.PRIORITY, QueueColumn.SIZE, QueueColumn.PROGRESS, QueueColumn.LAST_ACTIVITY, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, false, "uncompleted-download", false, false));
      }
    }

    if (!uncompletedUpload.isEmpty()) {
      contentNode.addChild("a", "id", "uncompletedUpload");
      HTMLNode uncompletedContent = pageMaker.getInfobox("requests_in_progress", l10n("wipU", new String[]{ "size" }, new String[]{ String.valueOf(uncompletedUpload.size()) }), contentNode, "upload-progressing", false);
      if (advancedModeEnabled) {
        uncompletedContent.addChild(createRequestTable(pageMaker, ctx, uncompletedUpload, new QueueColumn[] { QueueColumn.IDENTIFIER, QueueColumn.PRIORITY, QueueColumn.SIZE, QueueColumn.MIME_TYPE, QueueColumn.PROGRESS, QueueColumn.LAST_ACTIVITY, QueueColumn.PERSISTENCE, QueueColumn.FILENAME, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, true, "uncompleted-upload-file", false, false));
      } else {
        uncompletedContent.addChild(createRequestTable(pageMaker, ctx, uncompletedUpload, new QueueColumn[] { QueueColumn.PRIORITY, QueueColumn.FILENAME, QueueColumn.SIZE, QueueColumn.PROGRESS, QueueColumn.LAST_ACTIVITY, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, true, "uncompleted-upload-file", false, false));
      }
    }

    if (!uncompletedDirUpload.isEmpty()) {
      contentNode.addChild("a", "id", "uncompletedDirUpload");
      HTMLNode uncompletedContent = pageMaker.getInfobox("requests_in_progress", l10n("wipDU", new String[]{ "size" }, new String[]{ String.valueOf(uncompletedDirUpload.size()) }), contentNode, "download-progressing upload-progressing", false);
      if (advancedModeEnabled) {
        uncompletedContent.addChild(createRequestTable(pageMaker, ctx, uncompletedDirUpload, new QueueColumn[] { QueueColumn.IDENTIFIER, QueueColumn.FILES, QueueColumn.PRIORITY, QueueColumn.TOTAL_SIZE, QueueColumn.PROGRESS, QueueColumn.LAST_ACTIVITY, QueueColumn.PERSISTENCE, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, true, "uncompleted-upload-dir", false, false));
      } else {
        uncompletedContent.addChild(createRequestTable(pageMaker, ctx, uncompletedDirUpload, new QueueColumn[] { QueueColumn.PRIORITY, QueueColumn.FILES, QueueColumn.TOTAL_SIZE, QueueColumn.PROGRESS, QueueColumn.LAST_ACTIVITY, QueueColumn.KEY }, priorityClasses, advancedModeEnabled, true, "uncompleted-upload-dir", false, false));
      }
    }

    if(!uploads) {
      contentNode.addChild(createBulkDownloadForm(ctx, pageMaker));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.