Add: allow edit player's entercode

This commit is contained in:
2019-08-18 15:34:40 +09:00
parent 1926c0e42b
commit 48d50b3f35
4 changed files with 49 additions and 31 deletions
+21
View File
@@ -91,6 +91,27 @@ DBService.prototype.tddRun = function(command, onSucceededListener, onFailedList
xhr.send("command=" + command); xhr.send("command=" + command);
} }
// allow edit setting for play enter code
DBService.prototype.requestAllowEditEnterCode = function(onSucceededListener, onFailedListener) {
var xhr = this.makeXhr(
"php/menu/allow_edit_entercode.php",
(function() { // onreadystatechange
if(xhr.readyState == 4 && xhr.status == 200) {
var replyJSON = JSON.parse(xhr.responseText);
if(replyJSON != null)
onSucceededListener(replyJSON);
else
onFailedListener(replyJSON);
}
}).bind(this)
);
xhr.send("maestroID=" + this.maestroID);
}
// writing // writing
DBService.prototype.requestWritingPlayerList = function(onSucceededListener, onFailedListener) { DBService.prototype.requestWritingPlayerList = function(onSucceededListener, onFailedListener) {
var xhr = this.makeXhr( var xhr = this.makeXhr(
+14 -28
View File
@@ -72,9 +72,10 @@ MainMenu.prototype.fontLoaded = function() {
); );
// top UI // top UI
this.makeButtons(); this.backButton = new BackButton(
(function() { console.log("back"); }).bind(this)
);
this.backButton.applyLoadedFont(); this.backButton.applyLoadedFont();
this.settingButton.applyLoadedFont();
this.makeAppGroupTab(); this.makeAppGroupTab();
this.makeLanguageTab(); this.makeLanguageTab();
@@ -100,6 +101,8 @@ MainMenu.prototype.fontLoaded = function() {
this.activeSavedAppGroupTab(); this.activeSavedAppGroupTab();
this.activeSavedLanguageTab(); this.activeSavedLanguageTab();
// this.loadAppData(); // this.loadAppData();
this.loadAllowEditEnterCode();
} }
@@ -109,26 +112,14 @@ MainMenu.prototype.back = function() {
location.href = '../../web/client/login.html'; location.href = '../../web/client/login.html';
} }
MainMenu.prototype.loadAllowEditEnterCode = function(screenTopUI) { MainMenu.prototype.loadAllowEditEnterCode = function() {
/* this.dbService.requestAllowEditEnterCode(
var dbConnectManager = new DBConnectManager();
dbConnectManager.requestAllowEditEnterCode(
sessionStorageManager.getMaestroID(),
(function(replyJSON) { (function(replyJSON) {
if(replyJSON["AllowEditEnterCode"] == "1") { if(parseInt(replyJSON.allowEditEntercode) === 1)
screenTopUI.makeSetupButton( (function() { this.makeSettingButton();
console.log("setup");
location.href = '../../web/client/setup.html';
}).bind(this) );
}
}).bind(this), }).bind(this),
(function(replyJSON) { console.log(replyJSON); }).bind(this)
(function(replyJSON) {
this.loadFailed(replyJSON);
}).bind(this)
); );
*/
} }
MainMenu.prototype.loadAppData = function() { MainMenu.prototype.loadAppData = function() {
@@ -140,9 +131,7 @@ MainMenu.prototype.loadAppData = function() {
this.updateAppButtons(replyJSON.appGroup, replyJSON.appData); this.updateAppButtons(replyJSON.appGroup, replyJSON.appData);
// this.updateLanguageTab(replyJSON.appGroup); // this.updateLanguageTab(replyJSON.appGroup);
}).bind(this), }).bind(this),
(function(replyJSON) { (function(replyJSON) { console.log(replyJSON); }).bind(this)
console.log(replyJSON);
}).bind(this)
); );
} }
@@ -420,14 +409,11 @@ MainMenu.prototype.updatePlayAppButtons = function(appData) {
} }
MainMenu.prototype.makeButtons = function() { MainMenu.prototype.makeSettingButton = function() {
this.backButton = new BackButton(
(function() { console.log("back"); }).bind(this)
);
this.settingButton = new SettingButton( this.settingButton = new SettingButton(
(function() { console.log("setting"); }).bind(this) (function() { location.href = '../../web/client/setup.html'; }).bind(this)
); );
this.settingButton.applyLoadedFont();
} }
MainMenu.prototype.activeSavedAppGroupTab = function() { MainMenu.prototype.activeSavedAppGroupTab = function() {
+2 -3
View File
@@ -54,9 +54,8 @@ var Setup = {
}, },
back: function() { back: function() {
// sessionStorageManager.clear(); // location.href = '../../web/client/menu_app.html';
// location.href = '../../web/main/index.html'; location.href = '../../web/client/main_menu.html';
location.href = '../../web/client/menu_app.html';
}, },
makePrevEnterCodeText: function(x, y) { makePrevEnterCodeText: function(x, y) {
+12
View File
@@ -319,5 +319,17 @@ class MenuCollection extends DBMethodContainer
} }
*/ */
public function getAllowEditEntercode($maestroID) {
$query = "SELECT AllowEditEnterCode FROM maestro WHERE MaestroID = ?";
$stmt = $this->mysqli->prepare($query);
$stmt->bind_param("i", $maestroID);
$stmt->execute();
$stmt->bind_result($allowEditEntercode);
$stmt->fetch();
$stmt->close();
return $allowEditEntercode;
}
} }
?> ?>