From 73cc4b4e3ffe20197ea34fa04a27e6b514739f7c Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 18 Dec 2015 14:58:22 +0100 Subject: [PATCH] Web proj is building --- .../Editors/AuthenticationController.cs | 8 +- .../InstallSteps/DatabaseUpgradeStep.cs | 4 +- .../ThumbnailProvidersResolver.cs | 2 +- .../PropertyEditors/DecimalPropertyEditor.cs | 10 +++ .../FolderBrowserPropertyEditor.cs | 7 +- .../Identity/BackOfficeCookieManager.cs | 4 +- .../umbraco.presentation/content.cs | 90 +++---------------- .../umbraco/Trees/loadMemberTypes.cs | 3 +- src/UmbracoExamine/UmbracoMemberIndexer.cs | 2 + src/umbraco.cms/businesslogic/Dictionary.cs | 8 +- 10 files changed, 44 insertions(+), 94 deletions(-) diff --git a/src/Umbraco.Web/Editors/AuthenticationController.cs b/src/Umbraco.Web/Editors/AuthenticationController.cs index 53f777fdf9..e3a3005731 100644 --- a/src/Umbraco.Web/Editors/AuthenticationController.cs +++ b/src/Umbraco.Web/Editors/AuthenticationController.cs @@ -3,14 +3,12 @@ using System.Linq; using System.Net; using System.Net.Http; using System.Collections.Generic; -using System.Security.Claims; -using System.ServiceModel.Channels; using System.Threading.Tasks; using System.Web.Http; using AutoMapper; using Microsoft.AspNet.Identity; using Microsoft.Owin; -using Microsoft.Owin.Security; +using Umbraco.Core; using Umbraco.Web.Models; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Mvc; @@ -20,10 +18,8 @@ using Umbraco.Web.WebApi; using Umbraco.Web.WebApi.Filters; using Microsoft.AspNet.Identity.Owin; using Umbraco.Core.Logging; -using Newtonsoft.Json.Linq; -using Umbraco.Core.Models.Identity; +using Umbraco.Core.Configuration; using Umbraco.Web.Security.Identity; -using IUser = Umbraco.Core.Models.Membership.IUser; namespace Umbraco.Web.Editors { diff --git a/src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs b/src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs index dff79d07c7..b283b684dc 100644 --- a/src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs @@ -31,7 +31,9 @@ namespace Umbraco.Web.Install.InstallSteps { LogHelper.Info("Running 'Upgrade' service"); - var result = _applicationContext.DatabaseContext.UpgradeSchemaAndData(_applicationContext.Services.MigrationEntryService); + var result = _applicationContext.DatabaseContext.UpgradeSchemaAndData( + _applicationContext.Services.MigrationEntryService, + MigrationResolver.Current); if (result.Success == false) { diff --git a/src/Umbraco.Web/Media/ThumbnailProviders/ThumbnailProvidersResolver.cs b/src/Umbraco.Web/Media/ThumbnailProviders/ThumbnailProvidersResolver.cs index 34fee93fb0..e0aa2569c1 100644 --- a/src/Umbraco.Web/Media/ThumbnailProviders/ThumbnailProvidersResolver.cs +++ b/src/Umbraco.Web/Media/ThumbnailProviders/ThumbnailProvidersResolver.cs @@ -13,7 +13,7 @@ using umbraco.BusinessLogic.Utils; namespace Umbraco.Web.Media.ThumbnailProviders { - public sealed class ThumbnailProvidersResolver : ManyObjectsResolverBase + public sealed class ThumbnailProvidersResolver : ContainerManyObjectsResolver { /// /// Constructor diff --git a/src/Umbraco.Web/PropertyEditors/DecimalPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/DecimalPropertyEditor.cs index f636e8cdb2..1d5ac82ae4 100644 --- a/src/Umbraco.Web/PropertyEditors/DecimalPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/DecimalPropertyEditor.cs @@ -1,4 +1,5 @@ using Umbraco.Core; +using Umbraco.Core.Logging; using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors @@ -6,6 +7,13 @@ namespace Umbraco.Web.PropertyEditors [PropertyEditor(Constants.PropertyEditors.DecimalAlias, "Decimal", "decimal", "decimal", IsParameterEditor = true)] public class DecimalPropertyEditor : PropertyEditor { + /// + /// The constructor will setup the property editor based on the attribute if one is found + /// + public DecimalPropertyEditor(ILogger logger) : base(logger) + { + } + /// /// Overridden to ensure that the value is validated /// @@ -53,5 +61,7 @@ namespace Umbraco.Web.PropertyEditors }); } } + + } } \ No newline at end of file diff --git a/src/Umbraco.Web/PropertyEditors/FolderBrowserPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/FolderBrowserPropertyEditor.cs index 5a4e60d3c6..576012d52f 100644 --- a/src/Umbraco.Web/PropertyEditors/FolderBrowserPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/FolderBrowserPropertyEditor.cs @@ -13,6 +13,11 @@ namespace Umbraco.Web.PropertyEditors [PropertyEditor(Constants.PropertyEditors.FolderBrowserAlias, "(Obsolete) Folder Browser", "folderbrowser", HideLabel=true, Icon="icon-folder", Group="media")] public class FolderBrowserPropertyEditor : PropertyEditor { - + /// + /// The constructor will setup the property editor based on the attribute if one is found + /// + public FolderBrowserPropertyEditor(ILogger logger) : base(logger) + { + } } } \ No newline at end of file diff --git a/src/Umbraco.Web/Security/Identity/BackOfficeCookieManager.cs b/src/Umbraco.Web/Security/Identity/BackOfficeCookieManager.cs index 76bd80037c..b7e71a3f66 100644 --- a/src/Umbraco.Web/Security/Identity/BackOfficeCookieManager.cs +++ b/src/Umbraco.Web/Security/Identity/BackOfficeCookieManager.cs @@ -93,9 +93,7 @@ namespace Umbraco.Web.Security.Identity //check installer || request.Uri.IsInstallerRequest() //detect in preview - || (request.HasPreviewCookie() && request.Uri != null && request.Uri.AbsolutePath.StartsWith(IOHelper.ResolveUrl(SystemDirectories.Umbraco)) == false) - //check for base - || BaseRest.BaseRestHandler.IsBaseRestRequest(originalRequestUrl)) + || (request.HasPreviewCookie() && request.Uri != null && request.Uri.AbsolutePath.StartsWith(IOHelper.ResolveUrl(SystemDirectories.Umbraco)) == false)) { return true; } diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs index 23e44896f4..3a60cb0534 100644 --- a/src/Umbraco.Web/umbraco.presentation/content.cs +++ b/src/Umbraco.Web/umbraco.presentation/content.cs @@ -11,7 +11,6 @@ using umbraco.BusinessLogic; using umbraco.cms.businesslogic; using umbraco.cms.businesslogic.web; using umbraco.DataLayer; -using umbraco.presentation.nodeFactory; using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Configuration; @@ -23,7 +22,6 @@ using Umbraco.Web; using Umbraco.Web.PublishedCache.XmlPublishedCache; using Umbraco.Web.Scheduling; using File = System.IO.File; -using Node = umbraco.NodeFactory.Node; using Task = System.Threading.Tasks.Task; namespace umbraco @@ -198,28 +196,7 @@ namespace umbraco var attr = ((XmlElement)node).GetAttributeNode("sortOrder"); attr.Value = d.sortOrder.ToString(); xmlContentCopy = GetAddOrUpdateXmlNode(xmlContentCopy, d.Id, d.Level, parentId, node); - - // update sitemapprovider - if (updateSitemapProvider && SiteMap.Provider is UmbracoSiteMapProvider) - { - try - { - var prov = (UmbracoSiteMapProvider)SiteMap.Provider; - var n = new Node(d.Id, true); - if (string.IsNullOrEmpty(n.Url) == false && n.Url != "/#") - { - prov.UpdateNode(n); - } - else - { - LogHelper.Debug(string.Format("Can't update Sitemap Provider due to empty Url in node id: {0}", d.Id)); - } - } - catch (Exception ee) - { - LogHelper.Error(string.Format("Error adding node to Sitemap Provider in PublishNodeDo(): {0}", d.Id), ee); - } - } + } return xmlContentCopy; @@ -243,9 +220,7 @@ namespace umbraco /// The parent node identifier. public void SortNodes(int parentId) { - var childNodesXPath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema - ? "./node" - : "./* [@id]"; + var childNodesXPath = "./* [@id]"; using (var safeXml = GetSafeXmlWriter(false)) { @@ -422,13 +397,7 @@ namespace umbraco //SD: changed to fire event BEFORE running the sitemap!! argh. FireAfterClearDocumentCache(doc, e); - - // update sitemapprovider - if (SiteMap.Provider is UmbracoSiteMapProvider) - { - var prov = (UmbracoSiteMapProvider)SiteMap.Provider; - prov.RemoveNode(doc.Id); - } + } } @@ -624,37 +593,14 @@ order by umbracoNode.level, umbracoNode.sortOrder"; if (hierarchy.TryGetValue(parentId, out children)) { - XmlNode childContainer = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema || - String.IsNullOrEmpty(UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME) - ? parentNode - : parentNode.SelectSingleNode( - UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME); - - if (!UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema && - !String.IsNullOrEmpty(UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME)) - { - if (childContainer == null) - { - childContainer = xmlHelper.addTextNode(parentNode.OwnerDocument, - UmbracoSettings. - TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME, ""); - parentNode.AppendChild(childContainer); - } - } + XmlNode childContainer = parentNode; + foreach (int childId in children) { XmlNode childNode = nodeIndex[childId]; - if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema || - String.IsNullOrEmpty(UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME)) - { - parentNode.AppendChild(childNode); - } - else - { - childContainer.AppendChild(childNode); - } + parentNode.AppendChild(childNode); // Recursively build the content tree under the current child GenerateXmlDocument(hierarchy, nodeIndex, childId, childNode); @@ -717,13 +663,7 @@ order by umbracoNode.level, umbracoNode.sortOrder"; private static bool XmlIsImmutable { get { return UmbracoConfig.For.UmbracoSettings().Content.CloneXmlContent; } - } - - // whether to use the legacy schema - private static bool UseLegacySchema - { - get { return UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema; } - } + } // whether to keep version of everything (incl. medias & members) in cmsPreviewXml // for audit purposes - false by default, not in umbracoSettings.config @@ -969,22 +909,12 @@ order by umbracoNode.level, umbracoNode.sortOrder"; private static string ChildNodesXPath { - get - { - return UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema - ? "./node" - : "./* [@id]"; - } + get { return "./* [@id]"; } } private static string DataNodesXPath { - get - { - return UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema - ? "./data" - : "./* [not(@id)]"; - } + get { return "./* [not(@id)]"; } } #endregion @@ -1209,7 +1139,7 @@ order by umbracoNode.level, umbracoNode.sortOrder"; // if the document is not there already then it's a new document // we must make sure that its document type exists in the schema - if (currentNode == null && UseLegacySchema == false) + if (currentNode == null) { var xml2 = EnsureSchema(docNode.Name, xml); if (ReferenceEquals(xml, xml2) == false) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMemberTypes.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMemberTypes.cs index ce8aaeb9eb..1df977c746 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMemberTypes.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMemberTypes.cs @@ -1,4 +1,5 @@ -using System.Text; +using System; +using System.Text; using System.Xml; using Umbraco.Core.Security; using umbraco.businesslogic; diff --git a/src/UmbracoExamine/UmbracoMemberIndexer.cs b/src/UmbracoExamine/UmbracoMemberIndexer.cs index a65f42d562..319ec304b3 100644 --- a/src/UmbracoExamine/UmbracoMemberIndexer.cs +++ b/src/UmbracoExamine/UmbracoMemberIndexer.cs @@ -28,6 +28,7 @@ namespace UmbracoExamine { private readonly IMemberService _memberService; + private readonly IDataTypeService _dataTypeService; /// /// Default constructor @@ -36,6 +37,7 @@ namespace UmbracoExamine : base() { _memberService = ApplicationContext.Current.Services.MemberService; + _dataTypeService = ApplicationContext.Current.Services.DataTypeService; } /// diff --git a/src/umbraco.cms/businesslogic/Dictionary.cs b/src/umbraco.cms/businesslogic/Dictionary.cs index 676d3a12df..8e76122175 100644 --- a/src/umbraco.cms/businesslogic/Dictionary.cs +++ b/src/umbraco.cms/businesslogic/Dictionary.cs @@ -90,7 +90,13 @@ namespace umbraco.cms.businesslogic throw new ArgumentException("No id " + id + " exists in dictionary"); } } - + + [Obsolete("This is no longer used and will be removed from the codebase in future versions")] + public bool IsTopMostItem() + { + return _dictionaryItem.ParentId.HasValue == false; + } + /// /// Returns the parent. ///