slightly enhanced interface for /Table_YMark_p.html

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7318 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
apfelmaennchen 14 years ago
parent b87bf88ac8
commit 2726606fc8

@ -6,6 +6,9 @@
<link rel="alternate" type="application/xml" title="Tables" href="Tables.rss?table=#[table]#" />
#(/showtable)#
#%env/templates/metas.template%#
<script src="/yacy/ui/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="/yacy/ui/js/jquery.dimensions.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/js/sorttable.js"></script>
<script type="text/javascript">
<!--
function setall(name, check){
@ -20,183 +23,183 @@
for(i = 0; i < count; i++) {
selectForm.elements["item_" + i].checked = check;
}
}
};
$(function() {
$(window).resize(function(){
var width = document.documentElement.clientWidth;
var height = document.documentElement.clientHeight;
width = width - 490;
height = height - 225;
$("#table").width(width);
$("#table").height(height);
$("#content_area").width(width);
});
$(window).trigger("resize");
});
-->
</script>
<script type="text/javascript" src="/js/sorttable.js"></script>
</head>
<body id="YMark">
#%env/templates/header.template%#
#%env/templates/submenuConfig.template%#
#(showselection)#::
<h2>YMark Table Administration</h2>
<form action="Table_YMark_p.html" method="get">
#(/showselection)#
<div style="width:70%; height:700px; float:left;">
#(showtable)#::
<form action="Table_YMark_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8" id="tablelisting">
<fieldset>
<legend><label for="tablelisting">Table Editor: showing table '#[table]#'</label></legend>
<div style="float:left;">
<p>
<input type="hidden" name="table" value="#[table]#" />
<input type="hidden" name="num" value="#[num]#" />
<input type="submit" name="editrow" value="Edit Selected Row" />
<input type="submit" name="addrow" value="Add a new Row" disabled/>
<input type="submit" name="deleterows" value="Delete Selected Rows" />
<input type="submit" name="deletetable" value="Delete Table" />
<input type="submit" name="rebuildindex" value="Rebuild Index" disabled/>
</p>
</div>
<div style="width:750px; height:600px; float:left; overflow:scroll;">
<table class="sortable" border="0" cellpadding="2" cellspacing="1">
<tr class="TableHeader" valign="bottom">
<td><input type="checkbox" name="allswitch" onclick="setall(this.form.name, this.value)" /></td>
<td>PK</td>
#{columns}#
<td>#[header]#</td>
#{/columns}#
</tr>
#{list}#
<tr class="TableCell#(dark)#Light::Dark::Summary#(/dark)#">
<td align="left"><input type="checkbox" name="item_#[count]#" value="mark_#[pk]#" /></td>
<td>#[pk]#</td>
#{columns}#
<td align="left">#[cell]#</td>
#{/columns}#
</tr>
#{/list}#
</table>
</div>
</fieldset>
</form>
#(/showtable)#
#(showedit)#::
<div style="width:800px; height:600px; float:left; overflow:auto;">
<form action="Tables_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset><legend>Row Editor</legend>
<dl>
<dt class="TableCellLight">Primary Key</dt>
<dd>#[pk]#</dd>
#{list}#
<dt class="TableCellLight">#[key]#</dt>
<dd>
<input type="text" name="col_#[key]#" value="#[value]#" size="65"/>
</dd>
#{/list}#
<dt class="TableCellDark"></dt>
<dd>
<input type="hidden" name="table" value="#[table]#" />
<input type="hidden" name="pk" value="#[pk]#" />
<input type="submit" name="commitrow" value="Commit" />
</dd>
</dl>
</fieldset>
</form>
</div>
#(/showedit)#
</div>
#(showselection)#::
<div style="width:320px; float:right;">
<fieldset><legend>Table Selection</legend>
<dl>
<dt>
<label for="table">Select Table:</label>
</dt>
<dd>
<select name="table" onchange='this.form.submit()'>
#{tables}#
<option value="#[name]#" #(selected)#::selected="selected"#(/selected)#>#[name]#</option>
#{/tables}#
</select>
</dd>
<dt>
<label for="count">show max.</label>
</dt>
<dd>
<select name="count" onchange='this.form.submit()'>
<option value="10">10</option>
<option value="100" selected="selected">100</option>
<option value="1000">1000</option>
<option value="all">all</option>
</select>
<b>entries</b>
</dd>
<dt>
<label for="columns">Display columns:</label>
</dt>
<dd>
<select name="columns" multiple onchange='this.form.submit()'>
#{columns}#
<option value="#[col]#">#[col]#</option>
#{/columns}#
</select>
</dd>
</dl>
</fieldset>
<fieldset>
<legend>Search Table</legend>
<dl>
<dt>
<label for="search">search rows for</label>
</dt>
<dd>
<input type="text" name="search" value="#[pattern]#" />
<input type="submit" name="edittable" value="Search" />
</dd>
</dl>
</fieldset>
<fieldset>
<legend>Filter Table</legend>
<dt>
<label for="tags">Tags</label>
</dt>
<dd>
<select name="tags" onchange='this.form.submit()'>
<option value="" selected>select a tag</option>
#{tags}#
<option value="#[tagName]#">#[tagName]#</option>
#{/tags}#
</select>
</dd>
<dt>
<label for="folders">Folders</label>
</dt>
<dd>
<select name="folders" style="width: 200px" onchange='this.form.submit()'>
<option value="" selected>select a folder</option>
#{folders}#
<option value="#[folderName]#">#[folderName]#</option>
#{/folders}#
</select>
</dd>
</fieldset>
<fieldset>
<legend>Import Bookmarks</legend>
<dl>
<dt>
<label for="importer">Importer:</label>
</dt>
<dd>
<select name="importer" id="importer">
<option value="xbel">XBEL Importer</option>
<option value="html">Netscape HTML Importer</option>
</select>
</dd>
<dt>
<label for="file">File:</label>
</dt>
<dd>
<input type="file" name="bmkfile" id="bmkfile" size="10"/>
<h2>YMark Table Administration</h2>
<div id="content_area" style="float: left;">
#(showtable)#::
<form action="Table_YMark_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8" id="tablelisting">
<fieldset>
<legend><label for="tablelisting">Table Editor: showing table '#[table]#'</label></legend>
<p>
<input type="hidden" name="table" value="#[table]#" />
<input type="hidden" name="num" value="#[num]#" />
<input type="submit" name="editrow" value="Edit Selected Row" />
<input type="submit" name="addrow" value="Add a new Row" disabled/>
<input type="submit" name="deleterows" value="Delete Selected Rows" />
<input type="submit" name="deletetable" value="Delete Table" />
<input type="submit" name="rebuildindex" value="Rebuild Index" disabled/>
</p>
<div id="table" style="float:left; overflow:auto;">
<table class="sortable" border="0" cellpadding="2" cellspacing="1">
<tr class="TableHeader" valign="bottom">
<td><input type="checkbox" name="allswitch" onclick="setall(this.form.name, this.value)" /></td>
<td>PK</td>
#{columns}#
<td>#[header]#</td>
#{/columns}#
</tr>
#{list}#
<tr class="TableCell#(dark)#Light::Dark::Summary#(/dark)#">
<td align="left"><input type="checkbox" name="item_#[count]#" value="mark_#[pk]#" /></td>
<td>#[pk]#</td>
#{columns}#
<td align="left">#[cell]#</td>
#{/columns}#
</tr>
#{/list}#
</table>
</div>
</fieldset>
</form>
#(/showtable)#
#(showedit)#::
<div>
<form action="Table_YMark_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset><legend>Row Editor</legend>
<dl>
<dt class="TableCellLight">Primary Key</dt>
<dd>#[pk]#</dd>
#{list}#
<dt class="TableCellLight">#[key]#</dt>
<dd>
<input type="text" name="col_#[key]#" value="#[value]#" size="65"/>
</dd>
#{/list}#
<dt class="TableCellLight"></dt>
<dd>
<input type="hidden" name="table" value="#[table]#" />
<input type="hidden" name="pk" value="#[pk]#" />
<input type="submit" name="commitrow" value="Commit" />
</dd>
</dl>
</fieldset>
</form>
</div>
#(/showedit)#
</div>
#(showselection)#::
<div style="width:310px; float:right;">
<form action="Table_YMark_p.html" method="get">
<fieldset><legend>Table Selection</legend>
<dl>
<dt>
<label for="table">Select Table:</label>
</dt>
<dd>
<select name="table" onchange='this.form.submit()'>
#{tables}#
<option value="#[name]#" #(selected)#::selected="selected"#(/selected)#>#[name]#</option>
#{/tables}#
</select>
</dd>
<dt>
<label for="count">show max. entries</label>
</dt>
<dd>
<select name="count" onchange='this.form.submit()'>
<option value="10">10</option>
<option value="100">100</option>
<option value="1000">1000</option>
<option value="all" selected="selected">all</option>
</select>
</dd>
<dt>
<label for="columns">Display columns:</label>
</dt>
<dd>
#{columns}#
<input type="checkbox" name="col_#[col]#" #(checked)#::checked="checked"#(/checked)# />#[col]#<br/>
#{/columns}#
</dd>
</dl>
<input type="submit" value="load" />
</fieldset>
<fieldset>
<legend>Search/Filter Table</legend>
<dl>
<dt>
<label for="search">search rows for</label>
</dt>
<dd>
<input type="text" name="search" value="#[pattern]#" />
<input type="submit" name="edittable" value="Search" />
</dd>
<dt>
<label for="tags">Tags</label>
</dt>
<dd>
<select name="tags" onchange='this.form.submit()'>
<option value="" selected>select a tag</option>
#{tags}#
<option value="#[tagName]#">#[tagName]#</option>
#{/tags}#
</select>
</dd>
<dt>
<label for="folders">Folders</label>
</dt>
<dd>
<select name="folders" style="width: 200px" onchange='this.form.submit()'>
<option value="" selected>select a folder</option>
#{folders}#
<option value="#[folderName]#">#[folderName]#</option>
#{/folders}#
</select>
</dd>
</dl>
</fieldset>
<fieldset>
<legend>Import Bookmarks</legend>
<dl>
<dt>
<label for="importer">Importer:</label>
</dt>
<dd>
<select name="importer" id="importer">
<option value="xbel">XBEL Importer</option>
<option value="html">Netscape HTML Importer</option>
</select>
</dd>
<dt>
<label for="file">File:</label>
</dt>
<dd>
<input type="file" name="bmkfile" id="bmkfile" size="10"/>
</dd>
</dl>
<input type="submit" name="importbookmarks" value="import" disabled />
</dd>
</dl>
</fieldset>
</form>
</div>
#(/showselection)#
</fieldset>
</form>
</div>
#(/showselection)#
#%env/templates/footer.template%#
</body>
</html>

@ -25,7 +25,7 @@ public class Table_YMark_p {
prop.put("showedit", 0);
prop.put("showselection", 0);
String table = (post == null) ? null : post.get("table", null);
String table = (post == null) ? "admin_bookmarks" : post.get("table", "admin_bookmarks");
if (table != null && !sb.tables.hasHeap(table)) table = null;
// get the user name for the selected table
@ -85,18 +85,33 @@ public class Table_YMark_p {
prop.put("pattern", pattern);
List<String> columns = null;
if (table != null) try {
columns = new ArrayList<String>();
for (Map.Entry<String, String> entry: post.entrySet()) {
if (entry.getKey().startsWith("col_")) {
columns.add(entry.getKey().substring(4));
}
}
if (columns.isEmpty() && table != null) try {
columns = sb.tables.columns(table);
} catch (IOException e) {
Log.logException(e);
columns = new ArrayList<String>();
}
final Iterator<String> cit = columns.iterator();
count = 0;
while(cit.hasNext()) {
prop.put("showselection_columns_" + count + "_col", cit.next());
count++;
if (table != null) {
Iterator<String> cit;
String col;
try {
cit = sb.tables.columns(table).iterator();
while(cit.hasNext()) {
col = cit.next();
prop.put("showselection_columns_" + count + "_col", col);
prop.put("showselection_columns_" + count + "_checked", columns.contains(col) ? 1 : 0);
count++;
}
} catch (IOException e) {
Log.logException(e);
}
}
prop.put("showselection_columns", count);

Loading…
Cancel
Save