mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-15 06:09:58 +08:00
added support of changing model preference in console
This commit is contained in:
parent
0cf7e747e3
commit
d20be14f90
@ -3,7 +3,7 @@
|
||||
* @Author: prpr
|
||||
* @Date: 2016-02-04 13:53:55
|
||||
* @Last Modified by: prpr
|
||||
* @Last Modified time: 2016-02-04 17:14:06
|
||||
* @Last Modified time: 2016-02-04 18:09:26
|
||||
*/
|
||||
session_start();
|
||||
$dir = dirname(dirname(__FILE__));
|
||||
@ -61,6 +61,16 @@ if (isset($_GET['action'])) {
|
||||
$user->unRegister();
|
||||
$json['errno'] = 0;
|
||||
$json['msg'] = "Account successfully deleted.";
|
||||
} else if ($action == "model") {
|
||||
if (isset($_POST['model']) && $_POST['model'] == 'slim' || $_POST['model'] == 'default') {
|
||||
$user->setPreference($_POST['model']);
|
||||
$json['errno'] = 0;
|
||||
$json['msg'] = "Model preference of ".$_GET['uname']." changed to ".$_POST['model']." successfully.";
|
||||
} else {
|
||||
utils::raise(1, 'Illegal parameters');
|
||||
}
|
||||
} else {
|
||||
utils::raise(1, 'Illegal parameters');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @Author: prpr
|
||||
* @Date: 2016-02-03 14:39:50
|
||||
* @Last Modified by: prpr
|
||||
* @Last Modified time: 2016-02-04 17:32:11
|
||||
* @Last Modified time: 2016-02-04 18:08:41
|
||||
*/
|
||||
|
||||
session_start();
|
||||
@ -88,8 +88,10 @@ if (isset($_SESSION['uname'])) {
|
||||
<?php echo '<img id="'.$row['username'].'_cape" width="64" '.(($row['cape_hash'] == "") ? '' : 'src="../cape/'.$row['username'].'.png"').'/>'; ?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:showUpload('<?php echo $row['username'] ?>', 'skin');" class="pure-button pure-button-primary">Skin</a>
|
||||
<a href="javascript:showUpload('<?php echo $row['username'] ?>', 'cape');" class="pure-button pure-button-primary">Cape</a>
|
||||
<a href="javascript:showUpload('<?php echo $row['username']; ?>', 'skin');" class="pure-button pure-button-primary">Skin</a>
|
||||
<a href="javascript:showUpload('<?php echo $row['username']; ?>', 'cape');" class="pure-button pure-button-primary">Cape</a>
|
||||
<a href="javascript:showModel('<?php echo $row['username']; ?>', 'cape');" class="pure-button pure-button-default">Model</a>
|
||||
<span>(<?php echo $row['preference']; ?>)</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:showChange('<?php echo $row['username'] ?>');" class="pure-button pure-button-default">Password</a>
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: prpr
|
||||
* @Date: 2016-02-04 16:48:42
|
||||
* @Last Modified by: prpr
|
||||
* @Last Modified time: 2016-02-04 17:09:20
|
||||
* @Last Modified time: 2016-02-04 18:02:38
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@ -83,3 +83,29 @@ function showDelete(uname) {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function showModel(uname) {
|
||||
Ply.dialog("prompt", {
|
||||
title: "Change "+uname+"'s model prefrence:",
|
||||
form: { text: "Type in `slim` or `default`" }
|
||||
}).done(function(ui){
|
||||
var model = ui.data.text;
|
||||
if (model == 'slim'| model == 'default') {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "admin_ajax.php?action=model&uname="+uname,
|
||||
data: { "model": ui.data.text },
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
if (json.errno == 0) {
|
||||
showAlert(json.msg);
|
||||
} else {
|
||||
showAlert(json.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showAlert('Only `slim` or `default` is valid.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user