PHRAS-1010 - fix maintenance message display

This commit is contained in:
Florian BLOUET
2016-02-26 11:45:30 +01:00
parent db47b7621d
commit fdc2129c22
3 changed files with 17 additions and 5 deletions

View File

@@ -86,7 +86,7 @@ class SessionController extends Controller
} }
if ($this->getConf()->get(['registry', 'maintenance', 'enabled'], false)) { if ($this->getConf()->get(['registry', 'maintenance', 'enabled'], false)) {
$ret['message'] .= strip_tags($this->getConf()->get(['registry', 'maintenance', 'enabled'])); $ret['message'] .= strip_tags($this->getConf()->get(['registry', 'maintenance', 'message']));
} }
} }

View File

@@ -34,7 +34,7 @@ class UserPreferenceController extends Controller
$success = false; $success = false;
$msg = $this->app->trans('Error while saving preference'); $msg = $this->app->trans('Error while saving preference');
if ($prop && $value) { if (!is_null($prop) && !is_null($value)) {
$this->getSession()->set('phraseanet.' . $prop, $value); $this->getSession()->set('phraseanet.' . $prop, $value);
$success = true; $success = true;
$msg = $this->app->trans('Preference saved !'); $msg = $this->app->trans('Preference saved !');

View File

@@ -384,7 +384,7 @@ function manageSession(data, showMessages) {
$('body').append('<div id="#MESSAGE"></div>'); $('body').append('<div id="#MESSAGE"></div>');
$('#MESSAGE') $('#MESSAGE')
.empty() .empty()
.append(data.message + '<div style="margin:20px;"><input type="checkbox" class="dialog_remove" />' + language.hideMessage + '</div>') .append('<div style="margin:30px 10px;"><h4><b>' + data.message + '</b></h4></div><div style="margin:20px 0px 10px;"><label class="checkbox"><input type="checkbox" class="dialog_remove" />' + language.hideMessage + '</label></div>')
.attr('title', 'Global Message') .attr('title', 'Global Message')
.dialog({ .dialog({
autoOpen: false, autoOpen: false,
@@ -393,8 +393,20 @@ function manageSession(data, showMessages) {
draggable: false, draggable: false,
modal: true, modal: true,
close: function () { close: function () {
if ($('.dialog_remove:checked', $(this)).length > 0) if ($('.dialog_remove:checked', $(this)).length > 0) {
setTemporaryPref('message', 0); // setTemporaryPref
$.ajax({
type: "POST",
url: "/user/preferences/temporary/",
data: {
prop: 'message',
value: 0
},
success: function (data) {
return;
}
});
}
} }
}) })
.dialog('open'); .dialog('open');