summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/edit.php
diff options
context:
space:
mode:
authork-paulius <k.dash.paulius@gmail.com>2016-02-13 17:12:08 -0600
committerStephen Beaver <sbeaver@netgate.com>2016-02-14 15:09:54 -0500
commit1bd5e62dced82f354e9d769cab8384955f0b1d82 (patch)
treed4e511d139c82ec35a2421e555d01cd616d7c275 /src/usr/local/www/edit.php
parent7c945f74712d3c2ef8d1beee65b881cfcf80e6bd (diff)
downloadpfsense-1bd5e62dced82f354e9d769cab8384955f0b1d82.zip
pfsense-1bd5e62dced82f354e9d769cab8384955f0b1d82.tar.gz
Use print_info_box() to generate alerts
Diffstat (limited to 'src/usr/local/www/edit.php')
-rw-r--r--src/usr/local/www/edit.php37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/usr/local/www/edit.php b/src/usr/local/www/edit.php
index 72b18ca..050afa9 100644
--- a/src/usr/local/www/edit.php
+++ b/src/usr/local/www/edit.php
@@ -66,21 +66,26 @@ $pgtitle = array(gettext("Diagnostics"), gettext("Edit File"));
require("guiconfig.inc");
if ($_POST['action']) {
- $button_html = '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>';
- $alert_danger_html = '<div class="alert alert-danger" role="alert">' . $button_html;
- $alert_success_html = '<div class="alert alert-success" role="alert">' . $button_html;
switch ($_POST['action']) {
case 'load':
if (strlen($_POST['file']) < 1) {
- print('|5|' . $alert_danger_html . gettext("No file name specified") . '</div>' . '|');
+ print('|5|');
+ print_info_box(gettext("No file name specified"), 'danger', false);
+ print('|');
} elseif (is_dir($_POST['file'])) {
- print('|4|' . $alert_danger_html . gettext("Loading a directory is not supported") . '</div>' . '|');
+ print('|4|');
+ print_info_box(gettext("Loading a directory is not supported"), 'danger', false);
+ print('|');
} elseif (!is_file($_POST['file'])) {
- print('|3|' . $alert_danger_html . gettext("File does not exist or is not a regular file") . '</div>' . '|');
+ print('|3|');
+ print_info_box(gettext("File does not exist or is not a regular file"), 'danger', false);
+ print('|');
} else {
$data = file_get_contents(urldecode($_POST['file']));
if ($data === false) {
- print('|1|' . $alert_danger_html . gettext("Failed to read file") . '</div>' . '|');
+ print('|1|');
+ print_info_box(gettext("Failed to read file"), 'danger', false);
+ print('|');
} else {
$data = base64_encode($data);
print("|0|{$_POST['file']}|{$data}|");
@@ -90,7 +95,9 @@ if ($_POST['action']) {
case 'save':
if (strlen($_POST['file']) < 1) {
- print('|' . $alert_danger_html . gettext("No file name specified") . '</div>' . '|');
+ print('|');
+ print_info_box(gettext("No file name specified"), 'danger', false);
+ print('|');
} else {
conf_mount_rw();
$_POST['data'] = str_replace("\r", "", base64_decode($_POST['data']));
@@ -103,11 +110,17 @@ if ($_POST['action']) {
disable_security_checks();
}
if ($ret === false) {
- print('|' . $alert_danger_html . gettext("Failed to write file") . '</div>' . '|');
+ print('|');
+ print_info_box(gettext("Failed to write file"), 'danger', false);
+ print('|');
} elseif ($ret != strlen($_POST['data'])) {
- print('|' . $alert_danger_html . gettext("Error while writing file") . '</div>' . '|');
+ print('|');
+ print_info_box(gettext("Error while writing file"), 'danger', false);
+ print('|');
} else {
- print('|' . $alert_success_html . gettext("File saved successfully") . '</div>' . '|');
+ print('|');
+ print_info_box(gettext("File saved successfully"), 'success', false);
+ print('|');
}
}
exit;
@@ -119,7 +132,7 @@ require("head.inc");
?>
<!-- file status box -->
<div style="display:none; background:#eeeeee;" id="fileStatusBox">
- <strong id="fileStatus"></strong>
+ <div id="fileStatus"></div>
</div>
<div class="panel panel-default">
OpenPOWER on IntegriCloud