- 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
pull/1/head
orbiter 18 years ago
parent a4e8ad95ab
commit 7c5c814a47

@ -47,7 +47,6 @@
// javac -classpath .:../classes index.java // javac -classpath .:../classes index.java
// if the shell's current path is HTROOT // if the shell's current path is HTROOT
import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.HashMap; import java.util.HashMap;
@ -266,9 +265,7 @@ public class DetailedSearch {
prop.put("num-results_globalresults", results.getGlobalresults()); prop.put("num-results_globalresults", results.getGlobalresults());
for(int i=0;i<results.numResults();i++){ for(int i=0;i<results.numResults();i++){
plasmaSearchResults.searchResult result=results.getResult(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);
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_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_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_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()); prop.put("type_results_" + i + "_authorized_urlhash", result.getUrlhash());

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

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

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

@ -313,9 +313,7 @@ public class yacysearch {
prop.put("num-results_globalresults", results.getGlobalresults()); prop.put("num-results_globalresults", results.getGlobalresults());
for(int i=0;i<results.numResults();i++){ for(int i=0;i<results.numResults();i++){
plasmaSearchResults.searchResult result=results.getResult(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);
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_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_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_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=.*"); 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=.*");

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

@ -403,7 +403,7 @@ public class yacyNewsPool {
return false; 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); yacyNewsQueue queue = switchQueue(dbKey);
yacyNewsRecord record; yacyNewsRecord record;
String s; String s;
@ -418,7 +418,7 @@ public class yacyNewsPool {
return null; 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); yacyNewsQueue queue = switchQueue(dbKey);
yacyNewsRecord record; yacyNewsRecord record;
Iterator i = queue.records(true); Iterator i = queue.records(true);
@ -433,7 +433,7 @@ public class yacyNewsPool {
return null; return null;
} }
public synchronized yacyNewsRecord getByID(int dbKey, String id) throws IOException { public synchronized yacyNewsRecord getByID(int dbKey, String id) {
switch (dbKey) { switch (dbKey) {
case INCOMING_DB: return incomingNews.get(id); case INCOMING_DB: return incomingNews.get(id);
case PROCESSED_DB: return processedNews.get(id); case PROCESSED_DB: return processedNews.get(id);

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

Loading…
Cancel
Save