Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
replaced old /api/table_p.xml servlet with /Tables_p.xml to avoid double code
orbiter3ffe19b85cb6
diff --git a/htroot/Tables_p.html b/htroot/Tables_p.htmlindex a7e7e725d..efbeb3530 100644--- a/htroot/Tables_p.html+++ b/htroot/Tables_p.html@@ -26,17 +26,18 @@<script type="text/javascript" src="js/sorttable.js"></script></head><body id="Tables">-++ #%env/templates/header.template%#+ #%env/templates/submenuConfig.template%#+<script type="text/javascript">//<![CDATA[if (window.location.search.length > 1) {-document.write("<div id=\"api\">\<a href=\"api/table_p.xml" + window.location.search + "\"\><img src=\"env/grafics/api.png\" width=\"60\" height=\"40\" alt=\"API\"/></a></div>");+document.write("<div id=\"api\"><a href=\"/Tables_p.xml" + window.location.search + "\"\ id=\"apilink\"><img src=\"env/grafics/api.png\" width=\"60\" height=\"40\" alt=\"API\"/></a></div>");}//]]></script>- #%env/templates/header.template%#- #%env/templates/submenuConfig.template%##(showselection)#::<h2>Table Administration</h2><form action="Tables_p.html" method="get" accept-charset="UTF-8">diff --git a/htroot/Tables_p.java b/htroot/Tables_p.javaindex 1f6a5ac05..4cf3025fe 100644--- a/htroot/Tables_p.java+++ b/htroot/Tables_p.java@@ -36,10 +36,14 @@ import net.yacy.server.serverSwitch;public class Tables_p {- public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header, final serverObjects post, final serverSwitch env) {+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {final Switchboard sb = (Switchboard) env;final serverObjects prop = new serverObjects();+ final String ext = header.get("EXT", "");+ final boolean json = ext.equals("json");+ final boolean xml = ext.equals("xml");+prop.put("showtable", 0);prop.put("showedit", 0);prop.put("showselection", 0);@@ -164,6 +168,7 @@ public class Tables_p {Tables.Row row;boolean dark = true;byte[] cell;+ prop.putXML("showtable_" + count + "_table", table); // only used in XMLwhile (mapIterator.hasNext() && count < maxcount) {row = mapIterator.next();if (row == null) continue;@@ -173,9 +178,20 @@ public class Tables_p {prop.put("showtable_list_" + count + "_pk", UTF8.String(row.getPK()));prop.put("showtable_list_" + count + "_count", count);prop.put("showtable_list_" + count + "_table", table); // tablename for edit link- for (int i = 0; i < columns.size(); i++) {- cell = row.get(columns.get(i));- prop.putHTML("showtable_list_" + count + "_columns_" + i + "_cell", cell == null ? "" : UTF8.String(cell));+ String col;+ if (xml) {+ for (int i = 0; i < columns.size(); i++) {+ col = columns.get(i);+ cell = row.get(col);+ prop.putXML("showtable_list_" + count + "_columns_" + i + "_cell", cell == null ? "" : UTF8.String(cell));+ prop.putXML("showtable_list_" + count + "_columns_" + i + "_col", col);+ }+ } else {+ for (int i = 0; i < columns.size(); i++) {+ col = columns.get(i);+ cell = row.get(col);+ prop.putHTML("showtable_list_" + count + "_columns_" + i + "_cell", cell == null ? "" : UTF8.String(cell));+ }}prop.put("showtable_list_" + count + "_columns", columns.size());count++;diff --git a/htroot/api/table_p.html b/htroot/api/table_p.htmldeleted file mode 100644index 0d1e76b66..000000000--- a/htroot/api/table_p.html+++ /dev/null@@ -1,41 +0,0 @@-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">-<html xmlns="http://www.w3.org/1999/xhtml">- <head>- <title>YaCy '#[clientname]#': Table Viewer</title>- #(showtable)#::- <link rel="alternate" type="application/xml" title="Table" href="table_p.xml?table=#[table]#&pk=" />- #(/showtable)#- #%env/templates/metas.template%#- </head>- <script type="text/javascript" src="/js/sorttable.js"></script>- <body id="Table">- #(showtable)#::- <form action="/Tables_p.html" method="post" target="_parent" enctype="multipart/form-data" accept-charset="UTF-8" name="tablelisting">- <fieldset>- <legend><label for="table">Table: '#[table]#'</label></legend>- <table class="sortable" border="0">- <tr class="TableHeader" valign="bottom">- #(showpk)#::<td>PK</td>#(/showpk)#- #{columns}#- <td>#[header]#</td>- #{/columns}#- </tr>- #{list}#- <tr class="TableCell#(dark)#Light::Dark::Summary#(/dark)#">- #(showpk)#::<td>#[pk]#</td>#(/showpk)#- #{columns}#- <td align="left">#[cell]#</td>- #{/columns}#- </tr>- #{/list}#- </table>- <p>- <input type="hidden" name="table" value="#[table]#" />- <input type="hidden" name="num" value="#[num]#" />- <input type="submit" name="edittable" value="Edit Table" class="btn btn-primary"/>- </p>- </fieldset>- </form>- #(/showtable)#- </body>-</html>diff --git a/htroot/api/table_p.xml b/htroot/api/table_p.xmldeleted file mode 100644index 2d447b287..000000000--- a/htroot/api/table_p.xml+++ /dev/null@@ -1,24 +0,0 @@-<tables count="#[tablecount]#">-#(showtable)#- #{tables}#- <table name="#[table]#" count="#[num]#"/>- #{/tables}#-::- <table name="#[table]#" count="#[num]#">- <columns>- #{columns}#- <column name="#[header]#" />- #{/columns}#- </columns>- <rows>- #{list}#- <row#(showpk)#:: key="#[pk]#"#(/showpk)#>- #{columns}#- <column name="#[column]#">#[cell]#</column>- #{/columns}#- </row>- #{/list}#- </rows>- </table>-#(/showtable)#-</tables>\ No newline at end of file