-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathControlPanel.ascx.cs
93 lines (77 loc) · 3.89 KB
/
ControlPanel.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
85
86
87
88
89
90
91
92
93
/*
' Copyright (c) 2016 Oliver Hine, nBrane llc
' All rights reserved.
'
' 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.
'
*/
using System;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Framework.JavaScriptLibraries;
using DotNetNuke.Framework;
using DotNetNuke.Web.Client.ClientResourceManagement;
using DotNetNuke.Web.Client;
namespace nBrane.Modules.AdministrationSuite
{
public partial class ControlPanel : DotNetNuke.UI.ControlPanels.ControlPanelBase
{
public override bool IsDockable { get; set; }
public override bool IncludeInControlHierarchy
{
get
{
return IsUserImpersonated() || (IsPageAdmin() || IsModuleAdmin());
}
}
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (IsPageAdmin() || IsModuleAdmin() || IsUserImpersonated())
{
ServicesFramework.Instance.RequestAjaxAntiForgerySupport();
JavaScript.RequestRegistration(CommonJs.jQuery);
JavaScript.RequestRegistration(CommonJs.Knockout);
if (PortalSettings.UserMode != DotNetNuke.Entities.Portals.PortalSettings.Mode.View)
JavaScript.RequestRegistration(CommonJs.DnnPlugins);
ClientResourceManager.RegisterStyleSheet(Page, "//fonts.googleapis.com/css?family=Montserrat", FileOrder.Css.ModuleCss);
ClientResourceManager.RegisterStyleSheet(Page, "//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css", FileOrder.Css.ModuleCss);
ClientResourceManager.RegisterStyleSheet(Page, "~/desktopmodules/nbrane/administrationsuite/stylesheet.css", FileOrder.Css.ModuleCss);
ClientResourceManager.RegisterScript(Page, "~/desktopmodules/nbrane/administrationsuite/api/controlpanel/loadjs?name=main", FileOrder.Js.DefaultPriority);
ClientResourceManager.RegisterScript(Page, "//cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.66.0-2013.10.09/jquery.blockUI.min.js", FileOrder.Js.DefaultPriority);
}
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
public bool IsUserImpersonated()
{
return Components.Common.IsUserImpersonated();
}
public bool ShowCachePanel()
{
var tabConfigCount = 0;
var globalConfigCount = 0;
var currentOutputCacheSetting = PortalSettings.ActiveTab.TabSettings["CacheProvider"] == null ? string.Empty : PortalSettings.ActiveTab.TabSettings["CacheProvider"].ToString();
if (!string.IsNullOrWhiteSpace(currentOutputCacheSetting))
{
tabConfigCount = DotNetNuke.Services.OutputCache.OutputCachingProvider.Instance(currentOutputCacheSetting).GetItemCount(PortalSettings.ActiveTab.TabID);
}
if (DotNetNuke.Entities.Host.Host.PageCachingMethod != currentOutputCacheSetting)
{
globalConfigCount = DotNetNuke.Services.OutputCache.OutputCachingProvider.Instance(DotNetNuke.Entities.Host.Host.PageCachingMethod).GetItemCount(PortalSettings.ActiveTab.TabID);
}
if (globalConfigCount > 0 || tabConfigCount > 0)
{
return true;
}
return false;
}
}
}