From aba236536bb8b64738e1012c749c026f8fe389ec 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: Thu, 28 Mar 2019 15:06:02 +0900 Subject: [PATCH] Add: subject list --- src/web/module/maestro_section_record.html | 187 ++++++++++++++++++--- 1 file changed, 159 insertions(+), 28 deletions(-) diff --git a/src/web/module/maestro_section_record.html b/src/web/module/maestro_section_record.html index 12310ed..88c77ac 100644 --- a/src/web/module/maestro_section_record.html +++ b/src/web/module/maestro_section_record.html @@ -10,36 +10,38 @@ $(document).ready(function() { }); */ -$('#start_datepicker').datepicker({ - format: 'yyyy-mm-dd', - autoclose: true, - language: 'kr' -}); - -$('#end_datepicker').datepicker({ - format: 'yyyy-mm-dd', - autoclose: true, - language: 'kr' -}); - -var today = new Date(); -var yyyy = today.getFullYear(); -var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0! -var dd = String(today.getDate()).padStart(2, '0'); - -$('#start_datepicker').datepicker('update', yyyy + "-" + mm + "-" + dd); -$('#end_datepicker').datepicker('update', yyyy + "-" + mm + "-" + dd); + initDatePicker(); + loadAppList(); }); +function initDatePicker() { + $('#start_datepicker').datepicker({ + format: 'yyyy-mm-dd', + autoclose: true, + language: 'kr' + }); + + $('#end_datepicker').datepicker({ + format: 'yyyy-mm-dd', + autoclose: true, + language: 'kr' + }); + + var today = new Date(); + var yyyy = today.getFullYear(); + var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0! + var dd = String(today.getDate()).padStart(2, '0'); + + $('#start_datepicker').datepicker('update', yyyy + "-" + mm + "-" + dd); + $('#end_datepicker').datepicker('update', yyyy + "-" + mm + "-" + dd); +} + + + function copyToClipboard() { - console.log("copyToClipboard();"); - var data = $("#dataTable") -}; - - -function selectElementContents(el) { + el = document.getElementById('dataTable'); var body = document.body, range, sel; if (document.createRange && window.getSelection) { range = document.createRange(); @@ -62,6 +64,123 @@ function selectElementContents(el) { +function loadAppList() { + var self = this; + + sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode); + "./../server/app/typing_app_list.php", + "maestro_id=" + maestroID, + + (function(jsonData) { + // console.log(jsonData); + makeTypingPracticeSubjectList(jsonData["appList"]); + makeTypingTestSubjectList(jsonData["appList"]); + makeTypingAppSubjectList(jsonData["appList"]); + }), + + (function(errorMessage, errorCode) { + showErrorMessage(errorMessage, "error"); + }) + + ); + + sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode); + "./../server/app/mouse_app_list.php", + "maestro_id=" + maestroID, + + (function(jsonData) { + // console.log(jsonData); + makeMouseAppSubjectList(jsonData["appList"]); + }), + + (function(errorMessage, errorCode) { + showErrorMessage(errorMessage, "error"); + }) + + ); +} + + +function makeTypingPracticeSubjectList(appList) { + $("#typing_practice_subject_list").empty(); + + addSubjectBundleItem("#typing_practice_subject_list", 1000, "한글 타자 연습 묶음"); + addSubjectBundleItem("#typing_practice_subject_list", 1001, "영문 타자 연습 묶음"); + + for(var i = 0; i < appList.length; i++) { + var appData = appList[i]; + if(appData.appID > 20) + continue; + else if(appData.koreanName == "") + continue; + + addSubjectListItem("#typing_practice_subject_list", appData.appID, appData.koreanName); + } +} + +function makeTypingTestSubjectList(appList) { + $("#typing_test_subject_list").empty(); + + addSubjectBundleItem("#typing_test_subject_list", 1002, "한글 타자 시험 묶음"); + addSubjectBundleItem("#typing_test_subject_list", 1003, "영문 타자 시험 묶음"); + + for(var i = 0; i < appList.length; i++) { + var appData = appList[i]; + if(appData.appID < 21 || appData.appID > 49) + continue; + else if(appData.koreanName == "") + continue; + + addSubjectListItem("#typing_test_subject_list", appData.appID, appData.koreanName); + } +} + +function makeTypingAppSubjectList(appList) { + $("#typing_app_subject_list").empty(); + + for(var i = 0; i < appList.length; i++) { + var appData = appList[i]; + if(appData.appID < 50) + continue; + else if(appData.koreanName == "") + continue; + + addSubjectListItem("#typing_app_subject_list", appData.appID, appData.koreanName); + } +} + +function makeMouseAppSubjectList(appList) { + $("#mouse_app_subject_list").empty(); + + for(var i = 0; i < appList.length; i++) { + var appData = appList[i]; + if(appData.koreanName == "") + continue; + + addSubjectListItem("#mouse_app_subject_list", appData.appID, appData.koreanName); + } +} + +function addSubjectListItem(subjectListID, appID, appName) { + $(subjectListID).append('\ +
\ + \ + \ +
\ + '); +} + +function addSubjectBundleItem(subjectListID, appID, appName) { + $(subjectListID).append('\ +
\ + \ + \ +
\ + '); +} + @@ -137,7 +256,7 @@ function selectElementContents(el) {
-
+
@@ -155,7 +274,7 @@ function selectElementContents(el) {
-
+
@@ -170,6 +289,18 @@ function selectElementContents(el) {
+ +
+ +
+
+
+ +
+ +
+
+

@@ -185,7 +316,7 @@ function selectElementContents(el) {
- + ?