Author: batosai
Date: 2008-08-23 16:52:48 +0000 (Sat, 23 Aug 2008)
New Revision: 22119
Modified:
trunk/apps/WoT/src/plugins/WoT/Identity.java
trunk/apps/WoT/src/plugins/WoT/WebInterface.java
trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
Log:
Added a page to display all OwnIdentity's parameters (bug #2506).
Modified: trunk/apps/WoT/src/plugins/WoT/Identity.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/Identity.java 2008-08-23 12:41:30 UTC
(rev 22118)
+++ trunk/apps/WoT/src/plugins/WoT/Identity.java 2008-08-23 16:52:48 UTC
(rev 22119)
@@ -209,6 +209,10 @@
return props.get(key);
}
+ public String getPropsAsString() {
+ return props.toString();
+ }
+
/**
* Removes a property from the list. Does nothing if it didn't exist.
* @param key
@@ -243,6 +247,10 @@
return contexts.contains(context.trim());
}
+ public String getContextsAsString() {
+ return contexts.toString();
+ }
+
/**
* Removes a context from this identity
* @param context
Modified: trunk/apps/WoT/src/plugins/WoT/WebInterface.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WebInterface.java 2008-08-23 12:41:30 UTC
(rev 22118)
+++ trunk/apps/WoT/src/plugins/WoT/WebInterface.java 2008-08-23 16:52:48 UTC
(rev 22119)
@@ -5,6 +5,7 @@
*/
package plugins.WoT;
+import java.net.MalformedURLException;
import java.util.Date;
import com.db4o.ObjectContainer;
@@ -85,6 +86,7 @@
row.addChild("th", "Last change");
row.addChild("th", "Last insert");
row.addChild("th", "Publish TrustList ?");
+ row.addChild("th", "Edit");
while(ownIdentities.hasNext()) {
OwnIdentity id = ownIdentities.next();
@@ -102,6 +104,11 @@
cell.addChild(new HTMLNode("a", "href",
"/"+id.getRequestURI().toString(), id.getLastInsert().toString()));
}
row.addChild("td", id.doesPublishTrustList() ?
"Yes" : "No");
+
+ HTMLNode editCell = row.addChild("td");
+ HTMLNode editForm = pr.addFormChild(editCell,
SELF_URI + "/editIdentity", "editForm");
+ editForm.addChild("input", new String[] {
"type", "name", "value" }, new String[] { "hidden", "id",
id.getRequestURI().toString() });
+ editForm.addChild("input", new String[] {
"type", "name", "value" }, new String[] { "submit", "edit", "Edit" });
}
}
@@ -299,4 +306,38 @@
contentNode.addChild(box);
return pageNode.generate();
}
+
+ public String makeEditIdentityPage(String requestURI) throws
MalformedURLException, InvalidParameterException, UnknownIdentityException {
+
+ OwnIdentity id = wot.getOwnIdentityByURI(requestURI);
+
+ HTMLNode pageNode = getPageNode();
+ HTMLNode contentNode = pm.getContentNode(pageNode);
+ HTMLNode box = pm.getInfobox("Identity edition");
+ HTMLNode boxContent = pm.getContentNode(box);
+
+ HTMLNode createForm = pr.addFormChild(boxContent, SELF_URI +
"/editIdentity2", "editForm");
+ createForm.addChild("#", "NickName : ");
+ createForm.addChild("input", new String[] { "type", "name",
"size", "value" }, new String[] { "text", "nickName", "20", id.getNickName() });
+ createForm.addChild("br");
+
+ createForm.addChild("p", new String[] { "style" }, new String[]
{ "font-size: x-small" }, "Request URI : "+id.getRequestURI().toString());
+ createForm.addChild("p", new String[] { "style" }, new String[]
{ "font-size: x-small" }, "Insert URI : "+id.getInsertURI().toString());
+
+ createForm.addChild("#", "Publish trust list ");
+ if(id.doesPublishTrustList())
+ createForm.addChild("input", new String[] { "type",
"name", "value", "checked" }, new String[] { "checkbox", "publishTrustList",
"true", "checked"});
+ else
+ createForm.addChild("input", new String[] { "type",
"name", "value" }, new String[] { "checkbox", "publishTrustList", "true"});
+ createForm.addChild("br");
+
+ createForm.addChild("p", "Contexts :
"+id.getContextsAsString());
+
+ createForm.addChild("p", "Properties : "+id.getPropsAsString());
+
+ // TODO Give the user the ability to edit these parameters...
+
+ contentNode.addChild(box);
+ return pageNode.generate();
+ }
}
Modified: trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-23 12:41:30 UTC
(rev 22118)
+++ trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-23 16:52:48 UTC
(rev 22119)
@@ -142,6 +142,10 @@
else if (page.equals("/wotTestDrive")) {
return web.makeTestPage();
}
+ else if(page.equals("/editIdentity")) {
+ return
web.makeEditIdentityPage(request.getPartAsString("id", 1024));
+ }
+
else {
return web.makeHomePage();
}
@@ -264,7 +268,6 @@
return null;
}
-
public String getVersion() {
return "0.1.2 r"+Version.getSvnRevision();
}