|
|
|
<script type="text/javascript">
|
|
|
|
//<![CDATA[
|
|
|
|
$(document).ready(function() {
|
|
|
|
$("#side1").accordion("activate", 0);
|
|
|
|
$("#side2").accordion("activate", 1);
|
|
|
|
// $('#yoptions').resetForm();
|
|
|
|
$("#bmadd").dialog({
|
|
|
|
autoOpen: false,
|
|
|
|
height: 375,
|
|
|
|
width: 250,
|
|
|
|
resizable: false,
|
|
|
|
buttons: {
|
|
|
|
"Add": function() {
|
|
|
|
var url = $("input[@name='bm_url']").getValue();
|
|
|
|
var title = $("textarea[@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();
|
|
|
|
var query = "&url="+url+"&title="+title+"&description="+desc+"&tags="+tags+"&path="+path+"&public="+pub+"&add=create";
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "/xml/bookmarks/posts/add_p.xml?login="+query,
|
|
|
|
dataType: "xml",
|
|
|
|
success: function(xml) {
|
|
|
|
$('#bmaddform').resetForm();
|
|
|
|
$("#bmadd").dialog("close");
|
|
|
|
$tabs.tabs("load", 3);
|
|
|
|
$("#side2 *").remove();
|
|
|
|
$("#side2").load("sidebar/sidebar_2.html");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
function bm_action(com,grid) {
|
|
|
|
if (com=='Delete') {
|
|
|
|
confirm('Delete ' + $('.trSelected',grid).length + ' bookmark(s)?')
|
|
|
|
$('.trSelected',grid).each(function(){
|
|
|
|
var url = "/xml/bookmarks/posts/delete_p.xml?login=&urlhash="+$(this).find('td :first').text();
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
|
|
|
url: url,
|
|
|
|
dataType: 'xml',
|
|
|
|
success: function(xml) {
|
|
|
|
$tabs.tabs("load", 3);
|
|
|
|
}
|
|
|
|
}); // close $.ajax(
|
|
|
|
}); //close each(
|
|
|
|
}
|
|
|
|
else if (com=='Add') {
|
|
|
|
$("#bmadd").dialog('open');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$("#bm_url").blur(function() {
|
|
|
|
var url = $("input[@name='bm_url']").getValue();
|
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
|
|
|
url: "/xml/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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
counter = 0;
|
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
|
|
|
url: "/xml/bookmarks/xbel/xbel.xml?tag="+qtag,
|
|
|
|
dataType: "xml",
|
|
|
|
success: function(xml) {
|
|
|
|
$(xml).find('bookmark').each(function(){
|
|
|
|
var link = $(this).attr('href');
|
|
|
|
var hash = $(this).attr('id');
|
|
|
|
var title = $(this).find('title').text();
|
|
|
|
var date = $(this).attr('added');
|
|
|
|
var desc = $(this).find('desc').text();
|
|
|
|
var pub = $(this).find('metadata[owner=YaCy][public]').attr('public');
|
|
|
|
var tags = $(this).find('metadata[owner=Mozilla][ShortcutURL]').attr('ShortcutURL');
|
|
|
|
if (tags != undefined) {
|
|
|
|
tags = tags.replace(",",", ","g");
|
|
|
|
} else {
|
|
|
|
tags ="";
|
|
|
|
}
|
|
|
|
if (pub == "true") {
|
|
|
|
icon = '<img src="img-2/world2.png" alt="public bookmark" title="public bookmark"/>'
|
|
|
|
} else {
|
|
|
|
var icon = '<img src="img-2/lock.png" alt="private bookmark" title="private bookmark"/>'
|
|
|
|
}
|
|
|
|
$('<tr></tr')
|
|
|
|
.html('<td>' +hash+ '</td><td>' +icon+ '</td><td><h3 class="linktitle">' +HTMLenc(title)+ '</h3><p class="desc">' +HTMLenc(desc)+ '</p><p class="url"><a href="' +link+ '">' +link+ '</a></p><td>' +HTMLenc(tags)+ ' </td><td>' +date+ '</td>')
|
|
|
|
.appendTo('#ymarks tbody');
|
|
|
|
counter++;
|
|
|
|
}); //close each(
|
|
|
|
var height=document.documentElement.clientHeight - 205;
|
|
|
|
$('#ymarks').flexigrid({
|
|
|
|
colModel: [
|
|
|
|
{display: 'Hash', name : 'hash', width : 50, sortable : false, align: 'center', hide: true},
|
|
|
|
{display: '', 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: 'Date', name : 'date', width : 130, sortable : true, align: 'left'}
|
|
|
|
],
|
|
|
|
buttons: [
|
|
|
|
{name: 'Add', bclass: 'add', onpress: bm_action},
|
|
|
|
{name: 'Delete', bclass: 'delete', onpress: bm_action},
|
|
|
|
{separator: true}
|
|
|
|
],
|
|
|
|
striped: true,
|
|
|
|
nowrap: false,
|
|
|
|
height: height,
|
|
|
|
title: 'YaCy Bookmarks: ' + HTMLenc(qtag)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}); //close $.ajax(
|
|
|
|
});
|
|
|
|
//]]>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<!-- Display Bookmarks Table -->
|
|
|
|
<table id="ymarks" summary="YaCy Bookmarks">
|
|
|
|
<tbody>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<!-- Display Bookmarks Edit Dialog -->
|
|
|
|
<div id="bmadd" class="bmdialog" title="Add bookmark">
|
|
|
|
<form id="bmaddform" class="small" method="get" accept-charset="UTF-8" action="">
|
|
|
|
<label for="url">URL:</label>
|
|
|
|
<br />
|
|
|
|
<input type="text" name="bm_url" id="bm_url" class="filter" size="80" />
|
|
|
|
<br />
|
|
|
|
<label for="bm_title">Title:</label>
|
|
|
|
<br />
|
|
|
|
<textarea name="bm_title" id="bm_title" class="filter" rows="1" cols="20">
|
|
|
|
</textarea>
|
|
|
|
<br />
|
|
|
|
<label for="bm_desc">Description:</label>
|
|
|
|
<br />
|
|
|
|
<textarea name="bm_desc" id="bm_desc" class="filter" rows="3" cols="20">
|
|
|
|
</textarea>
|
|
|
|
<br />
|
|
|
|
<label for="bm_path">Folder (/folder/subfolder):</label>
|
|
|
|
<br />
|
|
|
|
<input type="text" name="bm_path" id="bm_path" class="filter" size="80" />
|
|
|
|
<br />
|
|
|
|
<label for="bm_tags">Tags (comma separated):</label>
|
|
|
|
<br />
|
|
|
|
<input type="text" name="bm_tags" id="bm_tags" class="filter" size="80" />
|
|
|
|
<br />
|
|
|
|
<label for="bm_public">Public:</label>
|
|
|
|
<br />
|
|
|
|
<select name="bm_public" id="bm_public" class="selector">
|
|
|
|
<option value="public" selected="selected">yes</option>
|
|
|
|
<option value="private">no</option>
|
|
|
|
</select>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|