ui: remove $main_button use #4216

This commit is contained in:
Franco Fichtner 2021-06-14 16:03:26 +02:00
parent 0ce80dfd3a
commit da94d72fda
7 changed files with 64 additions and 85 deletions

View File

@ -61,10 +61,6 @@ legacy_html_escape_form_data($a_ifgroups);
include("head.inc");
$main_buttons = array(
array('href' => 'interfaces_groups_edit.php', 'label' => gettext('Add')),
);
?>
<body>
<script>
@ -115,7 +111,11 @@ $main_buttons = array(
<th><?=gettext("Name");?></th>
<th><?=gettext("Members");?></th>
<th><?=gettext("Description");?></th>
<th class="text-nowrap"></th>
<th class="text-nowrap">
<a href="interfaces_groups_edit.php" class="btn btn-primary btn-xs" data-toggle="tooltip" title="<?= html_safe(gettext('Add')) ?>">
<i class="fa fa-plus fa-fw"></i>
</a>
</th>
</tr>
</thead>
<tbody>

View File

@ -123,11 +123,6 @@ legacy_html_escape_form_data($pconfig);
include("head.inc");
$main_buttons = array();
if (!isset($_GET['act'])) {
$main_buttons[] = array('label' => gettext('Add'), 'href' => 'services_unbound_acls.php?act=new');
}
?>
<body>
<script>
@ -360,7 +355,13 @@ if (!isset($_GET['act'])) {
<th><?=gettext("Access List Name"); ?></th>
<th><?=gettext("Action"); ?></th>
<th><?=gettext("Description"); ?></th>
<th class="text-nowrap"></th>
<th class="text-nowrap">
<?php if (!isset($_GET['act'])): ?>
<a href="services_unbound_acls.php?act=new" class="btn btn-primary btn-xs" data-toggle="tooltip" title="<?= html_safe(gettext('Add')) ?>">
<i class="fa fa-plus fa-fw"></i>
</a>
<?php endif ?>
</th>
</tr>
</thead>
<tbody>

View File

@ -118,17 +118,11 @@ uasort($a_tunable, function($a, $b) {
return strnatcmp($a['tunable'], $b['tunable']);
});
legacy_html_escape_form_data($a_tunable);
if ($act != 'edit') {
$main_buttons = array(
array('href' => '#set_defaults', 'label' => gettext('Default')),
array('href' => 'system_advanced_sysctl.php?act=edit', 'label' => gettext('Add')),
);
}
include("head.inc");
legacy_html_escape_form_data($a_tunable);
legacy_html_escape_form_data($pconfig);
?>
<body>
<script>
@ -157,8 +151,6 @@ $( document ).ready(function() {
});
if ($("a[href='#set_defaults']").length > 0) {
// set defaults button visible, change style and hook event
$("a[href='#set_defaults']").removeClass('btn-primary').addClass('btn-danger');
$("a[href='#set_defaults']").click(function(event){
event.preventDefault();
BootstrapDialog.show({
@ -210,7 +202,16 @@ $( document ).ready(function() {
<th><?=gettext("Tunable Name"); ?></th>
<th><?=gettext("Description"); ?></th>
<th><?=gettext("Value"); ?></th>
<th class="text-nowrap"></th>
<th class="text-nowrap">
<?php if ($act != 'edit'): ?>
<a href="system_advanced_sysctl.php?act=edit" class="btn btn-primary btn-xs" data-toggle="tooltip" title="<?= html_safe(gettext('Add')) ?>">
<i class="fa fa-plus fa-fw"></i>
</a>
<a href="#set_defaults" class="btn btn-danger btn-xs" data-toggle="tooltip" title="<?= html_safe(gettext('Default')) ?>">
<i class="fa fa-trash-o fa-fw"></i>
</a>
<?php endif ?>
</th>
</tr>
<?php foreach ($a_tunable as $i => &$tunable): ?>
<tr>

View File

@ -62,10 +62,6 @@ $service_hook = 'strongswan';
include("head.inc");
$main_buttons = array(
array('href' => 'vpn_ipsec_keys_edit.php', 'label' => gettext('Add')),
);
?>
<body>
@ -119,7 +115,11 @@ if (is_subsystem_dirty('ipsec')) {
<td><?=gettext("Identifier"); ?></td>
<td><?=gettext("Pre-Shared Key"); ?></td>
<td><?=gettext("Type"); ?></td>
<td class="text-nowrap"></td>
<td class="text-nowrap">
<a href="vpn_ipsec_keys_edit.php" class="btn btn-primary btn-xs" data-toggle="tooltip" title="<?= html_safe(gettext('Add')) ?>">
<i class="fa fa-plus fa-fw"></i>
</a>
</td>
</tr>
<?php $i = 0;
$userkeys = array();

View File

@ -365,14 +365,7 @@ legacy_html_escape_form_data($pconfig);
include("head.inc");
$main_buttons = array();
if (empty($act)) {
$main_buttons[] = array('href' => 'vpn_openvpn_client.php?act=new', 'label' => gettext('Add'));
}
?>
<body>
<?php include("fbegin.inc"); ?>
<script>
@ -1155,7 +1148,17 @@ $( document ).ready(function() {
<td><?=gettext("Protocol"); ?></td>
<td><?=gettext("Server"); ?></td>
<td><?=gettext("Description"); ?></td>
<td class="text-nowrap"></td>
<td class="text-nowrap">
<a href="vpn_openvpn_client.php?act=new" class="btn btn-primary btn-xs" data-toggle="tooltip" title="<?= html_safe(gettext('Add')) ?>">
<i class="fa fa-plus fa-fw"></i>
</a>
<a data-id="<?= count($a_client) ?>" data-toggle="tooltip" title="<?=gettext("Move selected items to end");?>" class="act_move btn btn-default btn-xs">
<span class="fa fa-arrow-down fa-fw"></span>
</a>
<a data-id="x" title="<?=gettext("delete selected rules"); ?>" data-toggle="tooltip" class="act_delete btn btn-default btn-xs">
<span class="fa fa-trash-o fa-fw"></span>
</a>
</td>
</tr>
</thead>
<tbody>
@ -1187,7 +1190,7 @@ $( document ).ready(function() {
<span class="fa fa-pencil fa-fw"></span>
</a>
<a data-id="<?=$i;?>" title="<?=gettext("delete client"); ?>" class="act_delete btn btn-default btn-xs">
<span class="fa fa-trash fa-fw"></span>
<span class="fa fa-trash-o fa-fw"></span>
</a>
<a href="vpn_openvpn_client.php?act=new&amp;dup=<?=$i;?>" class="btn btn-default btn-xs" data-toggle="tooltip" title="<?=gettext("clone client");?>">
<span class="fa fa-clone fa-fw"></span>
@ -1197,17 +1200,6 @@ $( document ).ready(function() {
<?php
$i++;
endforeach;?>
<tr>
<td colspan="4"></td>
<td class="text-nowrap">
<a data-id="<?=$i;?>" data-toggle="tooltip" title="<?=gettext("Move selected items to end");?>" class="act_move btn btn-default btn-xs">
<span class="fa fa-arrow-down fa-fw"></span>
</a>
<a data-id="x" title="<?=gettext("delete selected rules"); ?>" data-toggle="tooltip" class="act_delete btn btn-default btn-xs">
<span class="fa fa-trash fa-fw"></span>
</a>
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -342,16 +342,11 @@ $( document ).ready(function() {
});
//]]>
</script>
<?php
include("fbegin.inc");
<?
if ($act!="new" && $act!="edit") {
$main_buttons = array(
array('href' => 'vpn_openvpn_csc.php?act=new', 'label' => gettext('Add')),
);
}
?>
<?php include("fbegin.inc"); ?>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
@ -687,7 +682,17 @@ if ($act!="new" && $act!="edit") {
<td><?=gettext("Common Name"); ?></td>
<td><?=gettext("Tunnel Network");?></td>
<td><?=gettext("Description"); ?></td>
<td class="text-nowrap"></td>
<td class="text-nowrap">
<a href="vpn_openvpn_csc.php?act=new" class="btn btn-primary btn-xs" data-toggle="tooltip" title="<?= html_safe(gettext('Add')) ?>">
<i class="fa fa-plus fa-fw"></i>
</a>
<a data-id="<?= count($a_csc) ?>" data-toggle="tooltip" title="<?=gettext("Move selected items to end");?>" class="act_move btn btn-default btn-xs">
<span class="fa fa-arrow-down fa-fw"></span>
</a>
<a data-id="x" title="<?=gettext("delete selected rules"); ?>" data-toggle="tooltip" class="act_delete btn btn-default btn-xs">
<span class="fa fa-trash fa-fw"></span>
</a>
</td>
</tr>
<?php
$i = 0;
@ -722,19 +727,6 @@ if ($act!="new" && $act!="edit") {
<?php
$i++;
endforeach;?>
<tr>
<td colspan="4">
<?=gettext("Additional OpenVPN client specific overrides can be added here.");?>
</td>
<td class="text-nowrap">
<a data-id="<?=$i;?>" data-toggle="tooltip" title="<?=gettext("Move selected items to end");?>" class="act_move btn btn-default btn-xs">
<span class="fa fa-arrow-down fa-fw"></span>
</a>
<a data-id="x" title="<?=gettext("delete selected rules"); ?>" data-toggle="tooltip" class="act_delete btn btn-default btn-xs">
<span class="fa fa-trash fa-fw"></span>
</a>
</td>
</tr>
</table>
</div>
</form>

View File

@ -433,16 +433,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
include("head.inc");
$main_buttons = array();
if (empty($act)) {
$main_buttons[] = array('href' => 'vpn_openvpn_server.php?act=new', 'label' => gettext('Add'));
}
legacy_html_escape_form_data($pconfig);
?>
<body>
<?php include("fbegin.inc"); ?>
<script>
@ -1618,7 +1611,14 @@ endif; ?>
<td><?=gettext("Protocol / Port"); ?></td>
<td><?=gettext("Tunnel Network"); ?></td>
<td><?=gettext("Description"); ?></td>
<td class="text-nowrap"></td>
<td class="text-nowrap">
<a href="vpn_openvpn_server.php?act=new" class="btn btn-primary btn-xs" data-toggle="tooltip" title="<?= html_safe(gettext('Add')) ?>">
<i class="fa fa-plus fa-fw"></i>
</a>
<a href="wizard.php?xml=openvpn" class="btn btn-defaultu btn-xs" data-toggle="tooltip" title="<?= html_safe(gettext('Use a wizard to setup a new server')) ?>">
<i class="fa fa-magic fa-fw"></i>
</a>
</td>
</tr>
</thead>
@ -1654,13 +1654,6 @@ endif; ?>
<?php
$i++;
endforeach;?>
<tr>
<td colspan="5">
<a href="wizard.php?xml=openvpn" class="btn btn-default">
<i class="fa fa-magic fa-fw"></i> <?= gettext('Use a wizard to setup a new server') ?>
</a>
</td>
</tr>
</tbody>
</table>
</div>