- simplified code (removed exception handling where not necessary)

- added confirmation dialog for shutdown and restart

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3962 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
orbiter 2007-07-13 14:54:01 +00:00
parent a4e8ad95ab
commit 7c5c814a47
8 changed files with 14 additions and 29 deletions

View File

@ -47,7 +47,6 @@
// javac -classpath .:../classes index.java
// if the shell's current path is HTROOT
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
@ -266,9 +265,7 @@ public class DetailedSearch {
prop.put("num-results_globalresults", results.getGlobalresults());
for(int i=0;i<results.numResults();i++){
plasmaSearchResults.searchResult result=results.getResult(i);
try {
prop.put("type_results_" + i + "_authorized_recommend", (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.getUrl()) == null) ? 1 : 0);
} catch (IOException e) {}
prop.put("type_results_" + i + "_authorized_recommend", (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.getUrl()) == null) ? 1 : 0);
prop.put("type_results_" + i + "_authorized_recommend_deletelink", "/yacysearch.html?search=" + results.getFormerSearch() + "&Enter=Search&count=" + results.getQuery().wantedResults + "&order=" + crypt.simpleEncode(results.getRanking().toExternalString()) + "&resource=local&time=3&deleteref=" + result.getUrlhash() + "&urlmaskfilter=.*");
prop.put("type_results_" + i + "_authorized_recommend_recommendlink", "/yacysearch.html?search=" + results.getFormerSearch() + "&Enter=Search&count=" + results.getQuery().wantedResults + "&order=" + crypt.simpleEncode(results.getRanking().toExternalString()) + "&resource=local&time=3&recommendref=" + result.getUrlhash() + "&urlmaskfilter=.*");
prop.put("type_results_" + i + "_authorized_urlhash", result.getUrlhash());

View File

@ -132,13 +132,8 @@ public class Supporter {
description = row.getColString(2,"UTF-8");
if ((url == null) || (title == null) || (description == null)) continue;
refid = row.getColString(3, null);
voted = false;
try {
voted = (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||
(yacyCore.newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);
} catch (IOException e) {
e.printStackTrace();
}
voted = (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||
(yacyCore.newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);
prop.put("supporter_results_" + i + "_authorized", (authenticated) ? 1 : 0);
prop.put("supporter_results_" + i + "_authorized_recommend", (voted) ? 0 : 1);

View File

@ -140,13 +140,8 @@ public class Surftips {
description = row.getColString(2,"UTF-8");
if ((url == null) || (title == null) || (description == null)) continue;
refid = row.getColString(3, null);
voted = false;
try { // performance problem if published news is too full
voted = (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||
(yacyCore.newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);
} catch (IOException e) {
e.printStackTrace();
}
voted = (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||
(yacyCore.newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);
prop.put("surftips_results_" + i + "_authorized", (authenticated) ? 1 : 0);
prop.put("surftips_results_" + i + "_authorized_recommend", (voted) ? 0 : 1);

View File

@ -47,8 +47,8 @@
<h3>Peer Control</h3>
<ul class="menu">
<li><a href="/Status.html" accesskey="t" class="MenuItemLink">Admin Console</a></li>
<li><a href="/Steering.html?restart=" class="MenuItemLink lock">Re-Start</a></li>
<li><a href="/Steering.html?shutdown=" class="MenuItemLink lock">Shutdown</a></li>
<li><a href="/Steering.html?restart=" class="MenuItemLink lock" onclick="return confirm('Confirm Restart')">Re-Start</a></li>
<li><a href="/Steering.html?shutdown=" class="MenuItemLink lock" onclick="return confirm('Confirm Shutdown')">Shutdown</a></li>
</ul>
</li>
<li class="menugroup" id="menugroupTheProjekt">

View File

@ -313,9 +313,7 @@ public class yacysearch {
prop.put("num-results_globalresults", results.getGlobalresults());
for(int i=0;i<results.numResults();i++){
plasmaSearchResults.searchResult result=results.getResult(i);
try {
prop.put("type_results_" + i + "_authorized_recommend", (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.getUrl()) == null) ? 1 : 0);
} catch (IOException e) {}
prop.put("type_results_" + i + "_authorized_recommend", (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.getUrl()) == null) ? 1 : 0);
//prop.put("type_results_" + i + "_authorized_recommend_deletelink", "/yacysearch.html?search=" + results.getFormerSearch() + "&amp;Enter=Search&amp;count=" + results.getQuery().wantedResults + "&amp;order=" + crypt.simpleEncode(results.getRanking().toExternalString()) + "&amp;resource=local&amp;time=3&amp;deleteref=" + result.getUrlhash() + "&amp;urlmaskfilter=.*");
//prop.put("type_results_" + i + "_authorized_recommend_recommendlink", "/yacysearch.html?search=" + results.getFormerSearch() + "&amp;Enter=Search&amp;count=" + results.getQuery().wantedResults + "&amp;order=" + crypt.simpleEncode(results.getRanking().toExternalString()) + "&amp;resource=local&amp;time=3&amp;recommendref=" + result.getUrlhash() + "&amp;urlmaskfilter=.*");
prop.put("type_results_" + i + "_authorized_recommend_deletelink", "/yacysearch.html?search=" + results.getFormerSearch() + "&Enter=Search&count=" + results.getQuery().wantedResults + "&order=" + crypt.simpleEncode(results.getRanking().toExternalString()) + "&resource=local&time=3&deleteref=" + result.getUrlhash() + "&urlmaskfilter=.*");

View File

@ -124,7 +124,7 @@ public class plasmaSwitchboardQueue {
return new Entry(b);
}
public synchronized Entry remove(String urlHash) throws IOException {
public synchronized Entry remove(String urlHash) {
Iterator i = sbQueueStack.stackIterator(true);
kelondroRow.Entry rowentry;
Entry entry;

View File

@ -403,7 +403,7 @@ public class yacyNewsPool {
return false;
}
public synchronized yacyNewsRecord getSpecific(int dbKey, String category, String key, String value) throws IOException {
public synchronized yacyNewsRecord getSpecific(int dbKey, String category, String key, String value) {
yacyNewsQueue queue = switchQueue(dbKey);
yacyNewsRecord record;
String s;
@ -418,7 +418,7 @@ public class yacyNewsPool {
return null;
}
public synchronized yacyNewsRecord getByOriginator(int dbKey, String category, String originatorHash) throws IOException {
public synchronized yacyNewsRecord getByOriginator(int dbKey, String category, String originatorHash) {
yacyNewsQueue queue = switchQueue(dbKey);
yacyNewsRecord record;
Iterator i = queue.records(true);
@ -433,7 +433,7 @@ public class yacyNewsPool {
return null;
}
public synchronized yacyNewsRecord getByID(int dbKey, String id) throws IOException {
public synchronized yacyNewsRecord getByID(int dbKey, String id) {
switch (dbKey) {
case INCOMING_DB: return incomingNews.get(id);
case PROCESSED_DB: return processedNews.get(id);

View File

@ -120,7 +120,7 @@ public class yacyNewsQueue {
return entry;
}
public synchronized yacyNewsRecord get(String id) throws IOException {
public synchronized yacyNewsRecord get(String id) {
yacyNewsRecord record;
Iterator i = records(true);
while (i.hasNext()) {
@ -130,7 +130,7 @@ public class yacyNewsQueue {
return null;
}
public synchronized yacyNewsRecord remove(String id) throws IOException {
public synchronized yacyNewsRecord remove(String id) {
yacyNewsRecord record;
Iterator i = records(true);
while (i.hasNext()) {