diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2016-04-05 12:07:11 -0400 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2016-04-05 12:12:37 -0400 |
commit | cccb1e1a97e8be119807e6f967f12fafdbf46123 (patch) | |
tree | 0f81a927bfc4e241328573808ca99f3879233a74 /src | |
parent | 4081c2320664db7e11aed93e2f5109bf89916627 (diff) | |
download | pfsense-cccb1e1a97e8be119807e6f967f12fafdbf46123.zip pfsense-cccb1e1a97e8be119807e6f967f12fafdbf46123.tar.gz |
Eliminate "onclick" from child SA buttons
Revise recording of open children
(cherry picked from commit 067551a44058656cd980bd95f55c59399c5c36af)
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/local/www/status_ipsec.php | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/usr/local/www/status_ipsec.php b/src/usr/local/www/status_ipsec.php index 9e5f03d..53377bd 100644 --- a/src/usr/local/www/status_ipsec.php +++ b/src/usr/local/www/status_ipsec.php @@ -275,8 +275,8 @@ function print_ipsec_body() { if (is_array($ikesa['child-sas']) && (count($ikesa['child-sas']) > 0)) { - print('<div id="btnchildsa-' . $ikeid . '">'); - print('<a type="button" onclick="show_childsa(\'childsa-' . $ikeid . '\',\'btnchildsa-' . $ikeid. '\');" class="btn btn-sm btn-info">'); + print('<div>'); + print('<a type="button" id="btnchildsa-' . $ikeid . '" class="btn btn-sm btn-info">'); print('<i class="fa fa-plus-circle icon-embed-btn"></i>'); print(gettext('Show child SA entries')); print("</a>\n"); @@ -545,21 +545,9 @@ print_info_box(sprintf(gettext('IPsec can be configured %1$shere%2$s.'), '<a hre <script type="text/javascript"> //<![CDATA[ -// Array in which to keep the SA show/hide state -sa_open = new Array(); - -function show_childsa(id, buttonid) { - $('#' + id).show(); - $('#' + buttonid).hide(); - - // Record the ID of the SA we have revealed so that it can automatically be shown on AJAX reload - idnum = id.replace( /^\D+/g, ''); - sa_open[idnum] = true; -} - events.push(function() { - ajax_lock = false; // Mutex so we don't make a call until the previous call is finished - sa_open = []; + ajax_lock = false; // Mutex so we don't make a call until the previous call is finished + sa_open = new Array(); // Array in which to keep the child SA show/hide state // Fetch the tbody contents from the server function update_table() { @@ -584,12 +572,17 @@ events.push(function() { $('#ipsec-body').html(response); ajax_lock = false; - // Check the sa_open array for SAs we have chosen to show + // Update "Show child SA" handlers + $('[id^=btnchildsa-]').click(function () { + show_childsa($(this).prop("id").replace( /^\D+/g, '')); + }); + + // Check the sa_open array for child SAs that have been opened $('[id^=childsa-con]').each(function(idx) { - sa_idx = idx + 1; + sa_idx = $(this).prop("id").replace( /^\D+/g, ''); if (sa_open[sa_idx]) { - show_childsa("childsa-con" + sa_idx, "btnchildsa-con" + sa_idx); + show_childsa(sa_idx); } }); @@ -598,6 +591,12 @@ events.push(function() { }); } + function show_childsa(said) { + sa_open[said] = true; + $('#childsa-con' + said).show(); + $('#btnchildsa-con' + said).hide(); + } + // Populate the tbody on page load update_table(); }); |