-
Notifications
You must be signed in to change notification settings - Fork 0
/
GroupVisibilityToggle.ascx.cs.txt
85 lines (72 loc) · 2.34 KB
/
GroupVisibilityToggle.ascx.cs.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
namespace ArenaWeb.UserControls.Custom.SOTH
{
using System;
using System.IO;
using System.Text;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Configuration;
using Arena.Portal;
using Arena.Portal.UI;
using Arena.Security;
using Arena.Exceptions;
using Arena.Core;
using Arena.SmallGroup;
public partial class GroupVisibilityToggle : PortalControl
{
private int groupId = -1;
protected void Page_Load(object sender, System.EventArgs e)
{
// get current group
if (Request["group"] != null)
{
groupId = Int32.Parse(Request["group"].ToString());
}
if (!Page.IsPostBack)
{
// load group
Group group = new Group(groupId);
if (group.Private)
{
lblCurrentGroupStatus.Text = "This group is currently marked private.";
btnChangeStatus.Text = "Mark Group Public";
}
else
{
lblCurrentGroupStatus.Text = "This group is currently marked public.";
btnChangeStatus.Text = "Mark Group Private";
}
}
}
#region Event Handlers
// Perform update/add
protected void btnChangeStatus_Click(object sender, EventArgs e)
{
// load group
Group group = new Group(groupId);
if (group.Private)
{
// make group public
group.Private = false;
group.Save(Page.User.Identity.Name);
// reset labels
lblCurrentGroupStatus.Text = "This group is currently marked public.";
btnChangeStatus.Text = "Mark Group Private";
}
else
{
// make group private
group.Private = true;
group.Save(Page.User.Identity.Name);
// reset labels
lblCurrentGroupStatus.Text = "This group is currently marked private.";
btnChangeStatus.Text = "Mark Group Public";
}
}
#endregion
}
}