Add support for removing admin settings
This commit is contained in:
@@ -38,6 +38,7 @@ try {
|
||||
$this->smarty->assign('success', $result);
|
||||
|
||||
$this->smarty->assign('name', $name);
|
||||
$this->smarty->assign('id', str_replace('.', '-',$name));
|
||||
$this->smarty->assign('type', $type);
|
||||
$this->smarty->assign('value', '');
|
||||
|
||||
|
||||
23
webui/source/pages/ajax/admin/remove-setting.php
Normal file
23
webui/source/pages/ajax/admin/remove-setting.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
$main = RippingCluster_Main::instance();
|
||||
$req = $main->request();
|
||||
$config = $main->config();
|
||||
|
||||
$messages = array();
|
||||
$result = false;
|
||||
|
||||
try {
|
||||
$name = $req->get('name', 'RippingCluster_Exception_InvalidParameters');
|
||||
|
||||
$result = $config->remove($name);
|
||||
$this->smarty->assign('success', $result);
|
||||
|
||||
} catch(RippingCluster_Exception $e) {
|
||||
$messages[] = get_class($e) . ':' . $e->getMessage();
|
||||
$this->smarty->assign('messages', $messages);
|
||||
$this->smarty->assign('success', false);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
1
webui/source/templates/ajax/admin/remove-setting.tpl
Normal file
1
webui/source/templates/ajax/admin/remove-setting.tpl
Normal file
@@ -0,0 +1 @@
|
||||
"success": {$success|json_encode}
|
||||
@@ -1,5 +1,10 @@
|
||||
<tr>
|
||||
<td>{$name}</td>
|
||||
<tr id="setting_{$id}_row">
|
||||
<td>
|
||||
<p>
|
||||
{$name}<br />
|
||||
<input type="button" id="setting_{$id}_remove" value="Remove" onclick="rc.settings.remove_setting('{$id}', '{$name}');" />
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
{include file="fragments/admin-setting-value.tpl"}
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user