From 4fe5a63708153e38687ad8a6e5f442b9555cde22 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 26 May 2010 17:30:55 +0000 Subject: [PATCH] show profile list when file was saved successfully --- lam/templates/profedit/profilemain.php | 6 ++++- lam/templates/profedit/profilepage.php | 31 ++++++++++++++------------ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/lam/templates/profedit/profilemain.php b/lam/templates/profedit/profilemain.php index ce3a567a..22fca206 100644 --- a/lam/templates/profedit/profilemain.php +++ b/lam/templates/profedit/profilemain.php @@ -103,8 +103,12 @@ for ($i = 0; $i < sizeof($profileClasses); $i++) { include '../main_header.php'; echo "

" . _('Profile editor') . "

\n"; -echo "
\n"; +if (isset($_GET['savedSuccessfully'])) { + StatusMessage("INFO", _("Profile was saved."), htmlspecialchars($_GET['savedSuccessfully'])); +} + +echo "
\n"; echo "
\n"; // new profile diff --git a/lam/templates/profedit/profilepage.php b/lam/templates/profedit/profilepage.php index 3439114a..6f8feafb 100644 --- a/lam/templates/profedit/profilepage.php +++ b/lam/templates/profedit/profilepage.php @@ -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,25 +103,29 @@ if (isset($_POST['save'])) { // check options $errors = checkProfileOptions($_POST['accounttype'], $options); - // print error messages if any - if (sizeof($errors) > 0) { - for ($i = 0; $i < sizeof($errors); $i++) { - call_user_func_array('StatusMessage', $errors[$i]); - } - echo "
\n"; - } - else { // input data is valid, save profile + if (sizeof($errors) == 0) { // input data is valid, save profile // save profile if (saveAccountProfile($options, $_POST['profname'], $_POST['accounttype'])) { - echo StatusMessage("INFO", _("Profile was saved."), $_POST['profname']); - echo ("

" . _("Back to profile editor") . "

"); - echo ""; + metaRefresh('profilemain.php?savedSuccessfully=' . $_POST['profname']); exit(); } - else StatusMessage("ERROR", _("Unable to save profile!"), $_POST['profname']); + 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 "
\n"; +} + // empty list of attribute types $_SESSION['profile_types'] = array();