Commit f15d7db1 authored by Ted Trask's avatar Ted Trask

Fixed selecting / deselecting entries in viewweblog

parent d8793e28
...@@ -29,24 +29,58 @@ end ...@@ -29,24 +29,58 @@ end
<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"></script> <script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"></script>
<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"></script> <script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { function clickhead(e) {
$("#loglist").tablesorter({headers: {0:{sorter: false},1:{sorter: false}, 2:{sorter: 'text'}, 6:{sorter: false}, 7:{sorter: false}, 8:{sorter: false}}}); var selectdata = "";
}); var deselectdata = "";
function hideColumn(myCol) { var array=[];
myCol.style.display = "none"; $(".chktbl").each(function () {
}; array.push(this.id);
</script> });
if (this.checked == false) {
$('.chktbl:checked').attr('checked', false);
$("#loglist").find('tr:not(#chktbl)').css("background-color","#FFF");
deselectdata = array.join("%0D%0A");
} else {
$('.chktbl:not(:checked)').attr('checked', true);
$("#loglist").find('tr:not(#chktbl)').css("background-color","#FC9A01");
selectdata = array.join("%0D%0A");
}
$.getJSON(
'<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/updateselected") %>?viewtype=ajax&Submit=true&select='+selectdata+'&deselect='+deselectdata,
function(data) {}
);
}
function clicktable(e) {
var selectdata = "";
var deselectdata = "";
if (this.checked == true) {
$(this).closest('tr').css("background-color","#FC9A01");
selectdata = this.id;
} else {
// If clearing, clear the Head too
$("#chkHead").attr("checked", false);
$(this).closest('tr').css("background-color","#ffffff");
deselectdata = this.id;
}
$.getJSON(
'<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/updateselected") %>?viewtype=ajax&Submit=true&select='+selectdata+'&deselect='+deselectdata,
function(data) {}
);
}
<% if data.value.focus.value ~= "" then %>
<script type="text/javascript">
$(function(){ $(function(){
if ($("#focus").length) { $("#loglist").tablesorter({headers: {0:{sorter: false}, 1:{sorter: 'text'}, 5:{sorter: false}, 6:{sorter: false}, 7:{sorter: false}}});
$('#chkHead').click(clickhead);
$('.chktbl').click(clicktable);
<% if data.value.focus.value ~= "" then %>
if ($("#focus").length) {
var top = $("#focus").offset().top; var top = $("#focus").offset().top;
$("html,body").scrollTop(top); $("html,body").scrollTop(top);
} }
<% end %>
}); });
</script> </script>
<% end %>
<% local subdata, pagedata = paginate(data.value.log.value, page_info.clientdata, 200) %> <% local subdata, pagedata = paginate(data.value.log.value, page_info.clientdata, 200) %>
...@@ -157,8 +191,14 @@ end ...@@ -157,8 +191,14 @@ end
<TABLE id="loglist" class="tablesorter"> <TABLE id="loglist" class="tablesorter">
<THEAD> <THEAD>
<TR style=font-weight:bold;> <TR style=font-weight:bold;>
<TH><input type="checkbox" id="chkHead" /></TH> <% local checkhead = true
<TH style="width:0%; display:none"></TH> for i,watch in ipairs(subdata) do
if watch.selected ~= "t" then
checkhead = false
break
end
end %>
<TH><input type="checkbox" id="chkHead"<% if checkhead then %> checked<% end %>></TH>
<TH>Timestamp</TH> <TH>Timestamp</TH>
<TH>Client IP</TH> <TH>Client IP</TH>
<TH>User ID</TH> <TH>User ID</TH>
...@@ -183,8 +223,7 @@ end ...@@ -183,8 +223,7 @@ end
string.match(watch.logdatetime, "(%d+)%-(%d+)-(%d+)%s+(%d+):(%d+):(%d+)") string.match(watch.logdatetime, "(%d+)%-(%d+)-(%d+)%s+(%d+):(%d+):(%d+)")
time = os.time(time) %> time = os.time(time) %>
<TR<%= mark %>> <TR<%= mark %>>
<TD><input class="chktbl" type="checkbox" value="true" <% if watch.selected == "t" then %> checked <% end %>></TD> <TD><input class="chktbl" type="checkbox" id="<%= html.html_escape(watch.id) %>"<% if watch.selected == "t" then %> checked <% end %>></TD>
<TD style="width:0%; display:none"><%= html.html_escape(watch.id) %></TD>
<TD <% if data.value.focus.value == watch.logdatetime then %> style="font-weight:bold;" id="focus" <% end %> ><%= html.link{value = "viewweblog?"..clientinfo.. <TD <% if data.value.focus.value == watch.logdatetime then %> style="font-weight:bold;" id="focus" <% end %> ><%= html.link{value = "viewweblog?"..clientinfo..
"starttime="..os.date("%Y-%m-%d %H:%M:%S", time - 60*(tonumber(data.value.window.value))).. "starttime="..os.date("%Y-%m-%d %H:%M:%S", time - 60*(tonumber(data.value.window.value)))..
"&endtime="..os.date("%Y-%m-%d %H:%M:%S", time + 60*(tonumber(data.value.window.value))).. "&endtime="..os.date("%Y-%m-%d %H:%M:%S", time + 60*(tonumber(data.value.window.value)))..
...@@ -241,71 +280,4 @@ end ...@@ -241,71 +280,4 @@ end
<DD><input class="submit" type="submit" name="Download" value="Export List"></DD> <DD><input class="submit" type="submit" name="Download" value="Export List"></DD>
</form> </form>
<% end %> <% end %>
<script type="text/javascript">
$('#chkHead').click(function () {
if (this.checked == false) {
$('.chktbl:checked').attr('checked', false);
} else {
$('.chktbl:not(:checked)').attr('checked', true);
}
if ($(this).attr("checked")==true) {
$("#loglist").find('tr:not(#chktbl)').css("background-color","#FC9A01");
} else {
$("#loglist").find('tr:not(#chktbl)').css("background-color","#FFF");
}
});
$('.chktbl').click(function () {
if ($("chkHead").attr('checked') == true && this.checked == false) {
var csv_data = "";
var csv_cnt = 0;
$(".chktbl").attr('checked',false);
$(this).closest('tr').css("background-color","#ffffff");
$(this).closest('tr').each(function () {
$(this).find('td').each(function () {
if (csv_cnt == 1) {
document.viewweblog.chktbl.value = "false|" + $(this).text();
return false;
}
csv_cnt +=1;
});
});
}
var selectdata = "";
var deselectdata = "";
if (this.checked == true) {
$(this).closest('tr').css("background-color","#FC9A01");
var csv_list = "";
var csv_cnt = 0;
$(this).closest('tr').each(function () {
$(this).find('td').each(function () {
if (csv_cnt == 1) {
selectdata = $(this).text();
//alert("this is: " + selectdata);
return false;
}
csv_cnt +=1;
});
});
} else {
$(this).closest('tr').css("background-color","#ffffff");
var csv_list = "";
var csv_cnt = 0;
$(this).closest('tr').each(function () {
$(this).find('td').each(function () {
if (csv_cnt == 1) {
deselectdata = $(this).text();
return false;
}
csv_cnt +=1;
});
});
}
$.getJSON(
'<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/updateselected") %>?viewtype=ajax&Submit=true&select='+selectdata+'&deselect='+deselectdata,
function(data) {}
);
});
</script>
</DL> </DL>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment