-
Notifications
You must be signed in to change notification settings - Fork 1
/
ModuleBase.cs
176 lines (160 loc) · 7.13 KB
/
ModuleBase.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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// <copyright file="ModuleBase.cs" company="Engage Software">
// Engage: Locator - http://www.engagemodules.com
// Copyright (c) 2004-2008
// by Engage Software ( http://www.engagesoftware.com )
// </copyright>
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
namespace Engage.Dnn.Locator
{
using System;
using System.Diagnostics;
using System.Globalization;
using Maps;
/// <summary>
/// The base class for all control in the Engage: Locator module
/// </summary>
public class ModuleBase : Framework.ModuleBase
{
/// <summary>
/// Gets the name of the desktop module.
/// </summary>
/// <value>The name of the desktop module.</value>
public override string DesktopModuleName
{
get { return Utility.DesktopModuleName; }
}
/// <summary>
/// Raises the <see cref="EventArgs"/> event.
/// </summary>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.AddJQueryReference();
}
/// <summary>
/// Gets a value indicating whether ratings are enabled for the module on this portal.
/// </summary>
/// <value><c>true</c> if ratings are enabled; otherwise, <c>false</c>.</value>
public bool RatingsEnabled
{
get
{
return Utility.GetBooleanPortalSetting("LocatorAllowRatings", this.PortalId, false);
}
}
/// <summary>
/// Gets a value indicating whether comments are enabled for the module on this portal.
/// </summary>
/// <value><c>true</c> if comments are enabled; otherwise, <c>false</c>.</value>
public bool CommentsEnabled
{
[DebuggerStepThrough]
get
{
return Utility.GetBooleanPortalSetting("LocatorAllowComments", PortalId, false);
}
}
/// <summary>
/// Gets a value indicating whether new comment submissions on this portal should be moderated.
/// </summary>
/// <value>
/// <c>true</c> if new comment submissions should be moderated; otherwise, <c>false</c>.
/// </value>
public bool CommentModerationEnabled
{
[DebuggerStepThrough]
get
{
return Utility.GetBooleanPortalSetting("LocatorCommentModeration", PortalId, false);
}
}
/// <summary>
/// Gets a value indicating whether the module accepts new location submissions on this portal.
/// </summary>
/// <value><c>true</c> if new location submissions are enabled; otherwise, <c>false</c>.</value>
public bool SubmissionsEnabled
{
[DebuggerStepThroughAttribute]
get
{
return Utility.GetBooleanPortalSetting("LocatorAllowSubmissions", PortalId, false);
}
}
/// <summary>
/// Gets a value indicating whether new location submissions on this portal should be moderated.
/// </summary>
/// <value>
/// <c>true</c> if new location submissions should be moderated; otherwise, <c>false</c>.
/// </value>
public bool SubmissionModerationEnabled
{
[DebuggerStepThroughAttribute]
get
{
return Utility.GetBooleanPortalSetting("LocatorSubmissionModeration", PortalId, false);
}
}
/// <summary>
/// Gets the map provider for this module.
/// </summary>
/// <returns>The map provider for this module</returns>
public MapProvider GetMapProvider()
{
MapProviderType providerType = Dnn.Utility.GetStringSetting(this.Settings, "DisplayProvider").ToUpperInvariant() == "YAHOO"
? MapProviderType.YahooMaps
: MapProviderType.GoogleMaps;
string apiKey = Dnn.Utility.GetStringSetting(this.Settings, providerType.ClassName + ".ApiKey");
return MapProvider.CreateInstance(providerType, apiKey);
}
/// <summary>
/// Handles the OnClick event of the lbSettings control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void lbSettings_OnClick(object sender, EventArgs e)
{
this.Response.Redirect(this.EditUrl("ModuleId", this.ModuleId.ToString(CultureInfo.InvariantCulture), "Module"), true);
}
/// <summary>
/// Handles the OnClick event of the lbManageLocations control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void lbManageLocations_OnClick(object sender, EventArgs e)
{
this.Response.Redirect(this.EditUrl("ManageLocations"), true);
}
/// <summary>
/// Handles the OnClick event of the lbImportFile control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void lbImportFile_OnClick(object sender, EventArgs e)
{
this.Response.Redirect(this.EditUrl("Import"), true);
}
/// <summary>
/// Handles the OnClick event of the lbManageComments control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void lbManageComments_OnClick(object sender, EventArgs e)
{
this.Response.Redirect(this.EditUrl("ManageComments"), true);
}
/// <summary>
/// Handles the OnClick event of the lbManageTypes control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void lbManageTypes_OnClick(object sender, EventArgs e)
{
this.Response.Redirect(this.EditUrl("AttributeDefinitions"), true);
}
}
}