diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index 1422cb620..c32b45836 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -939,7 +939,7 @@ class SetupUtils //-- TLS params (N°1260) $sTlsEnabledChecked = $bTlsEnabled ? ' checked' : ''; $sTlsCaDisabled = $bTlsEnabled ? '' : ' disabled'; - $oPage->add(''); + $oPage->add(''); $oPage->add(''); $oPage->add('Before configuring MySQL with TLS encryption, read the documentation on Combodo\'s Wiki'); $oPage->add(''); @@ -969,44 +969,53 @@ class SetupUtils else { $oPage->add('Database Name:'); - $oPage->add('Use a prefix for the tables:'); + $oPage->add(''); + $oPage->add(''); + $oPage->add(''); + $oPage->add('Use a prefix for the tables:'); + $oPage->add(''); } $oPage->add(''); $oPage->add(''); $oPage->add(' '); $oPage->add(''); - // TLS checkbox toggle - $oPage->add_script(<<<'EOF' -function toggleTlsOptions() { - $("tbody#tls_options>tr").not("tr:first-child").toggle(); - updateTlsImage(); + // Sub options toggle (TLS, prefix) + $oPage->add_script(<<<'JS' +function toggleCollapsableOptions($tbody) { + $tbody.find("tr").not("tr:first-child").toggle(); + updateCollapsableImage($tbody); } -function updateTlsImage() { - $dbTlsImg = $("img#db_tls_img"); +function updateCollapsableImage($tbody) { + $collapsableImg = $tbody.find("tr:first-child>th>label>img"); + console.debug("img", $collapsableImg, $tbody); imgPath = "../images/"; - dbImgUrl = ($("tbody#tls_options>tr:nth-child(2)>td:visible").length > 0) + imgUrl = ($tbody.find("tr:nth-child(2)>td:visible").length > 0) ? "minus.gif" : "plus.gif"; - $dbTlsImg.attr("src", imgPath+dbImgUrl); + $collapsableImg.attr("src", imgPath+imgUrl); } -EOF +JS ); if ($bTlsEnabled) { - $oPage->add_ready_script('toggleTlsOptions();'); + $oPage->add_ready_script('toggleCollapsableOptions($("tbody#tls_options"));'); } $oPage->add_ready_script( - <<tr>th>label").click(function() { - toggleTlsOptions(); + <<<'JS' +$("tbody.collapsable-options>tr>th>label").click(function() { + var $tbody = $(this).closest("tbody"); + toggleCollapsableOptions($tbody); }); $("#db_tls_enabled").click(function() { var bTlsEnabled = $("#db_tls_enabled").is(":checked"); $("#db_tls_ca").prop("disabled", !bTlsEnabled); }); -updateTlsImage(); -EOF +$("tbody.collapsable-options").each(function() { + updateCollapsableImage($(this)); +}) +JS ); $oPage->add_script(