Skip to content

Commit

Permalink
Merge pull request #744 from center-for-knowledge-communication/ms-is…
Browse files Browse the repository at this point in the history
…sue-723

Issue #723 - home page fix new teacher with no classes
  • Loading branch information
FrankSylvia authored Mar 6, 2023
2 parents 11fc107 + aa3dcdc commit f335f67
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 130 deletions.
259 changes: 137 additions & 122 deletions resources/teacherTools/teacherToolsMain.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<div class="loader" style="display: none" ></div>';
myHTML += '<div class="row"><div class="col-lg-6"><h1 class="page-header">';
if (nbrOfClasses > 0) {
myHTML += '<small><%= rb.getString("existing_classes") %></small>';
if (nbrOfClusters > 0) {
myHTML += ' | ';
myHTML += '<small><%= rb.getString("clusters") %></small>';
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 += '<small><%= rb.getString("no_pre-existing_classes") %></small>';
}
myHTML += '</h1></div></div>';
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 = '<div class="loader" style="display: none" ></div>';
myHTML += '<div class="row"><div class="col-lg-6"><h1 class="page-header">';
if (nbrOfClasses > 0) {
myHTML += '<small><%= rb.getString("existing_classes") %></small>';
if (nbrOfClusters > 0) {
myHTML += ' | ';
myHTML += '<small><%= rb.getString("clusters") %></small>';
}
}
else {
myHTML += '<small><%= rb.getString("no_pre-existing_classes") %></small>';
}
myHTML += '</h1></div></div>';
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 += '<div class="row">';
}
}
myHTML += '<div class="col-lg-3 col-md-6">';
if (t_isCluster == 0) {
myHTML += '<div class="panel panel-' + t_color + '">';
}
else {
myHTML += '<div class="panel panel-' + t_color + '-cluster">';
}
myHTML += '<div class="panel-heading">';
myHTML += '<div class="row">';
myHTML += '<div class="col-xs-3">';
if (t_isCluster == 0) {
myHTML += '<img src="../../images/classroom.png" height="64" width="64">';
}
else {
myHTML += '<img src="../../images/cluster.png" height="36" width="48">';
}
myHTML += '</div>';
myHTML += '<div class="col-xs-9 text-right">';
myHTML += '<div class="huge">' + t_name + '</div>';
var labelYear = '<%= rb.getString("year") %>';
var labelClassCode = '';
if (t_isCluster == 0) {
var toYear = t_schoolYear;
var fromYear = toYear-1;
myHTML += '<div class="pull-right">&nbsp;&nbsp;' + labelYear + ':' + fromYear + '-' + toYear + '</div>';
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 += '<div class="pull-right">&nbsp;&#91;' + labelClassCode + ':' + t_classid + '&#93;</div>';
myHTML += '</div>';
myHTML += '</div>';
myHTML += '</div>';
myHTML += '<div class="panel-footer">';
myHTML += '<a href="'+pgContext+'/tt/tt/viewClassDetails?classId=' + t_classid + '&#38;currentSelection=classHomePage">';
myHTML += '<div>';
var labelViewClass = '<%= rb.getString("view_class") %>';
myHTML += '<span class="pull-left">' + labelViewClass + '</span>';
myHTML += '<span class="pull-left"><i class="fa fa-eye fa-2x"></i>&nbsp;</span>';
myHTML += '</a>';
myHTML += '<a href="'+pgContext+'/tt/tt/setClassActiveFlag?teacherId=' + teacherId +'&#38;classId=' + t_classid + '&#38;activeFlag=0">';
var labelArchiveClass = '<%= rb.getString("archive_class") %>';
myHTML += '<span class="pull-right"><i class="fa fa-archive fa-2x">&nbsp;</i></span>';
myHTML += '<span class="pull-right">' + labelArchiveClass + '</span>';
myHTML += '</a>';
myHTML += '</div>';
myHTML += '<div class="clearfix"></div>';
myHTML += '</div></div>';
myHTML += '</div>';
if (nbrOfClusters > 0) {
if (index == (nbrOfClasses - 1)) {
myHTML += '</div>';
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 += '<div class="row">';
}
}
myHTML += '<div class="col-lg-3 col-md-6">';
if (t_isCluster == 0) {
myHTML += '<div class="panel panel-' + t_color + '">';
}
else {
if ((t_nextHasClusters > 0) || ((t_nextHasClusters+t_nextIsCluster) == 0)) {
myHTML += '</div>';
}
else {
myHTML += '<div class="panel panel-' + t_color + '-cluster">';
}
}
myHTML += '<div class="panel-heading">';
myHTML += '<div class="row">';
myHTML += '<div class="col-xs-3">';
if (t_isCluster == 0) {
myHTML += '<img src="../../images/classroom.png" height="64" width="64">';
}
else {
myHTML += '<img src="../../images/cluster.png" height="36" width="48">';
}
myHTML += '</div>';
myHTML += '<div class="col-xs-9 text-right">';
myHTML += '<div class="huge">' + t_name + '</div>';
var labelYear = '<%= rb.getString("year") %>';
var labelClassCode = '';
if (t_isCluster == 0) {
var toYear = t_schoolYear;
var fromYear = toYear-1;
myHTML += '<div class="pull-right">&nbsp;&nbsp;' + labelYear + ':' + fromYear + '-' + toYear + '</div>';
if (t_hasClusters) {
labelClassCode = '<%= rb.getString("master_code") %>';
}
else {
labelClassCode = '<%= rb.getString("class_code") %>';
}
}
else {
labelClassCode = '<%= rb.getString("cluster_code") %>';
}
myHTML += '<div class="pull-right">&nbsp;&#91;' + labelClassCode + ':' + t_classid + '&#93;</div>';
myHTML += '</div>';
myHTML += '</div>';
myHTML += '</div>';
myHTML += '<div class="panel-footer">';
myHTML += '<a href="'+pgContext+'/tt/tt/viewClassDetails?classId=' + t_classid + '&#38;currentSelection=classHomePage">';
myHTML += '<div>';
var labelViewClass = '<%= rb.getString("view_class") %>';
myHTML += '<span class="pull-left">' + labelViewClass + '</span>';
myHTML += '<span class="pull-left"><i class="fa fa-eye fa-2x"></i>&nbsp;</span>';
myHTML += '</a>';
myHTML += '<a href="'+pgContext+'/tt/tt/setClassActiveFlag?teacherId=' + teacherId +'&#38;classId=' + t_classid + '&#38;activeFlag=0">';
var labelArchiveClass = '<%= rb.getString("archive_class") %>';
myHTML += '<span class="pull-right"><i class="fa fa-archive fa-2x">&nbsp;</i></span>';
myHTML += '<span class="pull-right">' + labelArchiveClass + '</span>';
myHTML += '</a>';
myHTML += '</div>';
myHTML += '<div class="clearfix"></div>';
myHTML += '</div></div>';
myHTML += '</div>';
if (nbrOfClusters > 0) {
if (index == (nbrOfClasses - 1)) {
myHTML += '</div>';
}
else {
if ((t_nextHasClusters > 0) || ((t_nextHasClusters+t_nextIsCluster) == 0)) {
myHTML += '</div>';
}
}
}
}
}
}
document.getElementById('report-wrapper').innerHTML = myHTML;
document.getElementById('report-wrapper').innerHTML = myHTML;
}
else {
myHTML = '<div class="loader" style="display: none" ></div>';
myHTML += '<div class="row"><div class="col-lg-6"><h1 class="page-header">';
myHTML += '<small><%= rb.getString("no_pre-existing_classes") %></small>';
myHTML += '</h1></div></div>';
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion web/WEB-INF/classes/MathSpring.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion web/WEB-INF/classes/MathSpring_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion webProduction/WEB-INF/classes/MathSpring.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion webProduction/WEB-INF/classes/MathSpring_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion webTest/WEB-INF/classes/MathSpring.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion webTest/WEB-INF/classes/MathSpring_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f335f67

Please sign in to comment.