-
Notifications
You must be signed in to change notification settings - Fork 0
/
MojoPortalModuleEdit.cst
109 lines (99 loc) · 4.04 KB
/
MojoPortalModuleEdit.cst
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
namespace yaf_mojoportal
{
using mojoPortal.Web;
using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using yaf;
public class MojoportalModuleEdit : PortalModuleBase
{
protected DropDownList BoardID;
protected LinkButton cancel;
protected DropDownList CategoryID;
protected LinkButton create;
protected LinkButton update;
private void BindCategories()
{
using (DataTable table = DB.category_list(this.BoardID.SelectedValue, DBNull.Value))
{
DataRow row = table.NewRow();
row["Name"] = "[All Categories]";
row["CategoryID"] = DBNull.Value;
table.Rows.InsertAt(row, 0);
this.CategoryID.DataSource = table;
this.CategoryID.DataTextField = "Name";
this.CategoryID.DataValueField = "CategoryID";
this.CategoryID.DataBind();
if (base.get_Settings()["forumcategoryid"] != null)
{
ListItem item = this.CategoryID.Items.FindByValue(base.get_Settings()["forumcategoryid"].ToString());
if (item != null)
{
item.Selected = true;
}
}
}
}
private void BoardID_SelectedIndexChanged(object sender, EventArgs e)
{
this.BindCategories();
}
private void cancel_Click(object sender, EventArgs e)
{
Forum.Redirect(0);
}
private void create_Click(object sender, EventArgs e)
{
Forum.Redirect(0x37);
}
private void DotNetNukeModuleEdit_Load(object sender, EventArgs e)
{
this.update.Text = "Update";
this.cancel.Text = "Cancel";
this.create.Text = "Create New Board";
this.update.Visible = base.get_IsEditable();
this.create.Visible = base.get_IsEditable();
if (!base.IsPostBack)
{
using (DataTable table = DB.board_list(DBNull.Value))
{
this.BoardID.DataSource = table;
this.BoardID.DataTextField = "Name";
this.BoardID.DataValueField = "BoardID";
this.BoardID.DataBind();
if (base.get_Settings()["forumboardid"] != null)
{
ListItem item = this.BoardID.Items.FindByValue(base.get_Settings()["forumboardid"].ToString());
if (item != null)
{
item.Selected = true;
}
}
}
this.BindCategories();
}
}
protected override void OnInit(EventArgs e)
{
base.Load += new EventHandler(this.DotNetNukeModuleEdit_Load);
this.update.Click += new EventHandler(this.update_Click);
this.cancel.Click += new EventHandler(this.cancel_Click);
this.create.Click += new EventHandler(this.create_Click);
this.BoardID.SelectedIndexChanged += new EventHandler(this.BoardID_SelectedIndexChanged);
base.OnInit(e);
}
protected override void Render(HtmlTextWriter writer)
{
writer.WriteLine("<link rel='stylesheet' type='text/css' href='{0}themes/standard/theme.css'/>", Config.get_Root());
base.Render(writer);
}
private void update_Click(object sender, EventArgs e)
{
ModuleController controller = new ModuleController();
controller.UpdateModuleSetting(base.get_ModuleId(), "forumboardid", this.BoardID.SelectedValue);
controller.UpdateModuleSetting(base.get_ModuleId(), "forumcategoryid", this.CategoryID.SelectedValue);
Forum.Redirect(0);
}
}
}