new buttons to select/deselect all entries

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6681 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 8030ed3319
commit 23bf81d225

@ -6,7 +6,24 @@
<link rel="alternate" type="application/xml" title="Tables" href="Tables.rss?table=#[table]#" />
#(/showtable)#
#%env/templates/metas.template%#
</head>
<script>
<!--
function selectall(name){
var selectForm = document.forms.namedItem(name);
var count = selectForm.elements["num"].value;
for(i = 0; i < count; i++){
selectForm.elements["item_" + i].checked = true;
}
}
function deselectall(name){
var selectForm = document.forms.namedItem(name);
var count = selectForm.elements["num"].value;
for(i = 0; i < count; i++){
selectForm.elements["item_" + i].checked = false;
}
}
-->
</script> </head>
<body id="Tables">
#%env/templates/header.template%#
@ -17,12 +34,12 @@
to a scheduler for a periodic execution.
</p>
#(showtable)#::
<form action="Table_API_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
<form action="Table_API_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8" name="apilist">
<fieldset>
<legend><label for="table">Recorded Actions</label></legend>
<table border="0" cellpadding="2" cellspacing="1">
<tr class="TableHeader" valign="bottom">
<td>&nbsp;</td>
<td><input type="checkbox" name="allswitch" onselect="selectall(this.form.name)" ondeselect="deselectall(this.form.name)"/></td>
<td>Date</td>
<td>Type</td>
<td>Comment</td>
@ -30,7 +47,7 @@
</tr>
#{list}#
<tr class="TableCell#(dark)#Light::Dark::Summary#(/dark)#">
<td align="left"><input type="checkbox" name="mark_#[pk]#" /></td>
<td align="left"><input type="checkbox" name="item_#[count]#" value="mark_#[pk]#" /></td>
<td>#[date]#</td>
<td>#[type]#</td>
<td>#[comment]#</td>
@ -39,7 +56,9 @@
#{/list}#
</table>
<p>
<input type="hidden" name="table" value="#[table]#" />
<input type="hidden" name="num" value="#[num]#" />
<input type="button" onclick="selectall(this.form.name)" value="Select All" />
<input type="button" onclick="deselectall(this.form.name)" value="Deselect All" />&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="execrows" value="Execute Selected Actions" />
<input type="submit" name="deleterows" value="Delete Selected Actions" />
</p>

@ -42,9 +42,9 @@ public class Table_API_p {
if (post != null && post.get("deleterows", "").length() > 0) {
for (Map.Entry<String, String> entry: post.entrySet()) {
if (entry.getKey().startsWith("mark_") && entry.getValue().equals("on")) {
if (entry.getValue().startsWith("mark_")) {
try {
sb.tables.delete(WorkTables.TABLE_API_NAME, entry.getKey().substring(5).getBytes());
sb.tables.delete(WorkTables.TABLE_API_NAME, entry.getValue().substring(5).getBytes());
} catch (IOException e) {
Log.logException(e);
}
@ -59,8 +59,8 @@ public class Table_API_p {
// create a time-ordered list of events to execute
TreeSet<String> pks = new TreeSet<String>();
for (Map.Entry<String, String> entry: post.entrySet()) {
if (entry.getKey().startsWith("mark_") && entry.getValue().equals("on")) {
pks.add(entry.getKey().substring(5));
if (entry.getValue().startsWith("mark_")) {
pks.add(entry.getValue().substring(5));
}
}
@ -114,6 +114,7 @@ public class Table_API_p {
if (row == null) continue;
prop.put("showtable_list_" + count + "_dark", ((dark) ? 1 : 0) ); dark=!dark;
prop.put("showtable_list_" + count + "_pk", new String(row.getPK()));
prop.put("showtable_list_" + count + "_count", count);
prop.put("showtable_list_" + count + "_date", row.from(WorkTables.TABLE_API_COL_DATE));
prop.put("showtable_list_" + count + "_type", row.from(WorkTables.TABLE_API_COL_TYPE));
prop.put("showtable_list_" + count + "_comment", row.from(WorkTables.TABLE_API_COL_COMMENT));
@ -124,6 +125,7 @@ public class Table_API_p {
Log.logException(e);
}
prop.put("showtable_list", count);
prop.put("showtable_num", count);
// return rewrite properties
return prop;

Loading…
Cancel
Save