commit 7c945f74712d3c2ef8d1beee65b881cfcf80e6bd
Author: k-paulius <k.dash.paulius@gmail.com>
Date:   Sat Feb 13 16:22:44 2016 -0600

    Use print_info_box() to generate alerts

diff --git a/src/etc/inc/gmirror.inc b/src/etc/inc/gmirror.inc
index bacd77fe3e..a6e9d286a8 100644
--- a/src/etc/inc/gmirror.inc
+++ b/src/etc/inc/gmirror.inc
@@ -93,11 +93,7 @@ function gmirror_html_status() {
 	$mirrors = gmirror_get_status();
 	$output = "";
 	if (count($mirrors) < 1) {
-?>
-<div class="alert alert-warning" role="alert">
-	<p>No Mirrors Found</p>
-</div>
-<?php
+		print_info_box(gettext("No Mirrors Found"), 'warning', false);
 		return;
 	}
 
diff --git a/src/usr/local/www/diag_authentication.php b/src/usr/local/www/diag_authentication.php
index 03164b39ae..66e410696b 100644
--- a/src/usr/local/www/diag_authentication.php
+++ b/src/usr/local/www/diag_authentication.php
@@ -109,7 +109,7 @@ if ($input_errors) {
 }
 
 if ($savemsg) {
-	print('<div class="alert alert-success" role="alert">'. $savemsg.'</div>');
+	print_info_box($savemsg, 'success', false);
 }
 
 $form = new Form('Test');
diff --git a/src/usr/local/www/diag_dns.php b/src/usr/local/www/diag_dns.php
index 367d16612f..5be89d9bea 100755
--- a/src/usr/local/www/diag_dns.php
+++ b/src/usr/local/www/diag_dns.php
@@ -212,11 +212,11 @@ include("head.inc");
 if ($input_errors) {
 	print_input_errors($input_errors);
 } else if (!$resolved && $type) {
-	print('<div class="alert alert-warning" role="alert">' . sprintf(gettext('Host "%s" could not be resolved'), $host) . '</div>');
+	print_info_box(sprintf(gettext('Host "%s" could not be resolved'), $host), 'warning', false);
 }
 
 if ($createdalias) {
-	print('<div class="alert alert-success" role="alert">' . gettext("Alias was created/updated successfully") . '</div>');
+	print_info_box(gettext("Alias was created/updated successfully"), 'success', false);
 }
 
 $form = new Form('Lookup');
diff --git a/src/usr/local/www/diag_dump_states.php b/src/usr/local/www/diag_dump_states.php
index 005966305c..073a067a74 100755
--- a/src/usr/local/www/diag_dump_states.php
+++ b/src/usr/local/www/diag_dump_states.php
@@ -294,7 +294,7 @@ if ($states == 0) {
 		$errmsg = gettext('No states were found');
 	}
 
-	print('<p class="alert alert-warning">' . $errmsg . '</p>');
+	print_info_box($errmsg, 'warning', false);
 }
 
 include("foot.inc");
diff --git a/src/usr/local/www/diag_dump_states_sources.php b/src/usr/local/www/diag_dump_states_sources.php
index 63b0db7e31..4aab13de92 100644
--- a/src/usr/local/www/diag_dump_states_sources.php
+++ b/src/usr/local/www/diag_dump_states_sources.php
@@ -190,7 +190,7 @@ if (count($sources) > 0) {
 </div>
 <?php
 if ($row == 0) {
-	print('<p class="alert alert-warning">' . gettext('No source tracking entries were found.') . '</p>');
+	print_info_box(gettext('No source tracking entries were found.'), 'warning', false);
 }
 
 include("foot.inc");
diff --git a/src/usr/local/www/diag_halt.php b/src/usr/local/www/diag_halt.php
index c2b52364d8..848d96b05f 100755
--- a/src/usr/local/www/diag_halt.php
+++ b/src/usr/local/www/diag_halt.php
@@ -81,11 +81,9 @@ include('head.inc');
 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
 ?>
 	<meta http-equiv="refresh" content="70;url=/">
-	<div class="alert alert-success" role="alert">
-		<?=gettext("The system is halting now. This may take one minute or so.")?>
-	</div>
-
 <?php
+	print_info_box(gettext("The system is halting now. This may take one minute or so."), 'success', false);
+
 	if (DEBUG) {
 	   print(sprintf(gettext("Not actually halting (DEBUG is set true)%s"), "<br />"));
 	} else {
diff --git a/src/usr/local/www/diag_resetstate.php b/src/usr/local/www/diag_resetstate.php
index 8636dec8fd..d8d5a7f5c4 100644
--- a/src/usr/local/www/diag_resetstate.php
+++ b/src/usr/local/www/diag_resetstate.php
@@ -94,7 +94,7 @@ if ($input_errors) {
 }
 
 if ($savemsg) {
-	print_info_box($savemsg, 'alert-success');
+	print_info_box($savemsg, 'success');
 }
 
 $statetablehelp = sprintf(gettext('Resetting the state tables will remove all entries from the corresponding tables. This means that all open connections ' .
diff --git a/src/usr/local/www/diag_tables.php b/src/usr/local/www/diag_tables.php
index 00d0d88f31..d34d57c7fe 100644
--- a/src/usr/local/www/diag_tables.php
+++ b/src/usr/local/www/diag_tables.php
@@ -241,10 +241,8 @@ events.push(function() {
 	</div>
 </div>
 
-<?php if (empty($entries)): ?>
-	<div class="alert alert-warning" role="alert"><?=gettext("No entries exist in this table")?></div>
-<?php endif ?>
-
 <?php
-
+if (empty($entries)) {
+	print_info_box(gettext("No entries exist in this table"), 'warning', false);
+}
 include("foot.inc");
diff --git a/src/usr/local/www/diag_testport.php b/src/usr/local/www/diag_testport.php
index ccdb41e71c..9ac727822a 100644
--- a/src/usr/local/www/diag_testport.php
+++ b/src/usr/local/www/diag_testport.php
@@ -241,9 +241,8 @@ if ($input_errors) {
 	print ($alert_text . '</div>');
 } else {
 	// First time, new page
-	print('<div class="alert alert-warning" role="alert">' .
-		gettext('This page allows you to perform a simple TCP connection test to determine if a host is up and accepting connections on a given port.') . " " .
-		gettext('This test does not function for UDP since there is no way to reliably determine if a UDP port accepts connections in this manner.') . '</div>');
+	print_info_box(gettext('This page allows you to perform a simple TCP connection test to determine if a host is up and accepting connections on a given port.') . " " .
+		gettext('This test does not function for UDP since there is no way to reliably determine if a UDP port accepts connections in this manner.'), 'warning', false);
 }
 
 $form = new Form('Test');
diff --git a/src/usr/local/www/exec.php b/src/usr/local/www/exec.php
index b37c734744..2e785f4fab 100644
--- a/src/usr/local/www/exec.php
+++ b/src/usr/local/www/exec.php
@@ -218,7 +218,7 @@ if (isBlank($_POST['txtRecallBuffer'])) {
 <?php
 
 if (isBlank($_POST['txtCommand']) && isBlank($_POST['txtPHPCommand']) && isBlank($ulmsg)) {
-	print('<div class="alert alert-warning" role="alert">' . gettext("The capabilities offered here can be dangerous. No support is available. Use them at your own risk!") . '</div>');
+	print_info_box(gettext("The capabilities offered here can be dangerous. No support is available. Use them at your own risk!"), 'warning', false);
 }
 
 if (!isBlank($_POST['txtCommand'])):?>
@@ -269,7 +269,7 @@ if (!isBlank($_POST['txtCommand'])):?>
 
 <?php
 	if ($ulmsg) {
-		print('<div class="alert alert-success" role="alert">' . $ulmsg . '</div>');
+		print_info_box($ulmsg, 'success', false);
 	}
 ?>
 	<div class="panel panel-default">
diff --git a/src/usr/local/www/interfaces_assign.php b/src/usr/local/www/interfaces_assign.php
index 8ffff9aa96..cbc9fffdb2 100644
--- a/src/usr/local/www/interfaces_assign.php
+++ b/src/usr/local/www/interfaces_assign.php
@@ -597,6 +597,9 @@ display_top_tabs($tab_array);
 	<button name="Submit" type="submit" class="btn btn-primary" value="<?=gettext('Save')?>"><?=gettext('Save')?></button>
 </form>
 <br />
-<p class="alert alert-info"><?=gettext("Interfaces that are configured as members of a lagg(4) interface will not be shown.")?></p>
+
+<?php
+print_info_box(gettext("Interfaces that are configured as members of a lagg(4) interface will not be shown."), 'info', false);
+?>
 
 <?php include("foot.inc")?>
diff --git a/src/usr/local/www/pkg_mgr_installed.php b/src/usr/local/www/pkg_mgr_installed.php
index 93fd47546e..6804f673c2 100644
--- a/src/usr/local/www/pkg_mgr_installed.php
+++ b/src/usr/local/www/pkg_mgr_installed.php
@@ -89,11 +89,9 @@ foreach ($package_list as $pkg) {
 	$installed_packages[] = $pkg;
 }
 
-if (empty($installed_packages)):?>
-	<div class="alert alert-warning">
-		<?=gettext("There are no packages currently installed.")?>
-	</div>
-<?php else:?>
+if (empty($installed_packages)):
+	print_info_box(gettext("There are no packages currently installed."), 'warning', false);
+else:?>
 	<div class="panel panel-default">
 		<div class="panel-heading"><h2 class="panel-title"><?=gettext('Installed Packages')?></h2></div>
 		<div class="table-responsive">
diff --git a/src/usr/local/www/services_dhcp_relay.php b/src/usr/local/www/services_dhcp_relay.php
index ecb7186c74..acca7a970a 100644
--- a/src/usr/local/www/services_dhcp_relay.php
+++ b/src/usr/local/www/services_dhcp_relay.php
@@ -156,7 +156,7 @@ $shortcut_section = "dhcp";
 include("head.inc");
 
 if ($dhcpd_enabled) {
-	echo '<div class="alert alert-danger">' . gettext("DHCP Server is currently enabled. Cannot enable the DHCP Relay service while the DHCP Server is enabled on any interface.") . '</div>';
+	print_info_box(gettext("DHCP Server is currently enabled. Cannot enable the DHCP Relay service while the DHCP Server is enabled on any interface."), 'danger', false);
 	include("foot.inc");
 	exit;
 }
diff --git a/src/usr/local/www/services_dhcpv6_relay.php b/src/usr/local/www/services_dhcpv6_relay.php
index 974644a325..61cb1935d3 100644
--- a/src/usr/local/www/services_dhcpv6_relay.php
+++ b/src/usr/local/www/services_dhcpv6_relay.php
@@ -154,7 +154,7 @@ $shortcut_section = "dhcp6";
 include("head.inc");
 
 if ($dhcpd_enabled) {
-	echo '<div class="alert alert-danger">' . gettext("DHCPv6 Server is currently enabled. Cannot enable the DHCPv6 Relay service while the DHCPv6 Server is enabled on any interface.") . '</div>';
+	print_info_box(gettext("DHCPv6 Server is currently enabled. Cannot enable the DHCPv6 Relay service while the DHCPv6 Server is enabled on any interface."), 'danger', false);
 	include("foot.inc");
 	exit;
 }
diff --git a/src/usr/local/www/status_dhcpv6_leases.php b/src/usr/local/www/status_dhcpv6_leases.php
index 45fc70ad76..24c00bac15 100644
--- a/src/usr/local/www/status_dhcpv6_leases.php
+++ b/src/usr/local/www/status_dhcpv6_leases.php
@@ -439,7 +439,7 @@ if (count($pools) > 0) {
 }
 
 if (empty($leases)) {
-	print '<div class="alert alert-warning" role="alert">' . gettext("No leases file found. Is the DHCP server active?") . '</div>';
+	print_info_box(gettext("No leases file found. Is the DHCP server active?"), 'warning', false);
 }
 
 ?>
diff --git a/src/usr/local/www/status_interfaces.php b/src/usr/local/www/status_interfaces.php
index 3d19bacb52..227933b069 100644
--- a/src/usr/local/www/status_interfaces.php
+++ b/src/usr/local/www/status_interfaces.php
@@ -207,14 +207,11 @@ foreach ($ifdescrs as $ifdescr => $ifname):
 
 <?php
 	endforeach;
-?>
-
-<div class="alert alert-warning" role="alert">
-	<?=gettext("Using dial-on-demand will bring the connection up again if any packet ".
-	"triggers it. To substantiate this point: disconnecting manually ".
-	"will <strong>not</strong> prevent dial-on-demand from making connections ".
-	"to the outside! Don't use dial-on-demand if you want to make sure that the line ".
-	"is kept disconnected.");?>
-</div>
 
-<?php include("foot.inc"); ?>
+print_info_box(gettext("Using dial-on-demand will bring the connection up again if any packet ".
+	    "triggers it. To substantiate this point: disconnecting manually ".
+	    "will <strong>not</strong> prevent dial-on-demand from making connections ".
+	    "to the outside! Don't use dial-on-demand if you want to make sure that the line ".
+	    "is kept disconnected."), 'warning', false);
+include("foot.inc");
+?>
diff --git a/src/usr/local/www/status_lb_vs.php b/src/usr/local/www/status_lb_vs.php
index e86293a5cd..6951861716 100644
--- a/src/usr/local/www/status_lb_vs.php
+++ b/src/usr/local/www/status_lb_vs.php
@@ -91,7 +91,7 @@ $tab_array[] = array(gettext("Virtual Servers"), true, "status_lb_vs.php");
 display_top_tabs($tab_array);
 
 if (empty($a_vs)) {
-	print('<div class="alert alert-danger">' . gettext("No load balancers have been configured!") . '</div>');
+	print_info_box(gettext("No load balancers have been configured!"), 'danger', false);
 } else {
 ?>
 <div class="table-responsive"></div>
diff --git a/src/usr/local/www/vpn_ipsec_keys.php b/src/usr/local/www/vpn_ipsec_keys.php
index 2161831d20..00834c9fa5 100644
--- a/src/usr/local/www/vpn_ipsec_keys.php
+++ b/src/usr/local/www/vpn_ipsec_keys.php
@@ -202,9 +202,8 @@ if (is_subsystem_dirty('ipsec')) {
 	</a>
 </nav>
 
-<div class="alert alert-info">
-	<strong><?=gettext("Note"); ?>:</strong>
-	<?=gettext(" PSK for any user can be set by using an identifier of any")?>
-</div>
+<?php
+print_info_box(gettext("PSK for any user can be set by using an identifier of any."), 'info', false);
+?>
 
 <?php include("foot.inc"); ?>
diff --git a/src/usr/local/www/vpn_ipsec_keys_edit.php b/src/usr/local/www/vpn_ipsec_keys_edit.php
index e9e4229f2e..0bb99b9f3d 100644
--- a/src/usr/local/www/vpn_ipsec_keys_edit.php
+++ b/src/usr/local/www/vpn_ipsec_keys_edit.php
@@ -203,9 +203,8 @@ print $form;
 
 ?>
 
-<div class="alert alert-info">
-	<strong><?=gettext("Note"); ?>:</strong><br />
-	<?=gettext("PSK for any user can be set by using an identifier of any")?>
-</div>
+<?php
+print_info_box(gettext("PSK for any user can be set by using an identifier of any."), 'info', false);
+?>
 
 <?php include("foot.inc"); ?>
diff --git a/src/usr/local/www/widgets/widgets/installed_packages.widget.php b/src/usr/local/www/widgets/widgets/installed_packages.widget.php
index dca7c0d9d5..d1948a9a6c 100644
--- a/src/usr/local/www/widgets/widgets/installed_packages.widget.php
+++ b/src/usr/local/www/widgets/widgets/installed_packages.widget.php
@@ -73,10 +73,8 @@ if ($_REQUEST && $_REQUEST['ajax']) {
 	});
 
 	if (empty($installed_packages)) {
-		print("<div class=\"alert alert-warning\" role=\"alert\">\n");
-		print("	<strong>". gettext("No packages installed.") . "</strong>\n");
-		print(" " . gettext('You can install packages <a href="pkg_mgr.php" class="alert-link">here</a>.') . "\n");
-		print("</div>\n");
+		print_info_box("<strong>". gettext("No packages installed.") . "</strong>\n" . " " .
+		    gettext('You can install packages <a href="pkg_mgr.php" class="alert-link">here</a>.') . "\n", 'warning', false);
 		exit;
 	}
 
