Add admin backend code for updating settings.
Also removed reference to old full settings page. Also added site_title option to settings list.
This commit is contained in:
@@ -27,7 +27,7 @@ if ($request->exists('do')) {
|
||||
'severity' => 'success',
|
||||
'content' => 'The service was created succesfully.',
|
||||
);
|
||||
|
||||
|
||||
} break;
|
||||
|
||||
case 'delete-service': {
|
||||
@@ -49,6 +49,37 @@ if ($request->exists('do')) {
|
||||
}
|
||||
|
||||
} break;
|
||||
|
||||
case 'save-settings': {
|
||||
$supported_settings = array(
|
||||
'site_title' => 'site.title',
|
||||
'debug_display_exceptions' => 'debug.display_exceptions',
|
||||
'cache_base_dir' => 'cache.base_dir',
|
||||
'templates_tmp_path' => 'templates.tmp_path',
|
||||
);
|
||||
|
||||
$dirty = false;
|
||||
foreach ($supported_settings as $param => $setting) {
|
||||
$value = StatusBoard_Main::issetelse($_POST[$param]);
|
||||
if ($value && $value != $config->get($setting)) {
|
||||
$config->set($setting, $value);
|
||||
$dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($dirty) {
|
||||
$messages[] = array(
|
||||
'severity' => 'success',
|
||||
'content' => 'Settings were saved successfully.',
|
||||
);
|
||||
} else {
|
||||
$messages[] = array(
|
||||
'severity' => 'warning',
|
||||
'content' => 'Settings were not saved as no changes were necessary.',
|
||||
);
|
||||
}
|
||||
|
||||
} break;
|
||||
|
||||
default: {
|
||||
$messages[] = array(
|
||||
@@ -58,8 +89,11 @@ if ($request->exists('do')) {
|
||||
}
|
||||
}
|
||||
|
||||
$destination = $request->get('tab', 'admin');
|
||||
$destination = "admin/tab/{$destination}/";
|
||||
|
||||
$session->set('messages', $messages);
|
||||
StatusBoard_Page::redirect('admin/tab/services/');
|
||||
StatusBoard_Page::redirect($destination);
|
||||
}
|
||||
|
||||
$this->smarty->assign('tab', $request->get('tab', 'admin'));
|
||||
@@ -74,6 +108,7 @@ $this->smarty->assign('users', $users);
|
||||
$this->smarty->assign('debug_displayexceptions', $config->get('debug.display_exceptions'));
|
||||
$this->smarty->assign('cache_basedir', $config->get('cache.base_dir'));
|
||||
$this->smarty->assign('templates_tmppath', $config->get('templates.tmp_path'));
|
||||
$this->smarty->assign('site_title', $config->get('site.title'));
|
||||
$this->smarty->assign('messages', $messages);
|
||||
|
||||
?>
|
||||
@@ -102,33 +102,36 @@
|
||||
<div class="tab-pane {if $tab == 'settings'}active{/if}" id="tab_settings">
|
||||
<div class="span11"><!--Settings content container -->
|
||||
<h1>Settings<h1>
|
||||
<p>
|
||||
Quick access to important settings. Please use the <a href="{$base_uri}admin/settings/" title="Full settings">full settings</a>
|
||||
page to configure more advanced settings.
|
||||
</p>
|
||||
|
||||
<form id="admin_quicksettings" method="post" action="{$base_uri}admin/settings/do/">
|
||||
<form id="admin_quicksettings" method="post" action="{$base_uri}admin/tab/settings/do/save-settings/">
|
||||
<fieldset>
|
||||
<legend>Quick Settings</legend>
|
||||
|
||||
<div class="clearfix">
|
||||
<label for="admin_quicksettings_site_title">Site Title</label>
|
||||
<div class="checkbox">
|
||||
<input class="xlarge span5" id="admin_quicksettings_site_title" name="site_title" type="text" value="{$site_title|escape:html}" />
|
||||
</div><!-- /text -->
|
||||
</div><!-- /clearfix -->
|
||||
|
||||
<div class="clearfix">
|
||||
<label for="admin_quicksettings_debug_displayexceptions">Display Exceptions?</label>
|
||||
<div class="checkbox">
|
||||
<input class="" id="admin_quicksettings_debug_displayexceptions" name="debug.displayexceptions" type="checkbox" value="1" {if $debug_displayexceptions}checked="checked" {/if}/>
|
||||
<input class="" id="admin_quicksettings_debug_displayexceptions" name="debug_displayexceptions" type="checkbox" value="1" {if $debug_displayexceptions}checked="checked" {/if}/>
|
||||
</div><!-- /text -->
|
||||
</div><!-- /clearfix -->
|
||||
|
||||
<div class="clearfix">
|
||||
<label for="admin_quicksettings_cache_basedir">Cache Base Directory</label>
|
||||
<div class="text">
|
||||
<input class="xlarge span5" id="admin_quicksettings_cache_basedir" name="cache.base_dir" type="text" value="{$cache_basedir|escape:html}" />
|
||||
<input class="xlarge span5" id="admin_quicksettings_cache_basedir" name="cache_base_dir" type="text" value="{$cache_basedir|escape:html}" />
|
||||
</div><!-- /text -->
|
||||
</div><!-- /clearfix -->
|
||||
|
||||
<div class="clearfix">
|
||||
<label for="admin_quicksettings_templates_tmppath">Cache Base Directory</label>
|
||||
<div class="text">
|
||||
<input class="xlarge span5" id="admin_quicksettings_templates_tmppath" name="templates.tmp_path" type="text" value="{$templates_tmppath|escape:html}" />
|
||||
<input class="xlarge span5" id="admin_quicksettings_templates_tmppath" name="templates_tmp_path" type="text" value="{$templates_tmppath|escape:html}" />
|
||||
</div><!-- /text -->
|
||||
</div><!-- /clearfix -->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user