diff --git a/src/web/js/lib/account_validator.js b/src/web/js/lib/account_validator.js
index a8d26cd..0c71d20 100644
--- a/src/web/js/lib/account_validator.js
+++ b/src/web/js/lib/account_validator.js
@@ -3,7 +3,7 @@ function AccountValidator() {
this.patternMaestroPW = /^[A-Za-z0-9]{4,16}$/;
this.patternPlayerID = /^[A-Za-z0-9가-힣-_]{1,8}$/;
- this.patternPlayerPW = /^[0-9]{4,6}$/;
+ this.patternPlayerPW = /^[0-9]{2,6}$/;
}
// maestro
@@ -73,11 +73,11 @@ AccountValidator.prototype.isValidPlayerPW = function(textPW) {
AccountValidator.prototype.messageForInvalidPlayerPW = function(textPW) {
if(textPW.length < Number(AccountValidator.PLAYER_PW_LENGTH_MINIMUM))
- return "학생 입장 번호는 " + AccountValidator.PLAYER_PW_LENGTH_MINIMUM + "글자 이상의 숫자로 입력해 주세요.";
+ return "학생 입장 번호는 " + AccountValidator.PLAYER_PW_LENGTH_MINIMUM + "글자 이상의 숫자로만 입력해 주세요.";
else if(textPW.length > Number(AccountValidator.PLAYER_PW_LENGTH_MAXIMUM))
- return "학생 입장 번호는 " + AccountValidator.PLAYER_PW_LENGTH_MAXIMUM + "글자 이하의 숫자로 입력해 주세요.";
+ return "학생 입장 번호는 " + AccountValidator.PLAYER_PW_LENGTH_MAXIMUM + "글자 이하의 숫자로만 입력해 주세요.";
else
- return "학생 입장 번호는 4~6자리 숫자로 입력해 주세요.";
+ return "학생 입장 번호는 2~6자리 숫자로 입력해 주세요.";
}
@@ -91,5 +91,5 @@ AccountValidator.MAESTRO_PW_LENGTH_MAXIMUM = 16;
AccountValidator.PLAYER_ID_LENGTH_MINIMUM = 1;
AccountValidator.PLAYER_ID_LENGTH_MAXIMUM = 8;
-AccountValidator.PLAYER_PW_LENGTH_MINIMUM = 4;
+AccountValidator.PLAYER_PW_LENGTH_MINIMUM = 2;
AccountValidator.PLAYER_PW_LENGTH_MAXIMUM = 6;
\ No newline at end of file
diff --git a/src/web/js/player_list_navigator.js b/src/web/js/player_list_navigator.js
index b8a71b5..168b434 100644
--- a/src/web/js/player_list_navigator.js
+++ b/src/web/js/player_list_navigator.js
@@ -11,7 +11,6 @@
PlayerListNavigator.prototype.updateNavigator = function(activePageNo, lastPageNo) {
this.activePageNo = activePageNo;
this.lastPageNo = lastPageNo;
- // this.lastPageNo = Math.ceil( (playerCount + 1) / 10 );
$(this.pagination).empty();
this.makePagination();
@@ -41,10 +40,19 @@ PlayerListNavigator.prototype.makePagination = function() {
$(this.pagination).append(paginationLeftArrows);
// numbers
- for(var pageNo = 1; pageNo < this.lastPageNo + 1; pageNo++) {
- $(this.pagination).append(
- '
' + pageNo + ''
- );
+ var pageGroupNo = this.getPageGroupNo(this.activePageNo);
+ var startNo = pageGroupNo * 10 + 1;
+ var endNo = (pageGroupNo + 1) * 10 > this.lastPageNo ? this.lastPageNo : (pageGroupNo + 1) * 10;
+ for(var pageNo = startNo; pageNo < endNo + 1; pageNo++) {
+ var pageContent = "";
+ if(pageNo == this.activePageNo) {
+ pageContent = '' + pageNo + '';
+ } else {
+ pageContent = '' + pageNo + '';
+ }
+ $(this.pagination).append(pageContent);
}
// right arrows
@@ -68,6 +76,18 @@ PlayerListNavigator.prototype.makePagination = function() {
$(this.pagination).append(paginationRightArrows);
}
+PlayerListNavigator.prototype.getPageGroupNo = function(index) {
+ var pageGroupNo = Math.floor( (index - 1) / 10 );
+ var lastPageGroupNo = Math.floor( (this.lastPageNo - 1) / 10 );
+
+ if(pageGroupNo < 0)
+ return 0;
+ else if(pageGroupNo > lastPageGroupNo)
+ return lastPageGroupNo;
+ else
+ return pageGroupNo;
+}
+
PlayerListNavigator.prototype.applyClickEvent = function() {
var self = this;
@@ -81,7 +101,8 @@ PlayerListNavigator.prototype.applyClickEvent = function() {
for(var pageNo = 1; pageNo < this.lastPageNo + 1; pageNo++) {
$("[aria-label='" + pageNo + "']").click(function() {
- self.onClickPageNo(pageNo);
+ var selectedPageNo = $(this).attr("aria-label");
+ self.onClickPageNo(selectedPageNo);
});
}
@@ -130,20 +151,18 @@ PlayerListNavigator.prototype.disableNavButtons = function() {
}
PlayerListNavigator.prototype.onClickPageNo = function(pageNo) {
- console.log(pageNo);
+ // console.log(pageNo);
switch(pageNo) {
case "first":
this.activePageNo = 1;
break;
case "previous":
- if(this.activePageNo > 1)
- this.activePageNo -= 1;
+ this.activePageNo = this.getPrevGroupPage();
break;
case "next":
- if(this.activePageNo < this.lastPageNo)
- this.activePageNo += 1;
+ this.activePageNo = this.getNextGroupPage();
break;
case "last":
@@ -154,6 +173,34 @@ PlayerListNavigator.prototype.onClickPageNo = function(pageNo) {
this.activePageNo = pageNo;
}
- console.log(this.activePageNo);
+ // console.log(this.activePageNo);
this.playerListManager.onClickPageNo(this.activePageNo);
+}
+
+PlayerListNavigator.prototype.getPrevGroupPage = function() {
+ var savedPageNo = this.activePageNo;
+ var savedPageGroupNo = this.getPageGroupNo(savedPageNo);
+
+ var pageNo = this.activePageNo - 10;
+ var pageGroupNo = this.getPageGroupNo(pageNo);
+
+ if(pageGroupNo < savedPageGroupNo) {
+ var prevGroupLastPageNo = (pageGroupNo + 1) * 10;
+ return prevGroupLastPageNo;
+ }
+ return pageGroupNo * 10 + 1;
+}
+
+PlayerListNavigator.prototype.getNextGroupPage = function() {
+ var savedPageNo = this.activePageNo;
+ var savedPageGroupNo = this.getPageGroupNo(savedPageNo);
+
+ var pageNo = this.activePageNo + 10;
+ var pageGroupNo = this.getPageGroupNo(pageNo);
+
+ if(pageGroupNo > savedPageGroupNo) {
+ var prevGroupLastPageNo = pageGroupNo * 10 + 1;
+ return prevGroupLastPageNo;
+ }
+ return this.lastPageNo;
}
\ No newline at end of file
diff --git a/src/web/module/maestro_section_add_player.html b/src/web/module/maestro_section_add_player.html
index de8d505..53f7a96 100644
--- a/src/web/module/maestro_section_add_player.html
+++ b/src/web/module/maestro_section_add_player.html
@@ -99,7 +99,7 @@ function onErrorPlayerPW(message) {
- 4~6자리의 숫자
+ 2~6자리의 숫자
diff --git a/src/web/server/player/login.php b/src/web/server/player/login.php
index 0410f64..00c521e 100644
--- a/src/web/server/player/login.php
+++ b/src/web/server/player/login.php
@@ -8,6 +8,17 @@ $maestroName = $_POST["maestro_name"];
$name = $_POST["name"];
$enterCode = $_POST["enter_code"];
+if($enterCode === "" || strlen($enterCode) < 2) {
+ set_error_message("입장번호는 2개 이상의 숫자로 입력해야 합니다.");
+ send_result_fail();
+ exit;
+}
+
+if(strlen($enterCode) > 6) {
+ set_error_message("입장번호는 6개 이gk의 숫자로 입력해야 합니다.");
+ send_result_fail();
+ exit;
+}
$maestroInfo = get_maestro_id($maestroName);
if($maestroInfo === NULL) {
@@ -21,7 +32,7 @@ $maestroAccountType = $maestroInfo["accountType"];
$playerInfo = get_login_data($maestroID, $name, $enterCode);
if($playerInfo === NULL) {
- set_error_message("입력한 이름/입장번호와 일치하는 계정이 없습니다");
+ set_error_message("입력한 이름 / 입장번호와 일치하는 계정이 없습니다");
send_result_fail();
exit;
}