From 4edd637b05fc04085381c10731002ea79974b5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Fri, 13 Jul 2018 20:14:51 +0900 Subject: [PATCH] Fix: add player css, error_message css --- src/web/admin/admin_register_list.html | 3 - src/web/css/maestro_main.css | 12 +- src/web/css/module.css | 21 +- src/web/js/maestro_main.js | 2 +- src/web/js/player_list.js | 18 +- src/web/js/player_list_manager.js | 305 +----------------- .../module/maestro_section_add_player.html | 231 ++++++------- src/web/module/maestro_section_search.html | 5 +- src/web/server/player/search_player_count.php | 2 +- src/web/server/player/search_player_list.php | 2 +- 10 files changed, 157 insertions(+), 444 deletions(-) diff --git a/src/web/admin/admin_register_list.html b/src/web/admin/admin_register_list.html index 6f9dc59..de2454a 100644 --- a/src/web/admin/admin_register_list.html +++ b/src/web/admin/admin_register_list.html @@ -126,9 +126,6 @@
-
-
-

검색

diff --git a/src/web/css/maestro_main.css b/src/web/css/maestro_main.css index 9e53be4..1c6dfad 100644 --- a/src/web/css/maestro_main.css +++ b/src/web/css/maestro_main.css @@ -1,11 +1,5 @@ @charset "utf-8"; - \ No newline at end of file +*/ \ No newline at end of file diff --git a/src/web/css/module.css b/src/web/css/module.css index 72c2e65..cf9ee0c 100644 --- a/src/web/css/module.css +++ b/src/web/css/module.css @@ -1,7 +1,5 @@ @charset "utf-8"; - \ No newline at end of file +} \ No newline at end of file diff --git a/src/web/js/maestro_main.js b/src/web/js/maestro_main.js index 86cc221..e572b56 100644 --- a/src/web/js/maestro_main.js +++ b/src/web/js/maestro_main.js @@ -28,7 +28,7 @@ function tabClicked(tabNo) { $("#section_add_player").addClass("hide"); $("#search_player_name").val(""); - searchPlayerListManager.setupSearchPlayerList(""); + // searchPlayerListManager.setupSearchPlayerList(""); $("#search_player").removeClass("hide"); $("#mouse_app_list").addClass("hide"); diff --git a/src/web/js/player_list.js b/src/web/js/player_list.js index 1e09d4f..e09feff 100644 --- a/src/web/js/player_list.js +++ b/src/web/js/player_list.js @@ -12,9 +12,9 @@ class PlayerList { - constructor(tagDiv, parent) { + constructor(tagDiv, playerListManager) { let self = this; - this.parent = parent; + this.playerListManager = playerListManager; // console.log(tagDiv); this.playerCount = 0; @@ -36,11 +36,11 @@ class PlayerList { this.disableItem(this.listRows[i]); $(id_list[i]).siblings(".player_edit").click(function() { - parent.editPlayer(this); + playerListManager.editPlayer(this); }) $(id_list[i]).siblings(".player_delete").click(function() { - parent.deletePlayer(this); + playerListManager.deletePlayer(this); }) // console.log(this.listRows[i].playerName.val()); // console.log(this.listRows[i]); @@ -64,6 +64,16 @@ class PlayerList { updatePlayerList(jsonData) { // console.log(jsonData); + if(jsonData === null) { + for(let i = 0; i < 10; i++) { + $(this.listRows[i].playerName).val(""); + $(this.listRows[i].enterCode).val(""); + + this.disableItem(this.listRows[i]); + } + + return; + } for(let i = 0; i < 10; i++) { $(this.listRows[i].playerID).empty(); diff --git a/src/web/js/player_list_manager.js b/src/web/js/player_list_manager.js index 05c9c21..8146226 100644 --- a/src/web/js/player_list_manager.js +++ b/src/web/js/player_list_manager.js @@ -6,12 +6,12 @@ this.docNav = docNav; this.list = new PlayerList(this.docList, this); + this.list.updatePlayerList(null); this.listNavigator = new PlayerListNavigator(this.docNav); this.playerCount = 0; this.activePageNo = 1; this.lastPageNo = 0; - } @@ -38,48 +38,6 @@ } ); - -/* - let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/player/registered_player_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 jsonData = JSON.parse(xhr.responseText); - // console.log(jsonData); - - if(jsonData === null) { - console.log("no data from server"); - return; - } - - if(jsonData["ERROR"] !== undefined || jsonData["RESULT"] === undefined) { - console.log(jsonData["ERROR"]); - return; - } - - if(jsonData["RESULT"] === "fail") { - console.log(jsonData["RESULT"]); - return; - } - - self.playerCount = jsonData["Count"]; - self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 ); - self.activePageNo = 1; - - self.loadAddPlayerListPage(self.activePageNo); - self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo); - } - } - */ } loadAddPlayerListPage(pageNo) { @@ -106,47 +64,6 @@ } ); - -/* - let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/player/registered_player_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 jsonData = JSON.parse(xhr.responseText); - // console.log(jsonData); - - if(jsonData === null) { - console.log("no data from server"); - return; - } - - if(jsonData["ERROR"] !== undefined || jsonData["RESULT"] === undefined) { - console.log(jsonData["ERROR"]); - return; - } - - if(jsonData["RESULT"] === "fail") { - console.log(jsonData["RESULT"]); - return; - } - - // console.log(jsonData["PlayerList"]); - // updatePlayerListPage(jsonData["PlayerList"]); - self.list.updatePlayerList(jsonData["PlayerList"]); - - self.playerCount = jsonData["PlayerList"].length; - } - } - */ } @@ -175,52 +92,6 @@ } ); - - -/* - let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/player/registered_player_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 jsonData = JSON.parse(xhr.responseText); - // console.log(jsonData); - - if(jsonData === null) { - console.log("no data from server"); - return; - } - - if(jsonData["ERROR"] !== undefined || jsonData["RESULT"] === undefined) { - console.log(jsonData["ERROR"]); - return; - } - - if(jsonData["RESULT"] === "fail") { - console.log(jsonData["RESULT"]); - return; - } - - // console.log(jsonData["PlayerList"]); - self.list.updatePlayerList(jsonData["PlayerList"]); - - self.playerCount = jsonData["PlayerList"].length; - // console.log(self.playerCount); - // self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 ); - // self.activePageNo = 1; - - self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo); - } - } - */ } @@ -247,47 +118,6 @@ } ); - -/* - let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/player/search_player_count.php', true); - xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - xhr.send("maestro_id=" + maestroID + "&player_name=" + playerName); - 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 jsonData = JSON.parse(xhr.responseText); - // console.log(jsonData); - - if(jsonData === null) { - console.log("no data from server"); - return; - } - - if(jsonData["ERROR"] !== undefined || jsonData["RESULT"] === undefined) { - console.log(jsonData["ERROR"]); - return; - } - - if(jsonData["RESULT"] === "fail") { - console.log(jsonData["RESULT"]); - return; - } - - self.playerCount = jsonData["Count"]; - self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 ); - self.activePageNo = 1; - - self.updateSearchPlayerListPage(playerName, 1); - } - } - */ } updateSearchPlayerListPage(playerName, pageNo) { @@ -315,51 +145,6 @@ } ); - - -/* - let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/player/search_player_list.php', true); - xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - xhr.send("maestro_id=" + maestroID + "&player_name=" + playerName + "&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 jsonData = JSON.parse(xhr.responseText); - // console.log(jsonData); - - if(jsonData === null) { - console.log("no data from server"); - return; - } - - if(jsonData["ERROR"] !== undefined || jsonData["RESULT"] === undefined) { - console.log(jsonData["ERROR"]); - return; - } - - if(jsonData["RESULT"] === "fail") { - console.log(jsonData["RESULT"]); - return; - } - - // console.log(jsonData["PlayerList"]); - self.list.updatePlayerList(jsonData["PlayerList"]); - - self.playerCount = jsonData["PlayerList"].length; - // self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 ); - // self.activePageNo = 1; - - self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo); - } - } - */ } @@ -429,50 +214,6 @@ } ); - - -/* - let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/player/edit_player.php', true); - xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID + "&player_name=" + playerName + "&enter_code=" + playerEnterCode); - 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 jsonData = JSON.parse(xhr.responseText); - // console.log(jsonData); - - if(jsonData === null) { - console.log("no data from server"); - return; - } - - if(jsonData["ERROR"] !== undefined || jsonData["RESULT"] === undefined) { - console.log(jsonData["ERROR"]); - return; - } - - if(jsonData["RESULT"] === "fail") { - console.log(jsonData["RESULT"]); - return; - } - - console.log(clickedObjectID); - if(clickedObjectID === "add_player_list") { - self.setupAddPlayerList(); - } else if(clickedObjectID === "search_player_list") { - let playerName = $("#search_name").val(); - self.setupSearchPlayerList(playerName); - } - } - } - */ } deletePlayer(inputButton) { @@ -506,50 +247,6 @@ } ); - - -/* - let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/player/delete_player.php', true); - xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID); - 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 jsonData = JSON.parse(xhr.responseText); - // console.log(jsonData); - - if(jsonData === null) { - console.log("no data from server"); - return; - } - - if(jsonData["ERROR"] !== undefined || jsonData["RESULT"] === undefined) { - console.log(jsonData["ERROR"]); - return; - } - - if(jsonData["RESULT"] === "fail") { - console.log(jsonData["RESULT"]); - return; - } - - console.log(clickedObjectID); - if(clickedObjectID === "add_player_list") { - self.setupAddPlayerList(); - } else if(clickedObjectID === "search_player_list") { - let playerName = $("#search_name").val(); - self.setupSearchPlayerList(playerName); - } - } - } - */ } getClickedObjectID(clickedObject) { diff --git a/src/web/module/maestro_section_add_player.html b/src/web/module/maestro_section_add_player.html index 433da51..3af56b4 100644 --- a/src/web/module/maestro_section_add_player.html +++ b/src/web/module/maestro_section_add_player.html @@ -54,124 +54,127 @@ function addPlayer() {
- -

추가

+
+ +

추가

-

1명 추가

+

1명 추가

-
- 학생 이름
- 입장 번호 - -
+
+ 학생 이름
+ 입장 번호 + +
- -
+ + --> + - - 학생 목록 -
-
    -
  • - 이름 - 입장 코드 - -
  • -
  • - - - - - -
  • -
  • - - - - - -
  • -
  • - - - - - -
  • -
  • - - - - - -
  • -
  • - - - - - -
  • -
  • - - - - - -
  • -
  • - - - - - -
  • -
  • - - - - - -
  • -
  • - - - - - -
  • -
  • - - - - - -
  • -
-
+ + 학생 목록 +
+
    +
  • + 이름 + 입장 코드 + +
  • +
  • + + + + + +
  • +
  • + + + + + +
  • +
  • + + + + + +
  • +
  • + + + + + +
  • +
  • + + + + + +
  • +
  • + + + + + +
  • +
  • + + + + + +
  • +
  • + + + + + +
  • +
  • + + + + + +
  • +
  • + + + + + +
  • +
+
- -
\ No newline at end of file + +
+ +
\ No newline at end of file diff --git a/src/web/module/maestro_section_search.html b/src/web/module/maestro_section_search.html index e1952fe..24dea3a 100644 --- a/src/web/module/maestro_section_search.html +++ b/src/web/module/maestro_section_search.html @@ -6,7 +6,8 @@ $(document).ready(function() { $("#search_player_list_navigator > #page_no_area") ); - searchPlayerListManager.setupSearchPlayerList(""); + // searchPlayerListManager.setupSearchPlayerList(""); + console.log("search - ready"); }); @@ -17,6 +18,7 @@ function searchPlayer() { if(playerName.length === 0) { // $("#search_name_notice").val("학생 이름을 입력하세요."); $("#search_name").focus(); + return; } searchPlayerListManager.setupSearchPlayerList(playerName); @@ -25,7 +27,6 @@ function searchPlayer() { -

검색

diff --git a/src/web/server/player/search_player_count.php b/src/web/server/player/search_player_count.php index 2f6a1fc..567b74e 100644 --- a/src/web/server/player/search_player_count.php +++ b/src/web/server/player/search_player_count.php @@ -22,7 +22,7 @@ exit; function getPlayerCount($maestroID, $playerName) { global $db_conn; - $query = "SELECT COUNT(PlayerID) FROM moty_player WHERE MaestroID = ? AND Name = ?"; + $query = "SELECT COUNT(PlayerID) FROM moty_player WHERE MaestroID = ? AND Name LIKE CONCAT('%', ?, '%')"; $stmt = $db_conn->prepare($query); $stmt->bind_param("is", $maestroID, $playerName); $stmt->execute(); diff --git a/src/web/server/player/search_player_list.php b/src/web/server/player/search_player_list.php index 2d4000e..580d2a7 100644 --- a/src/web/server/player/search_player_list.php +++ b/src/web/server/player/search_player_list.php @@ -27,7 +27,7 @@ function get_player_list_page($maestroID, $playerName, $startNo, $endNo) { $query = " SELECT PlayerID, Name, EnterCode FROM moty_player - WHERE MaestroID=? AND Name=? + WHERE MaestroID = ? AND Name LIKE CONCAT('%', ?, '%') ORDER BY PlayerID DESC LIMIT ?, 10; ";