Merge commit 'e15e633a0128b8d31011283a65b4ef26a6dddcd8'

pull/1/head
Michael Peter Christen 13 years ago
commit edaa8ac94c

@ -12,7 +12,7 @@
<h3>Crawl Scheduler</h3> <h3>Crawl Scheduler</h3>
<p>Scheduled Crawls can be modified in this table</p> <p>Scheduled Crawls can be modified in this table</p>
<iframe id="APITable" src="Table_API_p.html?inline=true&amp;filter=crawler" width="100%" height="0" align="left" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" ></iframe> <iframe id="APITable" src="Table_API_p.html?inline=true&amp;filter=crawler" width="100%" height="0" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" ></iframe>
<h3>Crawl Profile Editor</h3> <h3>Crawl Profile Editor</h3>
<p>Crawl profiles hold information about a crawl process that is currently ongoing.</p> <p>Crawl profiles hold information about a crawl process that is currently ongoing.</p>

@ -21,6 +21,8 @@
<script type="text/javascript"> <script type="text/javascript">
function submitchange(from) { function submitchange(from) {
document.getElementById("apilist").action = "Table_API_p.html#" + from; document.getElementById("apilist").action = "Table_API_p.html#" + from;
document.getElementById ("scheduleevent").value = "true";
document.getElementById("current_schedule_pk").value = from;
document.getElementById("apilist").submit(); document.getElementById("apilist").submit();
} }
</script> </script>
@ -90,41 +92,26 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
<td>#[dateNextExec]#</td> <td>#[dateNextExec]#</td>
<td> <td>
#(scheduler)# #(scheduler)#
<form action="Table_API_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8" id="modify_repeat"> <select name="repeat_select_#[pk]#" onchange='submitchange("#[pk]#")'>
<select name="repeat_select" onchange='submitchange("#[pk]#")'>
<option value="off" selected="selected">no repetition</option> <option value="off" selected="selected">no repetition</option>
<option value="on">activate scheduler</option> <option value="on">activate scheduler</option>
</select> </select>
<input type="hidden" name="startRecord" value="#[startRecord]#" />
<input type="hidden" name="maximumRecords" value="#[maximumRecords]#" />
<input type="hidden" name="pk" value="#[pk]#" />
<input type="hidden" name="inline" value="#[inline]#" />
<input type="hidden" name="filter" value="#[filter]#" />
</form>
:: ::
<form action="Table_API_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8" id="modify_repeat">
<table> <table>
<tr><td> <tr><td>
<select name="repeat_time" onchange='submitchange("#[pk]#")'> <select name="repeat_time_#[pk]#" onchange='submitchange("#[pk]#")'>
#{scale}# #{scale}#
<option value="#[time]#" #(selected)#::selected="selected"#(/selected)#>#[time]#</option> <option value="#[time]#" #(selected)#::selected="selected"#(/selected)#>#[time]#</option>
#{/scale}# #{/scale}#
</select> </select>
</td><td> </td><td>
<select name="repeat_unit" onchange='submitchange("#[pk]#")'> <select name="repeat_unit_#[pk]#" onchange='submitchange("#[pk]#")'>
<option value="selminutes" #(selectedMinutes)#::selected="selected"#(/selectedMinutes)#>minutes</option> <option value="selminutes" #(selectedMinutes)#::selected="selected"#(/selectedMinutes)#>minutes</option>
<option value="selhours" #(selectedHours)#::selected="selected"#(/selectedHours)#>hours</option> <option value="selhours" #(selectedHours)#::selected="selected"#(/selectedHours)#>hours</option>
<option value="seldays" #(selectedDays)#::selected="selected"#(/selectedDays)#>days</option> <option value="seldays" #(selectedDays)#::selected="selected"#(/selectedDays)#>days</option>
</select> </select>
</td></tr> </td></tr>
</table> </table>
<input type="hidden" name="startRecord" value="#[startRecord]#" />
<input type="hidden" name="maximumRecords" value="#[maximumRecords]#" />
<input type="hidden" name="pk" value="#[pk]#" />
<input type="hidden" name="inline" value="#[inline]#" />
<input type="hidden" name="filter" value="#[filter]#" />
<noscript><input type="submit" value="Submit" /></noscript>
</form>
#(/scheduler)# #(/scheduler)#
</td> </td>
#(inline)#<td>#[url]#</td>::#(/inline)# #(inline)#<td>#[url]#</td>::#(/inline)#
@ -134,6 +121,8 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
</div> </div>
</fieldset> </fieldset>
<p> <p>
<input type="hidden" name="scheduleevent" id="scheduleevent" value="false" />
<input type="hidden" name="current_schedule_pk" id="current_schedule_pk" value="" />
<input type="hidden" name="num" value="#[num]#" /> <input type="hidden" name="num" value="#[num]#" />
<input type="submit" name="execrows" value="Execute Selected Actions" /> <input type="submit" name="execrows" value="Execute Selected Actions" />
<input type="submit" name="deleterows" value="Delete Selected Actions" /> <input type="submit" name="deleterows" value="Delete Selected Actions" />

@ -53,14 +53,18 @@ public class Table_API_p {
int startRecord = 0; int startRecord = 0;
int maximumRecords = 25; int maximumRecords = 25;
Pattern query = QueryParams.catchall_pattern; Pattern query = QueryParams.catchall_pattern;
if (post != null && post.containsKey("startRecord")) startRecord = post.getInt("startRecord", 0); if (post != null && post.containsKey("startRecord")) {
if (post != null && post.containsKey("maximumRecords")) maximumRecords = post.getInt("maximumRecords", 0); startRecord = post.getInt("startRecord", 0);
}
if (post != null && post.containsKey("maximumRecords")) {
maximumRecords = post.getInt("maximumRecords", 0);
}
if (post != null && post.containsKey("query") && !post.get("query", "").isEmpty()) { if (post != null && post.containsKey("query") && !post.get("query", "").isEmpty()) {
query = Pattern.compile(".*" + post.get("query", "") + ".*"); query = Pattern.compile(".*" + post.get("query", "") + ".*");
startRecord = 0; startRecord = 0;
maximumRecords = 1000; maximumRecords = 1000;
} }
final boolean inline = (post != null && post.getBoolean("inline",false)); final boolean inline = (post != null && post.getBoolean("inline", false));
prop.put("inline", (inline) ? 1 : 0); prop.put("inline", (inline) ? 1 : 0);
@ -70,10 +74,19 @@ public class Table_API_p {
} }
String pk; String pk;
if (post != null && post.containsKey("repeat_select") && ((pk = post.get("pk")) != null)) try { boolean scheduleevent = false; // flag if schedule info of row changes
final String action = post.get("repeat_select", "off"); String current_schedule_pk = ""; // pk of changed schedule data row
if (post != null && post.containsKey("scheduleevent")) {
scheduleevent = post.get("scheduleevent", "false").equalsIgnoreCase("true");
prop.put("scheduleevent", "false");
current_schedule_pk = post.get("current_schedule_pk", "");
}
if (scheduleevent && !current_schedule_pk.isEmpty()) {
if (post != null && post.containsKey("repeat_select_" + current_schedule_pk) ) {
try {
final String action = post.get("repeat_select_" + current_schedule_pk, "off");
if (action.equals("on")) { if (action.equals("on")) {
Tables.Row row = sb.tables.select(WorkTables.TABLE_API_NAME, pk.getBytes()); Tables.Row row = sb.tables.select(WorkTables.TABLE_API_NAME, current_schedule_pk.getBytes());
if (row != null) { if (row != null) {
row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 7); row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 7);
row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_UNIT, "days"); row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_UNIT, "days");
@ -86,10 +99,12 @@ public class Table_API_p {
} catch (RowSpaceExceededException e) { } catch (RowSpaceExceededException e) {
Log.logException(e); Log.logException(e);
} }
}
if (post != null && post.containsKey("repeat_time") && ((pk = post.get("pk")) != null)) try { if (post != null && post.containsKey("repeat_time_" + current_schedule_pk) ) {
final String action = post.get("repeat_time", "off"); try {
final Tables.Row row = sb.tables.select(WorkTables.TABLE_API_NAME, pk.getBytes()); final String action = post.get("repeat_time_" + current_schedule_pk, "off");
final Tables.Row row = sb.tables.select(WorkTables.TABLE_API_NAME, current_schedule_pk.getBytes());
if (row != null) { if (row != null) {
if ("off".equals(action)) { if ("off".equals(action)) {
row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 0); row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 0);
@ -104,17 +119,27 @@ public class Table_API_p {
} catch (RowSpaceExceededException e) { } catch (RowSpaceExceededException e) {
Log.logException(e); Log.logException(e);
} }
}
if (post != null && post.containsKey("repeat_unit") && ((pk = post.get("pk")) != null)) try { if (post != null && post.containsKey("repeat_unit_" + current_schedule_pk) ) {
final String action = post.get("repeat_unit", "seldays"); try {
final Tables.Row row = sb.tables.select(WorkTables.TABLE_API_NAME, pk.getBytes()); final String action = post.get("repeat_unit_" + current_schedule_pk, "seldays");
final Tables.Row row = sb.tables.select(WorkTables.TABLE_API_NAME, current_schedule_pk.getBytes());
if (row != null) { if (row != null) {
int time = row.get(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 1); int time = row.get(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 1);
row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_UNIT, action.substring(3)); row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_UNIT, action.substring(3));
if (action.equals("selminutes") && time > 0 && time < 10) row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 10); if (action.equals("selminutes") && time > 0 && time < 10) {
if (action.equals("selminutes") && time > 50) row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 50); row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 10);
if (action.equals("selhours") && time > 23) row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 23); }
if (action.equals("seldays") && time > 30) row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 30); if (action.equals("selminutes") && time > 50) {
row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 50);
}
if (action.equals("selhours") && time > 23) {
row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 23);
}
if (action.equals("seldays") && time > 30) {
row.put(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 30);
}
WorkTables.calculateAPIScheduler(row, false); WorkTables.calculateAPIScheduler(row, false);
sb.tables.update(WorkTables.TABLE_API_NAME, row); sb.tables.update(WorkTables.TABLE_API_NAME, row);
} }
@ -123,9 +148,10 @@ public class Table_API_p {
} catch (RowSpaceExceededException e) { } catch (RowSpaceExceededException e) {
Log.logException(e); Log.logException(e);
} }
}
}
if (post != null && !post.get("deleterows", "").isEmpty()) { if (post != null && !post.get("deleterows", "").isEmpty()) {
for (final Map.Entry<String, String> entry: post.entrySet()) { for (final Map.Entry<String, String> entry : post.entrySet()) {
if (entry.getValue().startsWith("mark_")) { if (entry.getValue().startsWith("mark_")) {
try { try {
sb.tables.delete(WorkTables.TABLE_API_NAME, entry.getValue().substring(5).getBytes()); sb.tables.delete(WorkTables.TABLE_API_NAME, entry.getValue().substring(5).getBytes());
@ -139,7 +165,7 @@ public class Table_API_p {
if (post != null && !post.get("execrows", "").isEmpty()) { if (post != null && !post.get("execrows", "").isEmpty()) {
// create a time-ordered list of events to execute // create a time-ordered list of events to execute
final Set<String> pks = new TreeSet<String>(); final Set<String> pks = new TreeSet<String>();
for (final Map.Entry<String, String> entry: post.entrySet()) { for (final Map.Entry<String, String> entry : post.entrySet()) {
if (entry.getValue().startsWith("mark_")) { if (entry.getValue().startsWith("mark_")) {
pks.add(entry.getValue().substring(5)); pks.add(entry.getValue().substring(5));
} }
@ -157,8 +183,11 @@ public class Table_API_p {
boolean dark = true; boolean dark = true;
while (resultIterator.hasNext()) { while (resultIterator.hasNext()) {
record = resultIterator.next(); record = resultIterator.next();
if (record == null) continue; if (record == null) {
prop.put("showexec_list_" + count + "_dark", ((dark) ? 1 : 0) ); dark=!dark; continue;
}
prop.put("showexec_list_" + count + "_dark", ((dark) ? 1 : 0));
dark = !dark;
prop.put("showexec_list_" + count + "_status", record.getValue()); prop.put("showexec_list_" + count + "_status", record.getValue());
prop.put("showexec_list_" + count + "_url", record.getKey()); prop.put("showexec_list_" + count + "_url", record.getKey());
count++; count++;
@ -186,17 +215,27 @@ public class Table_API_p {
// first prepare a list // first prepare a list
while (mapIterator.hasNext()) { while (mapIterator.hasNext()) {
r = mapIterator.next(); r = mapIterator.next();
if (r == null) continue; if (r == null) {
continue;
}
type = UTF8.String(r.get(WorkTables.TABLE_API_COL_TYPE)); type = UTF8.String(r.get(WorkTables.TABLE_API_COL_TYPE));
if (!typefilter.matcher(type).matches()) continue; if (!typefilter.matcher(type).matches()) {
continue;
}
comment = UTF8.String(r.get(WorkTables.TABLE_API_COL_COMMENT)); comment = UTF8.String(r.get(WorkTables.TABLE_API_COL_COMMENT));
if (!query.matcher(comment).matches()) continue; if (!query.matcher(comment).matches()) {
if (c >= startRecord) table.add(r); continue;
}
if (c >= startRecord) {
table.add(r);
}
c++; c++;
if (table.size() >= maximumRecords) break; if (table.size() >= maximumRecords) {
break;
}
} }
// then work on the list // then work on the list
for (final Tables.Row row: table) { for (final Tables.Row row : table) {
final Date now = new Date(); final Date now = new Date();
final Date date = row.containsKey(WorkTables.TABLE_API_COL_DATE) ? row.get(WorkTables.TABLE_API_COL_DATE, now) : null; final Date date = row.containsKey(WorkTables.TABLE_API_COL_DATE) ? row.get(WorkTables.TABLE_API_COL_DATE, now) : null;
final Date date_recording = row.get(WorkTables.TABLE_API_COL_DATE_RECORDING, date); final Date date_recording = row.get(WorkTables.TABLE_API_COL_DATE_RECORDING, date);
@ -206,7 +245,8 @@ public class Table_API_p {
final String unit = row.get(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_UNIT, "days"); final String unit = row.get(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_UNIT, "days");
final int time = row.get(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 0); final int time = row.get(WorkTables.TABLE_API_COL_APICALL_SCHEDULE_TIME, 0);
prop.put("showtable_list_" + count + "_inline", inline ? 1 : 0); prop.put("showtable_list_" + count + "_inline", inline ? 1 : 0);
prop.put("showtable_list_" + count + "_dark", dark ? 1 : 0); dark=!dark; prop.put("showtable_list_" + count + "_dark", dark ? 1 : 0);
dark = !dark;
prop.put("showtable_list_" + count + "_pk", UTF8.String(row.getPK())); prop.put("showtable_list_" + count + "_pk", UTF8.String(row.getPK()));
prop.put("showtable_list_" + count + "_count", count); prop.put("showtable_list_" + count + "_count", count);
prop.put("showtable_list_" + count + "_callcount", callcount); prop.put("showtable_list_" + count + "_callcount", callcount);
@ -233,7 +273,7 @@ public class Table_API_p {
prop.put("showtable_list_" + count + "_scheduler_selectedHours", 0); prop.put("showtable_list_" + count + "_scheduler_selectedHours", 0);
prop.put("showtable_list_" + count + "_scheduler_selectedDays", 0); prop.put("showtable_list_" + count + "_scheduler_selectedDays", 0);
if (unit.equals("minutes")) { if (unit.equals("minutes")) {
for (int i = 1; i <= 5 ; i++) { for (int i = 1; i <= 5; i++) {
prop.put("showtable_list_" + count + "_scheduler_scale_" + i + "_time", i * 10); prop.put("showtable_list_" + count + "_scheduler_scale_" + i + "_time", i * 10);
prop.put("showtable_list_" + count + "_scheduler_scale_" + i + "_selected", 0); prop.put("showtable_list_" + count + "_scheduler_scale_" + i + "_selected", 0);
} }
@ -241,7 +281,7 @@ public class Table_API_p {
prop.put("showtable_list_" + count + "_scheduler_scale", 6); prop.put("showtable_list_" + count + "_scheduler_scale", 6);
prop.put("showtable_list_" + count + "_scheduler_selectedMinutes", 1); prop.put("showtable_list_" + count + "_scheduler_selectedMinutes", 1);
} else if (unit.equals("hours")) { } else if (unit.equals("hours")) {
for (int i = 1; i <= 23 ; i++) { for (int i = 1; i <= 23; i++) {
prop.put("showtable_list_" + count + "_scheduler_scale_" + i + "_time", i); prop.put("showtable_list_" + count + "_scheduler_scale_" + i + "_time", i);
prop.put("showtable_list_" + count + "_scheduler_scale_" + i + "_selected", 0); prop.put("showtable_list_" + count + "_scheduler_scale_" + i + "_selected", 0);
} }
@ -249,7 +289,7 @@ public class Table_API_p {
prop.put("showtable_list_" + count + "_scheduler_scale", 24); prop.put("showtable_list_" + count + "_scheduler_scale", 24);
prop.put("showtable_list_" + count + "_scheduler_selectedHours", 1); prop.put("showtable_list_" + count + "_scheduler_selectedHours", 1);
} else { } else {
for (int i = 1; i <= 30 ; i++) { for (int i = 1; i <= 30; i++) {
prop.put("showtable_list_" + count + "_scheduler_scale_" + i + "_time", i); prop.put("showtable_list_" + count + "_scheduler_scale_" + i + "_time", i);
prop.put("showtable_list_" + count + "_scheduler_scale_" + i + "_selected", 0); prop.put("showtable_list_" + count + "_scheduler_scale_" + i + "_selected", 0);
} }
@ -307,5 +347,4 @@ public class Table_API_p {
// return rewrite properties // return rewrite properties
return prop; return prop;
} }
} }

@ -77,7 +77,7 @@
<compilation-unit> <compilation-unit>
<package-root>source</package-root> <package-root>source</package-root>
<package-root>htroot</package-root> <package-root>htroot</package-root>
<classpath mode="compile">lib/activation.jar:lib/apache-mime4j-0.6.jar:lib/apache-solr-solrj-3.4.0.jar:lib/bcmail-jdk15-145.jar:lib/bcprov-jdk15-145.jar:lib/bzip2.jar:lib/commons-codec-1.4.jar:lib/commons-fileupload-1.2.2.jar:lib/commons-httpclient-3.1.jar:lib/commons-io-2.0.1.jar:lib/commons-jxpath-1.3.jar:lib/commons-logging-1.1.1.jar:lib/fontbox-1.6.0.jar:lib/geronimo-stax-api_1.0_spec-1.0.1.jar:lib/httpclient-4.1.2.jar:lib/httpcore-4.1.3.jar:lib/httpmime-4.1.2.jar:lib/icu4j-core.jar:lib/J7Zip-modified.jar:lib/jakarta-oro-2.0.8.jar:lib/jcifs-1.3.15.jar:lib/jcl-over-slf4j-1.6.1.jar:lib/jempbox-1.6.0.jar:lib/jsch-0.1.42.jar:lib/json-simple-1.1.jar:lib/log4j-1.2.16.jar:lib/metadata-extractor-2.4.0-beta-1.jar:lib/mysql-connector-java-5.1.12-bin.jar:lib/pdfbox-1.6.0.jar:lib/poi-3.6-20091214.jar:lib/poi-scratchpad-3.6-20091214.jar:lib/servlet-api.jar:lib/slf4j-api-1.6.1.jar:lib/slf4j-jdk14-1.6.1.jar:lib/webcat-0.1-swf.jar:lib/wstx-asl-3.2.7.jar:lib/xercesImpl.jar:lib/xml-apis.jar:htroot/processing/domaingraph/applet/domaingraph.jar</classpath> <classpath mode="compile">lib/activation.jar:lib/apache-mime4j-0.6.jar:lib/apache-solr-solrj-3.5.0.jar:lib/bcmail-jdk15-145.jar:lib/bcprov-jdk15-145.jar:lib/bzip2.jar:lib/commons-codec-1.6.jar:lib/commons-fileupload-1.2.2.jar:lib/commons-httpclient-3.1.jar:lib/commons-io-2.0.1.jar:lib/commons-jxpath-1.3.jar:lib/commons-logging-1.1.1.jar:lib/fontbox-1.6.0.jar:lib/geronimo-stax-api_1.0_spec-1.0.1.jar:lib/httpclient-4.1.2.jar:lib/httpcore-4.1.4.jar:lib/httpmime-4.1.2.jar:lib/icu4j-core.jar:lib/J7Zip-modified.jar:lib/jakarta-oro-2.0.8.jar:lib/jcifs-1.3.15.jar:lib/jcl-over-slf4j-1.6.1.jar:lib/jempbox-1.6.0.jar:lib/jsch-0.1.42.jar:lib/json-simple-1.1.jar:lib/log4j-1.2.16.jar:lib/metadata-extractor-2.4.0-beta-1.jar:lib/mysql-connector-java-5.1.12-bin.jar:lib/pdfbox-1.6.0.jar:lib/poi-3.6-20091214.jar:lib/poi-scratchpad-3.6-20091214.jar:lib/servlet-api.jar:lib/slf4j-api-1.6.1.jar:lib/slf4j-jdk14-1.6.1.jar:lib/webcat-0.1-swf.jar:lib/wstx-asl-3.2.7.jar:lib/xercesImpl.jar:lib/xml-apis.jar:htroot/processing/domaingraph/applet/domaingraph.jar</classpath>
<source-level>1.6</source-level> <source-level>1.6</source-level>
</compilation-unit> </compilation-unit>
</java-data> </java-data>

Loading…
Cancel
Save