Skip to content

Commit 36ff61d

Browse files
committed
Fixes #28 DNN8 compatibility
1 parent ecf6060 commit 36ff61d

7 files changed

Lines changed: 29 additions & 3 deletions

File tree

Map.ascx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
var module_id = <%= ModuleId %>;
99
var portal_id = <%= PortalId %>;
1010
var sf = $.ServicesFramework(module_id);
11+
var apiUrlBase = "<%= ApiUrlBase %>";
1112
</script>

Map.ascx.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ public string GoogleAPIKey
3333
Exceptions.ProcessModuleLoadException(this, ex);
3434
}
3535
}
36+
protected string ApiUrlBase
37+
{
38+
get
39+
{
40+
if (DotNetNuke.Application.DotNetNukeContext.Current.Application.CurrentVersion.Major < 9)
41+
{
42+
return "/desktopmodules/Dnn.WebAnalytics/api";
43+
}
44+
return "/api/Dnn.WebAnalytics";
45+
}
46+
}
3647

3748
}
3849

View.ascx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
var module_id = <%= ModuleId %>;
99
var portal_id = <%= PortalId %>;
1010
var sf = $.ServicesFramework(module_id);
11+
var apiUrlBase = "<%= ApiUrlBase %>";
1112
</script>

View.ascx.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using DotNetNuke.Services.Exceptions;
22
using System;
3+
using DotNetNuke.Entities.Controllers;
4+
using DotNetNuke.Entities.Host;
35
using DotNetNuke.Entities.Modules.Actions;
46
using DotNetNuke.Entities.Modules;
57

@@ -32,5 +34,16 @@ public ModuleActionCollection ModuleActions
3234
}
3335
}
3436

37+
protected string ApiUrlBase
38+
{
39+
get
40+
{
41+
if (DotNetNuke.Application.DotNetNukeContext.Current.Application.CurrentVersion.Major < 9)
42+
{
43+
return "/desktopmodules/Dnn.WebAnalytics/api";
44+
}
45+
return "/api/Dnn.WebAnalytics";
46+
}
47+
}
3548
}
3649
}

app/services/map.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dnnWebAnalytics.factory('mapService', ['$http', function mapService($http) {
22

3-
var base_path = "/api/Dnn.WebAnalytics/map";
3+
var base_path = apiUrlBase + "/map";
44

55
// interface
66
var service = {

app/services/visit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dnnWebAnalytics.factory('visitService', ['$http', '$filter', function visitService($http, $filter) {
22

3-
var base_path = "/api/Dnn.WebAnalytics/visit";
3+
var base_path = apiUrlBase + "/visit";
44

55
// interface
66
var service = {

app/services/visitor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dnnWebAnalytics.factory('visitorService', ['$http', function visitorService($http) {
22

3-
var base_path = "/api/Dnn.WebAnalytics/visitor";
3+
var base_path = apiUrlBase + "/visitor";
44

55
// interface
66
var service = {

0 commit comments

Comments
 (0)