Unverified 提交 e59716c0 authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #762 from katzyn/web

Add row deletion confirmation to web console
...@@ -1675,10 +1675,11 @@ public class WebApp { ...@@ -1675,10 +1675,11 @@ public class WebApp {
"onmouseout = \"this.className ='icon'\" " + "onmouseout = \"this.className ='icon'\" " +
"class=\"icon\" alt=\"${text.resultEdit.edit}\" " + "class=\"icon\" alt=\"${text.resultEdit.edit}\" " +
"title=\"${text.resultEdit.edit}\" border=\"1\"/>"). "title=\"${text.resultEdit.edit}\" border=\"1\"/>").
append("<a href=\"editResult.do?op=2&row="). append("<img onclick=\"javascript:deleteRow(").
append(rs.getRow()). append(rs.getRow()).
append("&jsessionid=${sessionId}\" target=\"h2result\" >" + append(",'${sessionId}', '${text.resultEdit.delete}', " +
"<img width=16 height=16 src=\"ico_remove.gif\" " + "'${text.resultEdit.cancel}'").
append(")\" width=16 height=16 src=\"ico_remove.gif\" " +
"onmouseover = \"this.className ='icon_hover'\" " + "onmouseover = \"this.className ='icon_hover'\" " +
"onmouseout = \"this.className ='icon'\" " + "onmouseout = \"this.className ='icon'\" " +
"class=\"icon\" alt=\"${text.resultEdit.delete}\" " + "class=\"icon\" alt=\"${text.resultEdit.delete}\" " +
......
...@@ -82,18 +82,45 @@ function editRow(row, session, write, undo) { ...@@ -82,18 +82,45 @@ function editRow(row, session, write, undo) {
} }
} }
function editCancel(row) { function deleteRow(row, session, write, undo) {
var table = document.getElementById('editTable');
var y = row < 0 ? table.rows.length - 1 : row;
var i;
for(i=1; i<table.rows.length; i++) {
var cell = table.rows[i].cells[0];
if (i == y) {
var edit = '<img width=16 height=16 src="ico_remove_ok.gif" onclick="deleteOk('+row+')" onmouseover = "this.className =\'icon_hover\'" onmouseout = "this.className=\'icon\'" class="icon" alt="'+write+'" title="'+write+'" border="1"/>';
var undo = '<img width=16 height=16 src="ico_undo.gif" onclick="editCancel('+row+')" onmouseover = "this.className =\'icon_hover\'" onmouseout = "this.className=\'icon\'" class="icon" alt="'+undo+'" title="'+undo+'" border="1"/>';
cell.innerHTML = edit + undo;
} else {
cell.innerHTML = '';
}
}
var cells = table.rows[y].cells;
for (i=1; i<cells.length; i++) {
var s = cells[i].style;
s.color = 'red';
s.textDecoration = 'line-through';
}
}
function editFinish(row, res) {
var editing = document.getElementById('editing'); var editing = document.getElementById('editing');
editing.row.value = row; editing.row.value = row;
editing.op.value='3'; editing.op.value = res;
editing.submit(); editing.submit();
} }
function editCancel(row) {
editFinish(row, '3');
}
function editOk(row) { function editOk(row) {
var editing = document.getElementById('editing'); editFinish(row, '1');
editing.row.value = row; }
editing.op.value='1';
editing.submit(); function deleteOk(row) {
editFinish(row, '2');
} }
function editKeyDown(row, object, event) { function editKeyDown(row, object, event) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论