Author: batosai
Date: 2008-08-05 15:13:22 +0000 (Tue, 05 Aug 2008)
New Revision: 21617
Modified:
trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
Log:
Added 'Known identities' page/form.
Modified: trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-05 14:46:14 UTC
(rev 21616)
+++ trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-05 15:13:22 UTC
(rev 21617)
@@ -59,6 +59,7 @@
pm.addNavigationLink(SELF_URI, "Home", "Home page", false,
null);
pm.addNavigationLink(SELF_URI + "/ownidentities", "Own
Identities", "Manage your own identities", false, null);
+ pm.addNavigationLink(SELF_URI + "/knownidentities", "Known
Identities", "Manage others identities", false, null);
pm.addNavigationLink("/plugins/", "Plugins page", "Back to
Plugins page", false, null);
client = pr.getHLSimpleClient();
@@ -78,6 +79,9 @@
if(page.equals("/ownidentities")) {
return makeOwnIdentitiesPage();
}
+ if(page.equals("/knownidentities")) {
+ return makeKnownIdentitiesPage();
+ }
else {
return makeHomePage();
}
@@ -102,6 +106,7 @@
new Date(0),
new Date(),
!request.getPartAsString("publishTrustList",1024).equals(""));
+ //TODO Make the new identity trust the seed
identity
db.store(identity);
db.commit();
}
@@ -177,6 +182,49 @@
return pageNode.generate();
}
+ private String makeKnownIdentitiesPage() {
+ HTMLNode pageNode = getPageNode();
+ HTMLNode contentNode = pm.getContentNode(pageNode);
+
+ HTMLNode addBox = pm.getInfobox("Add an identity");
+ HTMLNode addBoxContent = pm.getContentNode(addBox);
+
+ HTMLNode createForm = pr.addFormChild(addBoxContent, SELF_URI +
"/addIdentity", "addForm");
+ createForm.addChild("span", new String[] {"title", "style"},
new String[] { "This must be a valid Freenet URI.", "border-bottom: 1px dotted;
cursor: help;"} , "Identity URI : ");
+ createForm.addChild("input", new String[] {"type", "name",
"size"}, new String[] {"text", "identityURI", "70"});
+ createForm.addChild("input", new String[] { "type", "name",
"value" }, new String[] { "submit", "add", "Add this identity !" });
+
+ HTMLNode listBox = pm.getInfobox("Known Identities");
+ HTMLNode listBoxContent = pm.getContentNode(listBox);
+
+ if(wot.getNbIdentities() == 0) {
+ listBoxContent.addChild("p", "You know no other
identites yet, we are fetching the seedfile that contains a first set of
identities (Freenet developpers).");
+ }
+ else {
+ HTMLNode identitiesTable =
listBoxContent.addChild("table", "border", "0");
+ HTMLNode row=identitiesTable.addChild("tr");
+ row.addChild("th", "");
+ row.addChild("th", "Last update");
+ row.addChild("th", "Publish TrustList ?");
+
+ ObjectSet<Identity> identities =
db.queryByExample(Identity.class);
+ while(identities.hasNext()) {
+ Identity id = identities.next();
+
+ if(id instanceof OwnIdentity) continue;
+
+ row=identitiesTable.addChild("tr");
+ row.addChild("td", new String[] {"title",
"style"}, new String[] {id.getRequestURI().toString(), "cursor: help;"},
id.getRequestURI().getDocName());
+ row.addChild("td",
id.getLastChange().toString());
+ row.addChild("td", id.PublishesTrustList() ?
"true" : "false");
+ }
+ }
+
+ contentNode.addChild(addBox);
+ contentNode.addChild(listBox);
+ return pageNode.generate();
+ }
+
private String makeCreateIdentityPage(String nickName) {
HTMLNode pageNode = getPageNode();