From cc9f1e9dd9ddd175695766e7192c9a47bb57dcf1 Mon Sep 17 00:00:00 2001 From: apfelmaennchen Date: Sat, 27 Sep 2008 21:15:30 +0000 Subject: [PATCH] YaCy-UI: enabled edit bookmarks in toolbar git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5215 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/yacy/ui/css/base.css | 18 ++- htroot/yacy/ui/css/jquery.dialog.css | 2 +- htroot/yacy/ui/index.html | 71 +++++++++- htroot/yacy/ui/sidebar/sidebar_1.html | 5 +- htroot/yacy/ui/yacyui-bookmarks.html | 184 +++++++++++--------------- htroot/yacy/ui/yacyui-search.html | 9 +- htroot/yacy/ui/yacyui-welcome.html | 1 + 7 files changed, 174 insertions(+), 116 deletions(-) diff --git a/htroot/yacy/ui/css/base.css b/htroot/yacy/ui/css/base.css index cb902c255..193a191a5 100644 --- a/htroot/yacy/ui/css/base.css +++ b/htroot/yacy/ui/css/base.css @@ -87,11 +87,23 @@ img.help { } /* YaCy Flexigrid ---------------------------*/ -.flexigrid div.fbutton .add { - background: url(../img/add.png) no-repeat center left; +.flexigrid div.fbutton .help { + background: url(../img-2/question_blue.png) no-repeat center left; } .flexigrid div.fbutton .delete { - background: url(../img/close.png) no-repeat center left; + background: url(../img-2/cancel.png) no-repeat center left; +} +.flexigrid div.fbutton .edit { + background: url(../img-2/pencil.png) no-repeat center left; +} +.flexigrid div.fbutton .import { + background: url(../img-2/download.png) no-repeat center left; +} +.flexigrid div.fbutton .rss { + background: url(../img-2/rss_round.png) no-repeat center left; +} +.flexigrid div.fbutton .xml { + background: url(../img-2/code.png) no-repeat center left; } .flexigrid div.fbutton .bookmark { background: url(../img/bookmark.png) no-repeat center left; diff --git a/htroot/yacy/ui/css/jquery.dialog.css b/htroot/yacy/ui/css/jquery.dialog.css index 77a14e695..d931bd7e3 100644 --- a/htroot/yacy/ui/css/jquery.dialog.css +++ b/htroot/yacy/ui/css/jquery.dialog.css @@ -25,7 +25,7 @@ .bmdialog.ui-dialog .ui-dialog-titlebar-close { width: 16px; height: 16px; - background: url(../img-2/cancel.png) no-repeat; + background: url(../img/cancel.png) no-repeat; position:absolute; top: 8px; right: 7px; diff --git a/htroot/yacy/ui/index.html b/htroot/yacy/ui/index.html index 414149cc6..b2b9f5ad6 100644 --- a/htroot/yacy/ui/index.html +++ b/htroot/yacy/ui/index.html @@ -112,13 +112,45 @@ $('#yoptions').trigger('update'); } } - }); - + }); + /* Initialize Bookmark Dialog */ + $("#bmadd").dialog({ + autoOpen: false, + height: 400, + width: 250, + resizable: false, + buttons: { + OK: bookmark, + Cancel: function() { $("#bmadd").dialog("close"); } + } + }); /* Load Sidebar */ $("#side1").load("sidebar/sidebar_1.html"); $("#side2").load("sidebar/sidebar_2.html"); }); - //]]> + //]]> + function bookmark() { + 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(); + $("#bm_url").unbind('blur'); + $("#bmadd").dialog("close"); + loadFolders(); + loadTagCloud(); + $tabs.tabs("load", 3); + } + }); + } @@ -138,6 +170,39 @@
  • Compare Search
  • Bookmarks
  • + + +
    +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    diff --git a/htroot/yacy/ui/sidebar/sidebar_1.html b/htroot/yacy/ui/sidebar/sidebar_1.html index fd037d22b..7cc6dfd87 100644 --- a/htroot/yacy/ui/sidebar/sidebar_1.html +++ b/htroot/yacy/ui/sidebar/sidebar_1.html @@ -23,8 +23,9 @@ }); $("#shutdown").click(function() { - confirm("Shutdown YaCy-Peer?"); - $("body").load("../../Steering.html?shutdown="); + if ( confirm("Shutdown YaCy-Peer?") ) { + $("body").load("../../Steering.html?shutdown="); + } }); $("#admin").click(function() { diff --git a/htroot/yacy/ui/yacyui-bookmarks.html b/htroot/yacy/ui/yacyui-bookmarks.html index fbddad0f8..b4a14de9f 100644 --- a/htroot/yacy/ui/yacyui-bookmarks.html +++ b/htroot/yacy/ui/yacyui-bookmarks.html @@ -4,73 +4,7 @@ $("#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"); - loadFolders(); - loadTagCloud(); - $tabs.tabs("select", 3); - } - }); - } - } - }); - $("#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); - } - }); - }); - 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' - }); // close $.ajax( - }); //close each( - loadFolders(); - loadTagCloud(); - $tabs.tabs("load", 3); - } - else if (com=='Add') { - $("#bmadd").dialog('open'); - } - } + $.ajax({ type: "POST", async: true, @@ -91,12 +25,12 @@ tags =""; } if (pub == "true") { - icon = 'public bookmark' + icon = 'public' } else { - var icon = 'private bookmark' + var icon = 'private' } $('' +hash+ '' +icon+ '

    ' +HTMLenc(title)+ '

    ' +HTMLenc(desc)+ '

    ' +link+ '

    ' +HTMLenc(tags)+ ' ' +date+ '') + .html('' +hash+ '' +icon+ '

    ' +HTMLenc(title)+ '

    ' +HTMLenc(desc)+ '

    ' +link+ '

    ' +HTMLenc(tags)+ ' ' +date+ '') .appendTo('#ymarks tbody'); }); //close each( var height=document.documentElement.clientHeight - 205; @@ -109,9 +43,20 @@ {display: 'Date', name : 'date', width : 130, sortable : true, align: 'left'} ], buttons: [ - {name: 'Add', bclass: 'add', onpress: bm_action}, + {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} + {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}, ], striped: true, nowrap: false, @@ -121,6 +66,67 @@ } }); //close $.ajax( }); + function bm_action(com,grid) { + if (com=='XBEL') { + window.document.location.href = '/xml/bookmarks/xbel/xbel.xml'; + } + else if (com=='RSS') { + window.document.location.href = '/Bookmarks.rss'; + } + else if (com=='XML') { + window.document.location.href = '/xml/bookmarks/posts/all.xml'; + } + else 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' + }); // 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: "/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); + } + }); + }); + $("#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('td.tags').text()); + // $("input[@name='bm_path']").setValue($('.trSelected',grid).find('.path').text()); + $("select[@name='bm_public']").setValue($('.trSelected',grid).find('img').attr('alt')); + $("#bmadd").dialog('open'); + } + } //]]> @@ -129,39 +135,7 @@ - -
    -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    -
    + diff --git a/htroot/yacy/ui/yacyui-search.html b/htroot/yacy/ui/yacyui-search.html index 87b6db2f8..9ba8c8be7 100644 --- a/htroot/yacy/ui/yacyui-search.html +++ b/htroot/yacy/ui/yacyui-search.html @@ -41,14 +41,19 @@ {display: 'Date', name : 'date', width : 130, sortable : true, align: 'left'} ], buttons: [ - {name: 'Bookmark', bclass: 'bookmark', onpress: yaction}, {name: 'Crawl', bclass: 'crawl', onpress: yaction}, + {separator: true}, + {name: 'Bookmark', bclass: 'bookmark', onpress: yaction}, + {separator: true}, {name: 'Blacklist', bclass: 'blacklist', onpress: yaction}, + {separator: true}, {name: 'Refresh', bclass: 'load', onpress: yload}, + {name: 'RSS', bclass: 'rss', onpress: yaction}, {separator: true}, {name: page, bclass: 'prev', onpress: yload}, {name: ' ', bclass: 'next', onpress: yload}, - {separator: true} + {separator: true}, + {name: 'Help', bclass: 'help', onpress:yaction}, ], striped: true, nowrap: false, diff --git a/htroot/yacy/ui/yacyui-welcome.html b/htroot/yacy/ui/yacyui-welcome.html index 0e09a7701..203eeac93 100644 --- a/htroot/yacy/ui/yacyui-welcome.html +++ b/htroot/yacy/ui/yacyui-welcome.html @@ -7,6 +7,7 @@ apfelmaennchen

    Change Log