From 3c46b5675a98cf0871a041c5517799ebf504f083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C3=A7=20Masanas?= Date: Sat, 19 Oct 2013 09:41:04 +0200 Subject: [PATCH 1/5] DNN-3862 All page properties should be copied when copying a page DNN-3865 Page settings do not save start date Modified the logic in page management so when a page is copied a clone of previous page is use as the base for the new one. Removed minimum value for start date so date is preserved when editing take place after start date --- .../Admin/Tabs/ManageTabs.ascx.cs | Bin 166242 -> 165856 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Website/DesktopModules/Admin/Tabs/ManageTabs.ascx.cs b/Website/DesktopModules/Admin/Tabs/ManageTabs.ascx.cs index 140010a959985a34280ef70012543acef322afb4..2e01d84574d99f26b223997ceb731b1feeaa5ee8 100644 GIT binary patch delta 792 zcmbtSUr19?7(d@>TrRh987AW9W!*$1)21v6k#)DsbT-i$HX?>h(M(%w(~V+Ehzd%9 z$-e49uRYXDV{oP0qYn}$6!R&ts3k#vsIf;MqB?gW^ceJTIOlhMzwi6b_x;XJMk?Hq za+7wJp8y#>%CHgs1Wv%LBI8%bF0*|HE4D4Pviu9Ez?>3d#S>7)e12%<8juP$rKqU*GPrk(|X&4^IPE)Rf*<-dV1(=KDFM$@y3=Ek+YAV&HGbOwjZ`*KiY{t7N%Izy{a z>U)ZjpEk@!1s0Bjq+9z39c;G1bEah~<919&TeOMAeN@8UsNWRp*=Q}`+7%Bfu^>|| z^oSWCXFiJhcFbkPNZN+Vv>P{i>dNxn>4E*&GB02>V6~@6ylhR1oAbval??G|jWGBC z4fd;LFhs^UsdDKMcX5={N!$uFV6Iuz2No>?Ke%yr(SyaVHe8u&*9*%zH%1yAddK>v z16v{rs+$w~>ig#+E*;&$-j{+t_vP8CeJb&?L>_7|_@vs1HNxHcjMsv$*X8HabB=k{c~gtAM&8zfQ8E=5ne?!9Ng%{rnTjjtGzyJ1Eqkaa z+n0S25oQGyA)q*u#uf7=+cJ*6uOd%DJ2!Hy6GAyC`L&OMDn1_WPceZJIwGR!i z37h7gSh757%?cpL^ z8`sM9acy}2IVs5L=JsLhLsEpECye6HsbV&TQbn!nP|06~`K%{Fd@%)1f@r$^+; zj7VVCEV2$7n5`7#$e&PY_-{|M^92PBkaOj+^T-Tue-OhEj*}b}jL*flIHv@fK0J*hoB9BEr>{ zVbn*678;suFy3-pVMef!H4{`SWhm8CJH%#r6g0F9!Y}QL{xn(Wy=|u{3h6}wCi-;v zc!t=(d&&k^hOJC53nnDuS)!)L>qnU~_uS@!I_@A_lq!R|G9TMXI}@Xal5O~HGjWa1 zQ3w3^VpME7)LFHB1(!WoyONeD?CTs>H(<oP)O f(E?JN3sap`P! Date: Sat, 19 Oct 2013 11:30:59 +0200 Subject: [PATCH 2/5] DNN-3285 GroupPendingNotification urls do not work --- .../Library/Security/Roles/RoleInfo.cs | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/DNN Platform/Library/Security/Roles/RoleInfo.cs b/DNN Platform/Library/Security/Roles/RoleInfo.cs index 08b382a464f..402c8adeaa2 100644 --- a/DNN Platform/Library/Security/Roles/RoleInfo.cs +++ b/DNN Platform/Library/Security/Roles/RoleInfo.cs @@ -40,6 +40,7 @@ using DotNetNuke.Security.Roles.Internal; using DotNetNuke.Services.FileSystem; using DotNetNuke.Services.Tokens; +using System.Web; #endregion @@ -359,7 +360,7 @@ public virtual void Fill(IDataReader dr) AutoAssignment = Null.SetNullBoolean(dr["AutoAssignment"]); RSVPCode = Null.SetNullString(dr["RSVPCode"]); IconFile = Null.SetNullString(dr["IconFile"]); - + //New properties may not be present if called before 6.2 Upgrade has been executed try { @@ -404,8 +405,8 @@ public virtual void Fill(IDataReader dr) IsSystemRole = Null.SetNullBoolean(dr["IsSystemRole"]); } } - - + + } catch (IndexOutOfRangeException) { @@ -487,7 +488,7 @@ public string GetProperty(string propertyName, string format, CultureInfo format case "datecreated": return PropertyAccess.FormatString(CreatedOnDate.ToString(), format); case "photourl": - return PropertyAccess.FormatString(PhotoURL, format); + return PropertyAccess.FormatString(FormatUrl(PhotoURL), format); case "stat_status": return PropertyAccess.FormatString(GetString("stat_status", string.Empty), format); case "stat_photo": @@ -495,7 +496,7 @@ public string GetProperty(string propertyName, string format, CultureInfo format case "stat_file": return PropertyAccess.FormatString(GetString("stat_file", string.Empty), format); case "url": - return PropertyAccess.FormatString(GetString("URL", string.Empty), format); + return PropertyAccess.FormatString(FormatUrl(GetString("URL", string.Empty)), format); case "issystemrole": return PropertyAccess.Boolean2LocalizedYesNo(IsSystemRole, formatProvider); case "grouptype": @@ -511,9 +512,6 @@ public string GetProperty(string propertyName, string format, CultureInfo format propertyNotFound = true; return string.Empty; } - - - } #endregion @@ -643,7 +641,7 @@ public void ReadXml(XmlReader reader) case "both": SecurityMode = SecurityMode.Both; break; - } + } break; case "status": switch (reader.ReadElementContentAsString()) @@ -755,5 +753,15 @@ private string GetString(string keyName, string defaultValue) return defaultValue; } + + private string FormatUrl(string url) + { + if (url.StartsWith("/") && HttpContext.Current != null) + { + //server absolute path + return Globals.AddHTTP(HttpContext.Current.Request.Url.Host) + url; + } + return url; + } } } \ No newline at end of file From 8d652e5c0e2c780ab5de016af10feb8ed6d2ce73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C3=A7=20Masanas?= Date: Sat, 19 Oct 2013 18:50:28 +0200 Subject: [PATCH 3/5] DNN-3864 Not able to edit page with start date in the future Add logic to process inactive pages (due to start / end date) the same way as disabled pages so they be opened in page settings. --- .../Entities/Urls/TabIndexController.cs | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/DNN Platform/Library/Entities/Urls/TabIndexController.cs b/DNN Platform/Library/Entities/Urls/TabIndexController.cs index e08ba316a2a..e83f99e4b55 100644 --- a/DNN Platform/Library/Entities/Urls/TabIndexController.cs +++ b/DNN Platform/Library/Entities/Urls/TabIndexController.cs @@ -213,8 +213,10 @@ private static void AddCustomRedirectsToDictionary(SharedDictionary DateTime.MinValue) || + (tab.StartDate > DateTime.Now && tab.StartDate > DateTime.MinValue)) { string settingsUrl = tabPath + "/ctl/Tab"; string settingsRewritePath = CreateRewritePath(tab.TabID, redirect.CultureCode, "ctl=Tab"); @@ -329,11 +331,11 @@ private static void AddPermanentRedirectToDictionary(SharedDictionary tabIndex, + private static void AddSiteRootRedirects(PathSizes pathSizes, + SharedDictionary tabIndex, IEnumerable chosenAliases, - bool hasSiteRootRedirect, - Dictionary dupCheck, + bool hasSiteRootRedirect, + Dictionary dupCheck, ICollection usingHttpAliases) { foreach (PortalAliasInfo alias in chosenAliases) //and that is once per portal alias per portal @@ -451,8 +453,8 @@ private static int AddTabToTabDict(SharedDictionary tabIndex, //for deleted, expired or pages not enabled yet, direct to the home page if the setting is enabled //534 : tab is disabled, mark as deleted (don't want to cause duplicate tab warnings) bool isDeleted = (tab.IsDeleted || tab.DisableLink || - (tab.EndDate < DateTime.Now && tab.EndDate > DateTime.MinValue) || - (tab.StartDate > DateTime.Now && tab.StartDate > DateTime.MinValue)); + (tab.EndDate < DateTime.Now && tab.EndDate > DateTime.MinValue) || + (tab.StartDate > DateTime.Now && tab.StartDate > DateTime.MinValue)); if (isDeleted) // don't care what setting is, redirect code will decide whether to redirect or 404 - just mark as page deleted && // settings.DeletedTabHandlingValue == DeletedTabHandlingTypes.Do301RedirectToPortalHome) @@ -579,8 +581,10 @@ private static int AddTabToTabDict(SharedDictionary tabIndex, isDeleted); } - //594 : disabled / external url pages cannot navigate to settings page - if (tab.DisableLink || !string.IsNullOrEmpty(tab.Url)) + // disabled / not active by date / external url pages cannot navigate to settings page + if (tab.DisableLink || !string.IsNullOrEmpty(tab.Url) || + (tab.EndDate < DateTime.Now && tab.EndDate > DateTime.MinValue) || + (tab.StartDate > DateTime.Now && tab.StartDate > DateTime.MinValue)) { string settingsUrl = tabPath.Replace("//", "/") + "/ctl/Tab"; string settingsRewritePath = CreateRewritePath(tab.TabID, "", "ctl=tab"); @@ -825,7 +829,7 @@ private static void AddToTabDict(SharedDictionary tabIndex, { DupKeyCheck foundTAb = dupCheckDict[dupKey]; if ((foundTAb.IsDeleted == false && isDeleted == false) //found is not deleted, this tab is not deleted - && keyDupAction == UrlEnums.TabKeyPreference.TabOK + && keyDupAction == UrlEnums.TabKeyPreference.TabOK && foundTAb.TabIdOriginal != "-1") //-1 tabs are login, register, privacy etc { @@ -1296,11 +1300,11 @@ private static void GetAliasFromSettings(int portalId, } } - private static string ManageCustomAliases(string tabCulture, - PortalInfo thisPortal, - TabInfo tab, + private static string ManageCustomAliases(string tabCulture, + PortalInfo thisPortal, + TabInfo tab, List httpAliases, - List customHttpAliasesUsed, + List customHttpAliasesUsed, out bool customAliasUsed) { string customHttpAlias = ""; @@ -1529,7 +1533,7 @@ internal static PortalAliasInfo GetPortalAliasByPortal(int portalId, string port bool foundAlias = false; //Do a specified PortalAlias check first - PortalAliasInfo portalAliasInfo = portalAliasCollection.SingleOrDefault(a => a.HTTPAlias ==portalAlias.ToLower()); + PortalAliasInfo portalAliasInfo = portalAliasCollection.SingleOrDefault(a => a.HTTPAlias == portalAlias.ToLower()); if (portalAliasInfo != null) { if (portalAliasInfo.PortalID == portalId) @@ -1646,7 +1650,7 @@ public static void InvalidateDictionary(string reason, PageIndexData rebuildData //add log entry for cache clearance var elc = new EventLogController(); - var logValue = new LogInfo {LogTypeKey = "HOST_ALERT"}; + var logValue = new LogInfo { LogTypeKey = "HOST_ALERT" }; try { //817 : not clearing items correctly from dictionary From 68e74bc483194692cfe8071949b377320fb70d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C3=A7=20Masanas?= Date: Sat, 30 Nov 2013 12:43:48 +0100 Subject: [PATCH 4/5] DNN-4238 SQLModule missing localization options --- .../SQL/App_LocalResources/SQL.ascx.resx | 33 +++++++++++++++++++ Website/DesktopModules/Admin/SQL/sql.ascx | 15 +++++++++ 2 files changed, 48 insertions(+) diff --git a/Website/DesktopModules/Admin/SQL/App_LocalResources/SQL.ascx.resx b/Website/DesktopModules/Admin/SQL/App_LocalResources/SQL.ascx.resx index 7fad30e750f..9e45d1f4dc2 100644 --- a/Website/DesktopModules/Admin/SQL/App_LocalResources/SQL.ascx.resx +++ b/Website/DesktopModules/Admin/SQL/App_LocalResources/SQL.ascx.resx @@ -249,4 +249,37 @@ SQL Query Result + + First + + + Showing _START_ to _END_ of _TOTAL_ entries + + + (filtered from _MAX_ total entries) + + + Last + + + Show _MENU_ entries + + + Loading... + + + Next + + + Previous + + + Processing... + + + Search: + + + Showing 0 to 0 of 0 entries + \ No newline at end of file diff --git a/Website/DesktopModules/Admin/SQL/sql.ascx b/Website/DesktopModules/Admin/SQL/sql.ascx index 438a152c189..837675be143 100644 --- a/Website/DesktopModules/Admin/SQL/sql.ascx +++ b/Website/DesktopModules/Admin/SQL/sql.ascx @@ -156,6 +156,21 @@ } }--%> ] + }, + oLanguage: { + "sInfo": "<%=Localization.GetSafeJSString(LocalizeString("sInfo"))%>", + "sInfoFiltered": "<%=Localization.GetSafeJSString(LocalizeString("sInfoFiltered"))%>", + "sInfoEmpty": "<%=Localization.GetSafeJSString(LocalizeString("sInfoEmpty"))%>", + "sLengthMenu": "<%=Localization.GetSafeJSString(LocalizeString("sLengthMenu"))%>", + "sLoadingRecords": "<%=Localization.GetSafeJSString(LocalizeString("sLoadingRecords"))%>", + "sProcessing": "<%=Localization.GetSafeJSString(LocalizeString("sProcessing"))%>", + "sSearch": "<%=Localization.GetSafeJSString(LocalizeString("sSearch"))%>", + "oPaginate": { + "sFirst": "<%=Localization.GetSafeJSString(LocalizeString("sFirst"))%>", + "sLast": "<%=Localization.GetSafeJSString(LocalizeString("sLast"))%>", + "sNext": "<%=Localization.GetSafeJSString(LocalizeString("sNext"))%>", + "sPrevious": "<%=Localization.GetSafeJSString(LocalizeString("sPrevious"))%>" + } } }); //new FixedHeader(oTable); From d470a5ffbd92621382cd54fe6ba1898c104a5d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C3=A7=20Masanas?= Date: Sat, 30 Nov 2013 16:08:07 +0100 Subject: [PATCH 5/5] DNN-21481 Add alternate link w/ "hreflang" to sitemap.aspx for multilingual websites --- .../Services/Sitemap/CoreSitemapProvider.cs | 49 ++++++++++++++++++- .../Services/Sitemap/SitemapBuilder.cs | 13 +++++ .../Library/Services/Sitemap/SitemapUrl.cs | 13 +++-- 3 files changed, 70 insertions(+), 5 deletions(-) diff --git a/DNN Platform/Library/Services/Sitemap/CoreSitemapProvider.cs b/DNN Platform/Library/Services/Sitemap/CoreSitemapProvider.cs index aebc26b05e6..043fe3286ff 100644 --- a/DNN Platform/Library/Services/Sitemap/CoreSitemapProvider.cs +++ b/DNN Platform/Library/Services/Sitemap/CoreSitemapProvider.cs @@ -126,6 +126,51 @@ private SitemapUrl GetPageUrl(TabInfo objTab, string language) } pageUrl.ChangeFrequency = SitemapChangeFrequency.Daily; + // support for alternate pages: https://support.google.com/webmasters/answer/2620865?hl=en + if (ps.ContentLocalizationEnabled && !objTab.IsNeutralCulture) + { + List alternates = new List(); + TabInfo currentTab = objTab; + + if (!objTab.IsDefaultLanguage) + currentTab = objTab.DefaultLanguageTab; + + foreach (TabInfo localized in currentTab.LocalizedTabs.Values) + { + if ((!localized.IsDeleted && !localized.DisableLink && localized.TabType == TabType.Normal) && + (Null.IsNull(localized.StartDate) || localized.StartDate < DateTime.Now) && + (Null.IsNull(localized.EndDate) || localized.EndDate > DateTime.Now) && + (IsTabPublic(localized.TabPermissions)) && + (includeHiddenPages || localized.IsVisible)) + { + string alternateUrl = Globals.NavigateURL(localized.TabID, localized.IsSuperTab, ps, "", localized.CultureCode); + + if (alternateUrl.ToLower().IndexOf(portalAlias.ToLower(), StringComparison.Ordinal) == -1) + { + // code to fix a bug in dnn5.1.2 for navigateurl + if ((HttpContext.Current != null)) + { + alternateUrl = Globals.AddHTTP(HttpContext.Current.Request.Url.Host + alternateUrl); + } + else + { + // try to use the portalalias + alternateUrl = Globals.AddHTTP(portalAlias.ToLower()) + alternateUrl; + } + } + alternates.Add(new AlternateUrl() { Url = alternateUrl, Language = localized.CultureCode }); + } + } + + if (alternates.Count > 0) + { + // add self to the list + alternates.Add(new AlternateUrl() { Url = pageUrl.Url, Language = objTab.CultureCode }); + + pageUrl.AlternateUrls = alternates; + } + } + return pageUrl; } @@ -150,7 +195,7 @@ protected float GetPriority(TabInfo objTab) } else { - priority = Convert.ToSingle(1 - (objTab.Level*0.1)); + priority = Convert.ToSingle(1 - (objTab.Level * 0.1)); } if (priority < minPagePriority) @@ -173,7 +218,7 @@ public virtual bool IsTabPublic(TabPermissionCollection objTabPermissions) if ((roles != null)) { // permissions strings are encoded with Deny permissions at the beginning and Grant permissions at the end for optimal performance - foreach (string role in roles.Split(new[] {';'})) + foreach (string role in roles.Split(new[] { ';' })) { if (!string.IsNullOrEmpty(role)) { diff --git a/DNN Platform/Library/Services/Sitemap/SitemapBuilder.cs b/DNN Platform/Library/Services/Sitemap/SitemapBuilder.cs index 3c7693539c6..5e5a0a96b18 100644 --- a/DNN Platform/Library/Services/Sitemap/SitemapBuilder.cs +++ b/DNN Platform/Library/Services/Sitemap/SitemapBuilder.cs @@ -220,6 +220,7 @@ private void WriteSitemap(bool cached, TextWriter output, int index, List AlternateUrls { get; set; } + } + + public class AlternateUrl + { + public string Language { get; set; } + + public string Url { get; set; } } } \ No newline at end of file