Update domain settings

--HG--
branch : develop
This commit is contained in:
botanic 2014-09-14 09:46:12 -07:00
parent 07933bf52c
commit 38810a8c0f
2 changed files with 69 additions and 54 deletions

View file

@ -31,7 +31,7 @@ function domain_management_hook_display()
global $domain_management_return_set;
// to display plugin name in menu bar
$domain_management_return_set['admin_menu_display'] = 'Domain Management';
$domain_management_return_set['icon'] = 'icon-edit';
$domain_management_return_set['icon'] = 'icon-edit';
}
/**
@ -50,11 +50,11 @@ function domain_management_hook_call_rest()
{
global $domain_management_return_set;
global $WEBPATH;
global $WEBPATH;
$domain_management_return_set['path'] = $WEBPATH;
$domain_management_return_set['path'] = $WEBPATH;
}
}
/**
* Global Hook to return global variables which contains
@ -67,36 +67,49 @@ function domain_management_hook_get_db()
{
global $domain_management_return_set;
if ( isset( $_GET['ModifyDomain'] ) && $_GET['ModifyDomain'] = '1' && isset($_POST['domain_name'])) {
try {
$dbs = new DBLayer( 'shard' );
$dbs->update("domain", Array( 'domain_name' => $_POST['domain_name'], 'patch_version' => $_POST['patch_version'],'backup_patch_url' => $_POST['backup_patch_url'],'patch_urls' => $_POST['patch_urls'],'login_address' => $_POST['login_address'],'session_manager_address' => $_POST['session_manager_address'],'ring_db_name' => $_POST['ring_db_name'],'web_host' => $_POST['web_host'],'web_host_php' => $_POST['web_host_php'],'description' => $_POST['description'],),'`domain_id` = '.$_GET['edit_domain']);
}
catch ( Exception $e ) {
return null;
}
}
try {
$db = new DBLayer( 'shard' );
//get all domains
$statement = $db->executeWithoutParams("SELECT * FROM domain");
$rows = $statement->fetchAll();
$domain_management_return_set['domains'] = $rows;
// get all domains
$statement = $db -> executeWithoutParams( "SELECT * FROM domain" );
$rows = $statement -> fetchAll();
$domain_management_return_set['domains'] = $rows;
if (isset($_GET['edit_domain'])){
//get permissions
$statement = $db->executeWithoutParams("SELECT * FROM `domain` WHERE `domain_id` = '".$_GET['edit_domain']."'");
$rows = $statement->fetchAll();
$domain_management_return_set['domains'] = $rows;
if ( isset( $_GET['edit_domain'] ) ) {
// get permissions
$statement = $db -> executeWithoutParams( "SELECT * FROM `domain` WHERE `domain_id` = '" . $_GET['edit_domain'] . "'" );
$rows = $statement -> fetchAll();
$domain_management_return_set['domains'] = $rows;
$statement = $db->executeWithoutParams("SELECT * FROM `permission` WHERE `DomainId` = '".$_GET['edit_domain']."'");
$rows = $statement->fetchAll();
$domain_management_return_set['permissions'] = $rows;
$statement = $db -> executeWithoutParams( "SELECT * FROM `permission` WHERE `DomainId` = '" . $_GET['edit_domain'] . "'" );
$rows = $statement -> fetchAll();
$domain_management_return_set['permissions'] = $rows;
//get all users
$pagination = new Pagination(WebUsers::getAllUsersQuery(),"web",10,"WebUsers");
$domain_management_return_set['userlist'] = Gui_Elements::make_table($pagination->getElements() , Array("getUId","getUsername","getEmail"), Array("id","username","email"));
// get all users
$pagination = new Pagination( WebUsers :: getAllUsersQuery(), "web", 10, "WebUsers" );
$domain_management_return_set['userlist'] = Gui_Elements :: make_table( $pagination -> getElements() , Array( "getUId", "getUsername", "getEmail" ), Array( "id", "username", "email" ) );
}
}
return $rows;
} catch (Exception $e) {
}
catch ( Exception $e ) {
return null;
}
}
}
/**

View file

@ -60,7 +60,7 @@
<div class="panel-body">
<div class="row-fluid">
<form id="modifyMailSGroup" class="form-vertical" method="post" action="index.php?page=show_sgroup&id=">
<form id="modifyDomain" class="form-vertical" method="post" action="index.php?page=layout_plugin&name=Domain_Management&edit_domain={$hook_info['Domain_Management']['domains']['0']['domain_id']}&ModifyDomain=1">
<legend style="margin:0"> Domain Settings of '{$hook_info['Domain_Management']['domains']['0']['domain_name']}'</legend>
@ -85,12 +85,14 @@
<div class="control-group" style="display: inline-block; ">
<label class="control-label">Domain Status</label>
<div class="controls">
<select id="status" multiple class="form-control" data-rel="chosen">
<option {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_close"}selected{/if}>ds_close</option>
<option {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_dev"}selected{/if}>ds_dev</option>
<option {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_restricted"}selected{/if}>ds_restricted</option>
<option {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_open"}selected{/if}>ds_open</option>
</select>
<div class="input-prepend">
<select id="status" multiple class="form-control" form="modifyDomain">
<option value="ds_close" {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_close"}selected{/if}>ds_close</option>
<option value="ds_dev" {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_dev"}selected{/if}>ds_dev</option>
<option value="ds_restricted" {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_restricted"}selected{/if}>ds_restricted</option>
<option value="ds_open" {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_open"}selected{/if}>ds_open</option>
</select>
</div>
</div>
</div>