diff options
3 files changed, 25 insertions, 12 deletions
diff --git a/modules-available/sysconfig/addmodule_screensaver.inc.php b/modules-available/sysconfig/addmodule_screensaver.inc.php index 7417c200..b8e5d3cd 100644 --- a/modules-available/sysconfig/addmodule_screensaver.inc.php +++ b/modules-available/sysconfig/addmodule_screensaver.inc.php @@ -12,7 +12,10 @@ class Screensaver_Start extends AddModule_Base protected function preprocessInternal() { /* Load or initialise session data */ - if ($this->edit !== false) { + if (Request::get('back', 'false', 'string') !== 'false') + /* If coming via the back button, load the session data */ + $this->session_data = Session::get('data'); + elseif ($this->edit !== false) { $this->session_data = array( 'title' => $this->edit->title(), 'qss' => $this->edit->getData('qss'), @@ -62,7 +65,6 @@ class Screensaver_Start extends AddModule_Base 'qss' => $this->session_data['qss'], )); } - } class Screensaver_Text extends AddModule_Base @@ -85,6 +87,13 @@ class Screensaver_Text extends AddModule_Base Session::set('data', $this->session_data); Session::save(); + + $next = Request::post('next', '', 'string'); + + if ($next === '') + Util::redirect('?do=SysConfig&action=addmodule&step=Screensaver_Finish'); + elseif ($next === 'start') + Util::redirect('?do=SysConfig&action=addmodule&step=Screensaver_Start&back=true'); } protected function renderInternal() @@ -113,15 +122,18 @@ class Screensaver_Text extends AddModule_Base $data['text_value'] = $this->session_data['texts']['text-' . $next]; $data['text_locked_value'] = $this->session_data['texts']['text-' . $next . '-locked']; $data['inherit_locked'] = $this->session_data['texts'][$next . '-inherit']; + $data['step'] = 'Screensaver_Text'; + /* Set next and prev pages */ if ($next === 'idle-kill') { $data['next'] = 'no-timeout'; - $data['step'] = 'Screensaver_Text'; + $data['prev'] = 'start'; } elseif ($next === 'no-timeout') { $data['next'] = 'shutdown'; - $data['step'] = 'Screensaver_Text'; + $data['prev'] = 'idle-kill'; } elseif ($next === 'shutdown') { - $data['step'] = 'Screensaver_Finish'; + $data['next'] = ''; + $data['prev'] = 'no-timeout'; $data['lastStep'] = true; } @@ -136,9 +148,6 @@ class Screensaver_Finish extends AddModule_Base /* Get session data */ $session_data = Session::get('data'); - /* Process the last step */ - Screensaver_Helper::processScreensaverText($session_data, Request::post('id', '', 'string')); - if (empty($session_data['title'])) { Message::addError('missing-title'); Util::redirect('?do=SysConfig'); diff --git a/modules-available/sysconfig/templates/screensaver-start.html b/modules-available/sysconfig/templates/screensaver-start.html index ab1382bd..38610365 100644 --- a/modules-available/sysconfig/templates/screensaver-start.html +++ b/modules-available/sysconfig/templates/screensaver-start.html @@ -89,7 +89,8 @@ <hr> <div class="btn-group"> - <a class="btn btn-default" id="btn-back" tabindex="5" onclick="window.history.back()">{{lang_back}}</a> + <a class="btn btn-default" id="btn-back" tabindex="5" + {{#edit}}href="?do=sysconfig"{{/edit}}{{^edit}}href="?do=SysConfig&action=addmodule"{{/edit}}>{{lang_back}}</a> </div> <div class="btn-group pull-right"> <button type="submit" id="btn-next" tabindex="6" class="btn btn-primary">{{lang_next}} »</button> diff --git a/modules-available/sysconfig/templates/screensaver-text.html b/modules-available/sysconfig/templates/screensaver-text.html index 1aa45a90..9fd0cea4 100644 --- a/modules-available/sysconfig/templates/screensaver-text.html +++ b/modules-available/sysconfig/templates/screensaver-text.html @@ -1,6 +1,6 @@ <form role="form" enctype="multipart/form-data" method="post" action="?do=SysConfig&action=addmodule&step={{step}}"> <input type="hidden" name="token" value="{{token}}"> - <input type="hidden" name="next" value="{{next}}"> + <input type="hidden" id="next" name="next" value="{{next}}"> <input type="hidden" name="id" value="{{id}}"> <input type="hidden" name="edit" value="{{edit}}"> @@ -47,7 +47,7 @@ </div> <div class="btn-group"> - <a class="btn btn-default" onclick="window.history.back()" tabindex="5">{{lang_back}}</a> + <button class="btn btn-default" type="submit" onclick="goBack()" tabindex="5">{{lang_back}}</button> </div> <div class="btn-group pull-right"> <button type="submit" class="btn btn-primary" tabindex="6"> @@ -80,7 +80,6 @@ switchMode({{inherit_locked}}); }, false); - function switchMode(mode) { // true = inherit on // false = inherit off @@ -98,6 +97,10 @@ $('#inherit_locked').val(false); } } + + function goBack() { + $('#next').val('{{prev}}'); + } </script> <style> |