This commit is contained in:
botanic 2014-09-14 15:52:40 -07:00
parent 3cd38fdbdb
commit 4061ada656
4 changed files with 104 additions and 30 deletions

View file

@ -18,8 +18,8 @@ class Helpers {
*/
public static function loadTemplate( $template, $vars = array (), $returnHTML = false )
{
error_log(print_r($_GET,true));
error_log(print_r($_POST,true));
//error_log(print_r($_GET,true));
//error_log(print_r($_POST,true));
global $AMS_LIB;
global $SITEBASE;
global $AMS_TRANS;

View file

@ -336,12 +336,32 @@ class Users{
$dbs = new DBLayer("shard");
$sth = $dbs->selectWithParameter("UId", "user", $values, "Login= :username");
$result = $sth->fetchAll();
/*foreach ($result as $UId) {
$ins_values = array('UId' => $UId['UId'], 'clientApplication' => 'r2', 'AccessPrivilege' => 'OPEN');
$dbl = new DBLayer("lib");
$UId = $result['0']['UId'];
$statement = $dbl->execute("SELECT * FROM `settings` WHERE `Setting` = :setting", Array('setting' => 'Domain_Auto_Add'));
$json = $statement->fetch();
$json = json_decode($json['Value'],true);
$db = new DBLayer( 'shard' );
// get all domains
$statement = $db -> executeWithoutParams( "SELECT * FROM domain" );
$rows = $statement -> fetchAll();
//error_log(print_r($rows,true));
//error_log(print_r($result,true));
//error_log(print_r($json,true));
foreach ($json as $key => $value) {
//error_log(print_r($key,true));
//error_log(print_r($value,true));
$ins_values = array('UId' => $UId, 'DomainId' => $key, 'AccessPrivilege' => $value['1']);
error_log(print_r($ins_values,true));
$dbs = new DBLayer("shard");
$dbs->insert("permission", $ins_values);
$ins_values['clientApplication'] = 'ryzom_open';
$dbs->insert("permission", $ins_values);
}*/ // FIXME: GARBAGE
}
}
catch (PDOException $e) {
//oh noooz, the shard is offline! Put it in query queue at ams_lib db!

View file

@ -79,6 +79,29 @@ function domain_management_hook_get_db()
}
}
if ( isset( $_GET['ModifyPermission'] ) && $_GET['ModifyPermission'] = '1' && isset($_POST['user'])) {
try {
$dbl = new DBLayer("lib");
$statement = $dbl->execute("SELECT * FROM `settings` WHERE `Setting` = :setting", Array('setting' => 'Domain_Auto_Add'));
$json = $statement->fetch();
$json = json_decode($json['Value'],true);
$json[$_GET['edit_domain']]['1'] = $_POST['user'];
$json[$_GET['edit_domain']]['2'] = $_POST['moderator'];
$json[$_GET['edit_domain']]['3'] = $_POST['admin'];
$update = json_encode($json);
$dbl->update("settings", Array( 'Value' => $update),"`Setting` = 'Domain_Auto_Add'");
}
catch ( Exception $e ) {
return null;
}
}
try {
$db = new DBLayer( 'shard' );
@ -102,6 +125,14 @@ function domain_management_hook_get_db()
$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" ) );
$dbl = new DBLayer("lib");
$statement = $dbl->execute("SELECT * FROM `settings` WHERE `Setting` = :setting", Array('setting' => 'Domain_Auto_Add'));
$json = $statement->fetch();
$json = json_decode($json['Value'],true);
$domain_management_return_set['Domain_Auto_Add'] = $json[$_GET['edit_domain']];
}
return $rows;

View file

@ -205,35 +205,58 @@
<div class="panel-body">
<div class="row-fluid">
<form id="multiselectForm" method="post" class="form-horizontal" action="test.php?page=layout_plugin&name=Domain_Management&edit_domain={$hook_info['Domain_Management']['domains']['0']['domain_id']}&ModifyPermission=1">
<div class="form-group">
<label class="col-lg-3 control-label">Gender</label>
<div class="col-lg-5">
<select class="form-control" name="gender">
<option value="male">Male</option>
<option value="female">Female</option>
<option value="other">Other</option>
<form id="multiselectForm" method="post" class="form-vertical col-md-12" action="index.php?page=layout_plugin&name=Domain_Management&edit_domain={$hook_info['Domain_Management']['domains']['0']['domain_id']}&ModifyPermission=1">
<legend style="margin:0"> Permission Settings of '{$hook_info['Domain_Management']['domains']['0']['domain_name']}'</legend>
<div class="control-group " >
<div class="col-md-6"><label class="control-label">User:</label></div>
<div class="controls">
<div class="col-md-6">
<select class="form-control" name="user">
<option value="NONE" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['1']} eq "NONE"}selected{/if}>NONE</option>
<option value="CLOSE" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['1']} eq "CLOSE"}selected{/if}>CLOSE</option>
<option value="DEV" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['1']} eq "DEV"}selected{/if}>DEV</option>
<option value="RESTRICTED" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['1']} eq "RESTRICTED"}selected{/if}>RESTRICTED</option>
<option value="OPEN" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['1']} eq "OPEN"}selected{/if}>OPEN</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Browser</label>
<div class="col-lg-5">
<select class="form-control" name="browsers" multiple>
<option value="chrome">Google Chrome</option>
<option value="firefox">Firefox</option>
<option value="ie">IE</option>
<option value="safari">Safari</option>
<option value="opera">Opera</option>
<option value="other">Other</option>
<div class="clearfix"></div>
<div class="control-group " >
<div class="col-md-6"><label class="control-label">Moderator:</label></div>
<div class="controls">
<div class="col-md-6">
<select class="form-control" name="moderator">
<option value="NONE" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['2']} eq "NONE"}selected{/if}>NONE</option>
<option value="CLOSE" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['2']} eq "CLOSE"}selected{/if}>CLOSE</option>
<option value="DEV" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['2']} eq "DEV"}selected{/if}>DEV</option>
<option value="RESTRICTED" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['2']} eq "RESTRICTED"}selected{/if}>RESTRICTED</option>
<option value="OPEN" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['2']} eq "OPEN"}selected{/if}>OPEN</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-5 col-lg-offset-3">
<button type="submit" class="btn btn-default">Validate</button>
<div class="clearfix"></div>
<div class="control-group " >
<div class="col-md-6"><label class="control-label">Admin:</label></div>
<div class="controls">
<div class="col-md-6">
<select class="form-control" name="admin">
<option value="NONE" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['3']} eq "NONE"}selected{/if}>NONE</option>
<option value="CLOSE" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['3']} eq "CLOSE"}selected{/if}>CLOSE</option>
<option value="DEV" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['3']} eq "DEV"}selected{/if}>DEV</option>
<option value="RESTRICTED" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['3']} eq "RESTRICTED"}selected{/if}>RESTRICTED</option>
<option value="OPEN" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['3']} eq "OPEN"}selected{/if}>OPEN</option>
</select>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="control-group">
<label class="control-label"></label>
<div class="controls">
<button type="submit" class="btn btn-primary" >Update</button>
</div>
</div>
</form>