|
|
|
@ -3,263 +3,24 @@
|
|
|
|
|
<head>
|
|
|
|
|
<title>YaCy Bookmarks</title>
|
|
|
|
|
#%env/templates/metas.template%#
|
|
|
|
|
<link media="screen" type="text/css" href="/env/yacy-ymarks.css" rel="stylesheet" />
|
|
|
|
|
|
|
|
|
|
<link media="screen" type="text/css" href="/yacy/ui/css/jquery.flexigrid.css" rel="stylesheet" />
|
|
|
|
|
<link media="screen" type="text/css" href="/yacy/ui/css/jquery.treeview.css" rel="stylesheet" />
|
|
|
|
|
<link media="screen" type="text/css" href="/yacy/ui/css/jquery.multiselect.css" rel="stylesheet" />
|
|
|
|
|
<link media="screen" type="text/css" href="/env/yacy-ymarks.css" rel="stylesheet" />
|
|
|
|
|
|
|
|
|
|
</head>
|
|
|
|
|
<body id="ymarks_body">
|
|
|
|
|
#%env/templates/header.template%#
|
|
|
|
|
<script src="/yacy/ui/js/jquery-flexigrid.js" type="text/javascript"></script>
|
|
|
|
|
<script src="/yacy/ui/js/jquery.treeview.min.js" type="text/javascript"></script>
|
|
|
|
|
<script src="/yacy/ui/js/jquery.treeview.async.js" type="text/javascript"></script>
|
|
|
|
|
<script src="/yacy/ui/js/jquery.multiselect.min.js" type="text/javascript"></script>
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
//<![CDATA[
|
|
|
|
|
HTMLenc = function(s) {
|
|
|
|
|
return $('<div/>').text(s).html();
|
|
|
|
|
}
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
|
|
|
|
|
var height=document.documentElement.clientHeight - 200;
|
|
|
|
|
|
|
|
|
|
/* Initialize Bookmark Dialog */
|
|
|
|
|
$("#ymarks_add_dialog").dialog({
|
|
|
|
|
autoOpen: false,
|
|
|
|
|
height: 420,
|
|
|
|
|
width: 340,
|
|
|
|
|
position: ['top',100],
|
|
|
|
|
modal: true,
|
|
|
|
|
resizable: false,
|
|
|
|
|
buttons: {
|
|
|
|
|
OK: function() {
|
|
|
|
|
var url = $("input[name='bm_url']").getValue();
|
|
|
|
|
var title = $("input[name='bm_title']").getValue();
|
|
|
|
|
var desc = $("textarea[name='bm_desc']").getValue();
|
|
|
|
|
var tags = $("input[name='bm_tags']").getValue()
|
|
|
|
|
var path = $("input[name='bm_path']").getValue();
|
|
|
|
|
var pub = $("select[name='bm_public']").getValue();
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
url: "/api/ymarks/add_ymark.xml",
|
|
|
|
|
data: "url="+url+"&title="+title+"&desc="+desc+"&tags="+tags+"&folders="+path+"&public="+pub,
|
|
|
|
|
dataType: "xml",
|
|
|
|
|
success: function(xml) {
|
|
|
|
|
$('#bmaddform').resetForm();
|
|
|
|
|
$("#bm_url").unbind('blur');
|
|
|
|
|
$("#ymarks_add_dialog").dialog("close");
|
|
|
|
|
$('#ymarks_flexigrid').flexReload();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} ,
|
|
|
|
|
Cancel: function() { $("#ymarks_add_dialog").dialog("close"); }
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/* Initialize Flexigrid */
|
|
|
|
|
$('#ymarks_flexigrid').flexigrid({
|
|
|
|
|
url: '/api/ymarks/get_ymark.json',
|
|
|
|
|
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 : 400, sortable : true, align: 'left'},
|
|
|
|
|
{display: 'Tags', name : 'tags', width : 160, sortable : false, align: 'left'},
|
|
|
|
|
{display: 'Folders', name : 'folders', width : 160, sortable : true, align: 'left', hide: true},
|
|
|
|
|
{display: 'Date added', name : 'date_added', width : 100, sortable : true, align: 'left'},
|
|
|
|
|
{display: 'Date visited', name : 'date_visited', width : 100, sortable : true, align: 'left'}
|
|
|
|
|
],
|
|
|
|
|
buttons: [
|
|
|
|
|
{name: '...', bclass: 'burst', onpress: function() {
|
|
|
|
|
$('#ymarks_flexigrid').flexOptions({
|
|
|
|
|
sortname: "title",
|
|
|
|
|
sortorder: "asc",
|
|
|
|
|
query: ".*",
|
|
|
|
|
qtype: "title"
|
|
|
|
|
});
|
|
|
|
|
$('#ymarks_flexigrid').flexReload();
|
|
|
|
|
}},
|
|
|
|
|
{separator: true},
|
|
|
|
|
{name: 'Add', bclass: 'bookmark', onpress: bm_action},
|
|
|
|
|
{name: 'Edit', bclass: 'edit', onpress: bm_action},
|
|
|
|
|
{name: 'Delete', bclass: 'delete', onpress: bm_action},
|
|
|
|
|
{separator: true},
|
|
|
|
|
{name: 'Crawl', bclass: 'crawl', onpress: bm_action},
|
|
|
|
|
{separator: true},
|
|
|
|
|
{name: 'Add', bclass: 'addTag', onpress: tag_action},
|
|
|
|
|
{name: 'Rename', bclass: 'editTag', onpress: tag_action},
|
|
|
|
|
{separator: true},
|
|
|
|
|
{name: 'Help', bclass: 'help', onpress: bm_action}
|
|
|
|
|
],
|
|
|
|
|
searchitems : [
|
|
|
|
|
{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,
|
|
|
|
|
sortname: "title",
|
|
|
|
|
sortorder: "asc",
|
|
|
|
|
usepager: true,
|
|
|
|
|
striped: true,
|
|
|
|
|
nowrap: false,
|
|
|
|
|
height: height,
|
|
|
|
|
query: ".*",
|
|
|
|
|
qtype: "title"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/* Initialize Sidebar */
|
|
|
|
|
$('#ymarks_sidebar').height(height+90);
|
|
|
|
|
$tabs = $('#ymarks_sidebar').tabs({
|
|
|
|
|
// tabs options
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$tabs.bind('tabsselect', function(event, ui) {
|
|
|
|
|
/*
|
|
|
|
|
Objects available in the function context:
|
|
|
|
|
ui.tab - anchor element of the selected (clicked) tab
|
|
|
|
|
ui.panel - element, that contains the selected/clicked tab contents
|
|
|
|
|
ui.index - zero-based index of the selected (clicked) tab
|
|
|
|
|
*/
|
|
|
|
|
tabid = "#"+ui.panel.id;
|
|
|
|
|
if (tabid == "#ymarks_tags_tab") {
|
|
|
|
|
loadTagCloud();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#ymarks_treeview").treeview({
|
|
|
|
|
url: "/api/ymarks/get_treeview.json?bmtype=href",
|
|
|
|
|
unique: true,
|
|
|
|
|
persist: "location"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#ymarks_treeview").bind("click", function(event) {
|
|
|
|
|
if ($(event.target).is("li") || $(event.target).parents("li").length) {
|
|
|
|
|
var folder = $(event.target).parents("li").filter(":first").attr("id");
|
|
|
|
|
$('#ymarks_flexigrid').flexOptions({
|
|
|
|
|
query: folder,
|
|
|
|
|
qtype: "_folder",
|
|
|
|
|
newp: 1
|
|
|
|
|
});
|
|
|
|
|
$('#ymarks_flexigrid').flexReload();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#example").multiselect();
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function loadTagCloud() {
|
|
|
|
|
$("#ymarks_tagcloud *").remove();
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
url: "/api/ymarks/get_tags.xml?top=25&sort=alpha",
|
|
|
|
|
dataType: "xml",
|
|
|
|
|
cache: false,
|
|
|
|
|
success: function(xml) {
|
|
|
|
|
$(xml).find('tag').each(function(){
|
|
|
|
|
var count = $(this).attr('count');
|
|
|
|
|
var tag = $(this).attr('tag');
|
|
|
|
|
var size = ((count/20)+0.3);
|
|
|
|
|
if (size < 1) {size = 1;}
|
|
|
|
|
$('<a style="font-size:'+size+'em"></a>')
|
|
|
|
|
.html(HTMLenc(tag)+' ')
|
|
|
|
|
.appendTo('#ymarks_tagcloud')
|
|
|
|
|
.bind('click', function() {
|
|
|
|
|
var qtag = $(this).text().replace(/\s+$/g,"");
|
|
|
|
|
$('#ymarks_flexigrid').flexOptions({
|
|
|
|
|
query: qtag,
|
|
|
|
|
qtype: "_tags",
|
|
|
|
|
newp: 1
|
|
|
|
|
});
|
|
|
|
|
$('#ymarks_flexigrid').flexReload();
|
|
|
|
|
});
|
|
|
|
|
}); //close each(
|
|
|
|
|
}
|
|
|
|
|
}); //close $.ajax(
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Initialize Bookmark Actions */
|
|
|
|
|
function bm_action(com,grid) {
|
|
|
|
|
if (com=='Delete') {
|
|
|
|
|
var check = confirm('Delete ' + $('.trSelected',grid).length + ' bookmark(s)?');
|
|
|
|
|
if(check == true) {
|
|
|
|
|
$('.trSelected',grid).each(function(){
|
|
|
|
|
var url = "/api/ymarks/delete_ymark.xml?id="+$(this).find('td :first').text();
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
url: url,
|
|
|
|
|
dataType: 'xml',
|
|
|
|
|
success: function(xml) {
|
|
|
|
|
$('#ymarks_flexigrid').flexReload();
|
|
|
|
|
}
|
|
|
|
|
}); // close $.ajax(
|
|
|
|
|
}); //close each(
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (com=='Add') {
|
|
|
|
|
$('#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();
|
|
|
|
|
$("input[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);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
$("#ymarks_add_dialog").dialog('open');
|
|
|
|
|
}
|
|
|
|
|
else if (com=='Edit') {
|
|
|
|
|
if ($('.trSelected',grid).length > 1) {
|
|
|
|
|
alert("Editing of more than one selected bookmark is currently not supportet!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
$("input[name='bm_url']").setValue($('.trSelected',grid).find('.url').text());
|
|
|
|
|
$("input[name='bm_title']").setValue($('.trSelected',grid).find('h3.linktitle').text().trim());
|
|
|
|
|
$("textarea[name='bm_desc']").setValue($('.trSelected',grid).find('p.desc').text().trim());
|
|
|
|
|
$("input[name='bm_tags']").setValue($('.trSelected',grid).find('p.tags').text().trim().replace(/,\s/g,","));
|
|
|
|
|
$("input[name='bm_path']").setValue($('.trSelected',grid).find('p.folders').text().replace(/,\s/g,","));
|
|
|
|
|
$("select[name='bm_public']").setValue($('.trSelected',grid).find('img').attr('alt'));
|
|
|
|
|
$("#ymarks_add_dialog").dialog('open');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Initialize Tag Actions */
|
|
|
|
|
function tag_action(com,grid) {
|
|
|
|
|
if (com=='Add') {
|
|
|
|
|
flex = grid;
|
|
|
|
|
$('#tagaddform').resetForm();
|
|
|
|
|
$("#tagadd").dialog('open');
|
|
|
|
|
} else {
|
|
|
|
|
$('#tageditform').resetForm();
|
|
|
|
|
$("#tagedit").dialog('open');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
<script src="/js/yacy-ymarks.js" type="text/javascript"></script>
|
|
|
|
|
<script src="/js/yacy-ymarks-bookmark-actions.js" type="text/javascript"></script>
|
|
|
|
|
<script src="/js/yacy-ymarks-tag-actions.js" type="text/javascript"></script>
|
|
|
|
|
</head>
|
|
|
|
|
<body id="ymarks_body">
|
|
|
|
|
#%env/templates/header.template%#
|
|
|
|
|
|
|
|
|
|
//]]>
|
|
|
|
|
</script>
|
|
|
|
|
<div class="SubMenu">
|
|
|
|
|
<h3>Bookmarks</h3>
|
|
|
|
|
<!--
|
|
|
|
|