Skip to content

Commit

Permalink
improvements for the NRO page filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Wolniewicz committed May 27, 2024
1 parent aa7022a commit 7e3d98e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
38 changes: 18 additions & 20 deletions web/admin/js/nro.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

/* various jquery scripts for the NRO admin page */

function row_filter(table) {
var linked = table.find('[id^="unlinked_ck_"]').is(':checked');
var broken_cert = table.find('[id^="brokencert_ck_"]').is(':checked');
var or_warn = table.find('[id^="or_ck_"]').is(':checked');
var profile_warn = table.find('[id^="profile_ck_"]').is(':checked');
var input = table.find('[id^="qsearch_"]').val().toLowerCase();
function row_filter(tbody) {
var linked = tbody.find('[id^="unlinked_ck_"]').is(':checked');
var broken_cert = tbody.find('[id^="brokencert_ck_"]').is(':checked');
var or_warn = tbody.find('[id^="or_ck_"]').is(':checked');
var profile_warn = tbody.find('[id^="profile_ck_"]').is(':checked');
var input = tbody.find('[id^="qsearch_"]').val().toLowerCase();
var tr_visible;
var inp_found;
table.children("tr.idp_tr").each(function() {
tbody.children("tr.idp_tr").each(function() {
tr_visible = true;
if (linked && $(this).hasClass('linked')) {
tr_visible = false;
Expand All @@ -48,7 +48,6 @@ function row_filter(table) {
tr_visible = false;
}
}

if (tr_visible) {
$(this).show();
} else {
Expand All @@ -57,6 +56,11 @@ function row_filter(table) {
});
}

function filter_action() {
var this_tbody = $(this).parent().parent().parent();
row_filter(this_tbody);
}

$(document).ready(function() {
// realm diagnostics
$("#realmcheck").on('click', function() {
Expand Down Expand Up @@ -88,16 +92,10 @@ $(document).ready(function() {

// handler for the text filter (must take into account possible filtering
// on linked status
$('[id^="qsearch_"]').keyup(function() {
var this_table = $(this).parent().parent().parent();
row_filter(this_table);
});
$('[id^="qsearch_"]').keyup(filter_action);

// the linked filter checkbox handler
$(":checkbox").on('click', function() {
var this_table = $(this).parent().parent().parent();
row_filter(this_table);
});
$(":checkbox").on('click', filter_action);

$("#fed_selection").on('change', function() {
fed = $("#fed_selection option:selected").val();
Expand All @@ -109,12 +107,12 @@ $(document).ready(function() {
document.location.href = "overview_federation.php?fed_id="+fed;
});


$("img.cat-icon").tooltip();

$("#loading_gif").hide();

$("tbody.fedlist").each(function() {
row_filter($(this));
});
});




2 changes: 2 additions & 0 deletions web/admin/overview_federation.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@
$thefed = new \core\Federation($fedId);
/// nomenclature for 'federation', federation name, nomenclature for 'inst'
echo "<tr><td colspan='9'><strong>".sprintf(_("The following %s are in your %s %s:"), $uiElements->nomenclatureParticipant, $uiElements->nomenclatureFed, '<span style="color:green">'.$thefed->name.'</span>')."</strong></td></tr>";
echo "<tbody class='fedlist'>";
echo "<tr><td colspan='1'><strong>". _("Quick search:")." </strong><input style='background:#eeeeee;' type='text' id='qsearch_".$fedId."'></td>";
echo "<td style='border-bottom-style: dotted;border-bottom-width: 1px;'><input type='checkbox' name='profilecheck' id='profile_ck_".$fedId."'></td>";
echo "<td style='border-bottom-style: dotted;border-bottom-width: 1px;'><input type='checkbox' name='orcheck' id='or_ck_".$fedId."'></td>";
Expand Down Expand Up @@ -498,6 +499,7 @@
}
}
}
echo "</tbody>";
}
?>
</table>
Expand Down

0 comments on commit 7e3d98e

Please sign in to comment.