-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettings.ascx.cs
86 lines (65 loc) · 3.06 KB
/
Settings.ascx.cs
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
using System.IO;
using System.Runtime.Serialization.Formatters;
using DotNetNuke;
using System.Web.UI.WebControls;
using System.Web.UI;
using System.Collections.Generic;
using System;
using DotNetNuke.Entities.Modules;
using DnnSharp.FaqMaster.Core;
namespace DnnSharp.FaqMaster
{
public partial class Settings : DotNetNuke.Entities.Modules.ModuleSettingsBase
{
void Page_Init(object sender, EventArgs e)
{
//PopulateFolders("", PortalSettings.HomeDirectoryMapPath, 0);
}
public override void LoadSettings()
{
if (!Page.IsPostBack) {
// load templates
foreach (string dir in Directory.GetDirectories(App.Info.BasePath + "/templates/")) {
ddTemplates.Items.Add(new ListItem(Path.GetFileName(dir), Path.GetFileName(dir)));
}
FaqMasterSettings settings = new FaqMasterSettings();
settings.Load(ModuleId);
if (ModuleSettings.ContainsKey("Template") && ddTemplates.Items.FindByValue(ModuleSettings["Template"].ToString()) != null) {
ddTemplates.Items.FindByValue(ModuleSettings["Template"].ToString()).Selected = true;
}
// load AJAX switch
if (ModuleSettings.ContainsKey("UseAjax")) {
try {
cbUseAjax.Checked = Convert.ToBoolean(ModuleSettings["UseAjax"]);
} catch {
cbUseAjax.Checked = false;
}
}
// load jQuery switch
cbUseOwnjQuery.Checked = settings.UseOwnjQuery;
// load show effect
if (ModuleSettings.ContainsKey("ShowEffect") && ddEffectsShow.Items.FindByValue(ModuleSettings["ShowEffect"].ToString()) != null) {
ddEffectsShow.Items.FindByValue(ModuleSettings["ShowEffect"].ToString()).Selected = true;
}
// load hide effect
if (ModuleSettings.ContainsKey("HideEffect") && ddEffectsHide.Items.FindByValue(ModuleSettings["HideEffect"].ToString()) != null) {
ddEffectsHide.Items.FindByValue(ModuleSettings["HideEffect"].ToString()).Selected = true;
}
}
}
public override void UpdateSettings()
{
ModuleController modCtrl = new ModuleController();
// save template
modCtrl.UpdateModuleSetting(ModuleId, "Template", ddTemplates.SelectedValue);
// save ajax switch
modCtrl.UpdateModuleSetting(ModuleId, "UseAjax", cbUseAjax.Checked.ToString());
// save jQuery switch
modCtrl.UpdateModuleSetting(ModuleId, "UseOwnjQuery", cbUseOwnjQuery.Checked.ToString());
// save show effect
modCtrl.UpdateModuleSetting(ModuleId, "ShowEffect", ddEffectsShow.SelectedValue);
// save hide effect
modCtrl.UpdateModuleSetting(ModuleId, "HideEffect", ddEffectsHide.SelectedValue);
}
}
}