Hide give and save buttons if we are not the teacher
This commit is contained in:
parent
6198079bae
commit
f2e9cae817
@ -219,9 +219,18 @@ namespace EduNetworkBuilder
|
|||||||
else this.Text = "Student: " + CurrentUser.UserName;
|
else this.Text = "Student: " + CurrentUser.UserName;
|
||||||
|
|
||||||
tvClasswork.Nodes.Clear();
|
tvClasswork.Nodes.Clear();
|
||||||
TreeNode Node;
|
|
||||||
if (CurrentUser.isAdmin)
|
if (CurrentUser.isAdmin)
|
||||||
{
|
{
|
||||||
|
UpdateAdminFormFromUser();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
UpdateStudentFormFromUser();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateAdminFormFromUser()
|
||||||
|
{
|
||||||
|
TreeNode Node;
|
||||||
//We have a class tree
|
//We have a class tree
|
||||||
Node = new TreeNode(NB.Translate("PPF_Class"));
|
Node = new TreeNode(NB.Translate("PPF_Class"));
|
||||||
Node.Tag = "Class"; //Do not translate this
|
Node.Tag = "Class"; //Do not translate this
|
||||||
@ -245,7 +254,21 @@ namespace EduNetworkBuilder
|
|||||||
Node.Tag = PC;
|
Node.Tag = PC;
|
||||||
Top.Nodes.Add(Node);
|
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;
|
lblHWDue.Visible = false;
|
||||||
btnHWDelete.Visible = false;
|
btnHWDelete.Visible = false;
|
||||||
btnLaunch.Visible = false;
|
btnLaunch.Visible = false;
|
||||||
|
btnHWGive.Visible = false;
|
||||||
|
btnHWSave.Visible = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tbHWClass.Text = ViewedSchoolwork.Class;
|
tbHWClass.Text = ViewedSchoolwork.Class;
|
||||||
@ -447,7 +472,12 @@ namespace EduNetworkBuilder
|
|||||||
if (ViewedSchoolwork.DueDate < dtpHWDue.MinDate) ViewedSchoolwork.DueDate = dtpHWDue.MinDate;
|
if (ViewedSchoolwork.DueDate < dtpHWDue.MinDate) ViewedSchoolwork.DueDate = dtpHWDue.MinDate;
|
||||||
dtpHWDue.Value = ViewedSchoolwork.DueDate;
|
dtpHWDue.Value = ViewedSchoolwork.DueDate;
|
||||||
if (CurrentUser != null && CurrentUser.isAdmin)
|
if (CurrentUser != null && CurrentUser.isAdmin)
|
||||||
|
{
|
||||||
btnHWDelete.Visible = true; //Only the teacher can delete the homework
|
btnHWDelete.Visible = true; //Only the teacher can delete the homework
|
||||||
|
btnHWGive.Visible = true;
|
||||||
|
btnHWSave.Visible = true;
|
||||||
|
|
||||||
|
}
|
||||||
btnLaunch.Visible = true;
|
btnLaunch.Visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ namespace EduNetworkBuilder
|
|||||||
Clone(this, dest);
|
Clone(this, dest);
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Clone(SchoolworkClass source, SchoolworkClass dest)
|
public static void Clone(SchoolworkClass source, SchoolworkClass dest)
|
||||||
{
|
{
|
||||||
dest.ThisID = source.ThisID;
|
dest.ThisID = source.ThisID;
|
||||||
|
Loading…
Reference in New Issue
Block a user