|
|
|
<script type="text/javascript">
|
|
|
|
//<![CDATA[
|
|
|
|
$(document).ready(function() {
|
|
|
|
$("#side1").accordion("activate", 1);
|
|
|
|
// $("#side2").accordion("activate", 1);
|
|
|
|
// $('#yoptions').resetForm();
|
|
|
|
|
|
|
|
var height=document.documentElement.clientHeight - 240;
|
|
|
|
$('#ymarks').flexigrid({
|
|
|
|
url: '/api/bookmarks/get_bookmarks.json?display=1',
|
|
|
|
dataType: 'json',
|
|
|
|
method: 'GET',
|
|
|
|
colModel: [
|
|
|
|
{display: 'Hash', name : 'hash', width : 50, sortable : false, align: 'center', hide: true},
|
|
|
|
{display: 'Public', name : 'public', width : 25, sortable : true, align: 'center'},
|
|
|
|
{display: 'Title', name : 'title', width : 450, sortable : true, align: 'left'},
|
|
|
|
{display: 'Tags', name : 'tags', width : 240, sortable : false, align: 'left'},
|
|
|
|
{display: 'Folders', name : 'folders', width : 240, sortable : false, align: 'left', hide: true},
|
|
|
|
{display: 'Date', name : 'date', width : 100, sortable : true, align: 'left'}
|
|
|
|
],
|
|
|
|
buttons: [
|
|
|
|
{name: 'Crawl', bclass: 'crawl', onpress: bm_action},
|
|
|
|
{separator: true},
|
|
|
|
{name: 'Bookmark', bclass: 'bookmark', onpress: bm_action},
|
|
|
|
{separator: true},
|
|
|
|
{name: 'Edit', bclass: 'edit', onpress: bm_action},
|
|
|
|
{name: 'Delete', bclass: 'delete', onpress: bm_action},
|
|
|
|
{separator: true},
|
|
|
|
{name: 'RSS', bclass: 'rss', onpress: bm_action},
|
|
|
|
{name: 'XBEL', bclass: 'xml', onpress: bm_action},
|
|
|
|
{name: 'XML', bclass: 'xml', onpress: bm_action},
|
|
|
|
{separator: true},
|
|
|
|
{name: 'Import', bclass: 'import', onpress: bm_action},
|
|
|
|
{separator: true},
|
|
|
|
{name: 'Help', bclass: 'help', onpress: bm_action},
|
|
|
|
],
|
|
|
|
searchitems : [
|
|
|
|
{display: 'Tags', name : 'tags'}
|
|
|
|
],
|
|
|
|
useRp: true,
|
|
|
|
rp: 15,
|
|
|
|
sortname: "date",
|
|
|
|
sortorder: "asc",
|
|
|
|
usepager: true,
|
|
|
|
striped: true,
|
|
|
|
nowrap: false,
|
|
|
|
height: height,
|
|
|
|
query: qtag,
|
|
|
|
qtype: "tags",
|
|
|
|
title: 'YaCy Bookmarks: ' + HTMLenc(qtag)
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
function bm_action(com,grid) {
|
|
|
|
if (com=='XBEL') {
|
|
|
|
window.document.location.href = '/api/bookmarks/get_bookmarks.xml?display=xbel';
|
|
|
|
}
|
|
|
|
else if (com=='RSS') {
|
|
|
|
window.document.location.href = '/Bookmarks.rss';
|
|
|
|
}
|
|
|
|
else if (com=='XML') {
|
|
|
|
window.document.location.href = '/api/bookmarks/get_bookmarks.xml';
|
|
|
|
}
|
|
|
|
else if (com=='Delete') {
|
|
|
|
confirm('Delete ' + $('.trSelected',grid).length + ' bookmark(s)?')
|
|
|
|
$('.trSelected',grid).each(function(){
|
|
|
|
var url = "/api/bookmarks/posts/delete_p.xml?login=&urlhash="+$(this).find('td :first').text();
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
|
|
|
url: url,
|
|
|
|
dataType: 'xml'
|
|
|
|
}); // close $.ajax(
|
|
|
|
}); //close each(
|
|
|
|
loadFolders();
|
|
|
|
loadTagCloud();
|
|
|
|
$tabs.tabs("load", 3);
|
|
|
|
}
|
|
|
|
else if (com=='Bookmark') {
|
|
|
|
$('#bmaddform').resetForm();
|
|
|
|
$("#bm_url").blur(function() {
|
|
|
|
var url = $("input[@name='bm_url']").getValue();
|
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
|
|
|
url: "/api/util/getpageinfo_p.xml?url="+url,
|
|
|
|
dataType: "xml",
|
|
|
|
success: function(xml) {
|
|
|
|
var title = $(xml).find('title').text();
|
|
|
|
$("textarea[@name='bm_title']").setValue(title);
|
|
|
|
var desc = $(xml).find('desc').text();
|
|
|
|
$("textarea[@name='bm_desc']").setValue(desc);
|
|
|
|
tags = "";
|
|
|
|
$(xml).find('tag').each(function(){
|
|
|
|
tags = tags + "," + $(this).attr('name');
|
|
|
|
});
|
|
|
|
$("input[@name='bm_tags']").setValue(tags);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$("#bmadd").dialog('open');
|
|
|
|
}
|
|
|
|
else if (com=='Edit') {
|
|
|
|
if ($('.trSelected',grid).length > 1) {
|
|
|
|
alert("Edit of more than one selected bookmark is currently not supportet!");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$("input[@name='bm_url']").setValue($('.trSelected',grid).find('.url').text());
|
|
|
|
$("textarea[@name='bm_title']").setValue($('.trSelected',grid).find('h3.linktitle').text().replace(/^\s+/g,""));
|
|
|
|
$("textarea[@name='bm_desc']").setValue($('.trSelected',grid).find('p.desc').text().replace(/^\s+/g,""));
|
|
|
|
$("input[@name='bm_tags']").setValue($('.trSelected',grid).find('p.tags').text().replace(/\s+/g,""));
|
|
|
|
$("input[@name='bm_path']").setValue($('.trSelected',grid).find('p.folders').text());
|
|
|
|
$("select[@name='bm_public']").setValue($('.trSelected',grid).find('img').attr('alt'));
|
|
|
|
$("#bmadd").dialog('open');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//]]>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<!-- Display Bookmarks Table -->
|
|
|
|
<table id="ymarks" summary="YaCy Bookmarks">
|
|
|
|
<tbody>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|