show profile list when file was saved successfully

This commit is contained in:
Roland Gruber 2010-05-26 17:30:55 +00:00
parent 3bb940e737
commit 4fe5a63708
2 changed files with 22 additions and 15 deletions

View File

@ -103,8 +103,12 @@ for ($i = 0; $i < sizeof($profileClasses); $i++) {
include '../main_header.php';
echo "<h1>" . _('Profile editor') . "</h1>\n";
echo "<br>\n";
if (isset($_GET['savedSuccessfully'])) {
StatusMessage("INFO", _("Profile was saved."), htmlspecialchars($_GET['savedSuccessfully']));
}
echo "<br>\n";
echo "<form action=\"profilemain.php\" method=\"post\">\n";
// new profile

View File

@ -66,8 +66,7 @@ if (isset($_POST['abort'])) {
exit;
}
// print header
include '../main_header.php';
$errors = array();
// save button was presed
if (isset($_POST['save'])) {
@ -104,23 +103,27 @@ if (isset($_POST['save'])) {
// check options
$errors = checkProfileOptions($_POST['accounttype'], $options);
// print error messages if any
if (sizeof($errors) > 0) {
if (sizeof($errors) == 0) { // input data is valid, save profile
// save profile
if (saveAccountProfile($options, $_POST['profname'], $_POST['accounttype'])) {
metaRefresh('profilemain.php?savedSuccessfully=' . $_POST['profname']);
exit();
}
else {
$errors[] = array("ERROR", _("Unable to save profile!"), $_POST['profname']);
}
}
}
// print header
include '../main_header.php';
// print error messages if any
if (sizeof($errors) > 0) {
for ($i = 0; $i < sizeof($errors); $i++) {
call_user_func_array('StatusMessage', $errors[$i]);
}
echo "<br>\n";
}
else { // input data is valid, save profile
// save profile
if (saveAccountProfile($options, $_POST['profname'], $_POST['accounttype'])) {
echo StatusMessage("INFO", _("Profile was saved."), $_POST['profname']);
echo ("<br><p><a href=\"profilemain.php\">" . _("Back to profile editor") . "</a></p>");
echo "</body></html>";
exit();
}
else StatusMessage("ERROR", _("Unable to save profile!"), $_POST['profname']);
}
}
// empty list of attribute types