pull/1/head
sixcooler 13 years ago
commit fe72d6e549

@ -136,14 +136,6 @@ public class SettingsAck_p {
prop.put("info", "1");//error with submitted information
return prop;
}
/*if (user.length() == 0) {
prop.put("info", 2);//username must be given
return prop;
}*/
/*if (!(pw1.equals(pw2))) {
prop.put("info", 3);//pw check failed
return prop;
}*/
if (filter.length() == 0) filter = "*";
else if (!filter.equals("*")){

@ -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(
@ -39,11 +40,9 @@ function bm_action(com,grid) {
$("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;
@ -56,8 +55,39 @@ function bm_action(com,grid) {
$("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 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 {
});
} 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>{
@ -46,7 +48,6 @@ public class YMarkCrawlStart extends HashMap<String,String>{
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();

@ -43,7 +43,6 @@
package de.anomic.http.server;
import java.io.BufferedReader;
//import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
@ -88,10 +87,8 @@ import net.yacy.kelondro.util.FileUtils;
import net.yacy.repository.Blacklist;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import de.anomic.crawler.retrieval.Request;
import de.anomic.crawler.retrieval.Response;
//import de.anomic.http.client.Client;
import de.anomic.http.client.Cache;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
@ -234,7 +231,7 @@ public final class HTTPDProxyHandler {
*/
private static final StringBuilder userAgentStr = new StringBuilder();
public static void handleOutgoingCookies(final RequestHeader requestHeader, final String targethost, final String clienthost) {
private static void handleOutgoingCookies(final RequestHeader requestHeader, final String targethost, final String clienthost) {
/*
The syntax for the header is:
@ -257,7 +254,7 @@ public final class HTTPDProxyHandler {
}
}
public static void handleIncomingCookies(final ResponseHeader respondHeader, final String serverhost, final String targetclient) {
private static void handleIncomingCookies(final ResponseHeader respondHeader, final String serverhost, final String targetclient) {
/*
The syntax for the Set-Cookie response header is
@ -363,7 +360,7 @@ public final class HTTPDProxyHandler {
// handle outgoing cookies
handleOutgoingCookies(requestHeader, host, ip);
prepareRequestHeader(conProp, requestHeader, hostlow);
ResponseHeader cachedResponseHeader = Cache.getResponseHeader(url.hash());
final ResponseHeader cachedResponseHeader = Cache.getResponseHeader(url.hash());
// why are files unzipped upon arrival? why not zip all files in cache?
// This follows from the following premises
@ -409,7 +406,7 @@ public final class HTTPDProxyHandler {
"200 OK",
sb.crawler.defaultProxyProfile
);
byte[] cacheContent = Cache.getContent(url.hash());
final byte[] cacheContent = Cache.getContent(url.hash());
if (cacheContent != null && response.isFreshForProxy()) {
if (log.isFinest()) log.logFinest(reqID + " fulfill request from cache");
fulfillRequestFromCache(conProp, url, requestHeader, cachedResponseHeader, cacheContent, countedRespond);
@ -467,7 +464,7 @@ public final class HTTPDProxyHandler {
String yAddress = resolveYacyDomains(host);
// re-calc the url path
String remotePath = (args == null) ? path : (path + "?" + args); // with leading '/'
final String remotePath = (args == null) ? path : (path + "?" + args); // with leading '/'
// remove yacy-subdomain-path, when accessing /env
if ( (yAddress != null)
@ -500,9 +497,9 @@ public final class HTTPDProxyHandler {
long sizeBeforeDelete = -1;
if (cachedResponseHeader != null) {
// delete the cache
ResponseHeader rh = Cache.getResponseHeader(url.hash());
final ResponseHeader rh = Cache.getResponseHeader(url.hash());
if (rh != null && (sizeBeforeDelete = rh.getContentLength()) == 0) {
byte[] b = Cache.getContent(url.hash());
final byte[] b = Cache.getContent(url.hash());
if (b != null) sizeBeforeDelete = b.length;
}
Cache.delete(url);
@ -570,7 +567,7 @@ public final class HTTPDProxyHandler {
) {
// we don't write actually into a file, only to RAM, and schedule writing the file.
// int l = res.getResponseHeader().size();
int l = responseHeader.size();
final int l = responseHeader.size();
final ByteArrayOutputStream byteStream = new ByteArrayOutputStream((l < 32) ? 32 : l);
final OutputStream toClientAndMemory = new MultiOutputStream(new OutputStream[] {outStream, byteStream});
@ -591,7 +588,7 @@ public final class HTTPDProxyHandler {
try {
Cache.store(response.url(), response.getResponseHeader(), cacheArray);
sb.toIndexer(response);
} catch (IOException e) {
} catch (final IOException e) {
log.logWarning("cannot write " + response.url() + " to Cache (1): " + e.getMessage(), e);
}
conProp.put(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_CODE, "TCP_MISS");
@ -606,7 +603,7 @@ public final class HTTPDProxyHandler {
try {
Cache.store(response.url(), response.getResponseHeader(), cacheArray);
sb.toIndexer(response);
} catch (IOException e) {
} catch (final IOException e) {
log.logWarning("cannot write " + response.url() + " to Cache (2): " + e.getMessage(), e);
}
conProp.put(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_CODE, "TCP_REFRESH_MISS");
@ -629,7 +626,7 @@ public final class HTTPDProxyHandler {
chunkedOut.flush();
}
} // end hasBody
} catch(SocketException se) {
} catch(final SocketException se) {
// if opened ...
// if(res != null) {
// // client cut proxy connection, abort download
@ -774,7 +771,7 @@ public final class HTTPDProxyHandler {
final String hostlow = host.toLowerCase();
// re-calc the url path
String remotePath = (args == null) ? path : (path + "?" + args);
final String remotePath = (args == null) ? path : (path + "?" + args);
if (Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, hostlow, remotePath)) {
HTTPDemon.sendRespondError(conProp,respond,4,403,null,
@ -845,7 +842,7 @@ public final class HTTPDProxyHandler {
}
}
public static void doPost(final HashMap<String, Object> conProp, final RequestHeader requestHeader, final OutputStream respond, InputStream body) throws IOException {
public static void doPost(final HashMap<String, Object> conProp, final RequestHeader requestHeader, final OutputStream respond, final InputStream body) throws IOException {
assert conProp != null : "precondition violated: conProp != null";
assert requestHeader != null : "precondition violated: requestHeader != null";
assert body != null : "precondition violated: body != null";
@ -892,7 +889,7 @@ public final class HTTPDProxyHandler {
String yAddress = resolveYacyDomains(host);
// re-calc the url path
String remotePath = (args == null) ? path : (path + "?" + args);
final String remotePath = (args == null) ? path : (path + "?" + args);
// remove yacy-subdomain-path, when accessing /env
if ( (yAddress != null)
@ -952,7 +949,7 @@ public final class HTTPDProxyHandler {
chunked.finish();
}
outStream.flush();
} catch(SocketException se) {
} catch(final SocketException se) {
// connection closed by client, abort download
client.finish();
} finally {
@ -1219,7 +1216,7 @@ public final class HTTPDProxyHandler {
try {
remoteProxy.HEADResponse("http://" + host + ":" + port);
ResponseHeader header = new ResponseHeader(remoteProxy.getHttpResponse().getAllHeaders());
final ResponseHeader header = new ResponseHeader(remoteProxy.getHttpResponse().getAllHeaders());
// outputs a logline to the serverlog with the current status
log.logInfo("CONNECT-RESPONSE: status=" + remoteProxy.getHttpResponse().getStatusLine() + ", header=" + header.toString());
@ -1302,26 +1299,26 @@ public final class HTTPDProxyHandler {
final byte[] buffer = new byte[512];
int len;
try {
while ((socket != null) &&
(socket.isBound()) &&
(!(socket.isClosed())) &&
(socket.isConnected()) &&
(!(terminate)) &&
(in != null) &&
(out != null) &&
((len = in.read(buffer)) >= 0)
while ((this.socket != null) &&
(this.socket.isBound()) &&
(!(this.socket.isClosed())) &&
(this.socket.isConnected()) &&
(!(this.terminate)) &&
(this.in != null) &&
(this.out != null) &&
((len = this.in.read(buffer)) >= 0)
) {
out.write(buffer, 0, len);
this.out.write(buffer, 0, len);
}
} catch (final IOException e) {
// do nothing
} catch (Exception e) {
} catch (final Exception e) {
Log.logException(e);
}
}
public void pleaseTerminate() {
terminate = true;
this.terminate = true;
}
}

Loading…
Cancel
Save