Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions DNN Platform/DotNetNuke.Abstractions/Framework/PagePipeline.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

namespace DotNetNuke.Abstractions.Framework
{
/// <summary>
/// Represents the page pipeline configuration for rendering pages in the DNN platform.
/// </summary>
public static class PagePipeline
{
/// <summary>QueryString key.</summary>
public const string QueryStringKey = "pipeline";

/// <summary>QueryString WebForms.</summary>
public const string QueryStringWebForms = "webforms";

/// <summary>QueryString MVC.</summary>
public const string QueryStringMvc = "mvc";

/// <summary>Setting name for the page pipeline configuration.</summary>
public const string SettingName = "PagePipeline";

/// <summary>
/// Defines the pipeline types for rendering pages in a portal.
/// </summary>
public enum PortalRenderingPipeline
{
/// <summary>
/// Specifies that pages should be rendered using the WebForms pipeline.
/// </summary>
WebForms,

/// <summary>
/// Specifies that pages should be rendered using the MVC pipeline.
/// </summary>
MVC,

/// <summary>
/// Specifies that the pipeline type should be automatically determined.
/// </summary>
Auto,
}

/// <summary>
/// Defines the available pipeline types for rendering pages in the DNN platform.
/// </summary>
public enum PageRenderingPipeline
{
/// <summary>
/// Specifies that the pipeline type should be taken from the portal.
/// </summary>
Inherited = -1,

/// <summary>
/// Specifies that pages should be rendered using the WebForms pipeline.
/// </summary>
WebForms = 0,

/// <summary>
/// Specifies that pages should be rendered using the MVC pipeline.
/// </summary>
MVC = 1,
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ namespace DotNetNuke.Abstractions.Portals
using System;
using System.Diagnostics.CodeAnalysis;

using DotNetNuke.Abstractions.Framework;

/// <summary>
/// The PortalSettings class encapsulates all of the settings for the Portal,
/// as well as the configuration settings required to execute the current tab
Expand Down Expand Up @@ -359,5 +361,8 @@ public interface IPortalSettings

/// <summary>Gets a value indicating whether to display the dropdowns to quickly add a moduel to the page in the edit bar.</summary>
bool ShowQuickModuleAddMenu { get; }

/// <summary>Gets the pipeline type for the portal.</summary>
PagePipeline.PortalRenderingPipeline PagePipeline { get; }
}
}
25 changes: 21 additions & 4 deletions DNN Platform/Library/Data/DataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ public virtual int SaveTabVersionDetail(int tabVersionDetailId, int tabVersionId
return this.ExecuteScalar<int>("SaveTabVersionDetail", tabVersionDetailId, tabVersionId, moduleId, moduleVersion, paneName, moduleOrder, action, createdByUserID, modifiedByUserID);
}

public virtual void UpdateTab(int tabId, int contentItemId, int portalId, Guid versionGuid, Guid defaultLanguageGuid, Guid localizedVersionGuid, string tabName, bool isVisible, bool disableLink, int parentId, string iconFile, string iconFileLarge, string title, string description, string keyWords, bool isDeleted, string url, string skinSrc, string containerSrc, DateTime startDate, DateTime endDate, int refreshInterval, string pageHeadText, bool isSecure, bool permanentRedirect, float siteMapPriority, int lastModifiedByuserID, string cultureCode, bool isSystem)
public virtual void UpdateTab(int tabId, int contentItemId, int portalId, Guid versionGuid, Guid defaultLanguageGuid, Guid localizedVersionGuid, string tabName, bool isVisible, bool disableLink, int parentId, string iconFile, string iconFileLarge, string title, string description, string keyWords, bool isDeleted, string url, string skinSrc, string containerSrc, DateTime startDate, DateTime endDate, int refreshInterval, string pageHeadText, bool isSecure, bool permanentRedirect, float siteMapPriority, int lastModifiedByuserID, string cultureCode, bool isSystem, int pagePipeline)
{
this.ExecuteNonQuery(
"UpdateTab",
Expand Down Expand Up @@ -921,7 +921,8 @@ public virtual void UpdateTab(int tabId, int contentItemId, int portalId, Guid v
siteMapPriority,
lastModifiedByuserID,
this.GetNull(cultureCode),
isSystem);
isSystem,
pagePipeline);
}

public virtual void UpdateTabOrder(int tabId, int tabOrder, int parentId, int lastModifiedByUserID)
Expand Down Expand Up @@ -1329,14 +1330,23 @@ public virtual void UpdateModuleDefinition(int moduleDefId, string friendlyName,
lastModifiedByUserID);
}

public virtual int AddModuleControl(int moduleDefId, string controlKey, string controlTitle, string controlSrc, string iconFile, int controlType, int viewOrder, string helpUrl, bool supportsPartialRendering, bool supportsPopUps, int createdByUserID)
[DnnDeprecated(10, 99, 0, "Use overload with mvcControlClass")]
#pragma warning disable SA1601 // Partial elements should be documented
public virtual partial int AddModuleControl(int moduleDefId, string controlKey, string controlTitle, string controlSrc, string iconFile, int controlType, int viewOrder, string helpUrl, bool supportsPartialRendering, bool supportsPopUps, int createdByUserID)
#pragma warning restore SA1601 // Partial elements should be documented
{
return this.AddModuleControl(moduleDefId, controlKey, controlTitle, controlSrc, null, iconFile, controlType, viewOrder, helpUrl, supportsPartialRendering, supportsPopUps, createdByUserID);
}

public virtual int AddModuleControl(int moduleDefId, string controlKey, string controlTitle, string controlSrc, string mvcControlClass, string iconFile, int controlType, int viewOrder, string helpUrl, bool supportsPartialRendering, bool supportsPopUps, int createdByUserID)
{
return this.ExecuteScalar<int>(
"AddModuleControl",
this.GetNull(moduleDefId),
this.GetNull(controlKey),
this.GetNull(controlTitle),
controlSrc,
this.GetNull(mvcControlClass),
this.GetNull(iconFile),
controlType,
this.GetNull(viewOrder),
Expand All @@ -1356,7 +1366,13 @@ public virtual IDataReader GetModuleControls()
return this.ExecuteReader("GetModuleControls");
}

public virtual void UpdateModuleControl(int moduleControlId, int moduleDefId, string controlKey, string controlTitle, string controlSrc, string iconFile, int controlType, int viewOrder, string helpUrl, bool supportsPartialRendering, bool supportsPopUps, int lastModifiedByUserID)
[DnnDeprecated(10, 99, 0, "Use overload with mvcControlClass")]
#pragma warning disable SA1601 // Partial elements should be documented
public virtual partial void UpdateModuleControl(int moduleControlId, int moduleDefId, string controlKey, string controlTitle, string controlSrc, string iconFile, int controlType, int viewOrder, string helpUrl, bool supportsPartialRendering, bool supportsPopUps, int lastModifiedByUserID)
#pragma warning restore SA1601 // Partial elements should be documented
=> this.UpdateModuleControl(moduleControlId, moduleDefId, controlKey, controlTitle, controlSrc, null, iconFile, controlType, viewOrder, helpUrl, supportsPartialRendering, supportsPopUps, lastModifiedByUserID);

public virtual void UpdateModuleControl(int moduleControlId, int moduleDefId, string controlKey, string controlTitle, string controlSrc, string mvcControlClass, string iconFile, int controlType, int viewOrder, string helpUrl, bool supportsPartialRendering, bool supportsPopUps, int lastModifiedByUserID)
Comment thread
donker marked this conversation as resolved.
{
this.ExecuteNonQuery(
"UpdateModuleControl",
Expand All @@ -1365,6 +1381,7 @@ public virtual void UpdateModuleControl(int moduleControlId, int moduleDefId, st
this.GetNull(controlKey),
this.GetNull(controlTitle),
controlSrc,
this.GetNull(mvcControlClass),
this.GetNull(iconFile),
controlType,
this.GetNull(viewOrder),
Expand Down
9 changes: 9 additions & 0 deletions DNN Platform/Library/Entities/Modules/ControlInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ protected ControlInfo()
/// <returns>A String.</returns>
public string ControlSrc { get; set; }

/// <summary>Gets or sets the Mvc Control Class.</summary>
/// <returns>A String.</returns>
public string MvcControlClass { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the control support the AJAX
/// Update Panel.
Expand All @@ -42,6 +46,7 @@ protected override void FillInternal(IDataReader dr)
base.FillInternal(dr);
this.ControlKey = Null.SetNullString(dr["ControlKey"]);
this.ControlSrc = Null.SetNullString(dr["ControlSrc"]);
this.MvcControlClass = Null.SetNullString(dr["MvcControlClass"]);
this.SupportsPartialRendering = Null.SetNullBoolean(dr["SupportsPartialRendering"]);
}

Expand All @@ -55,6 +60,9 @@ protected void ReadXmlInternal(XmlReader reader)
case "controlSrc":
this.ControlSrc = reader.ReadElementContentAsString();
break;
case "mvcControlClass":
this.MvcControlClass = reader.ReadElementContentAsString();
break;
case "supportsPartialRendering":
string elementvalue = reader.ReadElementContentAsString();
if (!string.IsNullOrEmpty(elementvalue))
Expand All @@ -71,6 +79,7 @@ protected void WriteXmlInternal(XmlWriter writer)
// write out properties
writer.WriteElementString("controlKey", this.ControlKey);
writer.WriteElementString("controlSrc", this.ControlSrc);
writer.WriteElementString("mvcControlClass", this.MvcControlClass);
writer.WriteElementString("supportsPartialRendering", this.SupportsPartialRendering.ToString());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public static int SaveModuleControl(ModuleControlInfo moduleControl, bool clearC
moduleControl.ControlKey,
moduleControl.ControlTitle,
moduleControl.ControlSrc,
moduleControl.MvcControlClass,
moduleControl.IconFile,
(int)moduleControl.ControlType,
moduleControl.ViewOrder,
Expand All @@ -127,6 +128,7 @@ public static int SaveModuleControl(ModuleControlInfo moduleControl, bool clearC
moduleControl.ControlKey,
moduleControl.ControlTitle,
moduleControl.ControlSrc,
moduleControl.MvcControlClass,
moduleControl.IconFile,
(int)moduleControl.ControlType,
moduleControl.ViewOrder,
Expand Down
5 changes: 5 additions & 0 deletions DNN Platform/Library/Entities/Modules/ModuleInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,11 @@ public string GetProperty(string propertyName, string format, CultureInfo format
propertyNotFound = false;
result = PropertyAccess.FormatString(this.ModuleControl.ControlSrc, format);
break;
case "mvcControlClass":
isPublic = false;
propertyNotFound = false;
result = PropertyAccess.FormatString(this.ModuleControl.MvcControlClass, format);
break;
case "controltitle":
propertyNotFound = false;
result = PropertyAccess.FormatString(this.ModuleControl.ControlTitle, format);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace DotNetNuke.Entities.Portals
{
using System.Collections.Generic;

using DotNetNuke.Abstractions.Framework;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Tabs;

Expand All @@ -14,6 +15,8 @@ public interface IPortalSettingsController

PortalSettings.PortalAliasMapping GetPortalAliasMappingMode(int portalId);

PagePipeline.PortalRenderingPipeline GetPortalPagePipeline(int portalId);

/// <summary>The GetActiveTab method gets the active Tab for the current request.</summary>
/// <param name="tabId">The current tab's id.</param>
/// <param name="portalSettings">The current PortalSettings.</param>
Expand Down
4 changes: 4 additions & 0 deletions DNN Platform/Library/Entities/Portals/PortalSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace DotNetNuke.Entities.Portals
using System.Linq;
using System.Web;

using DotNetNuke.Abstractions.Framework;
using DotNetNuke.Abstractions.Portals;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
Expand Down Expand Up @@ -554,6 +555,9 @@ public string AddCompatibleHttpHeader
/// <inheritdoc />
public bool ShowQuickModuleAddMenu => PortalController.GetPortalSettingAsBoolean("ShowQuickModuleAddMenu", this.PortalId, false);

/// <inheritdoc/>
public PagePipeline.PortalRenderingPipeline PagePipeline { get; internal set; }

/// <summary>Create an <see cref="IPortalSettings"/> instance.</summary>
/// <returns>A new <see cref="IPortalSettings"/> instance.</returns>
public static IPortalSettings Create()
Expand Down
16 changes: 12 additions & 4 deletions DNN Platform/Library/Entities/Portals/PortalSettingsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ namespace DotNetNuke.Entities.Portals
using System.Linq;

using DotNetNuke.Abstractions.Application;
using DotNetNuke.Abstractions.Framework;
using DotNetNuke.Collections;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Tabs;
using DotNetNuke.Framework;
using DotNetNuke.Security;
using DotNetNuke.Services.Localization;
using DotNetNuke.UI.Skins;
Expand Down Expand Up @@ -125,7 +127,13 @@ public virtual PortalSettings.PortalAliasMapping GetPortalAliasMappingMode(int p
return aliasMapping;
}

/// <inheritdoc />
/// <inheritdoc/>
public virtual PagePipeline.PortalRenderingPipeline GetPortalPagePipeline(int portalId)
{
return PortalController.Instance.GetPortalSettings(portalId).GetPortalPipeline(PagePipeline.SettingName);
}

/// <inheritdoc/>
public virtual IList<ModuleInfo> GetTabModules(PortalSettings portalSettings)
{
return portalSettings.ActiveTab.Modules.Cast<ModuleInfo>().Select(m => m).ToList();
Expand Down Expand Up @@ -183,13 +191,13 @@ public virtual void LoadPortalSettings(PortalSettings portalSettings)
var settings = PortalController.Instance.GetPortalSettings(portalSettings.PortalId);
portalSettings.Registration = new RegistrationSettings(settings);

var clientResourcesSettings = new ClientResourceSettings();
var clientResourcesSettings = new Web.Client.ClientResourceSettings();
bool overridingDefaultSettings = clientResourcesSettings.IsOverridingDefaultSettingsEnabled(portalSettings.PortalId);

int crmVersion;
if (overridingDefaultSettings)
{
int? globalVersion = new ClientResourceSettings().GetVersion(portalSettings.PortalId);
int? globalVersion = new Web.Client.ClientResourceSettings().GetVersion(portalSettings.PortalId);
crmVersion = globalVersion ?? default(int);
}
else
Expand Down Expand Up @@ -280,7 +288,7 @@ public virtual void LoadPortalSettings(PortalSettings portalSettings)
portalSettings.DataConsentDelayMeasurement = setting;
setting = settings.GetValueOrDefault("AllowedExtensionsWhitelist", this.hostSettingsService.GetString("DefaultEndUserExtensionWhitelist"));
portalSettings.AllowedExtensionsWhitelist = new FileExtensionWhitelist(setting);

portalSettings.PagePipeline = settings.GetPortalPipeline(PagePipeline.SettingName);
setting = settings.GetValueOrDefault("CspHeaderMode", "OFF");
switch (setting.ToUpperInvariant())
{
Expand Down
6 changes: 4 additions & 2 deletions DNN Platform/Library/Entities/Tabs/TabController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public static void CopyDesignToChildren(IEventLogger eventLogger, TabInfo parent
tab.SiteMapPriority,
UserController.Instance.GetCurrentUserInfo().UserID,
tab.CultureCode,
tab.IsSystem);
tab.IsSystem,
(int)tab.PagePipeline);

UpdateTabVersion(tab.TabID);

Expand Down Expand Up @@ -2124,7 +2125,8 @@ public void UpdateTab(TabInfo updatedTab)
updatedTab.SiteMapPriority,
UserController.Instance.GetCurrentUserInfo().UserID,
updatedTab.CultureCode,
updatedTab.IsSystem);
updatedTab.IsSystem,
(int)updatedTab.PagePipeline);

// Update Tags
List<Term> terms = updatedTab.Terms;
Expand Down
11 changes: 11 additions & 0 deletions DNN Platform/Library/Entities/Tabs/TabInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace DotNetNuke.Entities.Tabs
using System.Xml.Serialization;

using DotNetNuke.Abstractions.Application;
using DotNetNuke.Abstractions.Framework;
using DotNetNuke.Collections.Internal;
using DotNetNuke.Common;
using DotNetNuke.Common.Internal;
Expand All @@ -27,6 +28,7 @@ namespace DotNetNuke.Entities.Tabs
using DotNetNuke.Entities.Portals;
using DotNetNuke.Entities.Tabs.TabVersions;
using DotNetNuke.Entities.Users;
using DotNetNuke.Framework;
using DotNetNuke.Security.Permissions;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.FileSystem;
Expand Down Expand Up @@ -525,6 +527,10 @@ public CacheLevel Cacheability
[XmlElement("localizedVersionGuid")]
public Guid LocalizedVersionGuid { get; set; }

/// <summary>Gets or sets the rendering pipeline of the page.</summary>
[XmlElement("pagepipeline")]
public PagePipeline.PageRenderingPipeline PagePipeline { get; set; }

/// <summary>Gets or sets a collection of the modules on this page.</summary>
/// <value>An <see cref="ArrayList"/> of <see cref="ModuleInfo"/>.</value>
[XmlIgnore]
Expand Down Expand Up @@ -855,6 +861,10 @@ public string GetProperty(string propertyName, string format, CultureInfo format
propertyNotFound = false;
result = PropertyAccess.FormatString(this.SiteMapPriority.ToString(formatProvider), format);
break;
case "pagepipeline":
propertyNotFound = false;
result = this.PagePipeline.ToString();
break;
}

if (!isPublic && currentScope != Scope.Debug)
Expand Down Expand Up @@ -985,6 +995,7 @@ public override void Fill(IDataReader dr)
this.BreadCrumbs = null;
this.Modules = null;
this.IsSystem = Null.SetNullBoolean(dr["IsSystem"]);
this.PagePipeline = (PagePipeline.PageRenderingPipeline)Null.SetNullInteger(dr["PagePipeline"]);
}

/// <summary>Gets the URL for the given <paramref name="cultureCode"/>.</summary>
Expand Down
Loading
Loading