diff options
author | Sander van Leeuwen <sander@react.nl> | 2015-01-20 10:34:35 +0100 |
---|---|---|
committer | Sander van Leeuwen <sander@react.nl> | 2015-01-20 11:08:49 +0100 |
commit | c4a7740d00282cb3b53fd0c320df2b706b2efafd (patch) | |
tree | 7cea6038f9443d9f23be4c755ac93781d03d3c9e | |
parent | 61144c9bc6f5e612c090dabaae17e87307e6c3af (diff) | |
download | pfsense-c4a7740d00282cb3b53fd0c320df2b706b2efafd.zip pfsense-c4a7740d00282cb3b53fd0c320df2b706b2efafd.tar.gz |
Finish preliminary restyle of L2TP configuration
vpn_l2tp.php - Use pill style for navigation
vpn_l2tp_users.php - Cleaned and formatted according to bootstrap styles
vpn_l2tp_users_edit.php - Cleaned and formatted according to bootstrap styles
pfSense.css - Styles for form validation and pill navigation
guiconfig.inc - display_top_tabs accepts different styles; print_input_errors prints proper bootstrap alert box
-rw-r--r-- | usr/local/www/bootstrap/css/pfSense.css | 9 | ||||
-rw-r--r-- | usr/local/www/guiconfig.inc | 30 | ||||
-rw-r--r-- | usr/local/www/vpn_l2tp.php | 5 | ||||
-rw-r--r-- | usr/local/www/vpn_l2tp_users.php | 81 | ||||
-rw-r--r-- | usr/local/www/vpn_l2tp_users_edit.php | 101 |
5 files changed, 111 insertions, 115 deletions
diff --git a/usr/local/www/bootstrap/css/pfSense.css b/usr/local/www/bootstrap/css/pfSense.css index 9546506..44c4a9d 100644 --- a/usr/local/www/bootstrap/css/pfSense.css +++ b/usr/local/www/bootstrap/css/pfSense.css @@ -41,6 +41,15 @@ tr.disabled { opacity: .5; } +.nav-pills { + margin-bottom: 20px; +} + +/** Form validation */ +.input-errors ul { + margin-top: 20px; +} + /** Page header with title and breadcrumb */ .header { position: relative; diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index 1ea8f22..f3c3f3c 100644 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -266,30 +266,16 @@ function do_input_validation($postdata, $reqdfields, $reqdfieldsn, &$input_error } function print_input_errors($input_errors) { - global $g; + echo '<div class="alert alert-danger input-errors">'; + echo '<p>' . gettext('The following input errors were detected:') . '</p>'; + echo '<ul>'; - print <<<EOF - <div id="inputerrorsdiv"> - <table border="0" cellspacing="0" cellpadding="4" width="100%" summary="input errors"> - <tr> - <td class="inputerrorsleft"> - <img src="/themes/{$g['theme']}/images/icons/icon_error.gif" alt="errors" /> - </td> - <td class="inputerrorsright errmsg"> -EOF; - echo "<p>" . gettext("The following input errors were detected:") . "</p>\n<ul>"; foreach ($input_errors as $ierr) { - echo "<li>" . htmlspecialchars($ierr) . "</li>"; + echo '<li>' . htmlspecialchars($ierr) . '</li>'; } - print <<<EOF2 - </ul> - </td></tr> - </table> - </div> - <br /> -EOF2; - + echo '</ul>'; + echo '</div>'; } function verify_gzip_file($fname) { @@ -916,7 +902,7 @@ function echo_array($array,$return_me=false){ * RESULT * null ******/ -function display_top_tabs(& $tab_array, $no_drop_down = false) { +function display_top_tabs(& $tab_array, $no_drop_down = false, $type = 'tabs') { global $config; global $g; global $tab_array_indent; @@ -982,7 +968,7 @@ function display_top_tabs(& $tab_array, $no_drop_down = false) { echo "//]]>\n"; echo "</script>"; <? else: ?> - <ul class="nav nav-tabs"> + <ul class="nav nav-<?= $type ?>"> <?php foreach ($tab_array as $ta): ?> <li role="presentation"<?=($ta[1] ? ' class="active"' : '')?>><a href="<?=$ta[2]?>"><?=$ta[0]?></a></li> <?php endforeach; ?> diff --git a/usr/local/www/vpn_l2tp.php b/usr/local/www/vpn_l2tp.php index 9a5b18e..3451c6b 100644 --- a/usr/local/www/vpn_l2tp.php +++ b/usr/local/www/vpn_l2tp.php @@ -280,7 +280,7 @@ function enable_change(enable_over) { $tab_array = array(); $tab_array[0] = array(gettext("Configuration"), true, "vpn_l2tp.php"); $tab_array[1] = array(gettext("Users"), false, "vpn_l2tp_users.php"); -display_top_tabs($tab_array); +display_top_tabs($tab_array, false, 'pills'); ?> <div class="panel panel-default"> @@ -495,6 +495,9 @@ foreach ($interfaces as $iface => $ifacename): ?> </div> </div> +<?php + // TODO: Is it possible to detect available rules and only show warning if there are no (relevant) rules set? +?> <div class="alert alert-danger"> <strong><?=gettext("Note:")?></strong> <?=gettext("Don't forget to add a firewall rule to permit traffic from L2TP clients!")?> </div> diff --git a/usr/local/www/vpn_l2tp_users.php b/usr/local/www/vpn_l2tp_users.php index 42cd8cf..c08eaba 100644 --- a/usr/local/www/vpn_l2tp_users.php +++ b/usr/local/www/vpn_l2tp_users.php @@ -77,57 +77,50 @@ if ($_GET['act'] == "del") { include("head.inc"); ?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<div id="inputerrors"></div> <form action="vpn_l2tp_users.php" method="post"> -<?php if ($savemsg) print_info_box($savemsg); ?> +<?php if ($savemsg) print_info_box($savemsg)?> <?php if (isset($config['l2tp']['radius']['enable'])) - print_info_box(gettext("Warning: RADIUS is enabled. The local user database will not be used.")); ?> -<?php if (is_subsystem_dirty('l2tpusers')): ?><br/> -<?php print_info_box_np(gettext("The l2tp user list has been modified") . ".<br />" . gettext("You must apply the changes in order for them to take effect") . ".<br /><b>" . gettext("Warning: this will terminate all current l2tp sessions!") . "</b>");?><br /> -<?php endif; ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn l2pt users"> - <tr><td class="tabnavtbl"> + print_info_box(gettext("Warning: RADIUS is enabled. The local user database will not be used."))?> +<?php if (is_subsystem_dirty('l2tpusers')):?><br/> +<?php print_info_box_np(gettext("The l2tp user list has been modified") . ".<br />" . gettext("You must apply the changes in order for them to take effect") . ".<br /><b>" . gettext("Warning: this will terminate all current l2tp sessions!") . "</b>")?><br /> +<?php endif?> + <?php $tab_array = array(); $tab_array[0] = array(gettext("Configuration"), false, "vpn_l2tp.php"); $tab_array[1] = array(gettext("Users"), true, "vpn_l2tp_users.php"); - display_top_tabs($tab_array); -?> </td></tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area"> - <tr> - <td class="listhdrr"><?=gettext("Username");?></td> - <td class="listhdr"><?=gettext("IP address");?></td> - <td class="list"></td> - </tr> - <?php $i = 0; foreach ($a_secret as $secretent): ?> - <tr> - <td class="listlr"> - <?=htmlspecialchars($secretent['name']);?> - </td> - <td class="listr"> - <?php if($secretent['ip'] == "") $secretent['ip'] = "Dynamic"; ?> - <?=htmlspecialchars($secretent['ip']);?> - </td> - <td class="list nowrap"><a href="vpn_l2tp_users_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="edit user" width="17" height="17" border="0" alt="edit" /></a> - <a href="vpn_l2tp_users.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this user?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete user"); ?>" width="17" height="17" border="0" alt="delete" /></a></td> + display_top_tabs($tab_array, false, 'pills'); +?> + <div class="table-responsive"> + <table class="table table-striped table-hover"> + <thead> + <tr> + <th><?=gettext("Username")?></th> + <th><?=gettext("IP address")?></th> + <th></th> </tr> - <?php $i++; endforeach; ?> - <tr> - <td class="list" colspan="2"></td> - <td class="list"> <a href="vpn_l2tp_users_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add user"); ?>" width="17" height="17" border="0" alt="add" /></a></td> + </thead> + <tbody> +<?php $i = 0; foreach ($a_secret as $secretent):?> + <tr> + <td> + <?=htmlspecialchars($secretent['name'])?> + </td> + <td> + <?php if($secretent['ip'] == "") $secretent['ip'] = "Dynamic"?> + <?=htmlspecialchars($secretent['ip'])?> + </td> + <td> + <a class="btn btn-xs btn-primary" href="vpn_l2tp_users_edit.php?id=<?=$i?>"><?= gettext('edit') ?></a> + <a class="btn btn-xs btn-danger" href="vpn_l2tp_users.php?act=del&id=<?=$i?>" onclick="return confirm('<?=gettext("Do you really want to delete this user?")?>')"><?=gettext("delete")?></a> + </td> </tr> - </table> -</div> - </td> - </tr> -</table> +<?php $i++; endforeach?> + </tbody> + </table> + </div> + + <a class="btn btn-success" href="vpn_l2tp_users_edit.php"><?=gettext("add user")?></a> </form> -<?php include("fend.inc"); ?> -</body> -</html> +<?php include("foot.inc")?> diff --git a/usr/local/www/vpn_l2tp_users_edit.php b/usr/local/www/vpn_l2tp_users_edit.php index 2d905a0..982d45b 100644 --- a/usr/local/www/vpn_l2tp_users_edit.php +++ b/usr/local/www/vpn_l2tp_users_edit.php @@ -44,12 +44,12 @@ function l2tpusercmp($a, $b) { } function l2tp_users_sort() { - global $config; + global $config; - if (!is_array($config['l2tp']['user'])) - return; + if (!is_array($config['l2tp']['user'])) + return; - usort($config['l2tp']['user'], "l2tpusercmp"); + usort($config['l2tp']['user'], "l2tpusercmp"); } require("guiconfig.inc"); @@ -147,49 +147,54 @@ if ($_POST) { include("head.inc"); ?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> - <div id="inputerrors"></div> - <form action="vpn_l2tp_users_edit.php" method="post" name="iform" id="iform"> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="vpn l2tp users edit"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Username");?></td> - <td width="78%" class="vtable"> - <?=$mandfldhtml;?><input name="usernamefld" type="text" class="formfld user" id="usernamefld" size="20" value="<?=htmlspecialchars($pconfig['usernamefld']);?>" /> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Password");?></td> - <td width="78%" class="vtable"> - <?=$mandfldhtml;?><input name="passwordfld" type="password" class="formfld pwd" id="passwordfld" size="20" /> - <br /><?=$mandfldhtml;?><input name="passwordfld2" type="password" class="formfld pwd" id="passwordfld2" size="20" /> - (<?=gettext("confirmation");?>)<?php if (isset($id) && $a_secret[$id]): ?><br /> - <span class="vexpl"><?=gettext("If you want to change the users password, enter it here twice.");?></span> - <?php endif; ?></td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("IP address");?></td> - <td width="78%" class="vtable"> - <input name="ip" type="text" class="formfld unknown" id="ip" size="20" value="<?=htmlspecialchars($pconfig['ip']);?>" /> - <br /><span class="vexpl"><?=gettext("If you want the user to be assigned a specific IP address, enter it here.");?></span></td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext('Save');?>" /> - <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> - <?php if (isset($id) && $a_secret[$id]): ?> - <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> - <?php endif; ?> - </td> - </tr> - </table> - </div> +<?php if ($input_errors) print_input_errors($input_errors)?> + +<form class="form-horizontal" action="vpn_l2tp_users_edit.php" method="post" name="iform" id="iform"> + <div class="panel panel-default"> + <div class="panel-heading"> + <h2 class="panel-title"><?=gettext('User'); ?></h2> + </div> + + <div class="panel-body"> + <div class="form-group"> + <label for="usernamefld" class="col-sm-2 control-label"><?=gettext("Username")?></label> + <div class="col-sm-10"> + <?=$mandfldhtml?><input name="usernamefld" type="text" class="formfld user form-control" id="usernamefld" size="20" value="<?=htmlspecialchars($pconfig['usernamefld'])?>" /> + </div> + </div> + <div class="form-group"> + <label for="passwordfld" class="col-sm-2 control-label"><?=gettext("Password")?></label> + <div class="col-sm-10"> + <?=$mandfldhtml?><input name="passwordfld" type="password" class="formfld pwd form-control" id="passwordfld" size="20" /> + </div> + </div> + <div class="form-group"> + <label for="passwordfld2" class="col-sm-2 control-label"><?=gettext('Confirm')?></label> + <div class="col-sm-10"> + <?=$mandfldhtml?><input name="passwordfld2" type="password" class="formfld pwd form-control" id="passwordfld2" size="20" /> +<?php if (isset($id) && $a_secret[$id]):?> + <span class="help-block"><?=gettext("If you want to change the users password, enter it here twice.")?></span> +<?php endif?> + </div> + </div> + <div class="form-group"> + <label for="ip" class="col-sm-2 control-label"><?=gettext("IP address")?></label> + <div class="col-sm-10"> + <input name="ip" type="text" class="formfld unknown form-control" id="ip" size="20" value="<?=htmlspecialchars($pconfig['ip'])?>" /> + <span class="help-block"><?=gettext("If you want the user to be assigned a specific IP address, enter it here.")?></span> + </div> + </div> + </div> + </div> + + <div class="col-sm-10 col-sm-offset-2"> + <input type="button" class="formbtn btn btn-default" value="<?=gettext("Cancel")?>" onclick="window.location.href='<?=$referer?>'" /> + <input id="submit" name="Submit" type="submit" class="formbtn btn btn-primary" value="<?=gettext('Save')?>" /> + </div> + +<?php if (isset($id) && $a_secret[$id]):?> + <input name="id" type="hidden" value="<?=htmlspecialchars($id)?>" /> +<?php endif?> </form> -<?php include("fend.inc"); ?> -</body> -</html> +<?php include("foot.inc")?> |