diff --git a/src/web/admin/admin_register_list.html b/src/web/admin/admin_register_list.html
index bc3b7b2..ff3ccdf 100644
--- a/src/web/admin/admin_register_list.html
+++ b/src/web/admin/admin_register_list.html
@@ -7,14 +7,163 @@
+
+
+
+
@@ -28,6 +177,19 @@
diff --git a/src/web/css/admin.css b/src/web/css/admin.css
new file mode 100644
index 0000000..c5111da
--- /dev/null
+++ b/src/web/css/admin.css
@@ -0,0 +1,114 @@
+@charset "utf-8";
+
+
\ No newline at end of file
diff --git a/src/web/js/maestro_list.js b/src/web/js/maestro_list.js
new file mode 100644
index 0000000..24c600e
--- /dev/null
+++ b/src/web/js/maestro_list.js
@@ -0,0 +1,86 @@
+class MaestroListRow {
+
+ constructor(maestroID, maestroName, password, editButton, deleteButton) {
+ this.maestroID = maestroID;
+ this.maestroName = maestroName;
+ this.password = password;
+ this.editButton = editButton;
+ this.deleteButton = deleteButton;
+ }
+
+}
+
+class MaestroList {
+
+ constructor(tagDiv, parent) {
+ let self = this;
+ this.parent = parent;
+ // console.log(tagDiv);
+
+ this.maestroCount = 0;
+ this.activePageNo = 1;
+
+ let id_list = tagDiv.find(".maestro_id");
+ // console.log(id_list);
+
+ this.listRows = new Array();
+ for(let i = 0; i < id_list.length; i++) {
+ this.listRows[i] = new PaestroListRow(
+ id_list[i], // span
+ $(id_list[i]).siblings(".maestro_name"),
+ $(id_list[i]).siblings(".maestro_password"),
+ $(id_list[i]).siblings(".maestro_edit"),
+ $(id_list[i]).siblings(".maestro_delete")
+ );
+
+ this.disableItem(this.listRows[i]);
+
+ $(id_list[i]).siblings(".maestro_edit").click(function() {
+ parent.editMaestro(this);
+ })
+
+ $(id_list[i]).siblings(".maestro_delete").click(function() {
+ parent.deleteMaestro(this);
+ })
+ // console.log(this.listRows[i].maestroName.val());
+ // console.log(this.listRows[i]);
+ }
+ }
+
+ disableItem(item) {
+ $(item.maestroID).empty();
+ $(item.maestroName).prop("disabled", true);
+ $(item.password).prop("disabled", true);
+ $(item.editButton).prop("disabled", true);
+ $(item.deleteButton).prop("disabled", true);
+ }
+
+ enableItem(item) {
+ $(item.maestroName).prop("disabled", false);
+ $(item.password).prop("disabled", false);
+ $(item.editButton).prop("disabled", false);
+ $(item.deleteButton).prop("disabled", false);
+ }
+
+ updatemaestroList(jsonData) {
+ // console.log(jsonData);
+
+ for(let i = 0; i < 10; i++) {
+ $(this.listRows[i].maestroID).empty();
+
+ if(i < jsonData.length) {
+ $(this.listRows[i].maestroID).append(jsonData[i]["maestroID"]);
+ $(this.listRows[i].maestroName).val(jsonData[i]["Name"]);
+ $(this.listRows[i].password).val(jsonData[i]["Password"]);
+
+ this.enableItem(this.listRows[i]);
+ } else {
+ $(this.listRows[i].maestroName).val("");
+ $(this.listRows[i].password).val("");
+
+ this.disableItem(this.listRows[i]);
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/web/js/maestro_list_manager.js b/src/web/js/maestro_list_manager.js
new file mode 100644
index 0000000..9f6f933
--- /dev/null
+++ b/src/web/js/maestro_list_manager.js
@@ -0,0 +1,411 @@
+class MaestroListManager {
+
+ constructor(docList, docNav) {
+ let self = this;
+ this.docList = docList;
+ this.docNav = docNav;
+
+ this.list = new MaestroList(this.docList, this);
+ this.listNavigator = new MaestroListNavigator(this.docNav);
+
+ this.maestroCount = 0;
+ this.activePageNo = 1;
+ this.lastPageNo = 0;
+
+ }
+
+
+ setupRegisteredMaestroList() {
+ let self = this;
+
+ let xhr = new XMLHttpRequest(); //new로 생성.
+ xhr.open('POST', './../server/maestro/registered_maestro_count.php', true);
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ xhr.send("maestro_id=" + maestroID);
+ xhr.onload = function() {
+ if(xhr.readyState === 4 && xhr.status === 200) {
+ // console.log(xhr.responseText);
+ // console.log(xhr.responseText.length);
+ if(xhr.responseText.length === 0 || xhr.responseText === null) {
+ console.log("no data from server");
+ return;
+ }
+
+ let replyJSON = JSON.parse(xhr.responseText);
+ // console.log(replyJSON);
+
+ if(replyJSON === null) {
+ console.log("no data from server");
+ return;
+ }
+
+ if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
+ console.log(replyJSON["ERROR"]);
+ return;
+ }
+
+ if(replyJSON["RESULT"] === "fail") {
+ console.log(replyJSON["RESULT"]);
+ return;
+ }
+
+ self.maestroCount = replyJSON["Count"];
+ self.lastPageNo = Math.ceil( (self.maestroCount + 1) / 10 );
+ self.activePageNo = 1;
+
+ self.loadRegisteredMaestroListPage(self.activePageNo);
+ self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo);
+ }
+ }
+ }
+
+ loadRegisteredMaestroListPage(pageNo) {
+ self = this;
+ this.activePageNo = pageNo;
+
+ let pageIndex = pageNo - 1;
+ let startNo = pageIndex * 10;
+ let endNo = pageIndex * 10 + 9;
+
+ let xhr = new XMLHttpRequest(); //new로 생성.
+ xhr.open('POST', './../server/maestro/registered_maestro_list.php', true);
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ xhr.send("maestro_id=" + maestroID + "&start_no=" + startNo + "&end_no=" + endNo);
+ xhr.onload = function() {
+ if(xhr.readyState === 4 && xhr.status === 200) {
+ // console.log(xhr.responseText);
+ // console.log(xhr.responseText.length);
+ if(xhr.responseText.length === 0 || xhr.responseText === null) {
+ console.log("no data from server");
+ return;
+ }
+
+ let replyJSON = JSON.parse(xhr.responseText);
+ // console.log(replyJSON);
+
+ if(replyJSON === null) {
+ console.log("no data from server");
+ return;
+ }
+
+ if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
+ console.log(replyJSON["ERROR"]);
+ return;
+ }
+
+ if(replyJSON["RESULT"] === "fail") {
+ console.log(replyJSON["RESULT"]);
+ return;
+ }
+
+ // console.log(replyJSON["MaestroList"]);
+ // updateMaestroListPage(replyJSON["MaestroList"]);
+ self.list.updateMaestroList(replyJSON["MaestroList"]);
+
+ self.maestroCount = replyJSON["MaestroList"].length;
+ }
+ }
+ }
+
+
+ updateRegisteredMaestroListPage(pageNo) {
+ self = this;
+ this.maestroListPage = pageNo;
+
+ let pageIndex = pageNo - 1;
+ let startNo = pageIndex * 10;
+ let endNo = pageIndex * 10 + 9;
+
+ let xhr = new XMLHttpRequest(); //new로 생성.
+ xhr.open('POST', './../server/maestro/registered_maestro_list.php', true);
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ xhr.send("maestro_id=" + maestroID + "&start_no=" + startNo + "&end_no=" + endNo);
+ xhr.onload = function() {
+ if(xhr.readyState === 4 && xhr.status === 200) {
+ // console.log(xhr.responseText);
+ // console.log(xhr.responseText.length);
+ if(xhr.responseText.length === 0 || xhr.responseText === null) {
+ console.log("no data from server");
+ return;
+ }
+
+ let replyJSON = JSON.parse(xhr.responseText);
+ // console.log(replyJSON);
+
+ if(replyJSON === null) {
+ console.log("no data from server");
+ return;
+ }
+
+ if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
+ console.log(replyJSON["ERROR"]);
+ return;
+ }
+
+ if(replyJSON["RESULT"] === "fail") {
+ console.log(replyJSON["RESULT"]);
+ return;
+ }
+
+ // console.log(replyJSON["MaestroList"]);
+ self.list.updateMaestroList(replyJSON["MaestroList"]);
+
+ self.maestroCount = replyJSON["MaestroList"].length;
+ // console.log(self.maestroCount);
+ // self.lastPageNo = Math.ceil( (self.maestroCount + 1) / 10 );
+ // self.activePageNo = 1;
+
+ self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo);
+ }
+ }
+ }
+
+
+
+ setupUpgradeMaestroList(maestroName) {
+ let self = this;
+
+ let xhr = new XMLHttpRequest(); //new로 생성.
+ xhr.open('POST', './../server/maestro/search_maestro_count.php', true);
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ xhr.send("maestro_id=" + maestroID + "&maestro_name=" + maestroName);
+ xhr.onload = function() {
+ if(xhr.readyState === 4 && xhr.status === 200) {
+ // console.log(xhr.responseText);
+ // console.log(xhr.responseText.length);
+ if(xhr.responseText.length === 0 || xhr.responseText === null) {
+ console.log("no data from server");
+ return;
+ }
+
+ let replyJSON = JSON.parse(xhr.responseText);
+ // console.log(replyJSON);
+
+ if(replyJSON === null) {
+ console.log("no data from server");
+ return;
+ }
+
+ if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
+ console.log(replyJSON["ERROR"]);
+ return;
+ }
+
+ if(replyJSON["RESULT"] === "fail") {
+ console.log(replyJSON["RESULT"]);
+ return;
+ }
+
+ self.maestroCount = replyJSON["Count"];
+ self.lastPageNo = Math.ceil( (self.maestroCount + 1) / 10 );
+ self.activePageNo = 1;
+
+ self.updateSearchMaestroListPage(maestroName, 1);
+ }
+ }
+ }
+
+ updateUpgradeMaestroListPage(maestroName, pageNo) {
+ let self = this;
+ this.maestroListPage = pageNo;
+
+ let pageIndex = pageNo - 1;
+ let startNo = pageIndex * 10;
+ let endNo = pageIndex * 10 + 9;
+
+ let xhr = new XMLHttpRequest(); //new로 생성.
+ xhr.open('POST', './../server/maestro/search_maestro_list.php', true);
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ xhr.send("maestro_id=" + maestroID + "&maestro_name=" + maestroName + "&start_no=" + startNo + "&end_no=" + endNo);
+ xhr.onload = function() {
+ if(xhr.readyState === 4 && xhr.status === 200) {
+ // console.log(xhr.responseText);
+ // console.log(xhr.responseText.length);
+ if(xhr.responseText.length === 0 || xhr.responseText === null) {
+ console.log("no data from server");
+ return;
+ }
+
+ let replyJSON = JSON.parse(xhr.responseText);
+ // console.log(replyJSON);
+
+ if(replyJSON === null) {
+ console.log("no data from server");
+ return;
+ }
+
+ if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
+ console.log(replyJSON["ERROR"]);
+ return;
+ }
+
+ if(replyJSON["RESULT"] === "fail") {
+ console.log(replyJSON["RESULT"]);
+ return;
+ }
+
+ // console.log(replyJSON["MaestroList"]);
+ self.list.updateMaestroList(replyJSON["MaestroList"]);
+
+ self.maestroCount = replyJSON["MaestroList"].length;
+ // self.lastPageNo = Math.ceil( (self.maestroCount + 1) / 10 );
+ // self.activePageNo = 1;
+
+ self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo);
+ }
+ }
+ }
+
+
+ onClickMaestroListPage(pageNo) {
+ switch(pageNo) {
+ case "first":
+ this.activePageNo = 1;
+ self.loadAddMaestroListPage(self.activePageNo);
+ return;
+
+ case "prev":
+ if(this.activePageNo > 1)
+ this.activePageNo -= 1;
+ self.loadAddMaestroListPage(self.activePageNo);
+ return;
+
+ case "next":
+ if(this.activePageNo < this.lastPageNo)
+ this.activePageNo += 1;
+ self.loadAddMaestroListPage(self.activePageNo);
+ return;
+
+ case "last":
+ this.loadAddMaestroListPage(this.lastPageNo);
+ return;
+ }
+
+ this.activePageNo = pageNo;
+ self.loadAddMaestroListPage(self.activePageNo);
+ }
+
+
+ registMaestro(inputButton) {
+ // console.log(inputButton);
+ let clickedObjectID = this.getClickedObjectID(inputButton);
+
+
+ let id = $(inputButton).siblings(".maestro_id");
+ let maestroID = id.text();
+ // console.log(maestroID);
+
+ let name = $(inputButton).siblings(".maestro_name");
+ let maestroName = name.val();
+ // console.log(maestroName);
+
+ let enterCode = $(inputButton).siblings(".maestro_entercode");
+ let maestroEnterCode = enterCode.val();
+ // console.log(maestroEnterCode);
+
+ let xhr = new XMLHttpRequest(); //new로 생성.
+ xhr.open('POST', './../server/maestro/edit_maestro.php', true);
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ xhr.send("maestro_id=" + maestroID + "&maestro_id=" + maestroID + "&maestro_name=" + maestroName + "&enter_code=" + maestroEnterCode);
+ xhr.onload = function() {
+ if(xhr.readyState === 4 && xhr.status === 200) {
+ // console.log(xhr.responseText);
+ // console.log(xhr.responseText.length);
+ if(xhr.responseText.length === 0 || xhr.responseText === null) {
+ console.log("no data from server");
+ return;
+ }
+
+ let replyJSON = JSON.parse(xhr.responseText);
+ // console.log(replyJSON);
+
+ if(replyJSON === null) {
+ console.log("no data from server");
+ return;
+ }
+
+ if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
+ console.log(replyJSON["ERROR"]);
+ return;
+ }
+
+ if(replyJSON["RESULT"] === "fail") {
+ console.log(replyJSON["RESULT"]);
+ return;
+ }
+
+ console.log(clickedObjectID);
+ if(clickedObjectID === "registered_maestro_list") {
+ self.setupRegisteredMaestroList();
+ } else if(clickedObjectID === "search_maestro_list") {
+ let maestroName = $("#search_name").val();
+ self.setupUpdateMaestroList(maestroName);
+ }
+ }
+ }
+ }
+
+ deleteMaestro(inputButton) {
+ let self = this;
+
+ let id = $(inputButton).siblings(".maestro_id");
+ let maestroID = id.text();
+
+ let clickedObjectID = this.getClickedObjectID(inputButton);
+
+ if(maestroID === null || maestroID === "")
+ return;
+
+ let xhr = new XMLHttpRequest(); //new로 생성.
+ xhr.open('POST', './../server/maestro/delete_maestro.php', true);
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ xhr.send("maestro_id=" + maestroID + "&maestro_id=" + maestroID);
+ xhr.onload = function() {
+ if(xhr.readyState === 4 && xhr.status === 200) {
+ // console.log(xhr.responseText);
+ // console.log(xhr.responseText.length);
+ if(xhr.responseText.length === 0 || xhr.responseText === null) {
+ console.log("no data from server");
+ return;
+ }
+
+ let replyJSON = JSON.parse(xhr.responseText);
+ // console.log(replyJSON);
+
+ if(replyJSON === null) {
+ console.log("no data from server");
+ return;
+ }
+
+ if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
+ console.log(replyJSON["ERROR"]);
+ return;
+ }
+
+ if(replyJSON["RESULT"] === "fail") {
+ console.log(replyJSON["RESULT"]);
+ return;
+ }
+
+ console.log(clickedObjectID);
+ if(clickedObjectID === "registered_maestro_list") {
+ self.setupRegisteredMaestroList();
+ } else if(clickedObjectID === "upgrade_maestro_list") {
+ let maestroName = $("#search_name").val();
+ self.setupUpgradeMaestroList(maestroName);
+ }
+ }
+ }
+ }
+
+ getClickedObjectID(clickedObject) {
+ let tagDiv = $(clickedObject).closest(".maestro_list");
+ let tagDivID = tagDiv.prop("id");
+ // console.log(tagDivIDName);
+
+ return tagDivID;
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/src/web/js/maestro_list_navigator.js b/src/web/js/maestro_list_navigator.js
new file mode 100644
index 0000000..1255f79
--- /dev/null
+++ b/src/web/js/maestro_list_navigator.js
@@ -0,0 +1,54 @@
+class MaestroListNavigator {
+
+ constructor(pageNoArea) {
+ let self = this;
+ this.pageNoArea = pageNoArea;
+ // console.log(parent);
+
+ this.activePageNo = 1;
+ this.lastPageNo = 1;
+ }
+
+ updateNavigator(activePageNo, lastPageNo) {
+ this.activePageNo = activePageNo;
+ this.lastPageNo = lastPageNo;
+ // this.lastPageNo = Math.ceil( (maestroCount + 1) / 10 );
+
+ $(this.pageNoArea).empty();
+
+ for(let pageNo = 1; pageNo < this.lastPageNo + 1; pageNo++) {
+ $(this.pageNoArea).append(
+ " " + pageNo + " "
+ );
+ }
+ }
+
+ onClickMaestroListPage(pageNo) {
+ switch(pageNo) {
+ case "first":
+ this.activePageNo = 1;
+ this.maestroList.loadMaestroListPage(this.activePageNo);
+ return;
+
+ case "prev":
+ if(this.activePageNo > 1)
+ this.activePageNo -= 1;
+ this.maestroList.loadMaestroListPage(this.activePageNo);
+ return;
+
+ case "next":
+ if(this.activePageNo < this.lastPageNo)
+ this.activePageNo += 1;
+ this.maestroList.loadMaestroListPage(this.activePageNo);
+ return;
+
+ case "last":
+ this.maestroList.loadMaestroListPage(this.lastPageNo);
+ return;
+ }
+
+ this.activePageNo = pageNo;
+ this.maestroList.loadMaestroListPage(this.activePageNo);
+ }
+
+}
\ No newline at end of file
diff --git a/src/web/server/admin/register_maestro.php b/src/web/server/admin/register_maestro.php
new file mode 100644
index 0000000..64525ea
--- /dev/null
+++ b/src/web/server/admin/register_maestro.php
@@ -0,0 +1,23 @@
+prepare($query);
+$stmt->bind_param('i', $maestro_id);
+$stmt->execute();
+
+if($stmt->affected_rows <= 0) {
+ send_error_message($replyJSON, "마에스트로 계정 활성화 실패");
+ $db_conn->close();
+ exit;
+}
+
+$replyJSON["RESULT"] = "ok";
+echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
+$db_conn->close();
+
+?>
\ No newline at end of file
diff --git a/src/web/server/admin/registered_maestro_list.php b/src/web/server/admin/registered_maestro_list.php
new file mode 100644
index 0000000..e24e929
--- /dev/null
+++ b/src/web/server/admin/registered_maestro_list.php
@@ -0,0 +1,80 @@
+close();
+ exit;
+}
+
+$replyJSON["RESULT"] = "ok";
+echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
+$db_conn->close();
+
+
+function get_maestro_list() {
+ global $db_conn;
+
+ $query = "
+ SELECT MaestroID, Name, AccountType FROM moty_maestro
+ WHERE ActivateStatus=0
+ ORDER BY MaestroID DESC
+ ";
+ $stmt = $db_conn->prepare($query);
+ // $stmt->bind_param('iii', $maestroID, $startNo, $endNo);
+ // $stmt->bind_param('ii', $maestroName, $startNo);
+ $stmt->execute();
+ $stmt->bind_result($maestroID, $name, $accountType);
+
+ $maestroList = array();
+ while($stmt->fetch()) {
+ $maestro['MaestroID'] = $maestroID;
+ $maestro['Name'] = $name;
+ $maestro['AccountType'] = $accountType;
+ array_push($maestroList, $maestro);
+ }
+
+ $return_array['MaestroList'] = $maestroList;
+ return $return_array;
+}
+
+function get_maestro_list_by_name($maestroName) {
+ global $db_conn;
+
+ $query = "
+ SELECT MaestroID, Name, AccountType FROM moty_maestro
+ WHERE Name=? AND ActivateStatus=0
+ ORDER BY MaestroID DESC
+ ";
+ $stmt = $db_conn->prepare($query);
+ // $stmt->bind_param('iii', $maestroID, $startNo, $endNo);
+ $stmt->bind_param('s', $maestroName);
+ $stmt->execute();
+ $stmt->bind_result($maestroID, $name, $accountType);
+
+ $maestroList = array();
+ while($stmt->fetch()) {
+ $maestro['MaestroID'] = $maestroID;
+ $maestro['Name'] = $name;
+ $maestro['AccountType'] = $accountType;
+ array_push($maestroList, $maestro);
+ }
+
+ $return_array['MaestroList'] = $maestroList;
+ return $return_array;
+}
+
+?>
\ No newline at end of file