Hide give and save buttons if we are not the teacher
This commit is contained in:
parent
6198079bae
commit
f2e9cae817
@ -219,33 +219,56 @@ namespace EduNetworkBuilder
|
||||
else this.Text = "Student: " + CurrentUser.UserName;
|
||||
|
||||
tvClasswork.Nodes.Clear();
|
||||
TreeNode Node;
|
||||
if (CurrentUser.isAdmin)
|
||||
{
|
||||
//We have a class tree
|
||||
Node = new TreeNode(NB.Translate("PPF_Class"));
|
||||
Node.Tag = "Class"; //Do not translate this
|
||||
TreeNode Top = Node;
|
||||
tvClasswork.Nodes.Add(Node);
|
||||
foreach(SchoolworkClass SWC in CurrentUser.Projects)
|
||||
{
|
||||
Node = new TreeNode(SWC.Name);
|
||||
Node.Tag = SWC; //Store the schoolwork record in with the node
|
||||
Top.Nodes.Add(Node);
|
||||
}
|
||||
UpdateAdminFormFromUser();
|
||||
}
|
||||
else
|
||||
UpdateStudentFormFromUser();
|
||||
|
||||
//we have a students tree. Use top again so we can populate it
|
||||
Top = new TreeNode(NB.Translate("PPF_Students"));
|
||||
Top.Tag = "Students"; //Do not translate this
|
||||
tvClasswork.Nodes.Add(Top);
|
||||
//Create nodes for each student
|
||||
foreach(PersonClass PC in CurrentUser.Students)
|
||||
{
|
||||
Node = new TreeNode(PC.UserName);
|
||||
Node.Tag = PC;
|
||||
Top.Nodes.Add(Node);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateAdminFormFromUser()
|
||||
{
|
||||
TreeNode Node;
|
||||
//We have a class tree
|
||||
Node = new TreeNode(NB.Translate("PPF_Class"));
|
||||
Node.Tag = "Class"; //Do not translate this
|
||||
TreeNode Top = Node;
|
||||
tvClasswork.Nodes.Add(Node);
|
||||
foreach (SchoolworkClass SWC in CurrentUser.Projects)
|
||||
{
|
||||
Node = new TreeNode(SWC.Name);
|
||||
Node.Tag = SWC; //Store the schoolwork record in with the node
|
||||
Top.Nodes.Add(Node);
|
||||
}
|
||||
|
||||
//we have a students tree. Use top again so we can populate it
|
||||
Top = new TreeNode(NB.Translate("PPF_Students"));
|
||||
Top.Tag = "Students"; //Do not translate this
|
||||
tvClasswork.Nodes.Add(Top);
|
||||
//Create nodes for each student
|
||||
foreach (PersonClass PC in CurrentUser.Students)
|
||||
{
|
||||
Node = new TreeNode(PC.UserName);
|
||||
Node.Tag = PC;
|
||||
Top.Nodes.Add(Node);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateStudentFormFromUser()
|
||||
{
|
||||
TreeNode Node;
|
||||
//We have a class tree
|
||||
Node = new TreeNode(NB.Translate("PPF_Class"));
|
||||
Node.Tag = "Class"; //Do not translate this
|
||||
TreeNode Top = Node;
|
||||
tvClasswork.Nodes.Add(Node);
|
||||
foreach (SchoolworkClass SWC in CurrentUser.Projects)
|
||||
{
|
||||
Node = new TreeNode(SWC.Name);
|
||||
Node.Tag = SWC; //Store the schoolwork record in with the node
|
||||
Top.Nodes.Add(Node);
|
||||
}
|
||||
}
|
||||
|
||||
@ -426,6 +449,8 @@ namespace EduNetworkBuilder
|
||||
lblHWDue.Visible = false;
|
||||
btnHWDelete.Visible = false;
|
||||
btnLaunch.Visible = false;
|
||||
btnHWGive.Visible = false;
|
||||
btnHWSave.Visible = false;
|
||||
return;
|
||||
}
|
||||
tbHWClass.Text = ViewedSchoolwork.Class;
|
||||
@ -446,8 +471,13 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
if (ViewedSchoolwork.DueDate < dtpHWDue.MinDate) ViewedSchoolwork.DueDate = dtpHWDue.MinDate;
|
||||
dtpHWDue.Value = ViewedSchoolwork.DueDate;
|
||||
if(CurrentUser != null && CurrentUser.isAdmin)
|
||||
if (CurrentUser != null && CurrentUser.isAdmin)
|
||||
{
|
||||
btnHWDelete.Visible = true; //Only the teacher can delete the homework
|
||||
btnHWGive.Visible = true;
|
||||
btnHWSave.Visible = true;
|
||||
|
||||
}
|
||||
btnLaunch.Visible = true;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ namespace EduNetworkBuilder
|
||||
Clone(this, dest);
|
||||
return dest;
|
||||
}
|
||||
|
||||
public static void Clone(SchoolworkClass source, SchoolworkClass dest)
|
||||
{
|
||||
dest.ThisID = source.ThisID;
|
||||
|
Loading…
Reference in New Issue
Block a user