support saving via ajax

This commit is contained in:
Uwe Steinmann 2025-04-02 08:04:56 +02:00
parent f8ceb0d56a
commit c2d8b383c3

View File

@ -321,15 +321,21 @@ if ($action == "saveSettings")
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// save // save
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
if (!$settings->save()) if (!$settings->save()) {
UI::exitError(getMLText("admin_tools"),getMLText("settings_SaveError")); if(isAjax()) {
echo json_encode(array('success'=>false, 'msg'=>getMLText('settings_SaveError')));
exit;
} else {
UI::exitError(getMLText("admin_tools"),getMLText("settings_SaveError"));
}
}
add_log_line(".php&action=savesettings"); add_log_line(".php&action=savesettings");
} }
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_settings_saved'))); if(isAjax()) {
echo json_encode(array('success'=>true, 'msg'=>getMLText('splash_settings_saved')));
} else {
header("Location:../out/out.Settings.php?currenttab=".$_POST['currenttab']); $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_settings_saved')));
header("Location:../out/out.Settings.php?currenttab=".$_POST['currenttab']);
?> }