further update to YMarks

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@8100 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
apfelmaennchen 13 years ago
parent c882c0d421
commit dd1482aaf5

@ -88,31 +88,33 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
</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>
<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 />
<input class="input" type="text" name="query" id="query" />
<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)
<small>Query Type</small>
<select id= "ymarks_qtype" name="qtype">
<option value="_tags" selected="selected">Tags (comma seperated)</option>
<option value="tags">Tags (regexp)</option>
<option value="_folder">Folders (comma seperated)</option>
<option value="folders">Folders (regexp)</option>
<option value="title">Title (regexp)</option>
<option value="desc">Description (regexp)</option>
</select>
</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>
Enter tags to add (<i>replace with</i>)
<br /><small>(comma separated tags)</small>
<input class="input" type="text" name="replace" id="source" value="" />
</p>
<hr />
<p style="text-align: right">
<input type="submit" name="action" value="Replace" />
</p>
@ -223,6 +225,77 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
</select>
</div></form>
</div>
<div id="ymarks_crawlstart" class="bm_dialog" title="Craw Start">
<form id="ymarks_crawler" method="post" action="Crawler_p.html" enctype="multipart/form-data" accept-charset="UTF-8">
<table cellspacing="10" cellpadding="20">
<tr id="ymarks_crawlstart_msg"></tr>
<tr>
<td>Site</td>
<td>
<input type="hidden" name="crawlingMode" id="crawlingMode" value="url" />
<input name="crawlingURL" id="crawlingURL" type="text" size="35" maxlength="256" />
<input type="hidden" name="crawlingDepth" id="crawlingDepth" value="99" />
</td>
<tr>
<td>Scheduler</td>
<td>
<input type="radio" name="recrawl" value="nodoubles" checked="checked"/>run this crawl once<br/>
<input type="radio" name="recrawl" value="scheduler"/>scheduled, look every
<select name="repeat_time">
<option value="1">1</option><option value="2">2</option><option value="3">3</option>
<option value="4">4</option><option value="5">5</option><option value="6">6</option>
<option value="7" selected="selected">7</option>
<option value="8">8</option><option value="9">9</option><option value="10">10</option>
<option value="12">12</option><option value="14">14</option><option value="21">21</option>
<option value="28">28</option><option value="30">30</option>
</select>
<select name="repeat_unit">
<option value="selminutes">minutes</option>
<option value="selhours">hours</option>
<option value="seldays" selected="selected">days</option>
</select>
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for new documents automatically.
</td>
</tr>
<tr>
<td>Path</td>
<td>
<input type="radio" name="range" id="rangeDomain" value="domain" checked="checked"/>load all files in domain<br />
<input type="radio" name="range" id="rangeSubpath" value="subpath" />load only files in a sub-path of given url
<input type="hidden" name="mustnotmatch" id="mustnotmatch" value="" />
<input type="hidden" name="crawlingDomFilterCheck" id="crawlingDomFilterCheck" value="off" />
<input type="hidden" name="crawlingDomFilterDepth" id="crawlingDomFilterDepth" value="1" />
</td>
<tr>
<tr>
<td>Limitations</td>
<td>
<input type="checkbox" name="crawlingDomMaxCheck" id="crawlingDomMaxCheck" /> not more than
<input name="crawlingDomMaxPages" id="crawlingDomMaxPages" type="text" size="6" maxlength="6" value="10000" />
documents
</td>
<tr>
<tr>
<td>Dynamic URLs</td>
<td>
<input type="checkbox" name="crawlingQ" id="crawlingQ" /> allow <a href="http://en.wikipedia.org/wiki/Query_string">
query-strings</a> (urls with a '?' in the path)
<input type="hidden" name="storeHTCache" id="storeHTCache" value="on" />
<input type="hidden" name="cachePolicy" id="cachePolicy" value="iffresh" />
<input type="hidden" name="indexText" id="indexText" value="on" />
<input type="hidden" name="indexMedia" id="indexMedia" value="on" />
<input type="hidden" name="intention" id="intention" value="" />
<input type="hidden" name="xsstopw" id="xsstopw" value="off" />
<input type="hidden" name="xdstopw" id="xdstopw" value="off" />
<input type="hidden" name="xpstopw" id="xpstopw" value="off" />
</td>
<tr>
</table>
<input type="hidden" value="Start New Crawl" name="crawlingstart">
</form>
</div>
#%env/templates/footer.template%#
</body>
</html>

@ -40,7 +40,7 @@ public class import_ymark {
final UserDB.Entry user = sb.userDB.getUser(header);
final boolean isAdmin = (sb.verifyAuthentication(header, true));
final boolean isAuthUser = user!= null && user.hasRight(UserDB.AccessRight.BOOKMARK_RIGHT);
final int queueSize = 20;
final int queueSize = 200;
Thread t;
YMarkEntry bmk;

@ -17,6 +17,7 @@
margin-top:5px;
padding-top:2px;
}
#ymarks_folders_tab {
margin-left: -5px;
margin-right: -5px;

File diff suppressed because one or more lines are too long

@ -56,28 +56,32 @@ function bm_action(com,grid) {
$("select[name='bm_public']").setValue($('.trSelected',grid).find('img').attr('alt'));
$("#ymarks_add_dialog").dialog('open');
} else if (com=='Crawl') {
if ($('.trSelected',grid).length == 1 && $(this).find('.apicall_pk').text() == "") {
var pk = $(this).find('.apicall_pk').text();
$("input[name='crawlingURL']").setValue($('.trSelected',grid).find('.url').text());
$("#ymarks_crawlstart").dialog('open');
} else {
var param = [];
var count = 0;
var i = 0;
var err = "";
var succ = "";
var msg = "";
$('.trSelected',grid).each(function() {
var pk = $(this).find('.apicall_pk').text();
if (pk == "") {
count++;
err = err + "\n" + $(this).find('.url').text();
/*
if (crawl_param.length == 0) {
$('<td colspan="2">You have selected one or more bookmarks without a crawl start entry in the API table. You can define a default profile which will be used instead.</td>').appendTo("#ymarks_crawlstart_msg");
$("input[name='crawlingURL']").attr("disabled","disabled");
$("input[name='crawlingURL']").setValue("Default profile");
$("#ymarks_crawlstart").dialog('open');
}
succ = succ + "\n" + $(this).find('.url').text();
var item = {name : 'item_'+count, value : "mark_"+pk};
*/
alert("Multiple selection currently only supports bookmarks"+"\n"+"with an existing crawl profile in the API table.");
} else {
var item = {name : 'item_'+i, value : "mark_"+pk};
param[i] = item;
i++;
}
});
if(i-count > 0)
msg = msg + "Success:"+succ;
if(count > 0)
msg = msg + "\n\nError: No entry in API Table found:"+err;
alert(msg);
param[param.length] = { name : 'execrows', value : 'true' };
$.ajax({
type: "POST",
@ -85,8 +89,11 @@ function bm_action(com,grid) {
url: "Table_API_p.html",
dataType: "html",
success: function() {
$('#ymarks_flexigrid').flexReload();
}
});
}
} else if (com=='XBEL') {
window.open("/api/ymarks/get_xbel.xml","_blank");
return false;
@ -131,4 +138,35 @@ function bm_dialog() {
Cancel: function() { $("#ymarks_add_dialog").dialog("close"); }
}
});
/* Initialize Crawl Start Dialog */
$("#ymarks_crawlstart").dialog({
autoOpen: false,
height: 390,
width: 470,
position: ['top',100],
modal: true,
resizable: false,
buttons: {
OK: function() {
var param = [];
var i = 0;
$("#ymarks_crawler input[type='text'],#ymarks_crawler input:checked,#ymarks_crawler select,#ymarks_crawler input[type='hidden']").each(function() {
var item = {name : $(this).attr("name"), value : $(this).attr("value")};
param[i] = item;
i++;
});
$.ajax({
type: "POST",
data: param,
url: "Crawler_p.html",
dataType: "html",
success: function() {
}
});
$('#ymarks_flexigrid').flexReload();
$("#ymarks_crawlstart").dialog("close");
} ,
Cancel: function() { $("#ymarks_crawlstart").dialog("close"); }
}
});
}

@ -20,7 +20,7 @@ $(document).ready(function() {
{display: 'Crawl start', name : 'crawl_start', width : 20, sortable : false, 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: 'Folders', name : 'folders', width : 160, sortable : true, align: 'left'},
{display: 'Date added', name : 'date_added', width : 100, sortable : true, align: 'left'},
{display: 'Date modified', name : 'date_modified', width : 100, sortable : true, align: 'left'},
{display: 'Date visited', name : 'date_visited', width : 100, sortable : true, align: 'left', hide: true},
@ -57,7 +57,7 @@ $(document).ready(function() {
{display: 'Full text (regexp)', name : ''},
{display: 'Tags (comma seperated)', name : '_tags'},
{display: 'Tags (regexp)', name : 'tags'},
{display: 'Singel Folder', name : '_folder'},
{display: 'Folders (comma seperated)', name : '_folder'},
{display: 'Folders (regexp)', name : 'folders'},
{display: 'Title (regexp)', name : 'title'},
{display: 'Description (regexp)', name : 'desc'}
@ -110,10 +110,11 @@ $(document).ready(function() {
}
});
loadTags("#tag_include", "alpha", "");
$("#tag_include").multiselect({
noneSelectedText: "Select (multiple) tags ...",
height: height-50,
minWidth: 200,
maxWidth: 200,
selectedList: 4,
header: "",
click: function(event, ui) {
@ -130,21 +131,33 @@ $(document).ready(function() {
$('#ymarks_flexigrid').flexReload();
},
beforeopen: function() {
// $(this).multiselect("uncheckAll");
loadTags("#tag_include", "alpha", "");
},
open: function() {
qtag = "";
}
}).multiselectfilter();
loadTags("#tag_select", "alpha", "");
$("#tag_select").multiselect({
noneSelectedText: "Select tags to replace ...",
noneSelectedText: "Select tags to remove ...",
minWidth: 200,
maxWidth: 200,
header: "",
selectedList: 4,
height: height - 540
height: height - 540,
beforeopen: function() {
loadTags("#tag_select", "alpha", "");
}
}).multiselectfilter();
$("#ymarks_qtype").multiselect({
noneSelectedText: "Select query type ...",
minWidth: 200,
maxWidth: 200,
header: "",
selectedList: 1
});
$('#ymarks_tagmanager').submit(function() {
var param = [];
$('#ymarks_tagmanager input[type="text"],#ymarks_tagmanager input[type="radio"]:checked').each(function(i){
@ -153,10 +166,12 @@ $(document).ready(function() {
var tags = "";
var ta = $("#tag_select").val();
var i = 0;
if(ta !== null) {
while (i<ta.length) {
tags = tags + ta[i] + ",";
i++;
};
}
}
param[param.length] = { name : 'tags', value : tags };
$.ajax({
type: "POST",

@ -246,49 +246,23 @@ public class YMarkTables {
}
public void replaceTags(final Iterator<Row> rowIterator, final String bmk_user, final String tagString, final String replaceString) throws IOException, RowSpaceExceededException {
final String[] tagArray = YMarkUtil.cleanTagsString(tagString).split(YMarkUtil.TAGS_SEPARATOR);
final StringBuilder tagStringBuilder = new StringBuilder(BUFFER_LENGTH);
final HashSet<String> remove = YMarkUtil.keysStringToSet(YMarkUtil.cleanTagsString(tagString.toLowerCase()));
final StringBuilder t = new StringBuilder(200);
HashSet<String> tags;
Row row;
while (rowIterator.hasNext()) {
row = rowIterator.next();
if(row != null) {
for (final String element : tagArray) {
tagStringBuilder.setLength(0);
tagStringBuilder.append(row.get(YMarkEntry.BOOKMARK.TAGS.key(), YMarkEntry.BOOKMARK.TAGS.deflt()));
int start = tagStringBuilder.indexOf(element);
int end = start;
while (end<=tagStringBuilder.length() && end != -1) {
if (end == (tagStringBuilder.length())) {
if (end-start == element.length()) {
if (start > 0)
start--; // also replace the tag separator
tagStringBuilder.replace(start, end, YMarkUtil.EMPTY_STRING);
tags = YMarkUtil.keysStringToSet(row.get(YMarkEntry.BOOKMARK.TAGS.key(), YMarkEntry.BOOKMARK.TAGS.deflt()).toLowerCase());
tags.removeAll(remove);
t.append(YMarkUtil.keySetToString(tags));
}
break;
} else if (tagStringBuilder.charAt(end) == ',') {
if (end-start == element.length()) {
if (start > 0)
start--; // also replace the tag separator
tagStringBuilder.replace(start, end, YMarkUtil.EMPTY_STRING);
} else {
start = tagStringBuilder.indexOf(element, end+1);
end = start;
}
} else if (tagStringBuilder.charAt(end) == ' ') {
start = tagStringBuilder.indexOf(element, end);
end = start;
} else {
end++;
}
}
tagStringBuilder.append(YMarkUtil.TAGS_SEPARATOR);
tagStringBuilder.append(replaceString);
row.put(YMarkEntry.BOOKMARK.TAGS.key(), YMarkUtil.cleanTagsString(tagStringBuilder.toString()));
t.append(YMarkUtil.TAGS_SEPARATOR);
t.append(replaceString);
row.put(YMarkEntry.BOOKMARK.TAGS.key(), YMarkUtil.cleanTagsString(t.toString()));
this.worktables.update(TABLES.BOOKMARKS.tablename(bmk_user), row);
}
}
}
}
public void addFolder(final String bmk_user, final String url, final String folder) throws IOException, RowSpaceExceededException {
if(!folder.isEmpty()) {

@ -87,7 +87,7 @@ public class YMarkUtil {
public final static String cleanTagsString(final String tagsString) {
StringBuilder ts = new StringBuilder(tagsString);
if(ts.length() == 0)
return YMarkEntry.BOOKMARK.TAGS.deflt();
return YMarkUtil.EMPTY_STRING;
// get rid of double commas and space characters following a comma
for (int i = 0; i < ts.length()-1; i++) {
if (ts.charAt(i) == TAGS_SEPARATOR.charAt(0)) {
@ -107,7 +107,7 @@ public class YMarkUtil {
public final static String cleanFoldersString(final String foldersString) {
if(foldersString.isEmpty())
return YMarkEntry.BOOKMARK.FOLDERS.deflt();
return YMarkUtil.EMPTY_STRING;
StringBuilder fs = new StringBuilder(cleanTagsString(foldersString));
if(fs.length() == 0)
return YMarkEntry.BOOKMARK.FOLDERS.deflt();

Loading…
Cancel
Save