diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index 100b701..e0c0898 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -912,14 +912,30 @@ namespace EduNetworkBuilder } else { - //It was homework. Ask if we want to submit it. - DialogResult answer = MessageBox.Show(NB.Translate("N_PromptToSubmit"), NB.Translate("_Solved"), MessageBoxButtons.YesNo); - - if (answer == DialogResult.Yes) + PersonClass CurrentUser = NB.GetUser(); + if (CurrentUser != null && CurrentUser.isAdmin) { - KillAllExtraWindows(true); - BuilderWindow BW = NB.GetBuilderWin(); - BW.SubmitHomework(); + //It was homework. Ask if we want to submit it. + DialogResult answer = MessageBox.Show(NB.Translate("N_PromptToGrade"), NB.Translate("_Solved"), MessageBoxButtons.YesNo); + + if (answer == DialogResult.Yes) + { + KillAllExtraWindows(true); + BuilderWindow BW = NB.GetBuilderWin(); + BW.MarkAsGraded(); + } + } + else + { + //It was homework. Ask if we want to submit it. + DialogResult answer = MessageBox.Show(NB.Translate("N_PromptToSubmit"), NB.Translate("_Solved"), MessageBoxButtons.YesNo); + + if (answer == DialogResult.Yes) + { + KillAllExtraWindows(true); + BuilderWindow BW = NB.GetBuilderWin(); + BW.SubmitHomework(); + } } } } diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index b41058a..173eed1 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -2088,7 +2088,8 @@ namespace EduNetworkBuilder SubmitHomework(); } - private void markAsGradedToolStripMenuItem_Click(object sender, EventArgs e) + + public void MarkAsGraded() { if (myNetwork.WhatFrom == null) return; //We cannot submit it @@ -2102,6 +2103,11 @@ namespace EduNetworkBuilder UpdateMenu(); } + private void markAsGradedToolStripMenuItem_Click(object sender, EventArgs e) + { + MarkAsGraded(); + } + private void logoutToolStripMenuItem_Click(object sender, EventArgs e) { if (CurrentUser == null) return; //Nobody to logout diff --git a/EduNetworkBuilder/PersonClass.cs b/EduNetworkBuilder/PersonClass.cs index da2d238..2c2d314 100644 --- a/EduNetworkBuilder/PersonClass.cs +++ b/EduNetworkBuilder/PersonClass.cs @@ -516,6 +516,7 @@ namespace EduNetworkBuilder List DrawFrom = new List(); List MasterList = new List(); + bool SomethingWasBolded = false; //Set this to true if we make something bold DrawFrom.AddRange(Projects); for (int i = DrawFrom.Count - 1; i >= 0; i--) @@ -541,9 +542,12 @@ namespace EduNetworkBuilder { Top = theTop; } - foreach(SchoolworkClass MasterSW in MasterList) + Font tFont = NB.GetFont(); + + foreach (SchoolworkClass MasterSW in MasterList) { int count = 0; + int ungraded = 0; Master = new TreeNode(MasterSW.Name); Master.Tag = MasterSW; @@ -556,20 +560,27 @@ namespace EduNetworkBuilder Master.Nodes.Add(Node); if (ForTeacher && !DrawFrom[i].IsGraded) //Bold ungraded homework { - Font tFont = NB.GetFont(); Node.NodeFont = new Font(tFont.FontFamily, tFont.Size, FontStyle.Bold); + SomethingWasBolded = true; + ungraded++; } count++; //How many submitted versions are there } } if(!ForTeacher && count ==0) //bold homework that has not yet been submitted { - Font tFont = NB.GetFont(); Master.NodeFont = new Font(tFont.FontFamily, tFont.Size, FontStyle.Bold); + SomethingWasBolded = true; + } else if(ForTeacher && ungraded > 0) //If we have ungraded submissions + { + Master.NodeFont = new Font(tFont.FontFamily, tFont.Size, FontStyle.Bold); + SomethingWasBolded = true; } Top.Nodes.Add(Master); } + if(ForTeacher && SomethingWasBolded) + Top.NodeFont = new Font(tFont.FontFamily, tFont.Size, FontStyle.Bold); return Top; } diff --git a/EduNetworkBuilder/Resources/languages/edustrings.resx b/EduNetworkBuilder/Resources/languages/edustrings.resx index ebcb9f4..2b0443a 100644 --- a/EduNetworkBuilder/Resources/languages/edustrings.resx +++ b/EduNetworkBuilder/Resources/languages/edustrings.resx @@ -1901,6 +1901,10 @@ Unable to load user {0} : No such account found. No password available to decrypt account. NB_TeacherUnableToLoadUserNoAcct = Unable to load user {0} : No such account found. No password available to decrypt account. + + The homework has passed all the tests. Would you like to Mark it as graded? If you want to keep wotking with it, click No. Go to "Edit" -> "Mark as graded" when ready. + N_PromptToGrade = The homework has passed all the tests. Would you like to Mark it as graded? If you want to keep wotking with it, click No. Go to "Edit" -> "Mark as graded" when ready. + You have completed the homework. Would you like to submit it? If you want to clean it up and submit later, click No. Go to "Edit" -> "Submit" when you want to submit it. N_PromptToSubmit = You have completed the homework. Would you like to submit it? If you want to clean it up and submit later, click No. Go to "Edit" -> "Submit" when you want to submit it.