Merge branch 'feature-settings' into develop
This commit is contained in:
@@ -89,6 +89,14 @@ var rc = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d.dialog.title) {
|
||||||
|
$('#dialogheadertitle').html(d.dialog.title);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d.dialog.content) {
|
||||||
|
$('#dialogcontent').html(d.dialog.content);
|
||||||
|
}
|
||||||
|
|
||||||
$("#dialog").show();
|
$("#dialog").show();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -149,6 +157,11 @@ var rc = {
|
|||||||
|
|
||||||
'add_setting_row': function(params) {
|
'add_setting_row': function(params) {
|
||||||
$("#settings tbody").append(params.content);
|
$("#settings tbody").append(params.content);
|
||||||
|
},
|
||||||
|
|
||||||
|
'remove_setting': function(params) {
|
||||||
|
$('#setting_' + params.id + '_row').remove();
|
||||||
|
rc.ajax.post(base_url + 'ajax/admin/remove-setting/name/' + params.name + '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -194,6 +207,30 @@ var rc = {
|
|||||||
rc.ajax.get(base_url + "ajax/admin/new-setting/");
|
rc.ajax.get(base_url + "ajax/admin/new-setting/");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
remove_setting: function(id, name) {
|
||||||
|
rc.dialog.prepare({
|
||||||
|
dialog: {
|
||||||
|
show: true,
|
||||||
|
title: 'Remove setting',
|
||||||
|
content: "Do you really want to remove setting '" + name + "'",
|
||||||
|
buttons: {
|
||||||
|
type: 'okcancel',
|
||||||
|
actions: {
|
||||||
|
ok: [
|
||||||
|
'remove_setting',
|
||||||
|
'close-dialog'
|
||||||
|
],
|
||||||
|
cancel: 'close-dialog'
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
id: id,
|
||||||
|
name: name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
add_stringlist_field: function(id) {
|
add_stringlist_field: function(id) {
|
||||||
var container = $('#container_'+id);
|
var container = $('#container_'+id);
|
||||||
var next = $('#settings_'+id+'_next');
|
var next = $('#settings_'+id+'_next');
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ try {
|
|||||||
$this->smarty->assign('success', $result);
|
$this->smarty->assign('success', $result);
|
||||||
|
|
||||||
$this->smarty->assign('name', $name);
|
$this->smarty->assign('name', $name);
|
||||||
|
$this->smarty->assign('id', str_replace('.', '-',$name));
|
||||||
$this->smarty->assign('type', $type);
|
$this->smarty->assign('type', $type);
|
||||||
$this->smarty->assign('value', '');
|
$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>
|
<tr id="setting_{$id}_row">
|
||||||
<td>{$name}</td>
|
<td>
|
||||||
|
<p>
|
||||||
|
{$name}<br />
|
||||||
|
<input type="button" id="setting_{$id}_remove" value="Remove" onclick="rc.settings.remove_setting('{$id}', '{$name}');" />
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{include file="fragments/admin-setting-value.tpl"}
|
{include file="fragments/admin-setting-value.tpl"}
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user