From 66fac4be6d0a89c45139621291e0abe161b9ebb7 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 21 Jan 2016 16:50:27 +0545 Subject: Add a close button to Edit load/save messages Other places use more standard code for printing success/error messages. But the Edit File page is a bit different. The standard code puts a close button on messages so that users can dismiss them if they like. Manually add the Close button here, to make it consistent with other UI pages. --- src/usr/local/www/edit.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/usr/local/www/edit.php b/src/usr/local/www/edit.php index 45fa6c1..a11f472 100644 --- a/src/usr/local/www/edit.php +++ b/src/usr/local/www/edit.php @@ -66,18 +66,21 @@ $pgtitle = array(gettext("Diagnostics"), gettext("Edit file")); require("guiconfig.inc"); if ($_POST['action']) { + $button_html = ''; + $alert_danger_html = '' . '|'); } elseif (!is_file($_POST['file'])) { - print('|3|' . '' . '|'); + print('|3|' . $alert_danger_html . gettext("File does not exist or is not a regular file") . '' . '|'); } else { $data = file_get_contents(urldecode($_POST['file'])); if ($data === false) { - print('|1|' . '' . '|'); + print('|1|' . $alert_danger_html . gettext("Failed to read file") . '' . '|'); } else { $data = base64_encode($data); print("|0|{$_POST['file']}|{$data}|"); @@ -87,7 +90,7 @@ if ($_POST['action']) { case 'save': if (strlen($_POST['file']) < 1) { - print('|' . '' . '|'); + print('|' . $alert_danger_html . gettext("No file name specified") . '' . '|'); } else { conf_mount_rw(); $_POST['data'] = str_replace("\r", "", base64_decode($_POST['data'])); @@ -100,11 +103,11 @@ if ($_POST['action']) { disable_security_checks(); } if ($ret === false) { - print('|' . '' . '|'); + print('|' . $alert_danger_html . gettext("Failed to write file") . '' . '|'); } elseif ($ret != strlen($_POST['data'])) { - print('|' . '' . '|'); + print('|' . $alert_danger_html . gettext("Error while writing file") . '' . '|'); } else { - print('|' . '' . '|'); + print('|' . $alert_success_html . gettext("File saved successfully") . '' . '|'); } } exit; -- cgit v1.1