From aa3dcdceeaaa3923148cdbc2b20f3b658045be8b Mon Sep 17 00:00:00 2001 From: fsylvia Date: Mon, 6 Mar 2023 06:37:03 -0600 Subject: [PATCH] Issue #723 - home page fix new teacher with no classes --- resources/teacherTools/teacherToolsMain.jsp | 259 +++++++++--------- .../loginservice/impl/TTLoginServiceImpl.java | 5 +- web/WEB-INF/classes/MathSpring.properties | 2 +- web/WEB-INF/classes/MathSpring_es.properties | 2 +- .../WEB-INF/classes/MathSpring.properties | 2 +- .../WEB-INF/classes/MathSpring_es.properties | 2 +- webTest/WEB-INF/classes/MathSpring.properties | 2 +- .../WEB-INF/classes/MathSpring_es.properties | 2 +- 8 files changed, 146 insertions(+), 130 deletions(-) diff --git a/resources/teacherTools/teacherToolsMain.jsp b/resources/teacherTools/teacherToolsMain.jsp index 298999bc..350158ca 100644 --- a/resources/teacherTools/teacherToolsMain.jsp +++ b/resources/teacherTools/teacherToolsMain.jsp @@ -284,141 +284,156 @@ catch (Exception e) { $("#message-wrapper").hide(); $("#edit-teacher-wrapper").hide(); - - classNameIdArr = ${classNameIdArrayStr}; - if (classNameIdArr[0].Id == 0) { - var x = document.getElementById("li_class_message_handler"); - x.style.display = "none"; - } - - homePageClassArr = ${homePageClassArrayStr}; - teacherId = ${teacherId}; - var myHTML = ""; - var nbrOfClasses = homePageClassArr[0][7]; - var nbrOfClusters = 0; - - for (let index = 0; index < nbrOfClasses; index++) { - nbrOfClusters += homePageClassArr[index][2]; - } - - myHTML = ''; - myHTML += '

'; - if (nbrOfClasses > 0) { - myHTML += '<%= rb.getString("existing_classes") %>'; - if (nbrOfClusters > 0) { - myHTML += ' | '; - myHTML += '<%= rb.getString("clusters") %>'; + var noClass = ${noClass}; + if (noClass == false) { + classNameIdArr = ${classNameIdArrayStr}; + if (classNameIdArr[0].Id == 0) { + var x = document.getElementById("li_class_message_handler"); + x.style.display = "none"; } - } - else { - myHTML += '<%= rb.getString("no_pre-existing_classes") %>'; - } - myHTML += '

'; - - var needsEndOfRowDiv = true; - - if (nbrOfClasses > 0) { + + homePageClassArr = ${homePageClassArrayStr}; + teacherId = ${teacherId}; + var myHTML = ""; + var nbrOfClasses = homePageClassArr[0][7]; + var nbrOfClusters = 0; + + for (let index = 0; index < nbrOfClasses; index++) { + nbrOfClusters += homePageClassArr[index][2]; + } + myHTML = ''; + myHTML += '

'; + if (nbrOfClasses > 0) { + myHTML += '<%= rb.getString("existing_classes") %>'; + if (nbrOfClusters > 0) { + myHTML += ' | '; + myHTML += '<%= rb.getString("clusters") %>'; + } + } + else { + myHTML += '<%= rb.getString("no_pre-existing_classes") %>'; + } + myHTML += '

'; + var needsEndOfRowDiv = true; - for (let index = 0; index < nbrOfClasses; index++) { - t_isCluster = homePageClassArr[index][2]; - t_hasClusters = homePageClassArr[index][3]; - if (index < (nbrOfClasses - 1)) { - t_nextIsCluster = homePageClassArr[index+1][2]; - t_nextHasClusters = homePageClassArr[index+1][3]; - } - t_name = homePageClassArr[index][0]; - t_classid = "" + homePageClassArr[index][1]; - t_schoolYear = homePageClassArr[index][4]; - t_color = homePageClassArr[index][5]; - if (nbrOfClusters > 0) { - if ((t_hasClusters > 0) || ((t_hasClusters+t_isCluster) == 0)) { - myHTML += '
'; - } - } - - myHTML += '
'; - if (t_isCluster == 0) { - myHTML += '
'; - } - else { - myHTML += '
'; - } - myHTML += '
'; - myHTML += '
'; - myHTML += '
'; - - if (t_isCluster == 0) { - myHTML += ''; - } - else { - myHTML += ''; - } - - myHTML += '
'; - myHTML += '
'; - myHTML += '
' + t_name + '
'; - var labelYear = '<%= rb.getString("year") %>'; - var labelClassCode = ''; - - if (t_isCluster == 0) { - var toYear = t_schoolYear; - var fromYear = toYear-1; - myHTML += '
  ' + labelYear + ':' + fromYear + '-' + toYear + '
'; - if (t_hasClusters) { - labelClassCode = '<%= rb.getString("master_code") %>'; - } - else { - labelClassCode = '<%= rb.getString("class_code") %>'; + if (nbrOfClasses > 0) { + + + + for (let index = 0; index < nbrOfClasses; index++) { + t_isCluster = homePageClassArr[index][2]; + t_hasClusters = homePageClassArr[index][3]; + if (index < (nbrOfClasses - 1)) { + t_nextIsCluster = homePageClassArr[index+1][2]; + t_nextHasClusters = homePageClassArr[index+1][3]; } - } - else { - labelClassCode = '<%= rb.getString("cluster_code") %>'; - } - - myHTML += '
 [' + labelClassCode + ':' + t_classid + ']
'; - myHTML += '
'; - myHTML += '
'; - myHTML += '
'; - - myHTML += '
'; - myHTML += '
'; - - if (nbrOfClusters > 0) { - if (index == (nbrOfClasses - 1)) { - myHTML += '
'; + t_name = homePageClassArr[index][0]; + t_classid = "" + homePageClassArr[index][1]; + t_schoolYear = homePageClassArr[index][4]; + t_color = homePageClassArr[index][5]; + if (nbrOfClusters > 0) { + if ((t_hasClusters > 0) || ((t_hasClusters+t_isCluster) == 0)) { + myHTML += '
'; + } + } + + myHTML += '
'; + if (t_isCluster == 0) { + myHTML += '
'; } - else { - if ((t_nextHasClusters > 0) || ((t_nextHasClusters+t_nextIsCluster) == 0)) { - myHTML += '
'; - } + else { + myHTML += '
'; } - } + myHTML += '
'; + myHTML += '
'; + myHTML += '
'; + + if (t_isCluster == 0) { + myHTML += ''; + } + else { + myHTML += ''; + } + + myHTML += '
'; + myHTML += '
'; + myHTML += '
' + t_name + '
'; + var labelYear = '<%= rb.getString("year") %>'; + var labelClassCode = ''; + + if (t_isCluster == 0) { + var toYear = t_schoolYear; + var fromYear = toYear-1; + myHTML += '
  ' + labelYear + ':' + fromYear + '-' + toYear + '
'; + if (t_hasClusters) { + labelClassCode = '<%= rb.getString("master_code") %>'; + } + else { + labelClassCode = '<%= rb.getString("class_code") %>'; + } + } + else { + labelClassCode = '<%= rb.getString("cluster_code") %>'; + } + + myHTML += '
 [' + labelClassCode + ':' + t_classid + ']
'; + myHTML += '
'; + myHTML += '
'; + myHTML += '
'; + + myHTML += '
'; + myHTML += '
'; + + if (nbrOfClusters > 0) { + if (index == (nbrOfClasses - 1)) { + myHTML += '
'; + } + else { + if ((t_nextHasClusters > 0) || ((t_nextHasClusters+t_nextIsCluster) == 0)) { + myHTML += '
'; + } + } + } + } } - } - document.getElementById('report-wrapper').innerHTML = myHTML; - + + document.getElementById('report-wrapper').innerHTML = myHTML; + + } + else { + myHTML = ''; + myHTML += '

'; + myHTML += '<%= rb.getString("no_pre-existing_classes") %>'; + myHTML += '

'; + document.getElementById('report-wrapper').innerHTML = myHTML; + + var x = document.getElementById("li_class_message_handler"); + x.style.display = "none"; + } + var pause = ${teacherPauseStudentUse}; if (pause == "1") $("#pause-status").show(); else $("#pause-status").hide(); + registerAllEvents(); handleclickHandlers(); $("#report-wrapper").show(); diff --git a/src/edu/umass/ckc/wo/ttmain/ttservice/loginservice/impl/TTLoginServiceImpl.java b/src/edu/umass/ckc/wo/ttmain/ttservice/loginservice/impl/TTLoginServiceImpl.java index a8e29786..f32146b5 100644 --- a/src/edu/umass/ckc/wo/ttmain/ttservice/loginservice/impl/TTLoginServiceImpl.java +++ b/src/edu/umass/ckc/wo/ttmain/ttservice/loginservice/impl/TTLoginServiceImpl.java @@ -174,8 +174,8 @@ public String populateClassInfoForTeacher(ModelMap model, int teacherId, String JSONObject nameIdJson = new JSONObject(); nameIdJson.put("name", "dummyClass"); nameIdJson.put("Id", 0); - classNameIdArray.add(nameIdJson); - resultArr.add(classNameIdArray); + homePageClassArray.add(nameIdJson); + resultArr.add(homePageClassArray); } } catch (JSONException e1) { // TODO Auto-generated catch block @@ -198,6 +198,7 @@ public String populateClassInfoForTeacher(ModelMap model, int teacherId, String model.addAttribute("homePageClassArrayStr", homePageClassArrayStr); return "teacherTools/teacherToolsMain"; } else { + model.addAttribute("classNameIdArrayStr", classNameIdArrayStr); model.addAttribute("homePageClassArrayStr", homePageClassArrayStr); model.addAttribute("noClass", true); return "teacherTools/teacherToolsMain"; diff --git a/web/WEB-INF/classes/MathSpring.properties b/web/WEB-INF/classes/MathSpring.properties index 8f1bc51c..b17b4235 100644 --- a/web/WEB-INF/classes/MathSpring.properties +++ b/web/WEB-INF/classes/MathSpring.properties @@ -98,7 +98,7 @@ create_surveys_and_math_problems=Create Surveys and Math Problems view_teacher_activities=View Teachers' Activities existing_classes=Existing Classes (New) existing_classes_archived=Existing Classes (Archived) -no_pre-existing_classes=You do not have any pre-existing classes. +no_pre-existing_classes=You do not have any active classes. Please use the Create class feature to add one or more. view_class=Edit/View delete_class=Delete archive_class=Archive diff --git a/web/WEB-INF/classes/MathSpring_es.properties b/web/WEB-INF/classes/MathSpring_es.properties index 78010bb6..8feabcdf 100644 --- a/web/WEB-INF/classes/MathSpring_es.properties +++ b/web/WEB-INF/classes/MathSpring_es.properties @@ -98,7 +98,7 @@ create_surveys_and_math_problems=Crear encuestas, pruebas o problemas de matem view_teacher_activities=ver las actividades de los maestros existing_classes=Clases existentes existing_classes_archived=Clases existentes (Archivadas) -no_pre-existing_classes=No tenés ninguna clase preexistente. +no_pre-existing_classes=No tienes ninguna clase activa. Utilice la función Crear clase para agregar una o más. view_class=Editar/Ver delete_class=Eliminar archive_class=Archivar diff --git a/webProduction/WEB-INF/classes/MathSpring.properties b/webProduction/WEB-INF/classes/MathSpring.properties index 8f1bc51c..b17b4235 100644 --- a/webProduction/WEB-INF/classes/MathSpring.properties +++ b/webProduction/WEB-INF/classes/MathSpring.properties @@ -98,7 +98,7 @@ create_surveys_and_math_problems=Create Surveys and Math Problems view_teacher_activities=View Teachers' Activities existing_classes=Existing Classes (New) existing_classes_archived=Existing Classes (Archived) -no_pre-existing_classes=You do not have any pre-existing classes. +no_pre-existing_classes=You do not have any active classes. Please use the Create class feature to add one or more. view_class=Edit/View delete_class=Delete archive_class=Archive diff --git a/webProduction/WEB-INF/classes/MathSpring_es.properties b/webProduction/WEB-INF/classes/MathSpring_es.properties index 78010bb6..8feabcdf 100644 --- a/webProduction/WEB-INF/classes/MathSpring_es.properties +++ b/webProduction/WEB-INF/classes/MathSpring_es.properties @@ -98,7 +98,7 @@ create_surveys_and_math_problems=Crear encuestas, pruebas o problemas de matem view_teacher_activities=ver las actividades de los maestros existing_classes=Clases existentes existing_classes_archived=Clases existentes (Archivadas) -no_pre-existing_classes=No tenés ninguna clase preexistente. +no_pre-existing_classes=No tienes ninguna clase activa. Utilice la función Crear clase para agregar una o más. view_class=Editar/Ver delete_class=Eliminar archive_class=Archivar diff --git a/webTest/WEB-INF/classes/MathSpring.properties b/webTest/WEB-INF/classes/MathSpring.properties index 8f1bc51c..b17b4235 100644 --- a/webTest/WEB-INF/classes/MathSpring.properties +++ b/webTest/WEB-INF/classes/MathSpring.properties @@ -98,7 +98,7 @@ create_surveys_and_math_problems=Create Surveys and Math Problems view_teacher_activities=View Teachers' Activities existing_classes=Existing Classes (New) existing_classes_archived=Existing Classes (Archived) -no_pre-existing_classes=You do not have any pre-existing classes. +no_pre-existing_classes=You do not have any active classes. Please use the Create class feature to add one or more. view_class=Edit/View delete_class=Delete archive_class=Archive diff --git a/webTest/WEB-INF/classes/MathSpring_es.properties b/webTest/WEB-INF/classes/MathSpring_es.properties index 78010bb6..8feabcdf 100644 --- a/webTest/WEB-INF/classes/MathSpring_es.properties +++ b/webTest/WEB-INF/classes/MathSpring_es.properties @@ -98,7 +98,7 @@ create_surveys_and_math_problems=Crear encuestas, pruebas o problemas de matem view_teacher_activities=ver las actividades de los maestros existing_classes=Clases existentes existing_classes_archived=Clases existentes (Archivadas) -no_pre-existing_classes=No tenés ninguna clase preexistente. +no_pre-existing_classes=No tienes ninguna clase activa. Utilice la función Crear clase para agregar una o más. view_class=Editar/Ver delete_class=Eliminar archive_class=Archivar