mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-17 21:11:39 +00:00
Update domain settings
This commit is contained in:
parent
62567d313a
commit
71014094b8
2 changed files with 69 additions and 54 deletions
|
@ -3,15 +3,15 @@
|
||||||
/**
|
/**
|
||||||
* Global and Local Hooks for the Domain_Management plugin
|
* Global and Local Hooks for the Domain_Management plugin
|
||||||
* Global Hooks are defined with the prefix(name of the plugin)
|
* Global Hooks are defined with the prefix(name of the plugin)
|
||||||
* Local Hooks are defined with normal function name
|
* Local Hooks are defined with normal function name
|
||||||
*
|
*
|
||||||
* All the Global Hooks are called during the page load
|
* All the Global Hooks are called during the page load
|
||||||
* and Local Hooks are called according to conditions
|
* and Local Hooks are called according to conditions
|
||||||
*
|
*
|
||||||
* Here, we request to the Domain_Management url using REST
|
* Here, we request to the Domain_Management url using REST
|
||||||
* to get the contents and will display with this plugin.
|
* to get the contents and will display with this plugin.
|
||||||
*
|
*
|
||||||
* @author shubham meena mentored by Matthew Lagoe
|
* @author shubham meena mentored by Matthew Lagoe
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,78 +31,91 @@ function domain_management_hook_display()
|
||||||
global $domain_management_return_set;
|
global $domain_management_return_set;
|
||||||
// to display plugin name in menu bar
|
// to display plugin name in menu bar
|
||||||
$domain_management_return_set['admin_menu_display'] = 'Domain Management';
|
$domain_management_return_set['admin_menu_display'] = 'Domain Management';
|
||||||
$domain_management_return_set['icon'] = 'icon-edit';
|
$domain_management_return_set['icon'] = 'icon-edit';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global Hook to interact with the REST api
|
* Global Hook to interact with the REST api
|
||||||
* Pass the variables in the REST object to
|
* Pass the variables in the REST object to
|
||||||
* make request
|
* make request
|
||||||
*
|
*
|
||||||
* variables REST object expects
|
* variables REST object expects
|
||||||
* url --> on which request is to be made
|
* url --> on which request is to be made
|
||||||
* appkey --> app key for authentication
|
* appkey --> app key for authentication
|
||||||
* host --> host from which request have been sent
|
* host --> host from which request have been sent
|
||||||
*
|
*
|
||||||
* @return $domain_management_return_set global array returns the template data
|
* @return $domain_management_return_set global array returns the template data
|
||||||
*/
|
*/
|
||||||
function domain_management_hook_call_rest()
|
function domain_management_hook_call_rest()
|
||||||
{
|
{
|
||||||
|
|
||||||
global $domain_management_return_set;
|
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
|
* Global Hook to return global variables which contains
|
||||||
* the content to use in the smarty templates extracted from
|
* the content to use in the smarty templates extracted from
|
||||||
* the database
|
* the database
|
||||||
*
|
*
|
||||||
* @return $domain_management_return_set global array returns the template data
|
* @return $domain_management_return_set global array returns the template data
|
||||||
*/
|
*/
|
||||||
function domain_management_hook_get_db()
|
function domain_management_hook_get_db()
|
||||||
{
|
{
|
||||||
global $domain_management_return_set;
|
global $domain_management_return_set;
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$db = new DBLayer( 'shard' );
|
|
||||||
|
|
||||||
//get all domains
|
|
||||||
$statement = $db->executeWithoutParams("SELECT * FROM domain");
|
|
||||||
$rows = $statement->fetchAll();
|
|
||||||
$domain_management_return_set['domains'] = $rows;
|
|
||||||
|
|
||||||
if (isset($_GET['edit_domain'])){
|
if ( isset( $_GET['ModifyDomain'] ) && $_GET['ModifyDomain'] = '1' && isset($_POST['domain_name'])) {
|
||||||
//get permissions
|
try {
|
||||||
$statement = $db->executeWithoutParams("SELECT * FROM `domain` WHERE `domain_id` = '".$_GET['edit_domain']."'");
|
|
||||||
$rows = $statement->fetchAll();
|
$dbs = new DBLayer( 'shard' );
|
||||||
$domain_management_return_set['domains'] = $rows;
|
$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']);
|
||||||
|
|
||||||
$statement = $db->executeWithoutParams("SELECT * FROM `permission` WHERE `DomainId` = '".$_GET['edit_domain']."'");
|
}
|
||||||
$rows = $statement->fetchAll();
|
catch ( Exception $e ) {
|
||||||
$domain_management_return_set['permissions'] = $rows;
|
return null;
|
||||||
|
}
|
||||||
//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"));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$db = new DBLayer( 'shard' );
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
$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" ) );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return $rows;
|
return $rows;
|
||||||
|
|
||||||
} catch (Exception $e) {
|
}
|
||||||
|
catch ( Exception $e ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global Hook to return global variables which contains
|
* Global Hook to return global variables which contains
|
||||||
* the content to use in the smarty templates
|
* the content to use in the smarty templates
|
||||||
*
|
*
|
||||||
* @return $domain_management_return_set global array returns the template data
|
* @return $domain_management_return_set global array returns the template data
|
||||||
*/
|
*/
|
||||||
function domain_management_hook_return_global()
|
function domain_management_hook_return_global()
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="row-fluid">
|
<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>
|
<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; ">
|
<div class="control-group" style="display: inline-block; ">
|
||||||
<label class="control-label">Domain Status</label>
|
<label class="control-label">Domain Status</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<select id="status" multiple class="form-control" data-rel="chosen">
|
<div class="input-prepend">
|
||||||
<option {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_close"}selected{/if}>ds_close</option>
|
<select id="status" multiple class="form-control" form="modifyDomain">
|
||||||
<option {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_dev"}selected{/if}>ds_dev</option>
|
<option value="ds_close" {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_restricted"}selected{/if}>ds_restricted</option>
|
<option value="ds_dev" {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_open"}selected{/if}>ds_open</option>
|
<option value="ds_restricted" {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_restricted"}selected{/if}>ds_restricted</option>
|
||||||
</select>
|
<option value="ds_open" {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_open"}selected{/if}>ds_open</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue