From 92d77c3befa539bc17e8842180b3f9628d56568f Mon Sep 17 00:00:00 2001
From: apfelmaennchen
Date: Mon, 26 Jan 2009 18:38:58 +0000
Subject: [PATCH] Major update to YaCy-UI...still not perfect...but I thought I
share my progress :-)
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5519 6c8d7289-2bf4-0310-a012-ef5d649a1542
---
htroot/api/bookmarks/get_bookmarks.java | 2 +-
htroot/api/bookmarks/get_folders.json | 9 +
htroot/yacy/ui/css/base.css | 52 +++-
htroot/yacy/ui/index.html | 40 ++-
htroot/yacy/ui/js/jquery.treeview.async.js | 72 ++++++
htroot/yacy/ui/sidebar/sidebar_1.html | 47 ++--
htroot/yacy/ui/sidebar/sidebar_2.html | 125 ----------
htroot/yacy/ui/yacyui-admin.html | 151 ++++++++++--
htroot/yacy/ui/yacyui-bookmarks.html | 10 +-
htroot/yacy/ui/yacyui-search.html | 267 +++++++++++----------
htroot/yacy/ui/yacyui-welcome.html | 3 +
11 files changed, 441 insertions(+), 337 deletions(-)
create mode 100644 htroot/api/bookmarks/get_folders.json
create mode 100644 htroot/yacy/ui/js/jquery.treeview.async.js
delete mode 100644 htroot/yacy/ui/sidebar/sidebar_2.html
diff --git a/htroot/api/bookmarks/get_bookmarks.java b/htroot/api/bookmarks/get_bookmarks.java
index 8774a75eb..2e4c49697 100644
--- a/htroot/api/bookmarks/get_bookmarks.java
+++ b/htroot/api/bookmarks/get_bookmarks.java
@@ -114,7 +114,7 @@ public class get_bookmarks {
// default covers all non XBEL formats
// set bookmark iterator according to query
- if (qtype.equals("tags") && !query.equals("")) {
+ if (qtype.equals("tags") && !query.equals("") && !query.equals("/")) {
it = sb.bookmarksDB.getBookmarksIterator(query, isAdmin);
} else {
it = sb.bookmarksDB.getBookmarksIterator(isAdmin);
diff --git a/htroot/api/bookmarks/get_folders.json b/htroot/api/bookmarks/get_folders.json
new file mode 100644
index 000000000..239901dcf
--- /dev/null
+++ b/htroot/api/bookmarks/get_folders.json
@@ -0,0 +1,9 @@
+[
+#{folders}#{
+"text": "#[foldername]#",
+"expanded": #[expanded]#,
+"classes": "#[classes]#",
+"id": "#[hash]#",
+"hasChildren": #[hasChildren]#
+}#[comma]##{/folders}#
+]
diff --git a/htroot/yacy/ui/css/base.css b/htroot/yacy/ui/css/base.css
index fed146db6..beacd0d77 100644
--- a/htroot/yacy/ui/css/base.css
+++ b/htroot/yacy/ui/css/base.css
@@ -7,6 +7,47 @@ div.main {
height:100%;
}
+.yresult .favicon {
+ width: 16px;
+ height: 16px;
+ padding: 5px 1px 1px 15px; /* top right bottom left */
+}
+
+/* Admin Console */
+.banner {
+ margin-top: 20px;
+ margin-bottom: 0px;
+}
+table.adminconsole {
+ width:100%;
+ margin:8px 0px 6px 0px;
+ display:inline-block;
+
+}
+table.adminconsole td {
+ width: 63px;
+ text-align:center;
+}
+table.adminconsole td.head {
+ text-align:left;
+}
+table.adminconsole h3 {
+ margin-top: 15px;
+ margin-bottom: 5px;
+ font-size: 14px;
+ color: #27537a;
+}
+table.adminconsole img {
+ width: 32px;
+ height: 32px;
+ padding: 1px 1px 7px 1px; /* top right bottom left */
+ vertical-align: middle;
+}
+table.adminconsole a {
+ text-decoration:none;
+ color: black;
+}
+
/* Searchbox */
table.contentdom {
@@ -57,20 +98,11 @@ div.ys {
}
/* Sidebar */
-
-
-
div.sidebar {
margin-right: 1em;
float:left;
width:250px;
}
-.menu img {
- width: 32px;
- height: 32px;
- padding: 2px 15px 2px 2px;
- vertical-align: middle;
-}
.menu img.logo {
width: 256px;
height: 128px;
@@ -236,7 +268,7 @@ dl.pairs dt {
border: 1px solid black;
text-decoration: none;
font-size: 14px;
- max-height: 220px;
+ max-height: 320px;
overflow-x: hidden;
overflow-y: auto;
}
diff --git a/htroot/yacy/ui/index.html b/htroot/yacy/ui/index.html
index 8679d1c04..dd62c897a 100644
--- a/htroot/yacy/ui/index.html
+++ b/htroot/yacy/ui/index.html
@@ -30,10 +30,13 @@
+
-
+
+
+
@@ -169,8 +164,7 @@
diff --git a/htroot/yacy/ui/js/jquery.treeview.async.js b/htroot/yacy/ui/js/jquery.treeview.async.js
new file mode 100644
index 000000000..2597dde17
--- /dev/null
+++ b/htroot/yacy/ui/js/jquery.treeview.async.js
@@ -0,0 +1,72 @@
+/*
+ * Async Treeview 0.1 - Lazy-loading extension for Treeview
+ *
+ * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
+ *
+ * Copyright (c) 2007 Jörn Zaefferer
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Revision: $Id$
+ *
+ */
+
+;(function($) {
+
+function load(settings, root, child, container) {
+ $.getJSON(settings.url, {root: root}, function(response) {
+ function createNode(parent) {
+ var current = $("").attr("id", this.id || "").html("" + this.text + "").appendTo(parent);
+ if (this.classes) {
+ current.children("span").addClass(this.classes);
+ }
+ if (this.expanded) {
+ current.addClass("open");
+ }
+ if (this.hasChildren || this.children && this.children.length) {
+ var branch = $("").appendTo(current);
+ if (this.hasChildren) {
+ current.addClass("hasChildren");
+ createNode.call({
+ text:"placeholder",
+ id:"placeholder",
+ children:[]
+ }, branch);
+ }
+ if (this.children && this.children.length) {
+ $.each(this.children, createNode, [branch])
+ }
+ }
+ }
+ $.each(response, createNode, [child]);
+ $(container).treeview({add: child});
+ });
+}
+
+var proxied = $.fn.treeview;
+$.fn.treeview = function(settings) {
+ if (!settings.url) {
+ return proxied.apply(this, arguments);
+ }
+ var container = this;
+ load(settings, "source", this, container);
+ var userToggle = settings.toggle;
+ return proxied.call(this, $.extend({}, settings, {
+ collapsed: true,
+ toggle: function() {
+ var $this = $(this);
+ if ($this.hasClass("hasChildren")) {
+ var childList = $this.removeClass("hasChildren").find("ul");
+ childList.empty();
+ load(settings, this.id, childList, container);
+ }
+ if (userToggle) {
+ userToggle.apply(this, arguments);
+ }
+ }
+ }));
+};
+
+})(jQuery);
\ No newline at end of file
diff --git a/htroot/yacy/ui/sidebar/sidebar_1.html b/htroot/yacy/ui/sidebar/sidebar_1.html
index a409eddb7..1f4944611 100644
--- a/htroot/yacy/ui/sidebar/sidebar_1.html
+++ b/htroot/yacy/ui/sidebar/sidebar_1.html
@@ -5,9 +5,33 @@
/* Init Sidebar_1 */
$("#side1").accordion({
autoHeight: false,
+ clearStyle: true,
header: "h3"
});
$("#side1").accordion("activate", 2);
+
+ $("#yfolder").treeview({
+ url: "/api/bookmarks/get_folders.json?bmtype=href",
+ unique: false,
+ toggle: function() {
+ var $this = $(this);
+ if ($this.hasClass("expandable")) {
+ var select = "li:has(ul li[id="+$this.attr("id")+"])";
+ qtag = $(select).attr("id");
+ if (!qtag) qtag = "/";
+ $this.addClass("hasChildren");
+ $this.find("ul").empty();
+ if (tabid == "#Bookmarks") {
+ reloadBM();
+ }
+ } else if ($this.hasClass("collapsable")) {
+ qtag = $this.attr("id");
+ if (tabid == "#Bookmarks") {
+ reloadBM();
+ }
+ }
+ }
+ });
/* Menu .click(function() */
$("#login").click(function() {
@@ -239,29 +263,10 @@
-YaCy Project
+Bookmark Folders
-YaCy Peer Admin
-
-
diff --git a/htroot/yacy/ui/sidebar/sidebar_2.html b/htroot/yacy/ui/sidebar/sidebar_2.html
deleted file mode 100644
index e9fb5c4e1..000000000
--- a/htroot/yacy/ui/sidebar/sidebar_2.html
+++ /dev/null
@@ -1,125 +0,0 @@
-
-
-
-Search Options
-
-
-
-Bookmark TagCloud
-
-
-
-
-
-Bookmark Folders
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/htroot/yacy/ui/yacyui-admin.html b/htroot/yacy/ui/yacyui-admin.html
index 0df984c62..f02f5d057 100644
--- a/htroot/yacy/ui/yacyui-admin.html
+++ b/htroot/yacy/ui/yacyui-admin.html
@@ -1,9 +1,5 @@
-
-
-
-
-
-
-
-
-

-
-
-
+
+
\ No newline at end of file
diff --git a/htroot/yacy/ui/yacyui-bookmarks.html b/htroot/yacy/ui/yacyui-bookmarks.html
index 666dc7b57..971c517ab 100644
--- a/htroot/yacy/ui/yacyui-bookmarks.html
+++ b/htroot/yacy/ui/yacyui-bookmarks.html
@@ -1,10 +1,10 @@
+
-
+
\ No newline at end of file
diff --git a/htroot/yacy/ui/yacyui-welcome.html b/htroot/yacy/ui/yacyui-welcome.html
index 94850d3fc..c3b6e3ff6 100644
--- a/htroot/yacy/ui/yacyui-welcome.html
+++ b/htroot/yacy/ui/yacyui-welcome.html
@@ -8,6 +8,9 @@
apfelmaennchen
Change Log
+ - 26-01-2009: reworked search interface, still has timing problems, but now uses yacysearch.json and has full support for flexigrid
+ - 25-01-2009: bookmark folders sidebar is now directly linked to flexigrid if bookmark tab is selected
+ - 25-01-2009: successfully migrated bookmark folders to treeview.async mode (==> new json api)
- 11-01-2009: support for new unified bookmark api ==> much improved handling due to json and flexigrid
- 27-09-2008: Enabled edit bookmark and added some more icons to toolbar
- 27-09-2008: Added scrollbar to folder widget