mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-01 11:04:24 +02:00
Only show the "save to session" button in case preferences store = none
refs #8234
This commit is contained in:
parent
d452f3218d
commit
55c20abddc
@ -43,7 +43,9 @@ class PreferenceController extends BasePreferenceController
|
|||||||
$user = $this->getRequest()->getUser();
|
$user = $this->getRequest()->getUser();
|
||||||
$form = new PreferenceForm();
|
$form = new PreferenceForm();
|
||||||
$form->setPreferences($user->getPreferences());
|
$form->setPreferences($user->getPreferences());
|
||||||
$form->setStore(PreferencesStore::create($storeConfig, $user));
|
if ($storeConfig->get('store', 'ini') !== 'none') {
|
||||||
|
$form->setStore(PreferencesStore::create($storeConfig, $user));
|
||||||
|
}
|
||||||
$form->handleRequest();
|
$form->handleRequest();
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
|
@ -86,7 +86,7 @@ class PreferenceForm extends Form
|
|||||||
*/
|
*/
|
||||||
public function onSuccess()
|
public function onSuccess()
|
||||||
{
|
{
|
||||||
$this->preferences = new Preferences($this->store->load());
|
$this->preferences = new Preferences($this->store ? $this->store->load() : array());
|
||||||
|
|
||||||
$webPreferences = $this->preferences->get('icingaweb', array());
|
$webPreferences = $this->preferences->get('icingaweb', array());
|
||||||
foreach ($this->getValues() as $key => $value) {
|
foreach ($this->getValues() as $key => $value) {
|
||||||
@ -103,7 +103,7 @@ class PreferenceForm extends Form
|
|||||||
Session::getSession()->user->setPreferences($this->preferences);
|
Session::getSession()->user->setPreferences($this->preferences);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($this->getElement('btn_submit_preferences')->isChecked()) {
|
if ($this->store && $this->getElement('btn_submit_preferences')->isChecked()) {
|
||||||
$this->save();
|
$this->save();
|
||||||
Notification::success($this->translate('Preferences successfully saved'));
|
Notification::success($this->translate('Preferences successfully saved'));
|
||||||
} else {
|
} else {
|
||||||
@ -186,18 +186,20 @@ class PreferenceForm extends Form
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addElement(
|
if ($this->store) {
|
||||||
'submit',
|
$this->addElement(
|
||||||
'btn_submit_preferences',
|
'submit',
|
||||||
array(
|
'btn_submit_preferences',
|
||||||
'ignore' => true,
|
array(
|
||||||
'label' => $this->translate('Save to the Preferences'),
|
'ignore' => true,
|
||||||
'decorators' => array(
|
'label' => $this->translate('Save to the Preferences'),
|
||||||
'ViewHelper',
|
'decorators' => array(
|
||||||
array('HtmlTag', array('tag' => 'div'))
|
'ViewHelper',
|
||||||
|
array('HtmlTag', array('tag' => 'div'))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
);
|
}
|
||||||
|
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'submit',
|
'submit',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user