--HG--
branch : develop
This commit is contained in:
botanic 2014-09-14 15:52:40 -07:00
parent ba3f48a9e2
commit 89604dbba4
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 ) public static function loadTemplate( $template, $vars = array (), $returnHTML = false )
{ {
error_log(print_r($_GET,true)); //error_log(print_r($_GET,true));
error_log(print_r($_POST,true)); //error_log(print_r($_POST,true));
global $AMS_LIB; global $AMS_LIB;
global $SITEBASE; global $SITEBASE;
global $AMS_TRANS; global $AMS_TRANS;

View file

@ -336,12 +336,32 @@ class Users{
$dbs = new DBLayer("shard"); $dbs = new DBLayer("shard");
$sth = $dbs->selectWithParameter("UId", "user", $values, "Login= :username"); $sth = $dbs->selectWithParameter("UId", "user", $values, "Login= :username");
$result = $sth->fetchAll(); $result = $sth->fetchAll();
/*foreach ($result as $UId) { $dbl = new DBLayer("lib");
$ins_values = array('UId' => $UId['UId'], 'clientApplication' => 'r2', 'AccessPrivilege' => 'OPEN');
$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); $dbs->insert("permission", $ins_values);
$ins_values['clientApplication'] = 'ryzom_open'; }
$dbs->insert("permission", $ins_values);
}*/ // FIXME: GARBAGE
} }
catch (PDOException $e) { catch (PDOException $e) {
//oh noooz, the shard is offline! Put it in query queue at ams_lib db! //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 { try {
$db = new DBLayer( 'shard' ); $db = new DBLayer( 'shard' );
@ -102,6 +125,14 @@ function domain_management_hook_get_db()
$pagination = new Pagination( WebUsers :: getAllUsersQuery(), "web", 10, "WebUsers" ); $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" ) ); $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; return $rows;

View file

@ -205,35 +205,58 @@
<div class="panel-body"> <div class="panel-body">
<div class="row-fluid"> <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"> <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">
<div class="form-group">
<label class="col-lg-3 control-label">Gender</label> <legend style="margin:0"> Permission Settings of '{$hook_info['Domain_Management']['domains']['0']['domain_name']}'</legend>
<div class="col-lg-5"> <div class="control-group " >
<select class="form-control" name="gender"> <div class="col-md-6"><label class="control-label">User:</label></div>
<option value="male">Male</option> <div class="controls">
<option value="female">Female</option> <div class="col-md-6">
<option value="other">Other</option> <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> </select>
</div>
</div> </div>
</div> </div>
<div class="clearfix"></div>
<div class="form-group"> <div class="control-group " >
<label class="col-lg-3 control-label">Browser</label> <div class="col-md-6"><label class="control-label">Moderator:</label></div>
<div class="col-lg-5"> <div class="controls">
<select class="form-control" name="browsers" multiple> <div class="col-md-6">
<option value="chrome">Google Chrome</option> <select class="form-control" name="moderator">
<option value="firefox">Firefox</option> <option value="NONE" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['2']} eq "NONE"}selected{/if}>NONE</option>
<option value="ie">IE</option> <option value="CLOSE" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['2']} eq "CLOSE"}selected{/if}>CLOSE</option>
<option value="safari">Safari</option> <option value="DEV" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['2']} eq "DEV"}selected{/if}>DEV</option>
<option value="opera">Opera</option> <option value="RESTRICTED" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['2']} eq "RESTRICTED"}selected{/if}>RESTRICTED</option>
<option value="other">Other</option> <option value="OPEN" {if {$hook_info['Domain_Management']['Domain_Auto_Add']['2']} eq "OPEN"}selected{/if}>OPEN</option>
</select> </select>
</div> </div>
</div>
</div> </div>
<div class="clearfix"></div>
<div class="form-group"> <div class="control-group " >
<div class="col-lg-5 col-lg-offset-3"> <div class="col-md-6"><label class="control-label">Admin:</label></div>
<button type="submit" class="btn btn-default">Validate</button> <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>
</div> </div>
</form> </form>