Author: jflesch
Date: 2008-02-16 00:48:13 +0000 (Sat, 16 Feb 2008)
New Revision: 17967
Modified:
trunk/apps/Thaw/src/thaw/core/Core.java
trunk/apps/Thaw/src/thaw/plugins/index/DatabaseManager.java
trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java
trunk/apps/Thaw/src/thaw/plugins/index/SearchResult.java
Log:
Index browser : add an option to blacklist an index directly from the links
table + fix search in the indexes + fix category cleaning
Modified: trunk/apps/Thaw/src/thaw/core/Core.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/Core.java 2008-02-15 23:59:37 UTC (rev
17966)
+++ trunk/apps/Thaw/src/thaw/core/Core.java 2008-02-16 00:48:13 UTC (rev
17967)
@@ -58,7 +58,7 @@
public Core() {
isStopping = false;
Logger.info(this, "Thaw, version "+Main.VERSION, true);
- Logger.info(this, "2006(c) Freenet project", true);
+ Logger.info(this, "2006-2008(c) Freenet project", true);
Logger.info(this, "Released under GPL license version 2 or
later (see http://www.fsf.org/licensing/licenses/gpl.html)", true);
}
Modified: trunk/apps/Thaw/src/thaw/plugins/index/DatabaseManager.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/DatabaseManager.java 2008-02-15
23:59:37 UTC (rev 17966)
+++ trunk/apps/Thaw/src/thaw/plugins/index/DatabaseManager.java 2008-02-16
00:48:13 UTC (rev 17967)
@@ -186,11 +186,14 @@
synchronized(db.dbLock) {
PreparedStatement st;
PreparedStatement countSt;
+ PreparedStatement countBisSt;
PreparedStatement deleteSt;
st =
db.getConnection().prepareStatement("SELECT id FROM categories");
- countSt =
db.getConnection().prepareStatement("SELECT count(id) FROM indexes "+
-
"WHERE categoryId = ?");
+ countSt =
db.getConnection().prepareStatement("SELECT id FROM indexes "+
+
"WHERE categoryId = ? LIMIT 1");
+ countBisSt =
db.getConnection().prepareStatement("SELECT id FROM links "+
+
"WHERE category = ? LIMIT 1");
deleteSt =
db.getConnection().prepareStatement("DELETE FROM categories "+
"WHERE id = ?");
@@ -202,11 +205,15 @@
countSt.setInt(1, id);
ResultSet aSet = countSt.executeQuery();
- aSet.next();
-
- if (aSet.getInt(1) == 0) {
- deleteSt.setInt(1, id);
- deleteSt.execute();
+
+ if (!aSet.next()) {
+ countBisSt.setInt(1, id);
+ aSet =
countBisSt.executeQuery();
+
+ if (!aSet.next()) {
+ deleteSt.setInt(1, id);
+ deleteSt.execute();
+ }
}
}
}
Modified: trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java 2008-02-15
23:59:37 UTC (rev 17966)
+++ trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java 2008-02-16
00:48:13 UTC (rev 17967)
@@ -52,7 +52,7 @@
private final static String unknownStr =
I18n.getMessage("thaw.common.unknown");
public LinkTable (final FCPQueueManager queueManager, IndexBrowserPanel
indexBrowser,
- Config config) {
+ Config config) {
this.indexBrowser = indexBrowser;
linkListModel = new LinkListModel();
@@ -105,7 +105,20 @@
toolbarModifier.addButtonToTheToolbar(button);
rightClickMenu.add(item);
rightClickActions.add(new
LinkManagementHelper.LinkRemover(indexBrowser, item));
+
+ item = new
JMenuItem(I18n.getMessage("thaw.plugin.index.editBlackList"));
+ rightClickMenu.add(item);
+ rightClickActions.add(new
LinkManagementHelper.BlackListDisplayer(item, indexBrowser.getBlackList()));
+ item = new
JMenuItem(I18n.getMessage("thaw.plugin.index.addToBlackList"), IconBox.minStop);
+ button = new JButton(IconBox.stop);
+
button.setToolTipText(I18n.getMessage("thaw.plugin.index.addToBlackList"));
+ toolbarActions.add(new
LinkManagementHelper.ToBlackListAdder(button, indexBrowser));
+ toolbarModifier.addButtonToTheToolbar(button);
+ rightClickMenu.add(item);
+ rightClickActions.add(new
LinkManagementHelper.ToBlackListAdder(item, indexBrowser));
+
+
gotoItem = new
JMenuItem(I18n.getMessage("thaw.plugin.index.gotoIndex"));
rightClickMenu.add(gotoItem);
gotoItem.addActionListener(this);
Modified: trunk/apps/Thaw/src/thaw/plugins/index/SearchResult.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/SearchResult.java 2008-02-15
23:59:37 UTC (rev 17966)
+++ trunk/apps/Thaw/src/thaw/plugins/index/SearchResult.java 2008-02-16
00:48:13 UTC (rev 17967)
@@ -108,11 +108,12 @@
try {
PreparedStatement st;
- st =
db.getConnection().prepareStatement("SELECT links.publicKey AS publicKey, "+
+ st =
db.getConnection().prepareStatement("SELECT links.id AS id, " +
+
" links.publicKey AS publicKey, "+
" links.blackListed AS blacklisted," +
" links.indexParent AS indexParent, "+
" categories.name AS categoryName "+
-
" FROM links OUTER JOIN categories "+
+
" FROM links LEFT OUTER JOIN categories "+
" ON links.category = categories.id "+
"WHERE "+getWhereClause(false));
fillInStatement(st);