From 079253b2f13786717bc0419e953346680e8608a9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 27 May 2025 07:04:08 +0000 Subject: [PATCH 1/3] Initial plan for issue From dea81ced599bdef9864fce57b0abbb5b6bb2d1fe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 27 May 2025 07:06:53 +0000 Subject: [PATCH 2/3] Implemented DNN 10.x Search Integration Co-authored-by: mitchelsellers <5659113+mitchelsellers@users.noreply.github.com> --- .../ExpandableTextHtmlModuleSearchBase.cs | 77 +++++++++++++++++++ ExpandableText/ExpandableTextHtml.csproj | 1 + .../ManifestAssets/ReleaseNotes.txt | 7 +- 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 ExpandableText/Components/ExpandableTextHtmlModuleSearchBase.cs diff --git a/ExpandableText/Components/ExpandableTextHtmlModuleSearchBase.cs b/ExpandableText/Components/ExpandableTextHtmlModuleSearchBase.cs new file mode 100644 index 0000000..1df557a --- /dev/null +++ b/ExpandableText/Components/ExpandableTextHtmlModuleSearchBase.cs @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2006-2024 IowaComputerGurus Inc (http://www.iowacomputergurus.com) + * Copyright Contact: webmaster@iowacomputergurus.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * 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 System.Collections.Generic; +using DotNetNuke.Entities.Modules; +using DotNetNuke.Services.Search.Entities; + +namespace ICG.Modules.ExpandableTextHtml.Components +{ + /// + /// Provides DNN search integration for Expandable Text/HTML module using the ModuleSearchBase approach + /// for DNN 10.x and beyond. + /// + public class ExpandableTextHtmlModuleSearchBase : ModuleSearchBase + { + /// + /// Gets the search documents for the module. + /// + /// The module information. + /// The begin date in UTC. + /// A collection of search documents. + public override IList GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDateUtc) + { + var searchDocuments = new List(); + var controller = new ExpandableTextHtmlController(); + + // Get all expandable text items for this module, ordered by last updated date + var items = controller.GetExpandableTextHtmls(moduleInfo.ModuleID, "ORDER BY LastUpdated"); + + foreach (var item in items) + { + // Only include items that have been updated since the begin date + if (item.LastUpdated.ToUniversalTime() >= beginDateUtc) + { + var searchDoc = new SearchDocument + { + UniqueKey = $"ETH_{moduleInfo.ModuleID}_{item.ItemId}", + PortalId = moduleInfo.PortalID, + TabId = moduleInfo.TabID, + ModuleId = moduleInfo.ModuleID, + ModuleDefId = moduleInfo.ModuleDefID, + Title = item.Title, + Body = item.Body, + Description = item.Title, + ModifiedTimeUtc = item.LastUpdated.ToUniversalTime(), + AuthorUserId = -1, // Default author as system since we don't track the author in this module + IsActive = true, // Assuming all items are active + CultureCode = moduleInfo.CultureCode, + Keywords = string.Empty // No specific keywords for this module + }; + + searchDocuments.Add(searchDoc); + } + } + + return searchDocuments; + } + } +} \ No newline at end of file diff --git a/ExpandableText/ExpandableTextHtml.csproj b/ExpandableText/ExpandableTextHtml.csproj index dd3c848..ebf91db 100644 --- a/ExpandableText/ExpandableTextHtml.csproj +++ b/ExpandableText/ExpandableTextHtml.csproj @@ -84,6 +84,7 @@ + diff --git a/ExpandableText/ManifestAssets/ReleaseNotes.txt b/ExpandableText/ManifestAssets/ReleaseNotes.txt index 610564f..42a9ef8 100644 --- a/ExpandableText/ManifestAssets/ReleaseNotes.txt +++ b/ExpandableText/ManifestAssets/ReleaseNotes.txt @@ -1,4 +1,9 @@ -

Version 06.01.00 - April 21st, 2012

+

Version 06.02.00 - [Current Date]

+
    +
  • Added support for DNN 10.x Search Integration using ModuleSearchBase
  • +
+ +

Version 06.01.00 - April 21st, 2012

  • Resolved issues installing to SQL Azure
  • Updated module to support proper installation if a failure occured during initial install
  • From eb2cc195ab346cabf09b91214745e680a43e784a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 27 May 2025 07:30:57 +0000 Subject: [PATCH 3/3] Moved search implementation into ExpandableTextHtmlController Co-authored-by: mitchelsellers <5659113+mitchelsellers@users.noreply.github.com> --- .../ExpandableTextHtmlController.cs | 49 +++++++++++- .../ExpandableTextHtmlModuleSearchBase.cs | 77 ------------------- ExpandableText/ExpandableTextHtml.csproj | 1 - 3 files changed, 48 insertions(+), 79 deletions(-) delete mode 100644 ExpandableText/Components/ExpandableTextHtmlModuleSearchBase.cs diff --git a/ExpandableText/Components/ExpandableTextHtmlController.cs b/ExpandableText/Components/ExpandableTextHtmlController.cs index 47187ef..33fad0b 100644 --- a/ExpandableText/Components/ExpandableTextHtmlController.cs +++ b/ExpandableText/Components/ExpandableTextHtmlController.cs @@ -25,13 +25,14 @@ using DotNetNuke.Common; using DotNetNuke.Common.Utilities; using DotNetNuke.Entities.Modules; +using DotNetNuke.Services.Search.Entities; namespace ICG.Modules.ExpandableTextHtml.Components { /// /// This is the controller class providing functionality to the module /// - public class ExpandableTextHtmlController : IPortable + public class ExpandableTextHtmlController : ModuleSearchBase, IPortable { #region Public Methods @@ -123,6 +124,52 @@ public void DeleteExpandableTextHtml(int moduleId, int itemId) //#endregion + #region ModuleSearchBase Members + + /// + /// Gets the search documents for the module. + /// + /// The module information. + /// The begin date in UTC. + /// A collection of search documents. + public override IList GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDateUtc) + { + var searchDocuments = new List(); + + // Get all expandable text items for this module, ordered by last updated date + var items = GetExpandableTextHtmls(moduleInfo.ModuleID, "ORDER BY LastUpdated"); + + foreach (var item in items) + { + // Only include items that have been updated since the begin date + if (item.LastUpdated.ToUniversalTime() >= beginDateUtc) + { + var searchDoc = new SearchDocument + { + UniqueKey = $"ETH_{moduleInfo.ModuleID}_{item.ItemId}", + PortalId = moduleInfo.PortalID, + TabId = moduleInfo.TabID, + ModuleId = moduleInfo.ModuleID, + ModuleDefId = moduleInfo.ModuleDefID, + Title = item.Title, + Body = item.Body, + Description = item.Title, + ModifiedTimeUtc = item.LastUpdated.ToUniversalTime(), + AuthorUserId = -1, // Default author as system since we don't track the author in this module + IsActive = true, // Assuming all items are active + CultureCode = moduleInfo.CultureCode, + Keywords = string.Empty // No specific keywords for this module + }; + + searchDocuments.Add(searchDoc); + } + } + + return searchDocuments; + } + + #endregion + #region IPortable Members ///// diff --git a/ExpandableText/Components/ExpandableTextHtmlModuleSearchBase.cs b/ExpandableText/Components/ExpandableTextHtmlModuleSearchBase.cs deleted file mode 100644 index 1df557a..0000000 --- a/ExpandableText/Components/ExpandableTextHtmlModuleSearchBase.cs +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2006-2024 IowaComputerGurus Inc (http://www.iowacomputergurus.com) - * Copyright Contact: webmaster@iowacomputergurus.com - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or substantial - * portions of the Software. - * - * 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 System.Collections.Generic; -using DotNetNuke.Entities.Modules; -using DotNetNuke.Services.Search.Entities; - -namespace ICG.Modules.ExpandableTextHtml.Components -{ - /// - /// Provides DNN search integration for Expandable Text/HTML module using the ModuleSearchBase approach - /// for DNN 10.x and beyond. - /// - public class ExpandableTextHtmlModuleSearchBase : ModuleSearchBase - { - /// - /// Gets the search documents for the module. - /// - /// The module information. - /// The begin date in UTC. - /// A collection of search documents. - public override IList GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDateUtc) - { - var searchDocuments = new List(); - var controller = new ExpandableTextHtmlController(); - - // Get all expandable text items for this module, ordered by last updated date - var items = controller.GetExpandableTextHtmls(moduleInfo.ModuleID, "ORDER BY LastUpdated"); - - foreach (var item in items) - { - // Only include items that have been updated since the begin date - if (item.LastUpdated.ToUniversalTime() >= beginDateUtc) - { - var searchDoc = new SearchDocument - { - UniqueKey = $"ETH_{moduleInfo.ModuleID}_{item.ItemId}", - PortalId = moduleInfo.PortalID, - TabId = moduleInfo.TabID, - ModuleId = moduleInfo.ModuleID, - ModuleDefId = moduleInfo.ModuleDefID, - Title = item.Title, - Body = item.Body, - Description = item.Title, - ModifiedTimeUtc = item.LastUpdated.ToUniversalTime(), - AuthorUserId = -1, // Default author as system since we don't track the author in this module - IsActive = true, // Assuming all items are active - CultureCode = moduleInfo.CultureCode, - Keywords = string.Empty // No specific keywords for this module - }; - - searchDocuments.Add(searchDoc); - } - } - - return searchDocuments; - } - } -} \ No newline at end of file diff --git a/ExpandableText/ExpandableTextHtml.csproj b/ExpandableText/ExpandableTextHtml.csproj index ebf91db..dd3c848 100644 --- a/ExpandableText/ExpandableTextHtml.csproj +++ b/ExpandableText/ExpandableTextHtml.csproj @@ -84,7 +84,6 @@ -