mirror of
https://github.com/yacy/yacy_search_server.git
synced 2025-05-06 20:59:33 -04:00
YMarks:
- introduced tag manager - a quite powerful tool (still not 100% stable, so be careful) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@8060 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
2236e01137
commit
6287c2b4a9
@ -9,6 +9,9 @@
|
||||
<link media="screen" type="text/css" href="/jquery/css/jquery.multiselect.css" rel="stylesheet" />
|
||||
<script src="/jquery/js/jquery.multiselect.min.js" type="text/javascript"></script>
|
||||
|
||||
<link media="screen" type="text/css" href="/jquery/css/jquery.multiselect.filter.css" rel="stylesheet" />
|
||||
<script src="/jquery/js/jquery.multiselect.filter.min.js" type="text/javascript"></script>
|
||||
|
||||
<link media="screen" type="text/css" href="/yacy/ui/css/jquery.treeview.css" rel="stylesheet" />
|
||||
<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>
|
||||
@ -36,12 +39,12 @@
|
||||
</div>
|
||||
<div id="ymarks_sidebar" class="sidebar">
|
||||
<ul>
|
||||
<li><a href="#ymarks_folders_tab" title="folders"><span>Folders</span></a></li>
|
||||
<li><a href="#ymarks_tags_tab" title="tags"><span>Tags</span></a></li>
|
||||
<li><a href="#ymarks_nav_tab" title="navigation"><span>Explorer</span></a></li>
|
||||
<li><a href="#ymarks_tags_tab" title="tags"><span>Tag Manager</span></a></li>
|
||||
<li><a href="#ymarks_import_tab" title="import"><span>Import</span></a></li>
|
||||
<li><a href="#ymarks_export_tab" title="export"><span>Export</span></a></li>
|
||||
<!-- <li><a href="#ymarks_export_tab" title="export"><span>Export</span></a></li> -->
|
||||
</ul>
|
||||
<div id="ymarks_folders_tab">
|
||||
<div id="ymarks_nav_tab">
|
||||
<!--
|
||||
<div style="margin-top:2px; background:url('/yacy/ui/img/flexigrid/bg.gif') repeat-x scroll center top #FAFAFA;
|
||||
border-color:#CCCCCC #CCCCCC -moz-use-text-color; border-style:solid solid none; border-width:1px 1px 0; padding:5px;
|
||||
@ -52,6 +55,11 @@
|
||||
<img src="/yacy/ui/img-2/question_blue.png" alt="Help" style="padding-right:4px; padding-left:25px;"/>Help
|
||||
</div>
|
||||
-->
|
||||
<div class="tagSelect">
|
||||
<p>
|
||||
<select id="tag_include" name="tag_include" multiple="multiple"></select>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<ul id="ymarks_treeview" class="filetree"></ul>
|
||||
</div>
|
||||
@ -67,17 +75,55 @@
|
||||
<img src="/yacy/ui/img-2/question_blue.png" alt="Help" style="padding-right:4px; padding-left:25px;"/>Help
|
||||
</div>
|
||||
-->
|
||||
<div>
|
||||
<h3>Tag Filter:</h3>
|
||||
<p>
|
||||
<select id="tag_include" name="tag_include" multiple="multiple"></select>
|
||||
</p>
|
||||
</div>
|
||||
<hr />
|
||||
<div>
|
||||
<p id="ymarks_tagcloud"></p>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<div class="tagSelect">
|
||||
<form id="ymarks_tagmanager" action="YMarks.html" method="POST" enctype="multipart/form-data" accept-charset="UTF-8">
|
||||
<h4>Tag Manager<img title="help" alt="help" class="help" src="/yacy/ui/img-2/question_blue.png"></h4>
|
||||
All tag actions are applied to the sub-set of bookmarks defined by this query.
|
||||
<p>
|
||||
<small>Query</small>
|
||||
<input class="input" type="text" name="query" id="query" /><br />
|
||||
<br />
|
||||
<input type="radio" name="qtype" value="_tags" checked="checked"/> Tags (comma seperated)
|
||||
<br />
|
||||
<input type="radio" name="qtype" value="tags" /> Tags (regexp)
|
||||
<br />
|
||||
<input type="radio" name="qtype" value="_folders" /> Folders (comma seperated)
|
||||
<br />
|
||||
<input type="radio" name="qtype" value="folders" /> Folders (regexp)
|
||||
|
||||
</p>
|
||||
<hr />
|
||||
<h5>Replace Tags</h5>
|
||||
<p>
|
||||
<select id="tag_select" name="tags" multiple="multiple"></select><br />
|
||||
</p>
|
||||
<p>
|
||||
<small>Replace with (comma separated tags)</small>
|
||||
<input class="input" type="text" name="replace" id="source" value="" />
|
||||
</p>
|
||||
<p style="text-align: right">
|
||||
<input type="submit" name="action" value="Replace" />
|
||||
</p>
|
||||
<!--
|
||||
<hr />
|
||||
<h5>Automatic tagging</h5>
|
||||
<p>
|
||||
<input type="radio" name="autotag" value="empty" checked="checked"/> Only for empty/unsorted tags
|
||||
<br />
|
||||
<input type="radio" name="autotag" value="overwrite" /> Overwriting existing tags
|
||||
<br />
|
||||
<input type="radio" name="autotag" value="merge" /> Merging with existing tags
|
||||
</p>
|
||||
<p style="text-align: right">
|
||||
<input type="submit" name="tagmanager" value="Run" />
|
||||
</p>
|
||||
-->
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ymarks_import_tab">
|
||||
<form action="/api/ymarks/import_ymark.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
|
||||
@ -124,9 +170,10 @@
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<!--
|
||||
<div id="ymarks_export_tab">
|
||||
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
<!-- Display Bookmarks Table -->
|
||||
<div class ="main">
|
||||
|
@ -133,15 +133,15 @@ public class get_ymark {
|
||||
int crawl = 0;
|
||||
if (!crawlstart.isEmpty()) {
|
||||
crawl = 1;
|
||||
prop.put("json_"+count+"_crawlstart_info", "crawl start");
|
||||
prop.put("json_"+count+"_crawlstart_info", "Crawl start in API Table");
|
||||
}
|
||||
if (crawlstart.hasSchedule()) {
|
||||
crawl = 2;
|
||||
prop.put("json_"+count+"_crawlstart_info", "scheduled crawl: "+YMarkDate.ISO8601(crawlstart.date_next_exec()));
|
||||
prop.put("json_"+count+"_crawlstart_info", "Scheduled Crawl: "+YMarkDate.ISO8601(crawlstart.date_next_exec()));
|
||||
}
|
||||
if (crawlstart.isRunning(sb.crawler)) {
|
||||
crawl = 3;
|
||||
prop.put("json_"+count+"_crawlstart_info", "crawl is running");
|
||||
prop.put("json_"+count+"_crawlstart_info", "Crawl is running ...");
|
||||
}
|
||||
prop.put("json_"+count+"_crawlstart", crawl);
|
||||
|
||||
|
@ -12,11 +12,11 @@
|
||||
#(crawlstart)#
|
||||
""
|
||||
::
|
||||
"<img src='/yacy/ui/img/crawl.png' alt='#[info]#' title='#[info]#'/>"
|
||||
"<img src='/yacy/ui/img-2/accept.png' alt='#[info]#' title='#[info]#'/>"
|
||||
::
|
||||
"<img src='/yacy/ui/img-2/calendar.png' alt='#[info]#' title='#[info]#'/>"
|
||||
::
|
||||
"<img src='/yacy/ui/img-2/arrow_right_blue_round.png' alt='#[info]#' title='#[info]#'/>"
|
||||
"<img src='/yacy/ui/img/crawl.png' alt='#[info]#' title='#[info]#'/>"
|
||||
#(/crawlstart)#,
|
||||
"<h3 class='linktitle'>#[title]#</h3><p class='desc'>#[desc]#</p><p class='url'><a href='#[url]#'>#[url]#</a>",
|
||||
"<p class='tags'>#[tags]#</p>",
|
||||
|
@ -39,7 +39,7 @@ public class replace_tags {
|
||||
if(post != null) {
|
||||
query = post.get("query", post.get("tags", YMarkUtil.EMPTY_STRING));
|
||||
qtype = post.get("qtype", "_tags");
|
||||
tags = post.get("tags", YMarkUtil.EMPTY_STRING);
|
||||
tags = YMarkUtil.cleanTagsString(post.get("tags", YMarkUtil.EMPTY_STRING));
|
||||
replace = post.get("replace", YMarkUtil.EMPTY_STRING);
|
||||
|
||||
} else {
|
||||
@ -55,6 +55,8 @@ public class replace_tags {
|
||||
if(!query.isEmpty()) {
|
||||
if(!qtype.isEmpty()) {
|
||||
if(qtype.equals("_tags")) {
|
||||
if(query.isEmpty())
|
||||
query = tags;
|
||||
final String[] tagArray = YMarkUtil.cleanTagsString(query).split(YMarkUtil.TAGS_SEPARATOR);
|
||||
row_iter = sb.tables.bookmarks.getBookmarksByTag(bmk_user, tagArray);
|
||||
} else if(qtype.equals("_folder")) {
|
||||
@ -66,7 +68,9 @@ public class replace_tags {
|
||||
row_iter = sb.tables.iterator(bmk_table, Pattern.compile(query));
|
||||
}
|
||||
} else {
|
||||
row_iter = sb.tables.iterator(bmk_table);
|
||||
final String[] tagArray = YMarkUtil.cleanTagsString(tags).split(YMarkUtil.TAGS_SEPARATOR);
|
||||
row_iter = sb.tables.bookmarks.getBookmarksByTag(bmk_user, tagArray);
|
||||
// row_iter = sb.tables.iterator(bmk_table);
|
||||
}
|
||||
sb.tables.bookmarks.replaceTags(row_iter, bmk_user, tags, replace);
|
||||
prop.put("status", 1);
|
||||
|
7
htroot/env/yacy-ymarks.css
vendored
7
htroot/env/yacy-ymarks.css
vendored
@ -188,6 +188,9 @@ img.help {
|
||||
.flexigrid div.fbutton .refresh {
|
||||
background: url(../../yacy/ui/img/flexigrid/load.png) no-repeat center left;
|
||||
}
|
||||
.flexigrid div.fbutton .accept {
|
||||
background: url(../../yacy/ui/img-2/accept.png) no-repeat center left;
|
||||
}
|
||||
.flexigrid div.fbutton .log-more {
|
||||
/* background: url(../img/flexigrid/uup.png) no-repeat center left; */
|
||||
margin-left: -20px;
|
||||
@ -218,4 +221,8 @@ img.help {
|
||||
}
|
||||
.filetree ul, .filetree li {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.tagSelect {
|
||||
width: 220px;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
.ui-multiselect { padding:2px 0 2px 4px; text-align:left }
|
||||
.ui-multiselect span.ui-icon { float:right }
|
||||
.ui-multiselect-single input { position:absolute !important; top: auto !important; left:-9999px; }
|
||||
.ui-multiselect-single label { padding:5px !important }
|
||||
.ui-multiselect-single .ui-multiselect-checkboxes input { position:absolute !important; top: auto !important; left:-9999px; }
|
||||
.ui-multiselect-single .ui-multiselect-checkboxes label { padding:5px !important }
|
||||
|
||||
.ui-multiselect-header { margin-bottom:3px; padding:3px 0 3px 4px }
|
||||
.ui-multiselect-header ul { font-size:0.9em }
|
||||
|
3
htroot/jquery/css/jquery.multiselect.filter.css
Normal file
3
htroot/jquery/css/jquery.multiselect.filter.css
Normal file
@ -0,0 +1,3 @@
|
||||
.ui-multiselect-hasfilter ul { position:relative; top:2px }
|
||||
.ui-multiselect-filter { float:left; margin-right:10px; font-size:11px }
|
||||
.ui-multiselect-filter input { width:100px; font-size:10px; margin-left:5px; height:15px; padding:2px; border:1px solid #292929; -webkit-appearance:textfield; -webkit-box-sizing:content-box; }
|
15
htroot/jquery/js/jquery.multiselect.filter.min.js
vendored
Normal file
15
htroot/jquery/js/jquery.multiselect.filter.min.js
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* jQuery MultiSelect UI Widget Filtering Plugin 1.3
|
||||
* Copyright (c) 2011 Eric Hynds
|
||||
*
|
||||
* http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/
|
||||
*
|
||||
* Depends:
|
||||
* - jQuery UI MultiSelect widget
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
(function(c){var f=/[\-\[\]{}()*+?.,\\^$|#\s]/g;c.widget("ech.multiselectfilter",{options:{label:"Filter:",width:null,placeholder:"Enter keywords"},_create:function(){var e;var a=this,b=this.options,d=this.instance=c(this.element).data("multiselect");this.header=d.menu.find(".ui-multiselect-header").addClass("ui-multiselect-hasfilter");e=this.wrapper=c('<div class="ui-multiselect-filter">'+(b.label.length?b.label:"")+'<input placeholder="'+b.placeholder+'" type="search"'+(/\d/.test(b.width)?'style="width:'+ b.width+'px"':"")+" /></div>").prependTo(this.header),b=e;this.inputs=d.menu.find('input[type="checkbox"], input[type="radio"]');this.input=b.find("input").bind({keydown:function(a){a.which===13&&a.preventDefault()},keyup:c.proxy(a._handler,a),click:c.proxy(a._handler,a)});this.updateCache();d._toggleChecked=function(b,d){var e=d&&d.length?d:this.labels.find("input"),i=this,e=e.not(a.instance._isOpen?":disabled, :hidden":":disabled").each(this._toggleCheckbox("checked",b));this.update();var j=e.map(function(){return this.value}).get(); this.element.find("option").filter(function(){!this.disabled&&c.inArray(this.value,j)>-1&&i._toggleCheckbox("selected",b).call(this)})};c(document).bind("multiselectrefresh",function(){a.updateCache();a._handler()})},_handler:function(a){var b=c.trim(this.input[0].value.toLowerCase()),d=this.rows,g=this.inputs,h=this.cache;if(b){d.hide();var e=RegExp(b.replace(f,"\\$&"),"gi");this._trigger("filter",a,c.map(h,function(a,b){return a.search(e)!==-1?(d.eq(b).show(),g.get(b)):null}))}else d.show();this.instance.menu.find(".ui-multiselect-optgroup-label").each(function(){var a= c(this);a[a.nextUntil(".ui-multiselect-optgroup-label").filter(":visible").length?"show":"hide"]()})},updateCache:function(){this.rows=this.instance.menu.find(".ui-multiselect-checkboxes li:not(.ui-multiselect-optgroup-label)");this.cache=this.element.children().map(function(){var a=c(this);this.tagName.toLowerCase()==="optgroup"&&(a=a.children());return a.map(function(){return this.innerHTML.toLowerCase()}).get()}).get()},widget:function(){return this.wrapper},destroy:function(){c.Widget.prototype.destroy.call(this); this.input.val("").trigger("keyup");this.wrapper.remove()}})})(jQuery);
|
2
htroot/jquery/js/jquery.multiselect.min.js
vendored
2
htroot/jquery/js/jquery.multiselect.min.js
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* jQuery MultiSelect UI Widget 1.11
|
||||
* jQuery MultiSelect UI Widget 1.12pre
|
||||
* Copyright (c) 2011 Eric Hynds
|
||||
*
|
||||
* http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/
|
||||
|
@ -3,7 +3,7 @@ HTMLenc = function(s) {
|
||||
}
|
||||
$(document).ready(function() {
|
||||
|
||||
var height=document.documentElement.clientHeight - 200;
|
||||
height=document.documentElement.clientHeight - 200;
|
||||
qtag = "";
|
||||
|
||||
/* Initialize Bookmark Dialog */
|
||||
@ -49,8 +49,7 @@ $(document).ready(function() {
|
||||
{name: 'Crawl', bclass: 'crawl', onpress: bm_action},
|
||||
{name: 'Schedule', bclass: 'calendar', onpress: bm_action},
|
||||
{separator: true},
|
||||
{name: 'Add', bclass: 'addTag', onpress: tag_action},
|
||||
{name: 'Rename', bclass: 'editTag', onpress: tag_action},
|
||||
{name: 'XBEL', bclass: 'xml', onpress: bm_action},
|
||||
{separator: true},
|
||||
{name: 'Help', bclass: 'help', onpress: bm_action}
|
||||
],
|
||||
@ -98,62 +97,111 @@ $(document).ready(function() {
|
||||
loadTreeView();
|
||||
|
||||
$('input[name=importer]').change(function() {
|
||||
if ($("input[name=importer]:checked").val() == 'crawls') {
|
||||
if ($("input[name=importer]:checked").val() == 'crawls') {
|
||||
$("input[name='root']").setValue("/Crawl Start");
|
||||
$("input[name='bmkfile']").attr("disabled","disabled");
|
||||
$("input[name='root']").setValue("/Crawl Start");
|
||||
}
|
||||
else {
|
||||
} else if ($("input[name=importer]:checked").val() == 'bmks') {
|
||||
$("input[name='bmkfile']").attr("disabled","disabled");
|
||||
} else {
|
||||
$("input[name='bmkfile']").removeAttr("disabled");
|
||||
$("input[name='root']").setValue("/Imported Bookmarks");
|
||||
}
|
||||
if ($("input[name=importer]:checked").val() == 'bmks') {
|
||||
$("input[name='bmkfile']").attr("disabled","disabled");
|
||||
}
|
||||
else {
|
||||
$("input[name='bmkfile']").removeAttr("disabled");
|
||||
}
|
||||
});
|
||||
|
||||
loadTags();
|
||||
loadTags("#tag_include", "alpha", "");
|
||||
$("#tag_include").multiselect({
|
||||
noneSelectedText: "Select (multiple) tags ...",
|
||||
height: height-50,
|
||||
selectedList: 4,
|
||||
header: "",
|
||||
click: function(event, ui) {
|
||||
if(ui.checked) {
|
||||
qtag = qtag + "," + ui.value;
|
||||
}
|
||||
},
|
||||
close: function() {
|
||||
$('#ymarks_flexigrid').flexOptions({
|
||||
query: qtag,
|
||||
qtype: "_tags",
|
||||
newp: 1
|
||||
});
|
||||
$('#ymarks_flexigrid').flexReload();
|
||||
},
|
||||
beforeopen: function() {
|
||||
// $(this).multiselect("uncheckAll");
|
||||
},
|
||||
open: function() {
|
||||
qtag = "";
|
||||
}
|
||||
}).multiselectfilter();
|
||||
|
||||
loadTags("#tag_select", "alpha", "");
|
||||
$("#tag_select").multiselect({
|
||||
noneSelectedText: "Select tags to replace ...",
|
||||
header: "",
|
||||
selectedList: 4,
|
||||
height: height - 540
|
||||
}).multiselectfilter();
|
||||
|
||||
$('#ymarks_tagmanager').submit(function() {
|
||||
var param = [];
|
||||
$('#ymarks_tagmanager input[type="text"],#ymarks_tagmanager input[type="radio"]:checked').each(function(i){
|
||||
param[i] = { name : $(this).attr('name'), value : $(this).attr('value') };
|
||||
});
|
||||
var tags = "";
|
||||
var ta = $("#tag_select").val();
|
||||
var i = 0;
|
||||
while (i<ta.length) {
|
||||
tags = tags + ta[i] + ",";
|
||||
i++;
|
||||
};
|
||||
param[param.length] = { name : 'tags', value : tags };
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/api/ymarks/replace_tags.xml",
|
||||
data: param,
|
||||
dataType: "xml",
|
||||
cache: false,
|
||||
success: function(xml) {
|
||||
/*
|
||||
$(xml).find('status').each(function(){
|
||||
var code = $(this).attr('code');
|
||||
alert("Request returned status: "+code);
|
||||
}); //close each(
|
||||
*/
|
||||
loadTagCloud()
|
||||
loadTags("#tag_select", "alpha", "");
|
||||
loadTags("#tag_include", "alpha", "");
|
||||
/*
|
||||
$('#ymarks_flexigrid').flexOptions({
|
||||
sortname: "title",
|
||||
sortorder: "asc",
|
||||
query: query,
|
||||
qtype: "title"
|
||||
});
|
||||
*/
|
||||
$('#ymarks_flexigrid').flexReload();
|
||||
}
|
||||
}); //close $.ajax(
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function loadTags() {
|
||||
$("#tag_include").empty();
|
||||
function loadTags(select, sortorder, tags) {
|
||||
$(select).empty();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/api/ymarks/get_tags.xml?sort=alpha",
|
||||
url: "/api/ymarks/get_tags.xml?sort="+sortorder+"&tag="+tags,
|
||||
dataType: "xml",
|
||||
cache: false,
|
||||
success: function(xml) {
|
||||
$(xml).find('tag').each(function(){
|
||||
var count = $(this).attr('count');
|
||||
var tag = $(this).attr('tag');
|
||||
$('<option value="'+tag+'">'+tag+' ['+count+']</option>').appendTo('#tag_include');
|
||||
}); //close each(
|
||||
$("#tag_include").multiselect({
|
||||
noneSelectedText: "Select tags ...",
|
||||
height: "400",
|
||||
click: function(event, ui) {
|
||||
if(ui.checked) {
|
||||
qtag = qtag + "," + ui.value;
|
||||
}
|
||||
},
|
||||
close: function() {
|
||||
$('#ymarks_flexigrid').flexOptions({
|
||||
query: qtag,
|
||||
qtype: "_tags",
|
||||
newp: 1
|
||||
});
|
||||
$('#ymarks_flexigrid').flexReload();
|
||||
},
|
||||
beforeopen: function() {
|
||||
$(this).multiselect("uncheckAll");
|
||||
},
|
||||
open: function() {
|
||||
qtag = "";
|
||||
}
|
||||
});
|
||||
$('<option value="'+tag+'">'+tag+' ['+count+']</option>').appendTo(select);
|
||||
}); //close each(
|
||||
$(select).multiselect('refresh');
|
||||
}
|
||||
}); //close $.ajax(
|
||||
}
|
||||
@ -169,7 +217,7 @@ function loadTagCloud() {
|
||||
$(xml).find('tag').each(function(){
|
||||
var count = $(this).attr('count');
|
||||
var tag = $(this).attr('tag');
|
||||
var size = ((count/20)+0.3);
|
||||
var size = ((count/20)+0.15);
|
||||
if (size < 1) {size = 1;}
|
||||
$('<a style="font-size:'+size+'em"></a>')
|
||||
.html(HTMLenc(tag)+' ')
|
||||
|
@ -100,7 +100,7 @@ public class YMarkUtil {
|
||||
// get rid of heading and trailing comma
|
||||
if (ts.charAt(0) == TAGS_SEPARATOR.charAt(0))
|
||||
ts.deleteCharAt(0);
|
||||
if (ts.charAt(ts.length()-1) == TAGS_SEPARATOR.charAt(0))
|
||||
if (ts.length()>0 && ts.charAt(ts.length()-1) == TAGS_SEPARATOR.charAt(0))
|
||||
ts.deleteCharAt(ts.length()-1);
|
||||
return ts.toString();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user