Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- adapted User_p to general web-interface style (and removed status-only page on changes) - beautified WikiHelp.html + typos - IP hasn't been set correctly in Blog.xml
karlchenofhell1fe505f0b094
diff --git a/htroot/Blog.java b/htroot/Blog.javaindex 8f15dde3c..d10f29d94 100644--- a/htroot/Blog.java+++ b/htroot/Blog.java@@ -60,6 +60,7 @@ import de.anomic.http.httpHeader;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;+import de.anomic.server.logging.serverLog;import de.anomic.yacy.yacyCore;import de.anomic.yacy.yacyNewsRecord;@@ -75,8 +76,8 @@ public class Blog {}public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {- plasmaSwitchboard switchboard = (plasmaSwitchboard) env;- serverObjects prop = new serverObjects();+ final plasmaSwitchboard switchboard = (plasmaSwitchboard) env;+ final serverObjects prop = new serverObjects();blogBoard.entry page = null;boolean hasRights = switchboard.verifyAuthentication(header, true);@@ -99,7 +100,7 @@ public class Blog {final int num = post.getInt("num",20); //indicates how many entries should be shownif(!hasRights){- userDB.Entry userentry = switchboard.userDB.proxyAuth((String)header.get("Authorization", "xxxxxx"));+ final userDB.Entry userentry = switchboard.userDB.proxyAuth((String)header.get("Authorization", "xxxxxx"));if(userentry != null && userentry.hasBlogRight()){hasRights=true;} else if(post.containsKey("login")) {@@ -109,7 +110,7 @@ public class Blog {}String pagename = post.get("page", DEFAULT_PAGE);- final String ip = post.get("CLIENTIP", "127.0.0.1");+ final String ip = (String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "127.0.0.1");String StrAuthor = post.get("author", "");@@ -134,7 +135,7 @@ public class Blog {if(hasRights && post.containsKey("delete") && post.get("delete").equals("sure")) {page = switchboard.blogDB.read(pagename);- Iterator i = page.comments().iterator();+ final Iterator i = page.comments().iterator();while(i.hasNext()) {switchboard.blogCommentDB.delete((String) i.next());}@@ -165,8 +166,8 @@ public class Blog {comments = page.comments();date = page.date();}- String commentMode = post.get("commentMode", "1");- String StrSubject = post.get("subject", "");+ final String commentMode = post.get("commentMode", "1");+ final String StrSubject = post.get("subject", "");byte[] subject;try {subject = StrSubject.getBytes("UTF-8");@@ -177,11 +178,11 @@ public class Blog {switchboard.blogDB.write(switchboard.blogDB.newEntry(pagename, subject, author, ip, date, content, comments, commentMode));// create a news message- HashMap map = new HashMap();- map.put("page", pagename);- map.put("subject", StrSubject.replace(',', ' '));- map.put("author", StrAuthor.replace(',', ' '));- yacyCore.newsPool.publishMyNews(new yacyNewsRecord("blog_add", map));+ final HashMap map = new HashMap();+ map.put("page", pagename);+ map.put("subject", StrSubject.replace(',', ' '));+ map.put("author", StrAuthor.replace(',', ' '));+ yacyCore.newsPool.publishMyNews(new yacyNewsRecord("blog_add", map));}page = switchboard.blogDB.read(pagename); //maybe "if(page == null)"@@ -264,7 +265,7 @@ public class Blog {else {//only show 1 entryprop.put("mode_entries",1);- putBlogEntry(prop, page, address, 0, xml, hasRights);+ putBlogEntry(prop, page, address, 0, hasRights, xml);}}@@ -273,28 +274,29 @@ public class Blog {}private static serverObjects putBlogDefault(- serverObjects prop,- plasmaSwitchboard switchboard,- String address,+ final serverObjects prop,+ final plasmaSwitchboard switchboard,+ final String address,int start,int num,- boolean hasRights,- boolean xml) {+ final boolean hasRights,+ final boolean xml) {try {- Iterator i = switchboard.blogDB.keys(false);+ final Iterator i = switchboard.blogDB.keys(false);String pageid;- blogBoard.entry entry;int count = 0; //counts how many entries are shown to the userif(xml) num = 0;- int nextstart = start+num; //indicates the starting offset for next results- while(i.hasNext()) {- if(count >= num && num > 0)- break;+ final int nextstart = start+num; //indicates the starting offset for next results+ while(i.hasNext() && (num == 0 || num > count)) {pageid = (String) i.next();- if(0 < start--)- continue;- entry = switchboard.blogDB.read(pageid);- putBlogEntry(prop, entry, address, count++, xml, hasRights);+ if(0 < start--) continue;+ putBlogEntry(+ prop,+ switchboard.blogDB.read(pageid),+ address,+ count++,+ hasRights,+ xml);}prop.put("mode_entries",count);@@ -305,7 +307,7 @@ public class Blog {} else {prop.put("moreentries",0);}- } catch (IOException e) { }+ } catch (IOException e) { serverLog.logSevere("BLOG", "Error reading blog-DB", e); }return prop;}@@ -314,8 +316,8 @@ public class Blog {final blogBoard.entry entry,final String address,final int number,- final boolean xml,- final boolean hasRights) {+ final boolean hasRights,+ final boolean xml) {// subjecttry {@@ -332,7 +334,9 @@ public class Blog {}// comments- if(entry.getCommentMode() != 0) {+ if(entry.getCommentMode() == 0) {+ prop.put("mode_entries_" + number + "_commentsactive", 0);+ } else {prop.put("mode_entries_" + number + "_commentsactive", 1);prop.put("mode_entries_" + number + "_commentsactive_pageid", entry.key());prop.put("mode_entries_" + number + "_commentsactive_address", address);@@ -341,14 +345,12 @@ public class Blog {} catch (UnsupportedEncodingException e) {prop.put("mode_entries_" + number + "_commentsactive_comments", new String(entry.commentsSize()));}- } else {- prop.put("mode_entries_" + number + "_commentsactive", 0);}-+prop.put("mode_entries_" + number + "_date", dateString(entry.date()));prop.put("mode_entries_" + number + "_pageid", entry.key());prop.put("mode_entries_" + number + "_address", address);- prop.put("mode_entries_" + number +" _ip", entry.ip());+ prop.put("mode_entries_" + number + "_ip", entry.ip());if(xml) {prop.putASIS("mode_entries_" + number + "_page", entry.page());diff --git a/htroot/User_p.html b/htroot/User_p.htmlindex dae3ec7c8..5a49bc587 100644--- a/htroot/User_p.html+++ b/htroot/User_p.html@@ -2,76 +2,7 @@<title>#[clientname]#'s User Administration</title>end of HEADER--><h2>User Administration</h2>- #(page)#- <table>- <tr>- <td valign="top">- <form action="User_p.html">- <select name="user">- <option value="newuser">new User</option>#{users}#- <option>#[user]#</option>#{/users}#- </select><br />- <input type="submit" name="change_user" value="Edit User" />- <input type="submit" name="delete_user" value="Delete User" />- </form>- </td>- <td width="100%">- <form action="User_p.html" method="POST">- <!-- Hidden(text for debugging): <input type="text" name="current_user" value="#[current_user]#" readonly> -->- <input type="hidden" name="current_user" value="#[current_user]#" />- Current User: #[username]#- <table border="1">- <tr>- <td>Username: </td>- <td><input type="text" name="username" value="#[username]#"></td>- </tr>- <tr>- <td>Password: </td>- <td><input type="password" name="password"></td>- </tr>- <tr>- <td>Password(repeat): </td>- <td><input type="password" name="password2"></td>- </tr>- <tr>- <td>First Name: </td>- <td><input type="text" name="firstname" value="#[firstname]#"></td>- </tr>- <tr>- <td>Last Name: </td>- <td><input type="text" name="lastname" value="#[lastname]#"></td>- </tr>- <tr>- <td>Address: </td>- <td><input type="text" name="address" value="#[address]#"></td>- </tr>- <tr>- <td>Rights</td>- <td>- <input type="checkbox" id="proxy" name="proxyRight"#(proxyRight)#:: checked="checked"#(/proxyRight)# /><label for="proxy">Proxy</label><br />- <input type="checkbox" id="admin" name="adminRight"#(adminRight)#:: checked="checked"#(/adminRight)# /><label for="admin">Admin</label><br />- <input type="checkbox" id="share" name="uploadRight"#(uploadRight)#:: checked="checked"#(/uploadRight)# /><label for="share">Fileshare-Upload</label><br />- <input type="checkbox" id="dwnld" name="downloadRight"#(downloadRight)#:: checked="checked"#(/downloadRight)# /><label for="dwnld">Fileshare-Download</label><br />- <input type="checkbox" id="blog" name="blogRight"#(blogRight)#:: checked="checked"#(/blogRight)# /><label for="blog">Blog</label><br />- <input type="checkbox" id="wiki" name="wikiAdminRight"#(wikiAdminRight)#:: checked="checked"#(/wikiAdminRight)# /><label for="wiki">Wiki Admin</label>- <input type="checkbox" id="wiki" name="bookmarkRight"#(bookmarkRight)#:: checked="checked"#(/bookmarkRight)# /><label for="wiki">Bookmarks</label>- </td>- </tr>- <tr>- <td><label for="tlimit">Timelimit</label>:</td>- <td><input type="text" id="tlimit" name="timelimit" value="#[timelimit]#" /></td>- </tr>- <tr>- <td><label for="tused">Time used</label>:</td>- <td><input type="text" id="tused" name="timeused" value="#[timeused]#" /></td>- </tr>- </table>- <input type="submit" name="change" value="Save User" />- </form>- </td>- </tr>- </table>- ::+<!-- Page 1: Results -->#(text)#::@@ -81,11 +12,65 @@#(/text)##(error)#::- <p>Generic error.</p>+ <p class="error">Generic error.</p>::- <p>Passwords do not match.</p>+ <p class="error">Passwords do not match.</p>::- <p>Username too short. Username must be >= 4 Characters.</p>+ <p class="error">Username too short. Username must be >= 4 Characters.</p>#(/error)#- <p>If you want to manage more Users, return to the <a href="User_p.html?change_user=true&user=#[username]#">user</a> page.</p>- #(/page)#++ <form action="User_p.html">+ <fieldset><legend>Select user</legend>+ <dl>+ <dt><label for="user">Select user</label>:</dt>+ <dd>+ <select name="user" id="user">+ <option value="newuser">New user</option>#{users}#+ <option>#[user]#</option>#{/users}#+ </select>+ </dd>+ <dt> </dt>+ <dd>+ <input type="submit" name="change_user" value="Edit User" />+ <input type="submit" name="delete_user" value="Delete User" />+ </dd>+ </dl>+ </fieldset>+ </form>++ <form action="User_p.html" method="post">+ <fieldset><legend>Edit current user: #[username]#</legend>+ <!-- Hidden(text for debugging): <input type="text" name="current_user" value="#[current_user]#" readonly> -->+ <input type="hidden" name="current_user" value="#[current_user]#" />+ <dl>+ <dt><label for="username">Username</label>:</dt>+ <dd><input type="text" id="username" name="username" value="#[username]#" /></dd>+ <dt><label for="password">Password</label>:</dt>+ <dd><input type="password" id="password" name="password" /></dd>+ <dt><label for="password2">Repeat password</label>:</dt>+ <dd><input type="password" id="password2" name="password2" /></dd>+ <dt><label for="firstname">First name</label>:</dt>+ <dd><input type="text" id="firstname" name="firstname" value="#[firstname]#" /></dd>+ <dt><label for="lastname">Last name</label>:</dt>+ <dd><input type="text" id="lastname" name="lastname" value="#[lastname]#" /></dd>+ <dt><label for="address">Address</label>:</dt>+ <dd><input type="text" id="address" name="address" value="#[address]#" /></dd>+ <dt>Rights:</dt>+ <dd>+ <input type="checkbox" id="proxy" name="proxyRight"#(proxyRight)#:: checked="checked"#(/proxyRight)# /><label for="proxy">Proxy</label><br />+ <input type="checkbox" id="admin" name="adminRight"#(adminRight)#:: checked="checked"#(/adminRight)# /><label for="admin">Admin</label><br />+ <input type="checkbox" id="share" name="uploadRight"#(uploadRight)#:: checked="checked"#(/uploadRight)# /><label for="share">Fileshare-Upload</label><br />+ <input type="checkbox" id="dwnld" name="downloadRight"#(downloadRight)#:: checked="checked"#(/downloadRight)# /><label for="dwnld">Fileshare-Download</label><br />+ <input type="checkbox" id="blog" name="blogRight"#(blogRight)#:: checked="checked"#(/blogRight)# /><label for="blog">Blog</label><br />+ <input type="checkbox" id="wiki" name="wikiAdminRight"#(wikiAdminRight)#:: checked="checked"#(/wikiAdminRight)# /><label for="wiki">Wiki Admin</label><br />+ <input type="checkbox" id="bkmark" name="bookmarkRight"#(bookmarkRight)#:: checked="checked"#(/bookmarkRight)# /><label for="bkmark">Bookmarks</label>+ </dd>+ <dt><label for="tlimit">Timelimit</label>:</dt>+ <dd><input type="text" id="tlimit" name="timelimit" value="#[timelimit]#" /></dd>+ <dt><label for="tused">Time used</label>:</dt>+ <dd><input type="text" id="tused" name="timeused" value="#[timeused]#" /></dd>+ <dt> </dt>+ <dd><input type="submit" name="change" value="Save User" /></dd>+ </dl>+ </fieldset>+ </form>diff --git a/htroot/User_p.java b/htroot/User_p.javaindex 8fbabe366..2ce2d660d 100644--- a/htroot/User_p.java+++ b/htroot/User_p.java@@ -67,23 +67,22 @@ public class User_p {prop.put("SUPERTEMPLATE", "/env/page.html"); //user Supertemplates//default values- prop.put("page", 0);- prop.put("page_current_user", "newuser");- prop.put("page_username", "");- prop.put("page_firstname", "");- prop.put("page_lastname", "");- prop.put("page_address", "");- prop.put("page_timelimit", "");- prop.put("page_timeused", "");- prop.put("page_timerange", "");- prop.put("page_proxyRight", 1);- prop.put("page_downloadRight", 0);- prop.put("page_uploadRight", 0);- prop.put("page_adminRight", 0);- prop.put("page_wikiAdminRight", 0);- prop.put("page_bookmarkRight", 0);+ prop.put("current_user", "newuser");+ prop.put("username", "");+ prop.put("firstname", "");+ prop.put("lastname", "");+ prop.put("address", "");+ prop.put("timelimit", "");+ prop.put("timeused", "");+ prop.put("timerange", "");+ prop.put("proxyRight", 1);+ prop.put("downloadRight", 0);+ prop.put("uploadRight", 0);+ prop.put("adminRight", 0);+ prop.put("wikiAdminRight", 0);+ prop.put("bookmarkRight", 0);- prop.put("page_users", 0);+ prop.put("users", 0);if(sb.userDB == null)return prop;@@ -102,35 +101,34 @@ public class User_p {// link: "If you want to manage more Users, return to the user page." (parameter "user" is empty)if (entry != null) {//TODO: set username read-only in html- prop.put("page_current_user", post.get("user"));- prop.put("page_username", post.get("user"));- prop.put("page_firstname", entry.getFirstName());- prop.put("page_lastname", entry.getLastName());- prop.put("page_address", entry.getAddress());- prop.put("page_timelimit", entry.getTimeLimit());- prop.put("page_timeused", entry.getTimeUsed());- prop.put("page_proxyRight", (entry.hasProxyRight()?1:0));- prop.put("page_uploadRight", (entry.hasUploadRight()?1:0));- prop.put("page_downloadRight", (entry.hasDownloadRight()?1:0));- prop.put("page_adminRight", (entry.hasAdminRight()?1:0));- prop.put("page_blogRight", (entry.hasBlogRight()?1:0));- prop.put("page_wikiAdminRight", (entry.hasWikiAdminRight()?1:0));- prop.put("page_bookmarkRight", (entry.hasBookmarkRight()?1:0));+ prop.put("current_user", post.get("user"));+ prop.put("username", post.get("user"));+ prop.put("firstname", entry.getFirstName());+ prop.put("lastname", entry.getLastName());+ prop.put("address", entry.getAddress());+ prop.put("timelimit", entry.getTimeLimit());+ prop.put("timeused", entry.getTimeUsed());+ prop.put("proxyRight", (entry.hasProxyRight()?1:0));+ prop.put("uploadRight", (entry.hasUploadRight()?1:0));+ prop.put("downloadRight", (entry.hasDownloadRight()?1:0));+ prop.put("adminRight", (entry.hasAdminRight()?1:0));+ prop.put("blogRight", (entry.hasBlogRight()?1:0));+ prop.put("wikiAdminRight", (entry.hasWikiAdminRight()?1:0));+ prop.put("bookmarkRight", (entry.hasBookmarkRight()?1:0));}}else if( post.containsKey("delete_user") && !((String)post.get("user")).equals("newuser") ){sb.userDB.removeEntry((String)post.get("user"));}} else if(post.containsKey("change")) { //New User / edit User- prop.put("page", 1); //results- prop.put("page_text", 0);- prop.put("page_error", 0);+ prop.put("text", 0);+ prop.put("error", 0);String username=(String)post.get("username");String pw=(String)post.get("password");String pw2=(String)post.get("password2");if(! pw.equals(pw2)){- prop.put("page_error", 2); //PW does not match+ prop.put("error", 2); //PW does not matchreturn prop;}String firstName=(String)post.get("firstname");@@ -166,10 +164,10 @@ public class User_p {try{entry=sb.userDB.createEntry(username, mem);sb.userDB.addEntry(entry);- prop.put("page_text_username", username);- prop.put("page_text", 1);+ prop.put("text_username", username);+ prop.put("text", 1);}catch(IllegalArgumentException e){- prop.put("page_error", 3);+ prop.put("error", 3);}@@ -196,12 +194,12 @@ public class User_p {}catch (IOException e){}}else{- prop.put("page_error", 1);+ prop.put("error", 1);}- prop.put("page_text_username", username);- prop.put("page_text", 2);+ prop.put("text_username", username);+ prop.put("text", 2);}//edit user- prop.put("page_username", username);+ prop.put("username", username);}//Generate Userlist@@ -209,10 +207,10 @@ public class User_p {int numUsers=0;while(it.hasNext()){entry = (userDB.Entry)it.next();- prop.put("page_users_"+numUsers+"_user", entry.getUserName());+ prop.put("users_"+numUsers+"_user", entry.getUserName());numUsers++;}- prop.put("page_users", numUsers);+ prop.put("users", numUsers);// return rewrite propertiesreturn prop;diff --git a/htroot/WikiHelp.html b/htroot/WikiHelp.htmlindex 325a3bb34..212c85aef 100644--- a/htroot/WikiHelp.html+++ b/htroot/WikiHelp.html@@ -5,12 +5,14 @@#%env/templates/metas.template%#</head><body>- <br>- <h2>Index Creation</h2>- <br><div align="center">- <table width="95%" border="1">- <caption>This table contains a short description of the tags that can be used in the Wiki and several other servlets of YaCy. For a more detailed description visit the <a href="http://www.yacy-websuche.de/wiki/index.php/Hauptseite">YaCy Wiki</a>.</caption>+ <h2>Wiki-Code</h2>+ <table width="95%" border="1" cellspacing="0" cellpadding="4">+ <caption>+ This table contains a short description of the tags that can be used in the Wiki and several other servlets+ of YaCy. For a more detailed description visit the+ <a href="http://www.yacy-websuche.de/wiki/index.php/Hauptseite">YaCy Wiki</a>.+ </caption><tr valign="top"><th>Code@@ -20,61 +22,65 @@</th></tr><tr valign="top">- <td>+ <td class="tt">==headline1==<br />===headline2===<br />====headline3====</td><td>- This tags create headlines. If a page has three or more headlines, a directory will be created automaticly.+ These tags create headlines. If a page has three or more headlines, a directory will be created automaticly.</td></tr><tr valign="top">- <td>+ <td class="tt">''text''<br />'''text'''<br />'''''text'''''</td><td>- This tags create stressed texts. Most browsers will display the texts in italics, bold, and a combination of both.+ These tags create stressed texts. The first pair emphasizes the text (most browsers will display it in italics),+ the second one emphazises it more strongly (i.e. bold) and the last tags create a combination of both.</td></tr><tr valign="top">- <td>+ <td class="tt">:text<br>::text</td><td>- Lines will be indented. This tag is supposed to mark citations.+ Lines will be indented. This tag is supposed to mark citations, but may as well be used for styling purposes.</td></tr><tr valign="top">- <td>+ <td class="tt">#point1<br />##point1.1<br />##point1.2<br />#point2</td><td>- This tags create a numbered list.+ These tags create a numbered list.</td></tr><tr valign="top">- <td>+ <td class="tt">*something<br />**another thing<br />***and yet another<br />*something else</td><td>- This tags create a unnumbered list.+ These tags create a unnumbered list.</td></tr><tr valign="top">- <td>- ;word 1:definition 1<br />;word 2:definition 2<br />;;word 3:definition 3<br />;word 4:definition 4+ <td class="tt">+ <nobr class="tt">;word 1:definition 1</nobr><br />+ <nobr class="tt">;word 2:definition 2</nobr><br />+ <nobr class="tt">;;word 3:definition 3</nobr><br />+ <nobr class="tt">;word 4:definition 4</nobr></td><td>- This tags create a definition list.+ These tags create a definition list.</td></tr><tr valign="top">- <td>+ <td class="tt">----</td><td>@@ -83,8 +89,9 @@</tr><tr valign="top">- <td>- [[pagename]]<br />[[pagename|description]]+ <td class="tt">+ <nobr class="tt">[[pagename]]</nobr><br />+ <nobr class="tt">[[pagename|description]]</nobr></td><td>This tag creates links to other pages of the wiki.@@ -92,7 +99,7 @@</tr><tr valign="top">- <td>+ <td class="tt">[url]<br />[url description]</td><td>@@ -101,8 +108,10 @@</tr><tr valign="top">- <td>- [[Image:url]]<br />[[Image:url|alt text]]<br />[[Image:url|align|alt text]]+ <td class="tt">+ <nobr class="tt">[[Image:url]]</nobr><br />+ <nobr class="tt">[[Image:url|alt text]]</nobr><br />+ <nobr class="tt">[[Image:url|align|alt text]]</nobr></td><td>This tag displays an image, it can be aligned left, right or center.@@ -110,34 +119,41 @@</tr><tr valign="top">- <td>- {|<br />|-<br />||row 1, col 1||row 1, col 2<br />|-<br />||row 2, col 1||row 2, col 2<br />|}+ <td class="tt">+ {|<br />+ |-<br />+ <nobr class="tt">||row 1, col 1||row 1, col 2</nobr><br />+ |-<br />+ <nobr class="tt">||row 2, col 1||row 2, col 2</nobr><br />+ |}</td><td>- This tags create a table.+ These tags create a table, whereas the first marks the beginning of the table, the second starts+ a new line, the third and fourth each create a new cell in the line. The last displayed tag closes+ the table.</td></tr><tr valign="top">- <td>+ <td class="tt">[= text =]</td><td>- The escape tags will cause all tags in the text between the starting and the closing tag to not be treated as regular text.+ The escape tags will cause all tags in the text between the starting and the closing tag to not be treated as wiki-code.</td></tr><tr valign="top">- <td>+ <td class="tt"><pre> text </pre></td><td>- A text between this tags will keep all the spaces and linebreaks in it. Great for ASCII-art and program code.+ A text between these tags will keep all the spaces and linebreaks in it. Great for ASCII-art and program code.</td></tr><tr valign="top">- <td>+ <td class="tt">text<br /> text<br />text</td><td>