YMarks: some improvements to flexigrid quick search on YMarks.html

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7694 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
apfelmaennchen 14 years ago
parent 6fa439c82b
commit 441035f1f4

@ -15,7 +15,7 @@
return $('<div/>').text(s).html();
}
$(document).ready(function() {
var height=document.documentElement.clientHeight - 180;
var height=document.documentElement.clientHeight - 220;
$('#ymarks').flexigrid({
url: '/api/ymarks/get_ymark.json',
dataType: 'json',
@ -44,9 +44,13 @@
{name: 'Help', bclass: 'help', onpress: bm_action},
],
searchitems : [
{display: 'Tags', name : 'tags'},
{display: 'Folders', name : 'folders'},
{display: 'Title', name : 'title'},
{display: 'Full text (regexp)', name : ''},
{display: 'Tags (comma seperated)', name : '_tags'},
{display: 'Tags (regexp)', name : 'tags'},
{display: 'Singel Folder', name : '_folder'},
{display: 'Folders (regexp)', name : 'folders'},
{display: 'Title (regexp)', name : 'title'},
{display: 'Description (regexp)', name : 'desc'}
],
useRp: true,
rp: 15,
@ -64,15 +68,16 @@
$("#side1").accordion({
autoHeight: false,
clearStyle: true,
collapsible: true,
header: "h3"
});
loadTagCloud();
$("#side1").accordion("activate", 0);
$("#side1").accordion("activate", 1);
});
function loadTagCloud() {
$("#tagcloud *").remove();
$("#sidebar-2-1").toggleClass("ui.loading");
$("#sidebar-1-1").toggleClass("ui.loading");
$.ajax({
type: "POST",
url: "/api/ymarks/get_tags.xml?top=25&sort=alpha",
@ -87,8 +92,17 @@
$('<a style="font-size:'+size+'em"></a>')
.html(HTMLenc(tag)+' ')
.appendTo('#tagcloud')
.bind('click', function() {
var qtag = $(this).text().replace(/\s+/g,"");
$('#ymarks').flexOptions({
query: qtag,
qtype: "_tags"
});
$('#ymarks').flexReload();
});
}); //close each(
$("#sidebar-1-1").toggleClass("ui.loading");
$("#side1").accordion("activate", 0);
}
}); //close $.ajax(
};
@ -180,16 +194,13 @@
</ul>
<p/>
</div>
<div id="sidebar" class="sidebar" style="float: right;">
<div id="sidebar" class="sidebar" style="float: right; margin-left: 15px;">
<div id="side1">
<h3 id="sidebar-1-1"><a href="#">Bookmark TagCloud</a></h3>
<div>
<p id="tagcloud"></p>
</div>
<h3 id="sidebar-1-2"><a href="#">Test</a></h3>
<div>
<p id="test">texttext</p>
</div>
</div>
<div id="side2"></div>
</div>

@ -45,15 +45,13 @@ public class get_tags {
int count = 0;
YMarkTag t;
if (post != null && post.containsKey(TAG)) {
if (!post.get(TAG).isEmpty()) {
if (post != null && post.containsKey(TAG) && !post.get(TAG).isEmpty()) {
final String[] tagArray = YMarkUtil.cleanTagsString(post.get(TAG)).split(YMarkUtil.TAGS_SEPARATOR);
try {
tags = new TreeSet<YMarkTag>(sb.tables.bookmarks.getTags(sb.tables.bookmarks.getBookmarksByTag(bmk_user, tagArray)).values());
} catch (IOException e) {
return prop;
}
}
} else {
try {
tags = new TreeSet<YMarkTag>(sb.tables.bookmarks.getTags(bmk_user).values());

@ -61,52 +61,30 @@ public class get_ymark {
sortname = (post.containsKey("sortname")) ? post.get("sortname", YMarkEntry.BOOKMARK.TITLE.key()) : YMarkEntry.BOOKMARK.TITLE.key();
sortorder = (post.containsKey("sortorder")) ? post.get("sortorder", "asc") : "asc";
}
if (qtype.isEmpty())
qtype = YMarkEntry.BOOKMARK.TITLE.key();
if (query.isEmpty())
query = ".*";
try {
final String bmk_table = TABLES.BOOKMARKS.tablename(bmk_user);
final Collection<Row> result = sb.tables.bookmarks.orderBookmarksBy(sb.tables.iterator(bmk_table, qtype, Pattern.compile(query)), sortname, sortorder);
total = result.size();
bookmarks = result.iterator();
} catch (IOException e) {
Log.logException(e);
}
/*
if (qtype.equals(YMarkEntry.BOOKMARK.TAGS.key()) && !query.isEmpty()) {
final String[] tagArray = YMarkUtil.cleanTagsString(post.get(YMarkEntry.BOOKMARK.TAGS.key())).split(YMarkUtil.TAGS_SEPARATOR);
try {
bookmarks = YMarkTables.getPage(sb.tables.bookmarks.getBookmarksByTag(bmk_user, tagArray), sortname, itemsPerPage, page).iterator();
} catch (IOException e) {
Log.logException(e);
final Collection<Row> result;
if(!query.isEmpty()) {
if(!qtype.isEmpty()) {
if(qtype.equals("_tags")) {
final String[] tagArray = YMarkUtil.cleanTagsString(query).split(YMarkUtil.TAGS_SEPARATOR);
result = sb.tables.bookmarks.orderBookmarksBy(sb.tables.bookmarks.getBookmarksByTag(bmk_user, tagArray), sortname, sortorder);
} else if(qtype.equals("_folder")) {
result = sb.tables.bookmarks.orderBookmarksBy(sb.tables.bookmarks.getBookmarksByFolder(bmk_user, query), sortname, sortorder);
} else {
result = sb.tables.bookmarks.orderBookmarksBy(sb.tables.iterator(bmk_table, qtype, Pattern.compile(query)), sortname, sortorder);
}
} else {
try {
bookmarks = YMarkTables.getPage(sb.tables.iterator(YMarkTables.TABLES.BOOKMARKS.tablename(bmk_user)), sortname, itemsPerPage, page).iterator();
} catch (IOException e) {
Log.logException(e);
result = sb.tables.bookmarks.orderBookmarksBy(sb.tables.iterator(bmk_table, Pattern.compile(query)), sortname, sortorder);
}
} else {
result = sb.tables.bookmarks.orderBookmarksBy(sb.tables.iterator(bmk_table), sortname, sortorder);
}
*/
/*
if(post.containsKey(YMarkTables.BOOKMARK.FOLDERS.key())) {
final String[] folderArray = YMarkTables.cleanFoldersString(post.get(YMarkTables.BOOKMARK.FOLDERS.key())).split(YMarkTables.TAGS_SEPARATOR);
try {
if(tags)
bookmarks.retainAll(sb.tables.bookmarks.folders.getBookmarkIds(bmk_user, folderArray));
else
bookmarks.addAll(sb.tables.bookmarks.folders.getBookmarkIds(bmk_user, folderArray));
total = result.size();
bookmarks = result.iterator();
} catch (IOException e) {
Log.logException(e);
} catch (RowSpaceExceededException e) {
Log.logException(e);
}
}
*/
prop.put("page", page);
prop.put("total", total);
putProp(bookmarks, rp, page);

@ -87,7 +87,7 @@ public class YMarkTables {
public final static String p3 = "\\E";
public final static String p4 = "(?:,.*|$)";
public final static String p5 = "((?:";
public final static String p6 = "),*.*){";
public final static String p6 = "),.*){";
public final static String p7 = "/.*)";
public final static String p8 = "(?:,|$)";

Loading…
Cancel
Save