diff --git a/src/web/maestro/main_menu.html b/src/web/maestro/main_menu.html index dcef5df..4a3d89f 100644 --- a/src/web/maestro/main_menu.html +++ b/src/web/maestro/main_menu.html @@ -12,12 +12,6 @@ - - diff --git a/src/web/module/maestro_section_main.html b/src/web/module/maestro_section_main.html index d412743..183d63c 100644 --- a/src/web/module/maestro_section_main.html +++ b/src/web/module/maestro_section_main.html @@ -37,6 +37,40 @@ function onClickMaestroUpgrade() { location.href='./../maestro/upgrade.html'; } +function activateApp(appID) { + sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode); + "./../server/app/activate_app.php", + "maestro_id=" + maestroID + "&app_id=" + appID, + + (function(jsonData) { + // console.log(jsonData); + showErrorMessage("[ " + jsonData["koreanName"] + "] 앱이 메뉴에 추가되었습니다. (위의 [마에스트로 앱 실행] 버튼을 눌러 확인해보세요)", "success"); + }), + + (function(errorMessage, errorCode) { + showErrorMessage(errorMessage, "error"); + }) + + ); +} + +function deactivateApp(appID) { + sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode); + "./../server/app/deactivate_app.php", + "maestro_id=" + maestroID + "&app_id=" + appID, + + (function(jsonData) { + // console.log(jsonData); + showErrorMessage("[ " + jsonData["koreanName"] + "] 앱이 메뉴에서 삭제되었습니다. (위의 [마에스트로 앱 실행] 버튼을 눌러 확인해보세요)", "danger"); + }), + + (function(errorMessage, errorCode) { + showErrorMessage(errorMessage, "error"); + }) + + ); +} + diff --git a/src/web/module/maestro_section_mouse_app.html b/src/web/module/maestro_section_mouse_app.html index d417f41..1d8bdf0 100644 --- a/src/web/module/maestro_section_mouse_app.html +++ b/src/web/module/maestro_section_mouse_app.html @@ -38,13 +38,6 @@ function makeMouseAppList(appList) { \ \ '); - /* - "" - + "" - + "" - + "" - ); - */ $("#" + appData.appID).change(function() { if($(this).is(":checked")) { @@ -65,41 +58,6 @@ function activateMouseApp(activatedList) { } } -function activateApp(appID) { - - sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode); - "./../server/app/activate_app.php", - "maestro_id=" + maestroID + "&app_id=" + appID, - - (function(jsonData) { - // console.log(jsonData); - showErrorMessage("[ " + jsonData["koreanName"] + "] 앱이 메뉴에 추가되었습니다. (위의 [마에스트로 앱 실행] 버튼을 눌러 확인해보세요)", "success"); - }), - - (function(errorMessage, errorCode) { - showErrorMessage(errorMessage, "error"); - }) - - ); -} - -function deactivateApp(appID) { - sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode); - "./../server/app/deactivate_app.php", - "maestro_id=" + maestroID + "&app_id=" + appID, - - (function(jsonData) { - // console.log(jsonData); - showErrorMessage("[ " + jsonData["koreanName"] + "] 앱이 메뉴에서 삭제되었습니다. (위의 [마에스트로 앱 실행] 버튼을 눌러 확인해보세요)", "danger"); - }), - - (function(errorMessage, errorCode) { - showErrorMessage(errorMessage, "error"); - }) - - ); -} - diff --git a/src/web/module/maestro_section_typing_app.html b/src/web/module/maestro_section_typing_app.html index d7de80a..dd66dc9 100644 --- a/src/web/module/maestro_section_typing_app.html +++ b/src/web/module/maestro_section_typing_app.html @@ -2,10 +2,81 @@ $(document).ready(function() { loadTypingApp(); + + $("input[id*='group_typing']").change(function() { + // console.log($(this).attr("id")); + var isChecked = $(this).is(":checked"); + // console.log("isChecked : " + isChecked); + var clickedGroupName = $(this).attr("id").substring(6); + // console.log("clickedGroupName : " + clickedGroupName); + + if($(this).is(":checked")) { + // activateApp($(this).data("appId")); + activateGroupApp(clickedGroupName); + } else { + // deactivateApp($(this).data("appId")); + deactivateGroupApp(clickedGroupName); + } + }); }); + +function getGroupName(groupName) { + switch(groupName) { + case "typing_practice_kor": + return "자리 연습 - 한글"; + + case "typing_practice_eng": + return "자리 연습 - 영문"; + + case "typing_test_kor": + return "타자 시험 - 한글"; + + case "typing_test_eng": + return "타자 시험 - 영문"; + + } + + return "?"; +} + +function activateGroupApp(groupName) { + var groupList = $("input[name='" + groupName + "[]']"); + // console.log(groupList); + + for(var i = 0; i < groupList.length; i++) { + var app = groupList[i]; + // console.log(app); + var isChecked = $(app).is(":checked"); + // console.log(isChecked); + if(!isChecked) { + app.checked = true; + // console.log($(app).data("appId")); + activateApp($(app).data("appId")); + } + } + + // showErrorMessage("[ " + this.getGroupName(groupName) + "] 앱이 모두 활성화 되었습니다. (위의 [마에스트로 앱 실행] 버튼을 눌러 확인해보세요)", "success"); +} + +function deactivateGroupApp(groupName) { + var groupList = $("input[name='" + groupName + "[]']"); + + for(var i = 0; i < groupList.length; i++) { + var app = groupList[i]; + var isChecked = $(app).is(":checked"); + if(isChecked) { + app.checked = false; + // console.log($(app).data("appId")); + deactivateApp($(app).data("appId")); + } + } + + // showErrorMessage("[ " + this.getGroupName(groupName) + "] 앱이 모두 활성화 되었습니다. (위의 [마에스트로 앱 실행] 버튼을 눌러 확인해보세요)", "success"); +} + function loadTypingApp() { - let self = this; + var self = this; sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode); "./../server/app/typing_app_list.php", @@ -30,26 +101,39 @@ function makeTypingAppList(appList) { $("#typing_test_eng").empty(); $("#typing_app").empty(); - for(let i = 0; i < appList.length; i++) { - let appData = appList[i]; + for(var i = 0; i < appList.length; i++) { + var appData = appList[i]; if(appData.koreanName === "") continue; - let divTag = null; - if(appData.appID <= 10) + var divTag = null; + var groupName = ""; + if(appData.appID <= 10) { divTag = $("#typing_practice_kor"); - else if(appData.appID <= 20) + groupName = "typing_practice_kor"; + } + else if(appData.appID <= 20) { divTag = $("#typing_practice_eng"); - else if(appData.appID <= 30) + groupName = "typing_practice_eng"; + } + else if(appData.appID <= 30) { divTag = $("#typing_test_kor"); - else if(appData.appID <= 40) + groupName = "typing_test_kor"; + } + else if(appData.appID <= 40) { divTag = $("#typing_test_eng"); - else + groupName = "typing_test_eng"; + } + else { divTag = $("#typing_app"); + groupName = "typing_app"; + } divTag.append('\