From 0d324bab698621f032202198ff97a22c03d0bf13 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: Sun, 16 Sep 2018 18:47:09 +0900 Subject: [PATCH] Fix: admin CSS -> BootStrap, register, upgrade page --- src/web/admin/admin_header.html | 45 ++--- src/web/admin/admin_register_list.html | 140 ++++++++------- src/web/admin/admin_upgrade_list.html | 186 +++++++++++++------- src/web/admin/login.html | 44 +++-- src/web/js/lib/number_util.js | 24 +++ src/web/main/login.html | 1 - src/web/server/lib/maestro_account_type.php | 4 + 7 files changed, 264 insertions(+), 180 deletions(-) create mode 100644 src/web/js/lib/number_util.js diff --git a/src/web/admin/admin_header.html b/src/web/admin/admin_header.html index a8949a0..5b396f5 100644 --- a/src/web/admin/admin_header.html +++ b/src/web/admin/admin_header.html @@ -21,37 +21,20 @@ -
- - - 마우스 타자 연습
-
-
+
+ diff --git a/src/web/admin/admin_register_list.html b/src/web/admin/admin_register_list.html index 58cc19f..4eabd3c 100644 --- a/src/web/admin/admin_register_list.html +++ b/src/web/admin/admin_register_list.html @@ -1,13 +1,10 @@  - 마우스 타자 관리자 페이지 - - - + @@ -17,13 +14,14 @@ $("#header").load("admin_header.html"); loadMaestroList(""); + }); function searchMaestro() { - let maestroName = $("#search_name").val(); + var maestroName = $("#search_name").val(); if(maestroName.length === 0) { - $("#error_message").text("마에스트로 아이디를 입력하세요."); + showErrorMessage("검색할 마에스트로 아이디를 입력하세요.", "error"); $("#search_name").focus(); } @@ -40,9 +38,7 @@ }, function(errorMessage, errorCode) { - if($("#error_message").length) { - $("#error_message").text(errorMessage); - } + showErrorMessage(errorMessag, "error"); } ); @@ -50,59 +46,58 @@ function updateMaestroList(jsonList) { $("#maestro_list_result_contents").empty(); - printHeader(); printContents(jsonList); - printFooter(); - } - - function printHeader() { - $("#maestro_list_result_contents").append( - ""); - } - function register(inputButton) { - let id = $(inputButton).siblings(".maestro_id"); - let maestroID = id.text(); + // var id = $(inputButton).siblings(".maestro_id d-none"); + // var maestroID = id.text(); + + var children = inputButton.parentElement.childNodes; + var maestroID = ""; + for (var i=0; i < children.length; i++) { + // console.log(children); + if (children[i].className == "maestro_id d-none") { + maestroID = children[i].value; + break; + } + } + // console.log(maestroID); sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode); "./../server/admin/register_maestro.php", "maestro_id=" + maestroID, function(jsonData) { + showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success"); loadMaestroList(""); - $("#error_message").text("마에스트로 계정이 정상적으로 등록되었습니다."); }, function(errorMessage, errorCode) { - if($("#error_message").length) { - $("#error_message").text(errorMessage); - } + showErrorMessage(errorMessage, "error"); } ); @@ -115,32 +110,53 @@ -
+ - +
+
+

신규 마에스트로 등록 목록

+
-
-
- -

검색

+
- 마에스트로 아이디 -
-
-
- - - 검색 결과 -
+
+
+
마에스트로 검색
+
+
+ +
+ + +
- -
-
-
+
+
+ +
+
+ +
+ +
+
검색 결과
+ +
+
+ + + + + +
+
+
+
+ + + - \ No newline at end of file diff --git a/src/web/admin/admin_upgrade_list.html b/src/web/admin/admin_upgrade_list.html index 4c96e12..2edabc4 100644 --- a/src/web/admin/admin_upgrade_list.html +++ b/src/web/admin/admin_upgrade_list.html @@ -5,13 +5,12 @@ 마우스 타자 관리자 페이지 - - - + + @@ -17,8 +16,8 @@ }); function login() { - let name = $("#admin_name").val(); - let password = $("#password").val(); + var name = $("#admin_name").val(); + var password = $("#password").val(); sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode); "./../server/admin/login.php", @@ -38,28 +37,37 @@ } - - -
- 관리자 아이디 -
- 암호 -
-
+
+
+

로그인

+
-
- 로그인 -
+
+
+ +
+ +
+
-
+
+ +
+ +


+ +
+
+ + +
- \ No newline at end of file diff --git a/src/web/js/lib/number_util.js b/src/web/js/lib/number_util.js new file mode 100644 index 0000000..1edb626 --- /dev/null +++ b/src/web/js/lib/number_util.js @@ -0,0 +1,24 @@ +function NumberUtil() { +} + + +NumberUtil.numberWithCommas = function(x) { + return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); +} + +NumberUtil.numberOfDigits = function(number) { + if(number === 1000) + return 4; + + return Math.floor(Math.log(number) / Math.LN10 + 1); // bug : 1000 -> expected 4 but 3 +} + +NumberUtil.getRecordText = function(value) { + var number = Math.floor(value); + var numberWithCommas = NumberUtil.numberWithCommas(number); + + if(isTypingGame()) + return numberWithCommas + " 타"; + else + return numberWithCommas + " 점"; +} \ No newline at end of file diff --git a/src/web/main/login.html b/src/web/main/login.html index 7d68d41..05d7462 100644 --- a/src/web/main/login.html +++ b/src/web/main/login.html @@ -3,7 +3,6 @@ - 마에스트로 로그인 diff --git a/src/web/server/lib/maestro_account_type.php b/src/web/server/lib/maestro_account_type.php index 83e29a5..a10ed37 100644 --- a/src/web/server/lib/maestro_account_type.php +++ b/src/web/server/lib/maestro_account_type.php @@ -11,6 +11,10 @@ function get_max_player_count($accountType) { return 50; case 3: return 100; + case 4: + return 500; + case 5: + return 1000; } return 0;