Update directory layout to fit with other projects

This commit is contained in:
2012-01-11 00:28:17 +00:00
parent 06e3d65ffa
commit 4486af7be8
86 changed files with 15 additions and 8 deletions

View File

@@ -0,0 +1,55 @@
<?php
$main = RippingCluster_Main::instance();
$req = $main->request();
$config = $main->config();
$messages = array();
$result = false;
try {
$name = $req->get('name', 'RippingCluster_Exception_InvalidParameters');
$type = $req->get('type', 'RippingCluster_Exception_InvalidParameters');
// Convert the web-friendly type field into the correct internal name
$value = null;
switch($type) {
case 'bool': {
$type = Sihnon_Config::TYPE_BOOL;
$value = false;
} break;
case 'int': {
$type = Sihnon_Config::TYPE_INT;
$value = 0;
} break;
case 'string': {
$type = Sihnon_Config::TYPE_STRING;
$value = '';
} break;
case 'string-list': {
$type = Sihnon_Config::TYPE_STRING_LIST;
$value = array();
} break;
case 'hash': {
$type = Sihnon_Config::TYPE_HASH;
$value = array();
} break;
}
// Add the new (empty) value. This is because no suitable UI has been presented yet.
// Possible future fix, to insert intermediate dialog to capture the value using the correct UI.
$result = $config->add($name, $type, $value);
$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', '');
} catch(RippingCluster_Exception $e) {
$messages[] = get_class($e) . ':' . $e->getMessage();
$this->smarty->assign('messages', $messages);
$this->smarty->assign('success', false);
}
?>

View 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);
}
?>

View File

@@ -0,0 +1,39 @@
<?php
$main = RippingCluster_Main::instance();
$req = $main->request();
$config = $main->config();
$messages = array();
$result = false;
$confirm = $req->exists('confirm');
$this->smarty->assign('confirm', $confirm);
if ($confirm) {
try {
$name = $req->get('name', 'RippingCluster_Exception_InvalidParameters');
$new_name = $req->get('new-name', 'RippingCluster_Exception_InvalidParameters');
$result = $config->rename($name, $new_name);
$this->smarty->assign('success', $result);
$this->smarty->assign('old_name', $name);
$this->smarty->assign('old_id', str_replace('.', '-', $name));
$this->smarty->assign('name', $new_name);
$this->smarty->assign('id', str_replace('.', '-', $new_name));
$this->smarty->assign('type', $config->type($new_name));
$this->smarty->assign('value', $config->get($new_name));
} catch(RippingCluster_Exception $e) {
$messages[] = get_class($e) . ':' . $e->getMessage();
$this->smarty->assign('messages', $messages);
$this->smarty->assign('success', false);
}
} else {
$name = $req->get('name', 'RippingCluster_Exception_InvalidParameters');
$this->smarty->assign('name', $name);
}
?>