- show active/running crawls
- execute crawls (works currently only if API entry is available)
- various smaller fixes

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

@ -125,45 +125,7 @@
</form>
</div>
<div id="ymarks_export_tab">
<form action="" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
<input type="hidden" value="/YMarks.html" name="redirect">
<h4>Export file format<img title="help" alt="help" class="help" src="/yacy/ui/img-2/question_blue.png"></h4>
<p>
<input type="radio" name="exporter" value="html" disabled="disabled" /> Netscape HTML<br />
<input type="radio" name="exporter" value="json" disabled="disabled" /> Firefox JSON<br />
<input type="radio" name="exporter" value="xbel" disabled="disabled" /> XBEL<br />
<input type="radio" name="exporter" value="surro" disabled="disabled" /> Surrogate XML<br />
<input type="radio" name="exporter" value="list" disabled="disabled" /> YaCy Black/White List<br />
</p>
<p>
File name <input class="input" type="text" name="bmkfile" id="bmkfile" size="8" /><br />
</p>
<hr />
<h4>Folder settings<img title="help" alt="help" class="help" src="/yacy/ui/img-2/question_blue.png"></h4>
<p>
<small>Source folder</small>
<input class="input" type="text" name="source" id="source" value="" disabled="disabled" />
</p>
<p>
<small>Target folder</small>
<input class="input" type="text" name="root" id="root" value="" disabled="disabled"/>
</p>
<hr />
<h4>Include metadata<img title="help" alt="help" class="help" src="/yacy/ui/img-2/question_blue.png"></h4>
<p>
<input type="radio" name="meta" value="none" /> none
<br />
<input type="radio" name="meta" value="tags" /> tags
<br />
<input type="radio" name="meta" value="some" /> ...
<br />
<input type="radio" name="meta" value="all" /> all
</p>
<hr />
<p style="text-align: right">
<input type="submit" name="exportbookmarks" value="Export" />
</p>
</form>
</div>
</div>
<!-- Display Bookmarks Table -->

@ -131,10 +131,17 @@ public class get_ymark {
final YMarkCrawlStart crawlstart = new YMarkCrawlStart(sb.tables, bmk_row.get(YMarkEntry.BOOKMARK.URL.key(),YMarkEntry.BOOKMARK.URL.deflt()));
int crawl = 0;
if (!crawlstart.isEmpty())
if (!crawlstart.isEmpty()) {
crawl = 1;
prop.put("json_"+count+"_crawlstart_info", "crawl start");
}
if (crawlstart.hasSchedule()) {
crawl = 2;
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", crawl);

@ -12,9 +12,11 @@
#(crawlstart)#
""
::
"<img src='/yacy/ui/img/crawl.png' alt='crawl start' title='crawl start'/>"
"<img src='/yacy/ui/img/crawl.png' alt='#[info]#' title='#[info]#'/>"
::
"<img src='/yacy/ui/img-2/clock.png' alt='scheduled crawl' title='scheduled crawl'/>"
"<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]#'/>"
#(/crawlstart)#,
"<h3 class='linktitle'>#[title]#</h3><p class='desc'>#[desc]#</p><p class='url'><a href='#[url]#'>#[url]#</a>",
"<p class='tags'>#[tags]#</p>",
@ -22,7 +24,7 @@
"<p class='date'>#[date_added]#</p>",
"<p class='date'>#[date_modified]#</p>",
"<p class='date'>#[date_visited]#</p>",
"#[apicall_pk]#",
"<p class='apicall_pk'>#[apicall_pk]#</p>",
"<p class='date'>#[date_recording]#</p>",
"<p class='date'>#[date_next_exec]#</p>",
"<p class='date'>#[date_last_exec]#</p>"

@ -179,6 +179,15 @@ img.help {
.flexigrid div.fbutton .log-new {
background: url(../../yacy/ui/img-2/new.png) no-repeat center left;
}
.flexigrid div.fbutton .clock {
background: url(../../yacy/ui/img-2/clock.png) no-repeat center left;
}
.flexigrid div.fbutton .calendar {
background: url(../../yacy/ui/img-2/calendar.png) no-repeat center left;
}
.flexigrid div.fbutton .refresh {
background: url(../../yacy/ui/img/flexigrid/load.png) no-repeat center left;
}
.flexigrid div.fbutton .log-more {
/* background: url(../img/flexigrid/uup.png) no-repeat center left; */
margin-left: -20px;

@ -11,6 +11,7 @@ function bm_action(com,grid) {
dataType: 'xml',
success: function(xml) {
$('#ymarks_flexigrid').flexReload();
loadTreeView();
}
}); // close $.ajax(
}); //close each(
@ -36,14 +37,12 @@ function bm_action(com,grid) {
$(autotags).find('tag').each(function(){
tags = tags + "," + $(this).attr('name');
});
$("input[name='bm_tags']").setValue(tags);
$("input[name='bm_tags']").setValue(tags);
}
});
});
$("#ymarks_add_dialog").dialog('open');
}
else if (com=='Edit') {
} else if (com=='Edit') {
if ($('.trSelected',grid).length > 1) {
alert("Editing of more than one selected bookmark is currently not supportet!");
return false;
@ -55,9 +54,40 @@ function bm_action(com,grid) {
$("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');
}
else {
$("#ymarks_add_dialog").dialog('open');
} else if (com=='Crawl') {
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();
}
succ = succ + "\n" + $(this).find('.url').text();
var item = {name : 'item_'+count, 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",
data: param,
url: "Table_API_p.html",
dataType: "html",
success: function() {
}
});
} else {
alert("Sorry, the function you have requested is not yet available!");
return false;
}
@ -90,6 +120,7 @@ function bm_dialog() {
$("#bm_url").unbind('blur');
$("#ymarks_add_dialog").dialog("close");
$('#ymarks_flexigrid').flexReload();
loadTreeView();
return false;
}
});

@ -16,7 +16,7 @@ $(document).ready(function() {
colModel: [
{display: 'Hash', name : 'hash', width : 85, sortable : false, align: 'left', hide: true},
{display: 'Public', name : 'public', width : 20, sortable : true, align: 'center'},
{display: 'Crawl start', name : 'crawl_start', width : 20, sortable : true, align: 'center'},
{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},
@ -24,12 +24,12 @@ $(document).ready(function() {
{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},
{display: 'API PK', name : 'apicall_pk', width : 85, sortable : true, align: 'left', hide: true},
{display: 'Date recording', name : 'date_recording', width : 100, sortable : true, align: 'left', hide: true},
{display: 'Date next exec', name : 'date_next_exec', width : 100, sortable : true, align: 'left', hide: true},
{display: 'Date last exec', name : 'date_last_exec', width : 100, sortable : true, align: 'left', hide: true}
{display: 'Date recording', name : 'date_recording', width : 100, sortable : false, align: 'left', hide: true},
{display: 'Date next exec', name : 'date_next_exec', width : 100, sortable : false, align: 'left', hide: true},
{display: 'Date last exec', name : 'date_last_exec', width : 100, sortable : false, align: 'left', hide: true}
],
buttons: [
{name: '...', bclass: 'burst', onpress: function() {
{name: '...', bclass: 'refresh', onpress: function() {
$('#ymarks_flexigrid').flexOptions({
sortname: "title",
sortorder: "asc",
@ -37,6 +37,8 @@ $(document).ready(function() {
qtype: "title"
});
$('#ymarks_flexigrid').flexReload();
loadTreeView();
}},
{separator: true},
{name: 'Add', bclass: 'bookmark', onpress: bm_action},
@ -44,6 +46,7 @@ $(document).ready(function() {
{name: 'Delete', bclass: 'delete', onpress: bm_action},
{separator: true},
{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},
@ -91,24 +94,7 @@ $(document).ready(function() {
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;
}
});
loadTreeView();
$('input[name=importer]').change(function() {
if ($("input[name=importer]:checked").val() == 'crawls') {
@ -160,3 +146,25 @@ function loadTagCloud() {
}
}); //close $.ajax(
};
function loadTreeView() {
$("#ymarks_treeview").empty();
$("#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;
}
});
}

@ -34,6 +34,8 @@ import java.util.regex.Pattern;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.blob.Tables;
import de.anomic.crawler.CrawlProfile;
import de.anomic.crawler.CrawlSwitchboard;
import de.anomic.data.WorkTables;
public class YMarkCrawlStart extends HashMap<String,String>{
@ -45,8 +47,7 @@ public class YMarkCrawlStart extends HashMap<String,String>{
private Date date_recording;
private String apicall_pk;
private String url;
public YMarkCrawlStart(final WorkTables worktables) {
super();
this.date_recording = new Date(0);
@ -87,6 +88,18 @@ public class YMarkCrawlStart extends HashMap<String,String>{
return false;
}
public boolean isRunning(final CrawlSwitchboard crawler) {
final Iterator<byte[]> iter = crawler.getActive().iterator();
while(iter.hasNext()) {
final byte[] key = iter.next();
final CrawlProfile crawl = crawler.getActive(key);
if (crawl.startURL().equals(this.url)) {
return true;
}
}
return false;
}
public Date date_recording() {
return this.date_recording;
}

@ -105,6 +105,8 @@ public class YMarkUtil {
}
public final static String cleanFoldersString(final String foldersString) {
if(foldersString.isEmpty())
return YMarkEntry.BOOKMARK.FOLDERS.deflt();
StringBuilder fs = new StringBuilder(cleanTagsString(foldersString));
if(fs.length() == 0)
return YMarkEntry.BOOKMARK.FOLDERS.deflt();

Loading…
Cancel
Save