diff --git a/.gitignore b/.gitignore index 9170764..d16a18b 100644 --- a/.gitignore +++ b/.gitignore @@ -205,6 +205,7 @@ DNN [Pp]latform/Syndication/[Bb]in/* ![Ww]ebsite/[Ii]nstall/[Aa]pp_[Ll]ocal[Rr]esources/*.nl-NL.resx *.zip.manifest +[Rr]esources.zip ############ ## Windows diff --git a/Components/ExtensionObject.cs b/Components/ExtensionObject.cs index d982951..c8ac4de 100644 --- a/Components/ExtensionObject.cs +++ b/Components/ExtensionObject.cs @@ -20,6 +20,7 @@ using DotNetNuke.Common; using DotNetNuke.Entities.Modules; using DotNetNuke.Framework; +using DotNetNuke.Web.Client.ClientResourceManagement; namespace DotNetNuke.Modules.Xml.Components { @@ -79,7 +80,7 @@ public void registerStyleSheet(string href) { if ((_page != null) && (_page) is CDefault) { - ((CDefault) _page).AddStyleSheet(Globals.CreateValidID(href), href); + ClientResourceManager.RegisterStyleSheet(_page, href); } } diff --git a/Components/FeatureController.cs b/Components/FeatureController.cs index df080ed..024ca51 100644 --- a/Components/FeatureController.cs +++ b/Components/FeatureController.cs @@ -18,14 +18,18 @@ // using System; using System.Collections; +using System.Collections.Generic; using System.IO; using System.Xml; using DotNetNuke.Common; +using DotNetNuke.Common.Utilities; using DotNetNuke.Entities.Modules; using DotNetNuke.Entities.Portals; using DotNetNuke.Modules.Xml.Providers.XmlDataProvider; using DotNetNuke.Modules.Xml.Providers.XmlRenderingProvider; using DotNetNuke.Services.Search; +using DotNetNuke.Services.Search.Entities; +using DotNetNuke.Services.Search.Internals; namespace DotNetNuke.Modules.Xml.Components { @@ -34,8 +38,39 @@ namespace DotNetNuke.Modules.Xml.Components /// The Controller class for Xml Module /// /// ----------------------------------------------------------------------------- - public class FeatureController : IPortable, ISearchable + public class FeatureController : ModuleSearchBase, IPortable { + #region ModuleSearchBase Implementation + public override IList GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDateUtc) + { + var controller = new XmlBaseController(moduleInfo); + var portalId = moduleInfo.PortalID; + var administratorId = PortalController.Instance.GetPortal(portalId).AdministratorId; + + var searchDocuments = new List(); + InternalSearchController.Instance.DeleteSearchDocumentsByModule(portalId, moduleInfo.ModuleID, moduleInfo.ModuleDefID); + if (MustAddContentToSearch(moduleInfo)) + { + var sw = new StringWriter(); + controller.Render(sw); + sw.Flush(); + var content = sw.ToString(); + var now = DateTime.Now; + + var searchDoc = new SearchDocument(); + searchDoc.Title = moduleInfo.ModuleTitle; + searchDoc.Description = content; + searchDoc.AuthorUserId = administratorId; + searchDoc.ModifiedTimeUtc = now; + searchDoc.ModuleId = moduleInfo.ModuleID; + searchDoc.Body = content; + + searchDocuments.Add(searchDoc); + } + return searchDocuments; + } + #endregion + #region IPortable Members /// @@ -43,7 +78,8 @@ public class FeatureController : IPortable, ISearchable /// public string ExportModule(int moduleId) { - var settings = new ModuleController().GetModuleSettings(moduleId); + var moduleInfo = ModuleController.Instance.GetModule(moduleId, Null.NullInteger, false); + var settings = moduleInfo.ModuleSettings; //start export var strXml = new StringWriter(); XmlWriter writer = new XmlTextWriter(strXml); @@ -106,36 +142,7 @@ public void ImportModule(int moduleId, string content, string version, int userI } #endregion - - #region ISearchable Members - - /// - /// DotNetNuke Search support - /// - public SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo) - { - var controller = new XmlBaseController(modInfo); - - var portalId = modInfo.PortalID; - var administratorId = new PortalController().GetPortal(portalId).AdministratorId; - - var searchItemCollection = new SearchItemInfoCollection(); - if (MustAddContentToSearch(modInfo)) - { - var sw = new StringWriter(); - controller.Render(sw); - sw.Flush(); - var content = sw.ToString(); - var now = DateTime.Now; - searchItemCollection.Add(new SearchItemInfo(modInfo.ModuleTitle, content, administratorId, now, modInfo.ModuleID, "", content)); - var mc = new ModuleController(); - mc.UpdateModuleSetting(modInfo.ModuleID, Setting.LastIndexRun, DateTime.Now.ToString("s")); - } - return searchItemCollection; - } - - #endregion - + /// /// Determines whether the module should be indexed or not. /// @@ -160,6 +167,6 @@ private static bool MustAddContentToSearch(ModuleInfo modInfo) default: return false; } - } + } } } \ No newline at end of file diff --git a/Components/Utils.cs b/Components/Utils.cs index 2a1d3ab..3c9de89 100644 --- a/Components/Utils.cs +++ b/Components/Utils.cs @@ -21,6 +21,7 @@ using System.Net; using System.Security; using System.Security.Cryptography; +using System.Security.Permissions; using System.Text; using System.Xml; using DotNetNuke.Common.Utilities; @@ -57,7 +58,9 @@ public static string DefaultIfNullOrEmpty(this object value, string @default = " /// public static bool CheckWebPermission(string url) { - return SecurityManager.IsGranted(new WebPermission(NetworkAccess.Connect, url)); + var permissionSet = new PermissionSet(System.Security.Permissions.PermissionState.None); + permissionSet.AddPermission(new WebPermission(NetworkAccess.Connect, url)); + return permissionSet.IsSubsetOf(AppDomain.CurrentDomain.PermissionSet); } public static bool IsOfSameTypeAs(this object a, object b) @@ -69,10 +72,11 @@ public static bool IsOfSameTypeAs(this object a, object b) public static XmlReader CreateXmlReader(string xmlsrc, int portalId, bool prohibitDtd) { - if (xmlsrc == String.Empty) return null; - var filecontroller = new FileController(); - var xmlFileInfo = filecontroller.GetFileById(filecontroller.ConvertFilePathToFileId(xmlsrc, portalId), portalId); - return XmlReader.Create(FileSystemUtils.GetFileStream(xmlFileInfo), new XmlReaderSettings {ProhibitDtd = prohibitDtd}); + if (xmlsrc == String.Empty) return null; + var xmlFileInfo = FileManager.Instance.GetFile(portalId, xmlsrc, true); + var xmlSettings = new XmlReaderSettings(); + xmlSettings.DtdProcessing = DtdProcessing.Prohibit; + return XmlReader.Create(FileManager.Instance.GetFileContent(xmlFileInfo), xmlSettings); } public static XmlReader CreateXmlReader(string xmlsrc, int portalId) diff --git a/Components/XmlBaseController.cs b/Components/XmlBaseController.cs index 084dd19..128f422 100644 --- a/Components/XmlBaseController.cs +++ b/Components/XmlBaseController.cs @@ -22,6 +22,7 @@ using System.Web; using System.Web.UI; using System.Xml; +using DotNetNuke.Common.Utilities; using DotNetNuke.Data; using DotNetNuke.Entities.Modules; using DotNetNuke.Modules.Xml.Providers.XmlDataProvider; @@ -130,13 +131,8 @@ public void Render(Stream stream) /// public void ClearSearchIndex() { - // FIX: for Error CS1061 'DataProvider' does not contain a definition for 'DeleteSearchItems' and no extension method 'DeleteSearchItems' accepting a first argument of type 'DataProvider' could be found(are you missing a using directive or an assembly reference ?) Xml D:\Materijali\SD\Portal2015\Dev\Prototips\DNN.XML\Components\XmlBaseController.cs 132 Active - //DataProvider.Instance().DeleteSearchItems(ModuleId); - var moduleSearchItems = SearchDataStoreController.GetSearchItems(ModuleId); - foreach (var searchItem in moduleSearchItems) - { - SearchDataStoreController.DeleteSearchItem(searchItem.Value.SearchItemId); - } + var moduleInfo = ModuleController.Instance.GetModule(ModuleId, Null.NullInteger, true); + DotNetNuke.Services.Search.Internals.InternalSearchController.Instance.DeleteSearchDocumentsByModule(moduleInfo.PortalID, ModuleId, moduleInfo.ModuleDefID); } diff --git a/DNN_XML.csproj b/DNN_XML.csproj index b840bc3..38bd9d0 100644 --- a/DNN_XML.csproj +++ b/DNN_XML.csproj @@ -31,7 +31,7 @@ DEBUG;TRACE ..\..\bin\ Xml.xml - 1 + 2 AllRules.ruleset false @@ -56,6 +56,11 @@ False False + + packages\DotNetNuke.Web.Client.8.0.1.239\lib\net40\DotNetNuke.Web.Client.dll + False + False + packages\DotNetNuke.Web.8.0.0.809\lib\net40\DotNetNuke.WebUtility.dll False diff --git a/Parameters/ParameterInfo.cs b/Parameters/ParameterInfo.cs index d41b887..4a9fb8a 100644 --- a/Parameters/ParameterInfo.cs +++ b/Parameters/ParameterInfo.cs @@ -295,7 +295,7 @@ public string GetValue() default: // user property // get current user - var objUser = UserController.GetCurrentUserInfo(); + var objUser = UserController.Instance.GetCurrentUserInfo(); // handle user property switch (ParseType(Type)) @@ -361,7 +361,7 @@ public string GetValue() return objUser.Profile.PreferredLocale.DefaultIfNullOrEmpty(TypeArgument); case ParameterType.UserTimeZone: - return objUser.Profile.TimeZone.DefaultIfNullOrEmpty(TypeArgument); + return objUser.Profile.PreferredTimeZone.DefaultIfNullOrEmpty(TypeArgument); case ParameterType.UserIsAuthorized: return objUser.Membership.Approved.DefaultIfNullOrEmpty(TypeArgument); diff --git a/Providers/XmlRenderingProvider/XslCompiledTransform/Provider.cs b/Providers/XmlRenderingProvider/XslCompiledTransform/Provider.cs index 421e9a5..6979205 100644 --- a/Providers/XmlRenderingProvider/XslCompiledTransform/Provider.cs +++ b/Providers/XmlRenderingProvider/XslCompiledTransform/Provider.cs @@ -120,7 +120,9 @@ private static System.Xml.Xsl.XslCompiledTransform GetXslContentByWebRequest(str { if (receiveStream != null) { - using (var objXslTransform = XmlReader.Create(receiveStream, new XmlReaderSettings {ProhibitDtd = prohibitDtd})) + var xmlReaderSettings = new XmlReaderSettings(); + xmlReaderSettings.DtdProcessing = DtdProcessing.Prohibit; + using (var objXslTransform = XmlReader.Create(receiveStream, xmlReaderSettings )) { var settings = new XsltSettings(enableDocument, enableScript); xslCompiledTransform.Load(objXslTransform, settings, new XmlUrlResolver()); diff --git a/Resources.zip b/Resources.zip deleted file mode 100644 index 0627d96..0000000 Binary files a/Resources.zip and /dev/null differ diff --git a/Xml.xml b/Xml.xml index b0a2c9a..12ce875 100644 --- a/Xml.xml +++ b/Xml.xml @@ -21,11 +21,6 @@ IPortable:Import - - - DotNetNuke Search support - - Determines whether the module should be indexed or not. diff --git a/download.ashx.cs b/download.ashx.cs index 1908201..30e8afc 100644 --- a/download.ashx.cs +++ b/download.ashx.cs @@ -76,7 +76,7 @@ public void ProcessRequest(HttpContext context) { try { - var portalSettings = PortalController.GetCurrentPortalSettings(); + var portalSettings = PortalController.Instance.GetCurrentPortalSettings(); if (context.Request.QueryString["tabid"] == null || context.Request.QueryString["mid"] == null) return; @@ -94,11 +94,10 @@ public void ProcessRequest(HttpContext context) moduleId = Int32.Parse(context.Request.QueryString["mid"]); } - UserController.GetCurrentUserInfo(); - - var moduleController = new ModuleController(); - var settings = moduleController.GetModuleSettings(moduleId); - var moduleInfo = moduleController.GetModule(moduleId, tabId); + UserController.Instance.GetCurrentUserInfo(); + + var moduleInfo = ModuleController.Instance.GetModule(moduleId, tabId, false); + var settings = moduleInfo.ModuleSettings; if (context.Request.QueryString["showsource"] == null) { @@ -115,7 +114,7 @@ public void ProcessRequest(HttpContext context) } } } - catch (Exception ex) + catch (Exception) { context.Response.Write("Not defined"); } diff --git a/packages.config b/packages.config index b1d369d..e203987 100644 --- a/packages.config +++ b/packages.config @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/releasenotes.htm b/releasenotes.htm index 77267b5..236a6cb 100644 --- a/releasenotes.htm +++ b/releasenotes.htm @@ -1,9 +1,10 @@ 

Release Notes

DNN XML Module 06.00.06

-

This release is compiled against the .Net 4.5 Framework using VS2015.
The minimum DNNPlatform version is 8.0.0

+

This release is compiled against the .Net 4.5 Framework using VS2015.
The minimum DNNPlatform version is 8.0.0 and this module has been teste up to Dnn 9.3.0

06.00.05

  • Source code dependencies are now pulled from Nuget
  • +
  • Replaced all deprecated API usages for Dnn 9.2 and up compatibility

06.00.04