Skip to content

Commit cc64d22

Browse files
authored
Merge pull request #226 from johnhenley/issues/224
move hardcoded paths to constants
2 parents ab29bba + 7a46c84 commit cc64d22

File tree

83 files changed

+718
-616
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+718
-616
lines changed

ActiveForumViewer.ascx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected override void OnLoad(EventArgs e)
6666
System.Web.UI.HtmlControls.HtmlGenericControl oLink = new System.Web.UI.HtmlControls.HtmlGenericControl("link");
6767
oLink.Attributes["rel"] = "stylesheet";
6868
oLink.Attributes["type"] = "text/css";
69-
oLink.Attributes["href"] = Page.ResolveUrl("~/DesktopModules/ActiveForums/module.css");
69+
oLink.Attributes["href"] = Page.ResolveUrl(Globals.ModulePath + "module.css");
7070
System.Web.UI.Control oCSS = this.Page.FindControl("CSS");
7171
if (oCSS != null)
7272
{

ActiveForums.ascx.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@ protected override void OnLoad(EventArgs e)
7878
// Users can only view thier own settings unless they are admin.
7979
if (userId == UserInfo.UserID || UserInfo.IsInRole(PortalSettings.AdministratorRoleName))
8080
{
81-
var userPrefsCtl = (SettingsBase)(LoadControl("~/desktopmodules/activeforums/controls/profile_mypreferences.ascx"));
81+
var userPrefsCtl = (SettingsBase)(LoadControl(Page.ResolveUrl(Globals.ModulePath + "controls/profile_mypreferences.ascx")));
8282
userPrefsCtl.ModuleConfiguration = ModuleConfiguration;
83-
userPrefsCtl.LocalResourceFile = "~/desktopmodules/activeforums/app_localresources/sharedresources.resx";
83+
userPrefsCtl.LocalResourceFile = Page.ResolveUrl(Globals.SharedResourceFile);
8484
plhAF.Controls.Add(userPrefsCtl);
8585
}
8686

8787
return;
8888
}
8989

9090
// Otherwise, just load the normal forum control
91-
var ctl = (ForumBase)(LoadControl("~/desktopmodules/activeforums/classic.ascx"));
91+
var ctl = (ForumBase)(LoadControl(Page.ResolveUrl(Globals.ModulePath + "classic.ascx")));
9292
ctl.ModuleConfiguration = ModuleConfiguration;
9393
plhAF.Controls.Add(ctl);
9494

ActiveForums.csproj

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,15 @@
269269
<Content Include="handlers\adminhelper.ashx" />
270270
<Content Include="images\add-circle.png" />
271271
<Content Include="images\af-fileicon.png" />
272+
<Content Include="images\arrows_down.png" />
273+
<Content Include="images\arrows_left.png" />
272274
<Content Include="images\arrow_down.png" />
273275
<Content Include="images\arrow_up.png" />
274276
<Content Include="images\check32.png" />
275277
<Content Include="images\checkbox.png" />
276278
<Content Include="images\checkbox_unchecked.png" />
279+
<Content Include="images\close.png" />
280+
<Content Include="images\delete_new.gif" />
277281
<Content Include="images\execute16.png" />
278282
<Content Include="images\delete16.png" />
279283
<Content Include="images\info32.png" />
@@ -284,7 +288,10 @@
284288
<Content Include="images\modal_top_left.png" />
285289
<Content Include="images\modal_top_right.png" />
286290
<Content Include="images\progress.gif" />
291+
<Content Include="images\search.gif" />
287292
<Content Include="images\sort_16.png" />
293+
<Content Include="images\spinner-lg.gif" />
294+
<Content Include="images\spinner.gif" />
288295
<Content Include="images\testrun16.png" />
289296
<Content Include="images\roles_add.png" />
290297
<Content Include="images\save16.png" />
@@ -534,7 +541,9 @@
534541
<Content Include="controls\admin_filters.ascx" />
535542
<Content Include="controls\admin_home.ascx" />
536543
<Content Include="controls\admin_manageforums_home.ascx" />
537-
<Content Include="controls\admin_ranks.ascx" />
544+
<Content Include="controls\admin_ranks.ascx">
545+
<SubType>ASPXCodeBehind</SubType>
546+
</Content>
538547
<Content Include="controls\admin_tags.ascx">
539548
<SubType>ASPXCodeBehind</SubType>
540549
</Content>
@@ -644,7 +653,9 @@
644653
<None Include="sql\06.04.01.SqlDataProvider" />
645654
<None Include="sql\07.00.02.SqlDataProvider" />
646655
<None Include="sql\07.00.00.SqlDataProvider" />
656+
<None Include="sql\07.00.02.SqlDataProvider" />
647657
<None Include="sql\07.00.05.SqlDataProvider" />
658+
<None Include="sql\07.00.06.SqlDataProvider" />
648659
<None Include="sql\Enterprise.sql" />
649660
<Content Include="config\templates\ModAlert_text.txt" />
650661
<Content Include="config\templates\ModEmail_text.txt" />

ActiveForums.dnn

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,12 @@
352352
<script type="UnInstall">
353353
<path>sql</path>
354354
<name>Uninstall.SqlDataProvider</name>
355-
<version>07.00.05</version>
355+
<version>07.00.06</version>
356+
</script>
357+
<script type="UnInstall">
358+
<path>sql</path>
359+
<name>Uninstall.SqlDataProvider</name>
360+
<version>07.00.06</version>
356361
</script>
357362
</scripts>
358363
</component>

Classic.ascx.cs

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ protected override void OnLoad(EventArgs e)
131131
else
132132
{
133133

134-
string ctlPath = "~/DesktopModules/activeforums/controls/_default.ascx";
134+
string ctlPath = Globals.ModulePath + "controls/_default.ascx";
135135
ForumBase ctlDefault = (ForumBase)(LoadControl(ctlPath));
136136
ctlDefault.ID = "ctlConfig";
137137
ctlDefault.ModuleConfiguration = this.ModuleConfiguration;
@@ -166,7 +166,7 @@ private void GetControl(string view, string options)
166166
}
167167
else if (view.ToUpperInvariant() == "ADVANCED")
168168
{
169-
ctl = (ForumBase)(LoadControl("~/desktopmodules/activeforums/advanced.ascx"));
169+
ctl = (ForumBase)(LoadControl(Page.ResolveUrl(Globals.ModulePath + "advanced.ascx")));
170170
}
171171
else if ((view.ToUpperInvariant() == Views.Topics.ToUpperInvariant()) || (view.ToUpperInvariant() == "topics".ToUpperInvariant()))
172172
{
@@ -179,7 +179,7 @@ private void GetControl(string view, string options)
179179
else if (view.ToUpperInvariant() == "USERSETTINGS".ToUpperInvariant())
180180
{
181181
string ctlPath = string.Empty;
182-
ctlPath = "~/DesktopModules/ActiveForums/controls/af_profile.ascx";
182+
ctlPath = Globals.ModulePath + "controls/af_profile.ascx";
183183
if (!(System.IO.File.Exists(Server.MapPath(ctlPath))))
184184
{
185185
ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.ForumView());
@@ -193,7 +193,7 @@ private void GetControl(string view, string options)
193193
{
194194
// this is where af_post.ascx is used
195195
string ctlPath = string.Empty;
196-
ctlPath = "~/DesktopModules/ActiveForums/controls/af_" + view + ".ascx";
196+
ctlPath = Globals.ModulePath + "controls/af_" + view + ".ascx";
197197
if (!(System.IO.File.Exists(Server.MapPath(ctlPath))))
198198
{
199199
ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.ForumView());
@@ -259,9 +259,9 @@ private void GetControl(string view, string options)
259259
ctl.Params = options;
260260
}
261261
ControlsConfig cc = new ControlsConfig();
262-
cc.AppPath = Page.ResolveUrl("~/DesktopModules/ActiveForums/");
263-
cc.ThemePath = Page.ResolveUrl("~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme + "/");
264-
cc.TemplatePath = cc.ThemePath + "templates/";
262+
cc.AppPath = Page.ResolveUrl(Globals.ModulePath);
263+
cc.ThemePath = Page.ResolveUrl(MainSettings.ThemesLocation + "/" + MainSettings.Theme);
264+
cc.TemplatePath = Page.ResolveUrl(MainSettings.TemplatesLocation + "/");
265265
cc.SiteId = PortalId;
266266
cc.PageId = TabId;
267267
cc.InstanceId = ModuleId;
@@ -318,8 +318,8 @@ private void SetupPage()
318318
//Register theme
319319
if (InheritModuleCSS == false)
320320
{
321-
ClientResourceManager.RegisterStyleSheet(this.Page, "~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme + "/module.css");
322-
ClientResourceManager.RegisterStyleSheet(this.Page, "~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme + "/jquery-ui.min.css");
321+
ClientResourceManager.RegisterStyleSheet(this.Page, MainSettings.ThemesLocation + "/" + MainSettings.Theme + "/module.css");
322+
ClientResourceManager.RegisterStyleSheet(this.Page, MainSettings.ThemesLocation + "/" + MainSettings.Theme + "/jquery-ui.min.css");
323323
}
324324

325325
string lang = "en-US";
@@ -341,22 +341,22 @@ private void SetupPage()
341341
ClientAPI.RegisterClientReference(this.Page, ClientAPI.ClientNamespaceReferences.dnn);
342342
Framework.jQuery.RequestDnnPluginsRegistration();
343343

344-
ClientResourceManager.RegisterScript(this.Page, "~/desktopmodules/activeforums/scripts/jquery-searchPopup.js");
344+
ClientResourceManager.RegisterScript(this.Page, Globals.ModulePath + "scripts/jquery-searchPopup.js");
345345

346-
ClientResourceManager.RegisterScript(this.Page, "~/desktopmodules/activeforums/scripts/json2009.min.js");
347-
ClientResourceManager.RegisterScript(this.Page, "~/desktopmodules/activeforums/scripts/afcommon.js");
348-
ClientResourceManager.RegisterScript(this.Page, "~/desktopmodules/activeforums/scripts/afutils.js");
349-
ClientResourceManager.RegisterScript(this.Page, "~/desktopmodules/activeforums/active/amlib.js");
346+
ClientResourceManager.RegisterScript(this.Page, Globals.ModulePath + "scripts/json2009.min.js");
347+
ClientResourceManager.RegisterScript(this.Page, Globals.ModulePath + "scripts/afcommon.js");
348+
ClientResourceManager.RegisterScript(this.Page, Globals.ModulePath + "scripts/afutils.js");
349+
ClientResourceManager.RegisterScript(this.Page, Globals.ModulePath + "active/amlib.js");
350350

351351
StringBuilder sb = new StringBuilder();
352-
string handlerURL = VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/handlers/forumhelper.ashx") + "?TabId=" + TabId.ToString() + "&PortalId=" + PortalId.ToString() + "&moduleid=" + ModuleId + "&language=" + lang;
352+
string handlerURL = VirtualPathUtility.ToAbsolute(Globals.ModulePath + "handlers/forumhelper.ashx") + "?TabId=" + TabId.ToString() + "&PortalId=" + PortalId.ToString() + "&moduleid=" + ModuleId + "&language=" + lang;
353353
sb.AppendFormat("var afHandlerURL = '{0}';", handlerURL);
354-
sb.AppendLine("var af_imgPath = '" + VirtualPathUtility.ToAbsolute("~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme) + "';");
354+
sb.AppendLine("var af_imgPath = '" + VirtualPathUtility.ToAbsolute(MainSettings.ThemesLocation + "/" + MainSettings.Theme) + "/images/';");
355355
string sLoadImg = "";
356-
sLoadImg = "var afSpinLg = new Image();afSpinLg.src='" + VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/images/spinner-lg.gif") + "';";
357-
sLoadImg += "var afSpin = new Image();afSpin.src='" + VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/images/spinner.gif") + "';";
356+
sLoadImg = "var afSpinLg = new Image();afSpinLg.src='" + VirtualPathUtility.ToAbsolute(Globals.ModulePath + "images/spinner-lg.gif") + "';";
357+
sLoadImg += "var afSpin = new Image();afSpin.src='" + VirtualPathUtility.ToAbsolute(Globals.ModulePath + "images/spinner.gif") + "';";
358358
sb.AppendLine(sLoadImg);
359-
sb.AppendLine(Utilities.LocalizeControl(Utilities.GetFile(Server.MapPath("~/desktopmodules/activeforums/scripts/resx.js")), false, true));
359+
sb.AppendLine(Utilities.LocalizeControl(Utilities.GetFile(Server.MapPath(Globals.ModulePath + "scripts/resx.js")), false, true));
360360
if (HttpContext.Current.Request.IsAuthenticated && MainSettings.UsersOnlineEnabled)
361361
{
362362
sb.AppendLine("setInterval('amaf_pinger()',120000);");
@@ -370,10 +370,8 @@ private void SetupPage()
370370

371371
if (ForumUser.Profile.IsMod)
372372
{
373-
ClientResourceManager.RegisterScript(this.Page, "~/desktopmodules/activeforums/scripts/afmod.js");
374-
ClientResourceManager.RegisterStyleSheet(this.Page, "~/DesktopModules/ActiveForums/active/am-ui.css");
375-
376-
373+
ClientResourceManager.RegisterScript(this.Page, Globals.ModulePath + "scripts/afmod.js");
374+
ClientResourceManager.RegisterStyleSheet(this.Page, Globals.ModulePath + "active/am-ui.css");
377375
}
378376

379377

@@ -414,7 +412,7 @@ protected override void OnPreRender(EventArgs e)
414412
object sToolbar = DataCache.CacheRetrieve("aftb" + ForumModuleId);
415413
if (sToolbar == null)
416414
{
417-
sToolbar = Utilities.GetFileContent(SettingKeys.TemplatePath + "ToolBar.txt");
415+
sToolbar = Utilities.GetFileContent(Globals.DefaultTemplatePath + "ToolBar.txt");
418416
DataCache.CacheStore("aftb" + ForumModuleId, sToolbar);
419417
}
420418
lit.Text = sToolbar.ToString();
@@ -430,15 +428,15 @@ protected override void OnPreRender(EventArgs e)
430428
ctl.Height = "350px";
431429
ctl.Width = "400px";
432430
ctl.Name = Utilities.GetSharedResource("[RESX:TopicQuickEdit]");
433-
ctl.FilePath = "~/desktopmodules/activeforums/controls/htmlcontrols/quickedit.ascx";
431+
ctl.FilePath = Globals.ModulePath + "controls/htmlcontrols/quickedit.ascx";
434432
this.Controls.Add(ctl);
435433

436434
ctl = new Controls.HtmlControlLoader();
437435
ctl.ControlId = "aftopicmove";
438436
ctl.Height = "350px";
439437
ctl.Width = "500px";
440438
ctl.Name = Utilities.GetSharedResource("[RESX:MoveTopicTitle]");
441-
ctl.FilePath = "~/desktopmodules/activeforums/controls/htmlcontrols/movetopic.ascx";
439+
ctl.FilePath = Globals.ModulePath + "controls/htmlcontrols/movetopic.ascx";
442440
this.Controls.Add(ctl);
443441
}
444442
}

ControlPanel.ascx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<%@ Control Language="C#" AutoEventWireup="false" CodeBehind="ControlPanel.ascx.cs" Inherits="DotNetNuke.Modules.ActiveForums.ControlPanel" %>
22
<%@ Register assembly="DotNetNuke.Modules.ActiveForums" namespace="DotNetNuke.Modules.ActiveForums.Controls" tagPrefix="am" %>
33
<script type="text/javascript">
4-
var imgPath = '<%=Page.ResolveUrl("~/DesktopModules/ActiveForums/images/")%>';
4+
var imgPath = '<%=Page.ResolveUrl("~/DesktopModules/ActiveForums/images/")%>';
55
var dlgHeight;
66
var dlgWidth;
77
var dlgTitle;
@@ -138,8 +138,8 @@
138138
<div>
139139
<div class="amcpcontainer" id="amcpcontainer">
140140
<div class="amcploader" id="amcploader">
141-
<span>[RESX:PleaseWait]</span>
142-
<img src="~/desktopmodules/activeforums/images/spinner-lg.gif" runat="server" />
141+
<span>[RESX:PleaseWait]</span>;
142+
<img src="~/DesktopModules/ActiveForums/images/spinner-lg.gif" runat="server" />
143143
</div>
144144
<div id="amcpnotify" class="amcpnotify">
145145
<div>
@@ -152,7 +152,7 @@
152152
<div class="amcpmdtoolbar">
153153
<am:imagebutton id="btnHome" runat="server" Height="50" Width="70" PostBack="False" ClientSideScript="LoadView('home');" ImageLocation="TOP" text="[RESX:Dashboard]" ImageUrl="~/DesktopModules/ActiveForums/images/home32.png" />
154154
<am:imagebutton id="btnForums" runat="server" Height="50" Width="70" PostBack="False" ClientSideScript="LoadView('manageforums');" ImageLocation="TOP" text="[RESX:Forums]" ImageUrl="~/DesktopModules/ActiveForums/images/forums32.png" />
155-
<am:imagebutton id="btnTemplates" runat="server" Height="50" Width="70" PostBack="False" ClientSideScript="LoadView('templates');" ImageLocation="TOP" text="[RESX:Templates]" ImageUrl="~/DesktopModules/ActiveForums/images/templates32.png" />
155+
<am:imagebutton id="btnTemplates" runat="server" Height="50" Width="70" PostBack="False" ClientSideScript="LoadView('templates');" ImageLocation="TOP" text="[RESX:Templates]" ImageUrl="~/DesktopModules/ActiveForums/images/templates32.png"/>
156156
<am:imagebutton id="btnFilters" runat="server" Height="50" Width="70" PostBack="False" ClientSideScript="LoadView('filters');" ImageLocation="TOP" text="[RESX:Filters]" ImageUrl="~/DesktopModules/ActiveForums/images/filters32.png" />
157157
<am:imagebutton id="btnRanks" runat="server" Height="50" Width="70" PostBack="False" ClientSideScript="LoadView('ranks');" ImageLocation="TOP" text="[RESX:Ranks]" ImageUrl="~/DesktopModules/ActiveForums/images/ranks32.png" />
158158
<am:imagebutton id="btnTags" runat="server" Height="50" Width="70" PostBack="False" ClientSideScript="LoadView('tags');" ImageLocation="TOP" text="[RESX:Tags]" ImageUrl="~/DesktopModules/ActiveForums/images/tags32.png" />

ControlPanel.ascx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ protected override void OnLoad(EventArgs e)
143143
var sb = new StringBuilder();
144144
sb.AppendLine("var asScriptPath = '" + VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/scripts/") + "';");
145145
sb.AppendFormat("var afAdminHandlerURL = '{0}';", adminHandler);
146-
sb.AppendLine("var af_imgPath = '" + VirtualPathUtility.ToAbsolute("~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme) + "';");
146+
sb.AppendLine("var af_imgPath = '" + VirtualPathUtility.ToAbsolute("~/DesktopModules/ActiveForums/images/") + "';");
147147
string sLoadImg;
148148
sLoadImg = "var afSpinLg = new Image();afSpinLg.src='" + VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/images/spinner-lg.gif") + "';";
149149
sLoadImg += "var afSpin = new Image();afSpin.src='" + VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/images/spinner.gif") + "';";

CustomControls/ServerControls/Modal.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ protected override void Render(HtmlTextWriter writer)
140140
writer.RenderEndTag();
141141
// END HEADER TEXT
142142
// BEGIN CLOSE BUTTON
143-
// <div class="amModalCloseImg" onclick="amaf_closeDialog();"><img src="<%=Page.ResolveUrl("~/DesktopModules/activeforums/images/close.gif") %>" alt="[RESX:Close]" /></div>
143+
// <div class="amModalCloseImg" onclick="amaf_closeDialog();"><img src="<%=Page.ResolveUrl("~/DesktopModules/ActiveForums/images/close.gif") %>" alt="[RESX:Close]" /></div>
144144
writer.AddAttribute("class", "amModalCloseImg");
145145
writer.AddAttribute("onclick", "amaf_closeDialog();");
146146
writer.RenderBeginTag(HtmlTextWriterTag.Div);
147-
writer.AddAttribute("src", Page.ResolveUrl("~/DesktopModules/activeforums/images/close.gif"));
147+
writer.AddAttribute("src", Page.ResolveUrl( "~/DesktopModules/ActiveForums/images/close.gif"));
148148
writer.AddAttribute("alt", "[RESX:Close]");
149149
writer.RenderBeginTag(HtmlTextWriterTag.Img);
150150
writer.RenderEndTag(); //Close image

CustomControls/ServerControls/WhatsNewControl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ protected override void OnLoad(EventArgs e)
321321

322322
dr.Close();
323323

324-
var sRSSImage = "<img src=\"" + Page.ResolveUrl("~/DesktopModules/ActiveForums/images/feedicon.gif") + "\" border=\"0\" />";
324+
var sRSSImage = "<img src=\"" + Page.ResolveUrl("<% (DotNetNuke.Modules.ActiveForums.Globals.ModuleImagesPath) %>feedicon.gif") + "\" border=\"0\" />";
325325
var sRSSURL = Page.ResolveUrl("~/desktopmodules/activeforumswhatsnew/feeds.aspx") + "?portalId=" + PortalId + "&tabid=" + TabId.ToString() + "&moduleid=" + ModuleId.ToString();
326326
var sRSSIconLink = "<a href=\"" + sRSSURL + "\">" + sRSSImage + "</a>";
327327
sFooterTemplate = sFooterTemplate.Replace("[RSSICON]", sRSSImage);

CustomControls/UserControls/ForumView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ protected override void OnInit(EventArgs e)
113113
{
114114
var lit = new LiteralControl();
115115
object sToolbar = null; //DataCache.CacheRetrieve("aftb" & ModuleId)
116-
sToolbar = Utilities.GetFileContent(SettingKeys.TemplatePath + "ToolBar.txt");
116+
sToolbar = Utilities.GetFileContent(HttpContext.Current.Server.MapPath(TemplatePath + "\\ToolBar.txt"));
117117
DataCache.CacheStore("aftb" + ModuleId, sToolbar);
118118
sToolbar = Utilities.ParseToolBar(sToolbar.ToString(), TabId, ModuleId, UserId, CurrentUserType);
119119
lit.Text = sToolbar.ToString();

0 commit comments

Comments
 (0)