Author: j16sdiz
Date: 2008-12-23 15:33:52 +0000 (Tue, 23 Dec 2008)
New Revision: 24771

Modified:
   trunk/plugins/XMLSpider/web/ConfigPage.java
Log:
show some config (does not work yet)

Modified: trunk/plugins/XMLSpider/web/ConfigPage.java
===================================================================
--- trunk/plugins/XMLSpider/web/ConfigPage.java 2008-12-23 15:15:08 UTC (rev 
24770)
+++ trunk/plugins/XMLSpider/web/ConfigPage.java 2008-12-23 15:33:52 UTC (rev 
24771)
@@ -4,6 +4,7 @@
  */
 package plugins.XMLSpider.web;
 
+import plugins.XMLSpider.Config;
 import plugins.XMLSpider.XMLSpider;
 import freenet.clients.http.PageMaker;
 import freenet.pluginmanager.PluginRespirator;
@@ -15,11 +16,14 @@
        private final XMLSpider xmlSpider;
        private final PageMaker pageMaker;
        private final PluginRespirator pr;
+       private Config config;
 
        ConfigPage(XMLSpider xmlSpider) {
                this.xmlSpider = xmlSpider;
                pageMaker = xmlSpider.getPageMaker();
                pr = xmlSpider.getPluginRespirator();
+               
+               config = xmlSpider.getConfig(); 
        }
 
        /*
@@ -44,15 +48,38 @@
         * freenet.support.HTMLNode)
         */
        public void writeContent(HTTPRequest request, HTMLNode contentNode) {
-               HTMLNode indexBox = pageMaker.getInfobox("Test");
-               HTMLNode indexContent = pageMaker.getContentNode(indexBox);
-               HTMLNode indexForm = pr.addFormChild(indexContent, 
"plugins.XMLSpider.XMLSpider?ConfigPage", "indexForm");
-               indexForm.addChild("input", //
-                       new String[] { "name", "type", "value" },//
-                       new String[] { "testButton", "hidden", "testButton" });
-               indexForm.addChild("input", //
+               HTMLNode configBox = pageMaker.getInfobox("Configuration");
+               HTMLNode configContent = pageMaker.getContentNode(configBox);
+               HTMLNode configForm = pr.addFormChild(configContent, 
"plugins.XMLSpider.XMLSpider?ConfigPage", "configForm");
+               HTMLNode configUi = configForm.addChild("ul", "class", 
"config");
+               
+               configUi.addChild("div", "class", "configprefix", "Index Writer 
Options");
+               addConfig(configUi, //
+                       "Index Directory", "Directory where the index should be 
written to.", // 
+                       "indexDir", config.getIndexDir());
+               addConfig(configUi, //
+                       "Index Title", "Index Title", // 
+                       "indexTitle", config.getIndexTitle());
+               addConfig(configUi, //
+                       "Index Owner", "Index Owner", // 
+                       "indexOwner", config.getIndexOwner());
+               addConfig(configUi, //
+                       "Index Owner Email", "Index Owner Email", // 
+                       "indexOwnerEmail", config.getIndexOwnerEmail());
+               
+               configForm.addChild("input", //
                        new String[] { "type", "value" }, //
-                       new String[] { "submit", "Button" });
-               contentNode.addChild(indexBox);
+                       new String[] { "submit", "Apply" });
+               contentNode.addChild(configBox);
        }
+       
+       private void addConfig(HTMLNode configUi, String shortDesc, String 
longDesc, String name, String value) {
+               HTMLNode li = configUi.addChild("li");
+               li.addChild("span","class","configshortdesc", shortDesc);
+               li.addChild("span","class","config") //
+                       .addChild("input", //
+                               new String[] { "class", "type", "name", "value" 
}, //
+                               new String[] { "config", "text", name, value });
+               li.addChild("span", "class", "configlongdesc", longDesc);
+       }
 }
\ No newline at end of file

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to