diff --git a/src/Umbraco.Core/IO/MasterPageHelper.cs b/src/Umbraco.Core/IO/MasterPageHelper.cs index 9560274b63..4870c7449a 100644 --- a/src/Umbraco.Core/IO/MasterPageHelper.cs +++ b/src/Umbraco.Core/IO/MasterPageHelper.cs @@ -7,6 +7,7 @@ using System.Text.RegularExpressions; using Umbraco.Core.Models; using Umbraco.Core.Persistence.Repositories; using Umbraco.Core.Services; +using Umbraco.Core.Xml; namespace Umbraco.Core.IO { @@ -341,7 +342,7 @@ namespace Umbraco.Core.IO return masterTemplate; } - private static string GetMasterContentElement(ITemplate template) + internal static string GetMasterContentElement(ITemplate template) { if (template.MasterTemplateAlias.IsNullOrWhiteSpace() == false) { @@ -355,96 +356,96 @@ namespace Umbraco.Core.IO } - //internal static string EnsureMasterPageSyntax(string templateAlias, string masterPageContent) - //{ - // ReplaceElement(ref masterPageContent, "?UMBRACO_GETITEM", "umbraco:Item", true); - // ReplaceElement(ref masterPageContent, "?UMBRACO_GETITEM", "umbraco:Item", false); + internal static string EnsureMasterPageSyntax(string templateAlias, string masterPageContent) + { + ReplaceElement(ref masterPageContent, "?UMBRACO_GETITEM", "umbraco:Item", true); + ReplaceElement(ref masterPageContent, "?UMBRACO_GETITEM", "umbraco:Item", false); - // // Parse the design for macros - // ReplaceElement(ref masterPageContent, "?UMBRACO_MACRO", "umbraco:Macro", true); - // ReplaceElement(ref masterPageContent, "?UMBRACO_MACRO", "umbraco:Macro", false); + // Parse the design for macros + ReplaceElement(ref masterPageContent, "?UMBRACO_MACRO", "umbraco:Macro", true); + ReplaceElement(ref masterPageContent, "?UMBRACO_MACRO", "umbraco:Macro", false); - // // Parse the design for load childs - // masterPageContent = masterPageContent.Replace("", CreateDefaultPlaceHolder(templateAlias)) - // .Replace("", CreateDefaultPlaceHolder(templateAlias)); - // // Parse the design for aspnet forms - // GetAspNetMasterPageForm(ref masterPageContent, templateAlias); - // masterPageContent = masterPageContent.Replace("", ""); - // // Parse the design for aspnet heads - // masterPageContent = masterPageContent.Replace("", String.Format("", templateAlias.Replace(" ", ""))); - // masterPageContent = masterPageContent.Replace("", ""); - // return masterPageContent; - //} + // Parse the design for load childs + masterPageContent = masterPageContent.Replace("", CreateDefaultPlaceHolder(templateAlias)) + .Replace("", CreateDefaultPlaceHolder(templateAlias)); + // Parse the design for aspnet forms + GetAspNetMasterPageForm(ref masterPageContent, templateAlias); + masterPageContent = masterPageContent.Replace("", ""); + // Parse the design for aspnet heads + masterPageContent = masterPageContent.Replace("", String.Format("", templateAlias.Replace(" ", ""))); + masterPageContent = masterPageContent.Replace("", ""); + return masterPageContent; + } - //private static void GetAspNetMasterPageForm(ref string design, string templateAlias) - //{ - // var formElement = Regex.Match(design, GetElementRegExp("?ASPNET_FORM", false), RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); + private static void GetAspNetMasterPageForm(ref string design, string templateAlias) + { + var formElement = Regex.Match(design, GetElementRegExp("?ASPNET_FORM", false), RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); - // if (string.IsNullOrEmpty(formElement.Value) == false) - // { - // string formReplace = String.Format("
", templateAlias.Replace(" ", "")); - // if (formElement.Groups.Count == 0) - // { - // formReplace += ""; - // } - // design = design.Replace(formElement.Value, formReplace); - // } - //} + if (string.IsNullOrEmpty(formElement.Value) == false) + { + string formReplace = String.Format("", templateAlias.Replace(" ", "")); + if (formElement.Groups.Count == 0) + { + formReplace += ""; + } + design = design.Replace(formElement.Value, formReplace); + } + } - //private static string CreateDefaultPlaceHolder(string templateAlias) - //{ - // return String.Format("", templateAlias.Replace(" ", "")); - //} + private static string CreateDefaultPlaceHolder(string templateAlias) + { + return String.Format("", templateAlias.Replace(" ", "")); + } - //private static void ReplaceElement(ref string design, string elementName, string newElementName, bool checkForQuotes) - //{ - // var m = - // Regex.Matches(design, GetElementRegExp(elementName, checkForQuotes), - // RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); + private static void ReplaceElement(ref string design, string elementName, string newElementName, bool checkForQuotes) + { + var m = + Regex.Matches(design, GetElementRegExp(elementName, checkForQuotes), + RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); - // foreach (Match match in m) - // { - // GroupCollection groups = match.Groups; + foreach (Match match in m) + { + GroupCollection groups = match.Groups; - // // generate new element (compensate for a closing trail on single elements ("/")) - // string elementAttributes = groups[1].Value; - // // test for macro alias - // if (elementName == "?UMBRACO_MACRO") - // { - // var tags = XmlHelper.GetAttributesFromElement(match.Value); - // if (tags["macroAlias"] != null) - // elementAttributes = String.Format(" Alias=\"{0}\"", tags["macroAlias"]) + elementAttributes; - // else if (tags["macroalias"] != null) - // elementAttributes = String.Format(" Alias=\"{0}\"", tags["macroalias"]) + elementAttributes; - // } - // string newElement = "<" + newElementName + " runat=\"server\" " + elementAttributes.Trim() + ">"; - // if (elementAttributes.EndsWith("/")) - // { - // elementAttributes = elementAttributes.Substring(0, elementAttributes.Length - 1); - // } - // else if (groups[0].Value.StartsWith(""; + // generate new element (compensate for a closing trail on single elements ("/")) + string elementAttributes = groups[1].Value; + // test for macro alias + if (elementName == "?UMBRACO_MACRO") + { + var tags = XmlHelper.GetAttributesFromElement(match.Value); + if (tags["macroAlias"] != null) + elementAttributes = String.Format(" Alias=\"{0}\"", tags["macroAlias"]) + elementAttributes; + else if (tags["macroalias"] != null) + elementAttributes = String.Format(" Alias=\"{0}\"", tags["macroalias"]) + elementAttributes; + } + string newElement = "<" + newElementName + " runat=\"server\" " + elementAttributes.Trim() + ">"; + if (elementAttributes.EndsWith("/")) + { + elementAttributes = elementAttributes.Substring(0, elementAttributes.Length - 1); + } + else if (groups[0].Value.StartsWith(""; - // if (checkForQuotes) - // { - // // if it's inside quotes, we'll change element attribute quotes to single quotes - // newElement = newElement.Replace("\"", "'"); - // newElement = String.Format("\"{0}\"", newElement); - // } - // design = design.Replace(match.Value, newElement); - // } - //} + if (checkForQuotes) + { + // if it's inside quotes, we'll change element attribute quotes to single quotes + newElement = newElement.Replace("\"", "'"); + newElement = String.Format("\"{0}\"", newElement); + } + design = design.Replace(match.Value, newElement); + } + } - //private static string GetElementRegExp(string elementName, bool checkForQuotes) - //{ - // if (checkForQuotes) - // return String.Format("\"<[^>\\s]*\\b{0}(\\b[^>]*)>\"", elementName); - // else - // return String.Format("<[^>\\s]*\\b{0}(\\b[^>]*)>", elementName); + private static string GetElementRegExp(string elementName, bool checkForQuotes) + { + if (checkForQuotes) + return String.Format("\"<[^>\\s]*\\b{0}(\\b[^>]*)>\"", elementName); + else + return String.Format("<[^>\\s]*\\b{0}(\\b[^>]*)>", elementName); - //} + } } } \ No newline at end of file diff --git a/src/Umbraco.Core/XmlExtensions.cs b/src/Umbraco.Core/XmlExtensions.cs index 8707523615..0f2239dbe7 100644 --- a/src/Umbraco.Core/XmlExtensions.cs +++ b/src/Umbraco.Core/XmlExtensions.cs @@ -209,15 +209,15 @@ namespace Umbraco.Core ///// ///// ///// - //public static XmlNode ToXmlElement(this XContainer xElement) - //{ - // var xmlDocument = new XmlDocument(); - // using (var xmlReader = xElement.CreateReader()) - // { - // xmlDocument.Load(xmlReader); - // } - // return xmlDocument.DocumentElement; - //} + public static XmlNode ToXmlElement(this XContainer xElement) + { + var xmlDocument = new XmlDocument(); + using (var xmlReader = xElement.CreateReader()) + { + xmlDocument.Load(xmlReader); + } + return xmlDocument.DocumentElement; + } /// /// Converts from an XmlElement to an XElement diff --git a/src/Umbraco.Tests/CoreThings/UdiTests.cs b/src/Umbraco.Tests/CoreThings/UdiTests.cs index b99129788d..411803bdd1 100644 --- a/src/Umbraco.Tests/CoreThings/UdiTests.cs +++ b/src/Umbraco.Tests/CoreThings/UdiTests.cs @@ -10,18 +10,6 @@ namespace Umbraco.Tests.CoreThings [TestFixture] public class UdiTests { - void foo() - { - var frenchContent = contentCache.Get(1234, "fr-FR"); - var mobileFrenchContent = contentCache.Get(1234, "fr-FR", "mobile"); - - var group = frenchContent.GetVariantGroup(); - - var defaultCulture = group.DefaultCulture; // CultureInfo - var cultures = group.GetCultures(); // CultureInfo[] - var segments = group.GetSegments("fr-FR"); // string[] - - } [Test] public void StringEntityCtorTest() { diff --git a/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs b/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs index f254028ceb..0b6c4ae310 100644 --- a/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs +++ b/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs @@ -1,10 +1,6 @@ using System; using System.Linq; -using Umbraco.Core.Configuration; using Umbraco.Core.Models; -using umbraco; -using umbraco.cms.businesslogic.web; -using Umbraco.Core.Cache; using Umbraco.Core.Services.Changes; namespace Umbraco.Web.Cache @@ -254,18 +250,6 @@ namespace Umbraco.Web.Cache dc.RefreshByJson(MacroCacheRefresher.UniqueId, MacroCacheRefresher.Serialize(macro)); } - public static void RefreshMacroCache(this DistributedCache dc, global::umbraco.cms.businesslogic.macro.Macro macro) - { - if (macro == null) return; - dc.RefreshByJson(MacroCacheRefresher.UniqueId, MacroCacheRefresher.Serialize(macro)); - } - - public static void RemoveMacroCache(this DistributedCache dc, global::umbraco.cms.businesslogic.macro.Macro macro) - { - if (macro == null) return; - dc.RefreshByJson(MacroCacheRefresher.UniqueId, MacroCacheRefresher.Serialize(macro)); - } - #endregion #region Content/Media/Member type cache @@ -340,18 +324,6 @@ namespace Umbraco.Web.Cache dc.Remove(LanguageCacheRefresher.UniqueId, language.Id); } - public static void RefreshLanguageCache(this DistributedCache dc, global::umbraco.cms.businesslogic.language.Language language) - { - if (language == null) return; - dc.Refresh(LanguageCacheRefresher.UniqueId, language.id); - } - - public static void RemoveLanguageCache(this DistributedCache dc, global::umbraco.cms.businesslogic.language.Language language) - { - if (language == null) return; - dc.Remove(LanguageCacheRefresher.UniqueId, language.id); - } - #endregion #region Relation type cache diff --git a/src/Umbraco.Web/Cache/MacroCacheRefresher.cs b/src/Umbraco.Web/Cache/MacroCacheRefresher.cs index 1ec9ec7866..301a3e6ce8 100644 --- a/src/Umbraco.Web/Cache/MacroCacheRefresher.cs +++ b/src/Umbraco.Web/Cache/MacroCacheRefresher.cs @@ -6,7 +6,6 @@ using umbraco; using Umbraco.Core.Persistence.Repositories; using System.Linq; using Newtonsoft.Json; -using Macro = umbraco.cms.businesslogic.macro.Macro; namespace Umbraco.Web.Cache { diff --git a/src/Umbraco.Web/CacheHelperExtensions.cs b/src/Umbraco.Web/CacheHelperExtensions.cs index 1b0451a999..e10852e9f0 100644 --- a/src/Umbraco.Web/CacheHelperExtensions.cs +++ b/src/Umbraco.Web/CacheHelperExtensions.cs @@ -3,8 +3,6 @@ using System.Web; using System.Web.Caching; using System.Web.Mvc; using System.Web.Mvc.Html; -using Umbraco.Core; -using umbraco.cms.businesslogic.web; using Umbraco.Core.Cache; namespace Umbraco.Web diff --git a/src/Umbraco.Web/Dictionary/UmbracoCultureDictionary.cs b/src/Umbraco.Web/Dictionary/UmbracoCultureDictionary.cs index 75433d6a2a..5cdb787f73 100644 --- a/src/Umbraco.Web/Dictionary/UmbracoCultureDictionary.cs +++ b/src/Umbraco.Web/Dictionary/UmbracoCultureDictionary.cs @@ -1,13 +1,7 @@ using System; using System.Collections.Generic; -using System.Dynamic; using System.Globalization; using System.Linq; -using System.Web; -using Umbraco.Core.Logging; -using umbraco.cms.businesslogic; -using umbraco.cms.businesslogic.language; -using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Models; using Umbraco.Core.Services; diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index dcf1eb3249..9416129547 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -21,7 +21,6 @@ using Umbraco.Web.Mvc; using Umbraco.Web.WebApi; using Umbraco.Web.WebApi.Binders; using Umbraco.Web.WebApi.Filters; -using umbraco.cms.businesslogic.web; using Umbraco.Core.Persistence.Querying; using Umbraco.Web.PublishedCache; using Constants = Umbraco.Core.Constants; diff --git a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs index 2e0b176061..5c6c1f93eb 100644 --- a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs +++ b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs @@ -11,15 +11,12 @@ using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Core.Exceptions; using Umbraco.Core.IO; -using Umbraco.Core.Logging; -using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; -using Umbraco.Core.Profiling; using Umbraco.Web.Composing; using Umbraco.Web.Models; using Umbraco.Web.Mvc; +using Umbraco.Web.Security; using Constants = Umbraco.Core.Constants; -using Member = umbraco.cms.businesslogic.member.Member; namespace Umbraco.Web { @@ -101,7 +98,8 @@ namespace Umbraco.Web } if (cacheByMember) { - var currentMember = Member.GetCurrentMember(); + var helper = new MembershipHelper(Current.UmbracoContext); + var currentMember = helper.GetCurrentMember(); cacheKey.AppendFormat("m{0}-", currentMember == null ? 0 : currentMember.Id); } if (contextualKeyBuilder != null) diff --git a/src/Umbraco.Web/Macros/PartialViewMacroController.cs b/src/Umbraco.Web/Macros/PartialViewMacroController.cs index c5133126ef..3eeedd05f7 100644 --- a/src/Umbraco.Web/Macros/PartialViewMacroController.cs +++ b/src/Umbraco.Web/Macros/PartialViewMacroController.cs @@ -1,9 +1,6 @@ -using System.Collections.Generic; using System.Web.Mvc; -using Umbraco.Core.Models; using Umbraco.Web.Models; using Umbraco.Web.Mvc; -using umbraco.cms.businesslogic.macro; using System.Linq; using Umbraco.Core.Models.PublishedContent; diff --git a/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs b/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs index af5f440d09..992581df47 100644 --- a/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs +++ b/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs @@ -1,12 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; using System.Web.WebPages; -using umbraco.cms.businesslogic.macro; -using Umbraco.Core.Models; using Umbraco.Web.Mvc; using Umbraco.Core; using Umbraco.Core.Models.PublishedContent; diff --git a/src/Umbraco.Web/Macros/UserControlMacroEngine.cs b/src/Umbraco.Web/Macros/UserControlMacroEngine.cs index acdf2b69da..790425f649 100644 --- a/src/Umbraco.Web/Macros/UserControlMacroEngine.cs +++ b/src/Umbraco.Web/Macros/UserControlMacroEngine.cs @@ -19,7 +19,7 @@ namespace Umbraco.Web.Macros // ensure the file exists var path = IOHelper.FindFile(filename); if (File.Exists(IOHelper.MapPath(path)) == false) - throw new UmbracoException($"Failed to load control, file {filename} does not exist."); + throw new Exception($"Failed to load control, file {filename} does not exist."); // load the control var control = (UserControl)new UserControl().LoadControl(path); diff --git a/src/Umbraco.Web/Macros/XsltMacroEngine.cs b/src/Umbraco.Web/Macros/XsltMacroEngine.cs index 9fa85d9bd6..10fd6b5305 100644 --- a/src/Umbraco.Web/Macros/XsltMacroEngine.cs +++ b/src/Umbraco.Web/Macros/XsltMacroEngine.cs @@ -10,13 +10,11 @@ using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; using umbraco; -using umbraco.cms.businesslogic.macro; using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Configuration; using Umbraco.Core.IO; using Umbraco.Core.Logging; -using Umbraco.Core.Macros; using Umbraco.Core.Xml.XPath; using Umbraco.Web.Composing; using Umbraco.Web.Templates; diff --git a/src/Umbraco.Web/Models/ContentExtensions.cs b/src/Umbraco.Web/Models/ContentExtensions.cs index b778cfc00e..382a7bbdf8 100644 --- a/src/Umbraco.Web/Models/ContentExtensions.cs +++ b/src/Umbraco.Web/Models/ContentExtensions.cs @@ -1,8 +1,6 @@ using System; using System.Globalization; using System.Linq; -using umbraco.cms.businesslogic.web; -using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Services; using Umbraco.Web.Composing; diff --git a/src/Umbraco.Web/Models/ProfileModel.cs b/src/Umbraco.Web/Models/ProfileModel.cs index a7b36e50ab..d7910d2481 100644 --- a/src/Umbraco.Web/Models/ProfileModel.cs +++ b/src/Umbraco.Web/Models/ProfileModel.cs @@ -2,16 +2,8 @@ using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using System.Linq; using System.Web; using System.Web.Mvc; -using System.Xml; -using System.Xml.Linq; -using umbraco.cms.businesslogic.member; -using Umbraco.Core; -using Umbraco.Core.Models; -using Umbraco.Core.Models.PublishedContent; -using Umbraco.Web.PublishedCache; using Umbraco.Web.Security; namespace Umbraco.Web.Models diff --git a/src/Umbraco.Web/Mvc/MemberAuthorizeAttribute.cs b/src/Umbraco.Web/Mvc/MemberAuthorizeAttribute.cs index c23bf77913..517fc9efdb 100644 --- a/src/Umbraco.Web/Mvc/MemberAuthorizeAttribute.cs +++ b/src/Umbraco.Web/Mvc/MemberAuthorizeAttribute.cs @@ -1,11 +1,7 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Web; using System.Web.Mvc; -using System.Web.Security; -using Umbraco.Web.Security; -using umbraco.cms.businesslogic.member; using AuthorizeAttribute = System.Web.Mvc.AuthorizeAttribute; using Umbraco.Core; using Umbraco.Web.Composing; diff --git a/src/Umbraco.Web/PublishedCache/NuCache/FacadeService.cs b/src/Umbraco.Web/PublishedCache/NuCache/FacadeService.cs index 0b35f45336..0f1559edcf 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/FacadeService.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/FacadeService.cs @@ -29,9 +29,6 @@ using Umbraco.Web.PublishedCache.NuCache.DataSource; using Umbraco.Web.PublishedCache.XmlPublishedCache; using Umbraco.Web.Routing; using Database = Umbraco.Web.PublishedCache.NuCache.DataSource.Database; -#pragma warning disable 618 -using Content = umbraco.cms.businesslogic.Content; -#pragma warning restore 618 namespace Umbraco.Web.PublishedCache.NuCache { @@ -197,11 +194,6 @@ namespace Umbraco.Web.PublishedCache.NuCache ContentTypeService.UowRefreshedEntity += OnContentTypeRefreshedEntity; MediaTypeService.UowRefreshedEntity+= OnMediaTypeRefreshedEntity; MemberTypeService.UowRefreshedEntity += OnMemberTypeRefreshedEntity; - - // temp - until we get rid of Content -#pragma warning disable 618 - Content.DeletedContent += OnDeletedContent; -#pragma warning restore 618 } public class Options @@ -1096,15 +1088,6 @@ namespace Umbraco.Web.PublishedCache.NuCache }); } -#pragma warning disable 618 - private static void OnDeletedContent(object sender, Content.ContentDeleteEventArgs args) -#pragma warning restore 618 - { - var db = args.Database; - var parms = new { @nodeId = args.Id }; - db.Execute("DELETE FROM cmsContentNu WHERE nodeId=@nodeId", parms); - } - private void OnContentTypeRefreshedEntity(IContentTypeService sender, ContentTypeChange.EventArgs args) { const ContentTypeChangeTypes types // only for those that have been refreshed diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs index d6875b5a1e..90c5705d7d 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs @@ -25,7 +25,6 @@ using Umbraco.Core.Xml; using Umbraco.Web.Cache; using Umbraco.Web.Composing; using Umbraco.Web.Scheduling; -using Content = umbraco.cms.businesslogic.Content; using File = System.IO.File; using Task = System.Threading.Tasks.Task; @@ -47,7 +46,6 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache private XmlStoreFilePersister _persisterTask; private volatile bool _released; private bool _withRepositoryEvents; - private bool _withOtherEvents; private readonly IFacadeAccessor _facadeAccessor; private readonly PublishedContentTypeCache _contentTypeCache; @@ -172,7 +170,6 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache InitializeRepositoryEvents(); if (testing) return; - InitializeOtherEvents(); // not so soon! if eg installing we may not be able to load content yet // so replace this by LazyInitializeContent() called in Xml ppty getter @@ -202,14 +199,6 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache _withRepositoryEvents = true; } - private void InitializeOtherEvents() - { - // temp - until we get rid of Content - Content.DeletedContent += OnDeletedContent; - - _withOtherEvents = true; - } - private void ClearEvents() { ContentRepository.UowRemovingEntity -= OnContentRemovingEntity; @@ -226,10 +215,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache MediaTypeService.UowRefreshedEntity -= OnMediaTypeRefreshedEntity; MemberTypeService.UowRefreshedEntity -= OnMemberTypeRefreshedEntity; - Content.DeletedContent -= OnDeletedContent; - _withRepositoryEvents = false; - _withOtherEvents = false; } private void LazyInitializeContent() @@ -1032,9 +1018,6 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; draftChanged = true; // by default - we don't track drafts publishedChanged = false; - if (_withOtherEvents == false) - return; - // process all changes on one xml clone using (var safeXml = GetSafeXmlWriter()) { @@ -1647,14 +1630,6 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; }); } - private static void OnDeletedContent(object sender, Content.ContentDeleteEventArgs args) - { - var db = args.Database; - var parms = new { @nodeId = args.Id }; - db.Execute("DELETE FROM cmsPreviewXml WHERE nodeId=@nodeId", parms); - db.Execute("DELETE FROM cmsContentXml WHERE nodeId=@nodeId", parms); - } - private void OnContentTypeRefreshedEntity(IContentTypeService sender, ContentTypeChange.EventArgs args) { const ContentTypeChangeTypes types // only for those that have been refreshed diff --git a/src/Umbraco.Web/Routing/DefaultUrlProvider.cs b/src/Umbraco.Web/Routing/DefaultUrlProvider.cs index 34df76b504..f88379ae16 100644 --- a/src/Umbraco.Web/Routing/DefaultUrlProvider.cs +++ b/src/Umbraco.Web/Routing/DefaultUrlProvider.cs @@ -1,14 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading; - -using Umbraco.Core; -using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Core.Logging; -using Umbraco.Web.PublishedCache; -using umbraco.cms.businesslogic.web; namespace Umbraco.Web.Routing { diff --git a/src/Umbraco.Web/Templates/TemplateRenderer.cs b/src/Umbraco.Web/Templates/TemplateRenderer.cs index 1c8d4ef9f2..29c46b49ae 100644 --- a/src/Umbraco.Web/Templates/TemplateRenderer.cs +++ b/src/Umbraco.Web/Templates/TemplateRenderer.cs @@ -10,7 +10,6 @@ using Umbraco.Web.Models; using Umbraco.Web.Mvc; using Umbraco.Web.Routing; using umbraco; -using umbraco.cms.businesslogic.language; using Umbraco.Core.Configuration; using Umbraco.Core.Services; using LightInject; @@ -78,10 +77,10 @@ namespace Umbraco.Web.Templates //set the culture to the same as is currently rendering if (_umbracoContext.PublishedContentRequest == null) { - var defaultLanguage = Language.GetAllAsList().FirstOrDefault(); + var defaultLanguage = Current.Services.LocalizationService.GetAllLanguages().FirstOrDefault(); contentRequest.Culture = defaultLanguage == null ? CultureInfo.CurrentUICulture - : new CultureInfo(defaultLanguage.CultureAlias); + : defaultLanguage.CultureInfo; } else { diff --git a/src/Umbraco.Web/Trees/ApplicationTreeExtensions.cs b/src/Umbraco.Web/Trees/ApplicationTreeExtensions.cs index ac96b2a188..b804c16ed1 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeExtensions.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeExtensions.cs @@ -1,12 +1,8 @@ using System; -using System.Collections.Generic; -using System.Globalization; using System.Linq; using System.Management.Instrumentation; using System.Net.Http; using System.Net.Http.Formatting; -using System.Text; -using System.Threading; using System.Threading.Tasks; using System.Web.Http; using System.Web.Http.Controllers; @@ -16,7 +12,6 @@ using Umbraco.Core; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi; -using umbraco.BusinessLogic; using umbraco.cms.presentation.Trees; using Umbraco.Core.Composing; using Current = Umbraco.Web.Composing.Current; diff --git a/src/Umbraco.Web/UI/Controls/InsertMacroSplitButton.cs b/src/Umbraco.Web/UI/Controls/InsertMacroSplitButton.cs index 3da45d85b1..bf44fa1944 100644 --- a/src/Umbraco.Web/UI/Controls/InsertMacroSplitButton.cs +++ b/src/Umbraco.Web/UI/Controls/InsertMacroSplitButton.cs @@ -1,16 +1,9 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Text; using System.Web.Mvc; using System.Web.UI; -using System.Web.UI.HtmlControls; using ClientDependency.Core; -using Umbraco.Core.Configuration; using Umbraco.Core.IO; -using Umbraco.Core.Models; -using Umbraco.Core.Models.Rdbms; -using umbraco.DataLayer; using Umbraco.Web.Composing; namespace Umbraco.Web.UI.Controls diff --git a/src/Umbraco.Web/UI/Pages/UmbracoEnsuredPage.cs b/src/Umbraco.Web/UI/Pages/UmbracoEnsuredPage.cs index c0735ef27e..dfc7986620 100644 --- a/src/Umbraco.Web/UI/Pages/UmbracoEnsuredPage.cs +++ b/src/Umbraco.Web/UI/Pages/UmbracoEnsuredPage.cs @@ -3,7 +3,6 @@ using System.Security; using System.Web; using Umbraco.Core.IO; using Umbraco.Core.Logging; -using umbraco.BusinessLogic; using Umbraco.Core; using Umbraco.Core.Security; using Umbraco.Web.Composing; diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 0c06891c2b..8e632fc4f9 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -107,15 +107,6 @@ Umbraco.Core - - umbraco.controls - - - umbraco.cms - - - umbraco.datalayer - @@ -999,9 +990,26 @@ + + + + + + + + + + + + + + + + + @@ -1012,6 +1020,20 @@ + + + + + + + + + + + + + + @@ -1680,6 +1702,7 @@ Settings1.Designer.cs + diff --git a/src/Umbraco.Web/WebApi/MemberAuthorizeAttribute.cs b/src/Umbraco.Web/WebApi/MemberAuthorizeAttribute.cs index 1ea7be719c..b8ec7e6a34 100644 --- a/src/Umbraco.Web/WebApi/MemberAuthorizeAttribute.cs +++ b/src/Umbraco.Web/WebApi/MemberAuthorizeAttribute.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.Http; -using Umbraco.Web.Security; -using umbraco.cms.businesslogic.member; using Umbraco.Core; namespace Umbraco.Web.WebApi diff --git a/src/Umbraco.Web/WebServices/SaveFileController.cs b/src/Umbraco.Web/WebServices/SaveFileController.cs index a7365c20a4..3eab6c67b1 100644 --- a/src/Umbraco.Web/WebServices/SaveFileController.cs +++ b/src/Umbraco.Web/WebServices/SaveFileController.cs @@ -8,7 +8,6 @@ using Umbraco.Web.Mvc; using System.Collections.Generic; using umbraco.cms.presentation.Trees; using Umbraco.Core; -using Template = umbraco.cms.businesslogic.template.Template; namespace Umbraco.Web.WebServices { @@ -127,71 +126,72 @@ namespace Umbraco.Web.WebServices return Success(Services.TextService.Localize("speechBubbles/partialViewSavedText"), Services.TextService.Localize("speechBubbles/partialViewSavedHeader"), new { name = currentView.Name, path = currentView.Path }); } - /// - /// Saves a template - /// - /// - /// - /// - /// - /// - /// - [HttpPost] - public JsonResult SaveTemplate(string templateName, string templateAlias, string templateContents, int templateId, int masterTemplateId) - { - //TODO: Change this over to use the new API - Also this will be migrated to a TemplateEditor or ViewEditor when it's all moved to angular + // fixme - remove code + ///// + ///// Saves a template + ///// + ///// + ///// + ///// + ///// + ///// + ///// + //[HttpPost] + //public JsonResult SaveTemplate(string templateName, string templateAlias, string templateContents, int templateId, int masterTemplateId) + //{ + // //TODO: Change this over to use the new API - Also this will be migrated to a TemplateEditor or ViewEditor when it's all moved to angular - Template t; - bool pathChanged = false; - try - { - t = new Template(templateId) - { - Text = templateName.CleanForXss('[', ']', '(', ')', ':'), - Alias = templateAlias.CleanForXss('[', ']', '(', ')', ':'), - Design = templateContents - }; + // Template t; + // bool pathChanged = false; + // try + // { + // t = new Template(templateId) + // { + // Text = templateName.CleanForXss('[', ']', '(', ')', ':'), + // Alias = templateAlias.CleanForXss('[', ']', '(', ')', ':'), + // Design = templateContents + // }; - //check if the master page has changed - we need to normalize both - if it's 0 or -1, then make it 0... this is easy - // to do with Math.Max - if (Math.Max(t.MasterTemplate, 0) != Math.Max(masterTemplateId, 0)) - { - t.MasterTemplate = Math.Max(masterTemplateId, 0); - pathChanged = true; - } - } - catch (ArgumentException ex) - { - //the template does not exist - return Failed("Template does not exist", Services.TextService.Localize("speechBubbles/templateErrorHeader"), ex); - } + // //check if the master page has changed - we need to normalize both - if it's 0 or -1, then make it 0... this is easy + // // to do with Math.Max + // if (Math.Max(t.MasterTemplate, 0) != Math.Max(masterTemplateId, 0)) + // { + // t.MasterTemplate = Math.Max(masterTemplateId, 0); + // pathChanged = true; + // } + // } + // catch (ArgumentException ex) + // { + // //the template does not exist + // return Failed("Template does not exist", Services.TextService.Localize("speechBubbles/templateErrorHeader"), ex); + // } - try - { - t.Save(); + // try + // { + // t.Save(); - //ensure the correct path is synced as the parent might have been changed - // http://issues.umbraco.org/issue/U4-2300 - if (pathChanged) - { - //need to re-look it up - t = new Template(templateId); - } - var syncPath = "-1,init," + t.Path.Replace("-1,", ""); + // //ensure the correct path is synced as the parent might have been changed + // // http://issues.umbraco.org/issue/U4-2300 + // if (pathChanged) + // { + // //need to re-look it up + // t = new Template(templateId); + // } + // var syncPath = "-1,init," + t.Path.Replace("-1,", ""); - return Success(Services.TextService.Localize("speechBubbles/templateSavedText"), Services.TextService.Localize("speechBubbles/templateSavedHeader"), - new - { - path = syncPath, - contents = t.Design, - alias = t.Alias // might have been updated! - }); - } - catch (Exception ex) - { - return Failed(Services.TextService.Localize("speechBubbles/templateErrorText"), Services.TextService.Localize("speechBubbles/templateErrorHeader"), ex); - } - } + // return Success(Services.TextService.Localize("speechBubbles/templateSavedText"), Services.TextService.Localize("speechBubbles/templateSavedHeader"), + // new + // { + // path = syncPath, + // contents = t.Design, + // alias = t.Alias // might have been updated! + // }); + // } + // catch (Exception ex) + // { + // return Failed(Services.TextService.Localize("speechBubbles/templateErrorText"), Services.TextService.Localize("speechBubbles/templateErrorHeader"), ex); + // } + //} //[HttpPost] //public JsonResult SaveXslt(string fileName, string oldName, string fileContents, bool ignoreDebugging) diff --git a/src/Umbraco.Web/_Legacy/BusinessLogic/Task.cs b/src/Umbraco.Web/_Legacy/BusinessLogic/Task.cs new file mode 100644 index 0000000000..7ea72815df --- /dev/null +++ b/src/Umbraco.Web/_Legacy/BusinessLogic/Task.cs @@ -0,0 +1,264 @@ +using System; +using Umbraco.Core.Composing; +using Umbraco.Core.Models.EntityBase; +using Umbraco.Core.Models.Membership; + +namespace Umbraco.Web._Legacy.BusinessLogic +{ + /// + /// An umbraco task is currently only used with the translation workflow in umbraco. But is extendable to cover other taskbased system as well. + /// A task represent a simple job, it will always be assigned to a user, related to a node, and contain a comment about the task. + /// The user attached to the task can complete the task, and the author of the task can reopen tasks that are not complete correct. + /// + /// Tasks can in umbraco be used for setting up simple workflows, and contains basic controls structures to determine if the task is completed or not. + /// + [Obsolete("Use Umbraco.Core.Service.ITaskService instead")] + public class Task + { + #region Properties + + public Umbraco.Core.Models.Task TaskEntity { get; } + + /// + /// Gets or sets the id. + /// + /// The id. + public int Id + { + get { return TaskEntity.Id; } + set + { + TaskEntity.Id = value; + _entityEntity = null; + } + } + + /// + /// Gets or sets a value indicating whether this is closed. + /// + /// true if closed; otherwise, false. + public bool Closed + { + get { return TaskEntity.Closed; } + set { TaskEntity.Closed = value; } + } + + /* + private CMSNode _node; + + /// + /// Gets or sets the node. + /// + /// The node. + public CMSNode Node + { + get { return _node ?? (_node = new CMSNode(TaskEntity.EntityId)); } + set + { + _node = value; + TaskEntity.EntityId = value.Id; + } + } + */ + + private IUmbracoEntity _entityEntity; + + public IUmbracoEntity TaskEntityEntity => _entityEntity ?? (_entityEntity = Current.Services.EntityService.Get(TaskEntity.EntityId)); + + private TaskType _type; + + /// + /// Gets or sets the type. + /// + /// The type. + public TaskType Type + { + get { return _type ?? (_type = new TaskType(TaskEntity.TaskType)); } + set + { + _type = value; + TaskEntity.TaskType = new Umbraco.Core.Models.TaskType(_type.Alias) + { + Id = _type.Id + }; + } + } + + + private IUser _parentUser; + + /// + /// Gets or sets the parent user. + /// + /// The parent user. + public IUser ParentUser + { + get { return _parentUser ?? (_parentUser = Current.Services.UserService.GetUserById(TaskEntity.OwnerUserId)); } + set + { + _parentUser = value; + TaskEntity.OwnerUserId = _parentUser.Id; + } + } + + /// + /// Gets or sets the comment. + /// + /// The comment. + public string Comment + { + get { return TaskEntity.Comment; } + set { TaskEntity.Comment = value; } + } + + /// + /// Gets or sets the date. + /// + /// The date. + public DateTime Date + { + get { return TaskEntity.CreateDate; } + set { TaskEntity.CreateDate = value; } + } + + private IUser _user; + + /// + /// Gets or sets the user. + /// + /// The user. + public IUser User + { + get { return _user ?? (_user = Current.Services.UserService.GetUserById(TaskEntity.AssigneeUserId)); } + set + { + _user = value; + TaskEntity.AssigneeUserId = _user.Id; + } + } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public Task() + { } + + internal Task(Umbraco.Core.Models.Task task) + { + TaskEntity = task; + } + + /// + /// Initializes a new instance of the class. + /// + /// The task id. + public Task(int TaskId) + { + TaskEntity = Current.Services.TaskService.GetTaskById(TaskId); + if (TaskEntity == null) throw new NullReferenceException("No task found with id " + TaskId); + } + + #endregion + + #region Public Methods + + /// + /// Deletes the current task. + /// Generally tasks should not be deleted and closed instead. + /// + public void Delete() + { + Current.Services.TaskService.Delete(TaskEntity); + } + + /// + /// Saves this instance. + /// + public void Save() + { + Current.Services.TaskService.Save(TaskEntity); + } + + #endregion + + #region static methods + + /// + /// Returns all tasks by type + /// + /// + /// + public static Tasks GetTasksByType(int taskType) + { + var foundTaskType = Current.Services.TaskService.GetTaskTypeById(taskType); + if (foundTaskType == null) return null; + + var result = new Tasks(); + var tasks = Current.Services.TaskService.GetTasks(taskTypeAlias: foundTaskType.Alias); + foreach (var task in tasks) + { + result.Add(new Task(task)); + } + + return result; + } + + /// + /// Get all tasks assigned to a node + /// + /// + /// + public static Tasks GetTasks(int nodeId) + { + var result = new Tasks(); + var tasks = Current.Services.TaskService.GetTasks(itemId:nodeId); + foreach (var task in tasks) + { + result.Add(new Task(task)); + } + + return result; + } + + /// + /// Retrieves a collection of open tasks assigned to the user + /// + /// The User who have the tasks assigned + /// If true both open and closed tasks will be returned + /// A collections of tasks + public static Tasks GetTasks(IUser User, bool IncludeClosed) + { + var result = new Tasks(); + var tasks = Current.Services.TaskService.GetTasks(assignedUser:User.Id, includeClosed:IncludeClosed); + foreach (var task in tasks) + { + result.Add(new Task(task)); + } + + return result; + } + + /// + /// Retrieves a collection of open tasks assigned to the user + /// + /// The User who have the tasks assigned + /// If true both open and closed tasks will be returned + /// A collections of tasks + public static Tasks GetOwnedTasks(IUser User, bool IncludeClosed) + { + var result = new Tasks(); + var tasks = Current.Services.TaskService.GetTasks(ownerUser:User.Id, includeClosed: IncludeClosed); + foreach (var task in tasks) + { + result.Add(new Task(task)); + } + return result; + } + + #endregion + } +} diff --git a/src/Umbraco.Web/_Legacy/BusinessLogic/TaskType.cs b/src/Umbraco.Web/_Legacy/BusinessLogic/TaskType.cs new file mode 100644 index 0000000000..abdc4af264 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/BusinessLogic/TaskType.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Umbraco.Core.Composing; + + +namespace Umbraco.Web._Legacy.BusinessLogic +{ + [Obsolete("Use Umbraco.Core.Service.ITaskService instead")] + public class TaskType + { + internal Umbraco.Core.Models.TaskType TaskTypeEntity; + + #region Public Properties + + public int Id + { + get { return TaskTypeEntity.Id; } + set { TaskTypeEntity.Id = value; } + } + + public string Alias + { + get { return TaskTypeEntity.Alias; } + set { TaskTypeEntity.Alias = value; } + } + + /// + /// All tasks associated with this task type + /// + public Tasks Tasks + { + get + { + //lazy load the tasks + if (_tasks == null) + { + _tasks = Task.GetTasksByType(this.Id); + } + return _tasks; + } + } + + #endregion + + #region Private/protected members + + private Tasks _tasks; + + #endregion + + #region Constructors + + internal TaskType(Umbraco.Core.Models.TaskType tt) + { + TaskTypeEntity = tt; + } + + public TaskType() + { + } + + public TaskType(string TypeAlias) + { + TaskTypeEntity = Current.Services.TaskService.GetTaskTypeByAlias(TypeAlias); + if (TaskTypeEntity == null) throw new NullReferenceException("No task type found by alias " + TypeAlias); + } + + public TaskType(int TaskTypeId) + { + TaskTypeEntity = Current.Services.TaskService.GetTaskTypeById(TaskTypeId); + if (TaskTypeEntity == null) throw new NullReferenceException("No task type found by alias " + TaskTypeId); + } + #endregion + + #region Public methods + + public void Save() + { + Current.Services.TaskService.Save(TaskTypeEntity); + } + + /// + /// Deletes the current task type. + /// This will remove all tasks associated with this type + /// + public void Delete() + { + Current.Services.TaskService.Delete(TaskTypeEntity); + } + + #endregion + + #region Static methods + /// + /// Returns all task types stored in the database + /// + /// + public static IEnumerable GetAll() + { + return Current.Services.TaskService.GetAllTaskTypes() + .Select(x => new TaskType(x)); + } + #endregion + + } +} diff --git a/src/Umbraco.Web/_Legacy/BusinessLogic/Tasks.cs b/src/Umbraco.Web/_Legacy/BusinessLogic/Tasks.cs new file mode 100644 index 0000000000..2b5cc09662 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/BusinessLogic/Tasks.cs @@ -0,0 +1,28 @@ +using System.Collections; + +namespace Umbraco.Web._Legacy.BusinessLogic +{ + /// + /// A collection of tasks. + /// + public class Tasks : CollectionBase + { + /// + /// Adds the specified new task. + /// + /// The new task. + public virtual void Add(Task NewTask) + { + this.List.Add(NewTask); + } + + /// + /// Gets the at the specified index. + /// + /// + public virtual Task this[int Index] + { + get { return (Task)this.List[Index]; } + } + } +} diff --git a/src/Umbraco.Web/_Legacy/Controls/BaseTreePicker.cs b/src/Umbraco.Web/_Legacy/Controls/BaseTreePicker.cs new file mode 100644 index 0000000000..7de4b9d4e0 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Controls/BaseTreePicker.cs @@ -0,0 +1,309 @@ +using System; +using System.Web.UI; +using ClientDependency.Core; +using ClientDependency.Core.Controls; +using System.Web.UI.WebControls; +using System.Web.UI.HtmlControls; +using umbraco.cms.businesslogic; +using Umbraco.Core; +using Umbraco.Core.Composing; +using Umbraco.Core.Services; + +namespace Umbraco.Web._Legacy.Controls +{ + + /* + [ClientDependency(0, ClientDependencyType.Javascript, "Application/NamespaceManager.js", "UmbracoClient")] + [ClientDependency(ClientDependencyType.Css, "modal/style.css", "UmbracoClient")] + [ClientDependency(ClientDependencyType.Javascript, "modal/modal.js", "UmbracoClient")] + [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoClientManager.js", "UmbracoClient")] + [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoUtils.js", "UmbracoClient")]*/ + + [ValidationProperty("Value")] + public abstract class BaseTreePicker : Control, INamingContainer + { + + protected HiddenField ItemIdValue; + protected HtmlAnchor DeleteLink; + protected HtmlAnchor ChooseLink; + protected HtmlGenericControl ItemTitle; + protected HtmlGenericControl ButtonContainer; + protected HtmlGenericControl RootContainer; + + public BaseTreePicker() + { + ShowDelete = true; + ModalHeight = 400; + ModalWidth = 300; + ShowHeader = true; + } + + /// + /// Wraps the hidden vield value + /// + public string Value + { + get + { + EnsureChildControls(); + return ItemIdValue.Value; + } + set + { + EnsureChildControls(); + ItemIdValue.Value = value; + } + } + + public int ModalWidth { get; set; } + public int ModalHeight { get; set; } + public bool ShowDelete { get; set; } + public bool ShowHeader { get; set; } + + /// + /// Need to specify the tree picker url (iframe) + /// + public abstract string TreePickerUrl { get; } + + /// + /// The title to specify for the picker window + /// + public abstract string ModalWindowTitle { get; } + + /// + /// If item has been selected or stored, this will query the db for its title + /// + protected virtual string GetItemTitle() + { + if (!string.IsNullOrEmpty(ItemIdValue.Value)) + { + try + { + return Current.Services.EntityService.Get(int.Parse(ItemIdValue.Value)).Name; + } + catch (ArgumentException) { /*the node does not exist! we will ignore*/ } + } + return ""; + } + + /// + /// Just like GetItemTitle, except returns the full path (breadcrumbs) of the node + /// + protected virtual string GetItemBreadcrumbs() + { + if (!string.IsNullOrEmpty(ItemIdValue.Value)) + { + try + { + int nodeId = -1; + if (int.TryParse(ItemIdValue.Value, out nodeId)) + { + var n = Current.Services.EntityService.Get(nodeId); + string title = n.Name; + string separator = " > "; + while (n.Level > 1) + { + n = Current.Services.EntityService.Get(n.ParentId); + title = n.Name + separator + title; + } + return title; + } + else + { + return ItemIdValue.Value; + } + + } + catch (ArgumentException) { /*the node does not exist! we will ignore*/ } + } + return ""; + } + + /// + /// Outputs the JavaScript instances used to make this control work + /// + protected virtual string GetJSScript() + { + /* 0 = this control's client id + * 1 = label + * 2 = itemIdValueClientID + * 3 = itemTitleClientID + * 4 = itemPickerUrl + * 5 = popup width + * 6 = popup height + * 7 = show header + * 8 = umbraco path + */ + return string.Format(@" + var mc_{0} = new Umbraco.Controls.TreePicker('{0}','{1}','{2}','{3}','{4}',{5},{6},{7},'{8}');", + new string[] + { + this.ClientID, + ModalWindowTitle, + ItemIdValue.ClientID, + ItemTitle.ClientID, + TreePickerUrl, + ModalWidth.ToString(), + ModalHeight.ToString(), + ShowHeader.ToString().ToLower(), + Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco).TrimEnd('/') + }); + } + + /// + /// Registers the required JS classes required to make this control work + /// + protected virtual void RenderJSComponents() + { + const string BaseTreePickerScriptJs = @"/// +(function ($) { + $(document).ready(function () { + // Tooltip only Text + $('.umb-tree-picker a.choose').click(function () { + var that = this; + var s = $(that).data(""section""); + UmbClientMgr.openAngularModalWindow({ + template: 'views/common/dialogs/treepicker.html', + section: s, + callback: function (data) { + //this returns the content object picked + var p = jQuery(that).parent(); + p.find("".buttons"").show(); + + p.find(""input"").val(data.id); + p.find("".treePickerTitle"").text(data.name).show(); + p.find("".clear"").show(); + } + }); + + return false; + }); + + $('.umb-tree-picker a.clear').click(function () { + jQuery(this).parent().parent().find(""input"").val(""-1""); + jQuery(this).parent().parent().find("".treePickerTitle"").text("""").hide(); + jQuery(this).hide(); + }); + }); +})(jQuery); +"; + + const string scriptKey = "BaseTreePickerScripts"; + if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack) + { + ScriptManager.RegisterStartupScript(this, this.GetType(), scriptKey, BaseTreePickerScriptJs, true); + } + else + { + Page.ClientScript.RegisterClientScriptBlock(typeof(BaseTreePicker), scriptKey, BaseTreePickerScriptJs, true); + } + } + + protected override void OnInit(EventArgs e) + { + base.OnInit(e); + + EnsureChildControls(); + + //disable view state for this control + this.EnableViewState = false; + } + + /// + /// Create the native .net child controls for this control + /// + protected override void CreateChildControls() + { + base.CreateChildControls(); + + RootContainer = new HtmlGenericControl("span"); + RootContainer.Attributes.Add("class", "umb-tree-picker"); + this.Controls.Add(RootContainer); + + //create the hidden field + ItemIdValue = new HiddenField(); + ItemIdValue.ID = "ContentIdValue"; + RootContainer.Controls.Add(ItemIdValue); + + + ButtonContainer = new HtmlGenericControl("span"); + ButtonContainer.ID = "btns"; + + //add item title with padding + ItemTitle = new HtmlGenericControl("span"); + ItemTitle.ID = "title"; + ItemTitle.Style.Add(HtmlTextWriterStyle.FontWeight, "bold"); + ItemTitle.Attributes.Add("class", "treePickerTitle"); // solely for styling, e.g. with an underline or dotted border, etc. + ButtonContainer.Controls.Add(ItemTitle); + ButtonContainer.Attributes.Add("class", "buttons"); + ButtonContainer.Controls.Add(new LiteralControl(" ")); + ButtonContainer.Controls.Add(new LiteralControl(" ")); + + //add the delete link with padding + DeleteLink = new HtmlAnchor(); + DeleteLink.HRef = "#"; //set on pre-render + DeleteLink.Style.Add(HtmlTextWriterStyle.Color, "red"); + DeleteLink.Title = Current.Services.TextService.Localize("delete"); + DeleteLink.InnerText = Current.Services.TextService.Localize("delete"); + DeleteLink.Attributes.Add("class", "clear"); + + ButtonContainer.Controls.Add(DeleteLink); + ButtonContainer.Controls.Add(new LiteralControl(" ")); + ButtonContainer.Controls.Add(new LiteralControl(" ")); + if (!ShowDelete) + { + DeleteLink.Style.Add(HtmlTextWriterStyle.Display, "none"); + } + + RootContainer.Controls.Add(ButtonContainer); + + //add choose link with padding + ChooseLink = new HtmlAnchor(); + ChooseLink.HRef = "#"; //filled in on pre-render + ChooseLink.InnerText = Current.Services.TextService.Localize("choose") + "..."; + ChooseLink.Attributes.Add("data-section", this.TreePickerUrl); + ChooseLink.Attributes.Add("class", "choose"); + + RootContainer.Controls.Add(ChooseLink); + } + + /// + /// Registers the JavaScript required for the control to function and hides/shows controls depending on it's properties + /// + /// + protected override void OnPreRender(EventArgs e) + { + base.OnPreRender(e); + + //hide the buttons if no item, otherwise get the item title + if (string.IsNullOrEmpty(ItemIdValue.Value)) + { + ButtonContainer.Style.Add(HtmlTextWriterStyle.Display, "none"); + } + else + { + ItemTitle.InnerText = GetItemTitle(); + ItemTitle.Attributes.Add("title", GetItemBreadcrumbs()); // Adding full path/meta info (Issue U4-192) + } + /* + ChooseLink.HRef = string.Format("javascript:mc_{0}.LaunchPicker();", this.ClientID); + DeleteLink.HRef = string.Format("javascript:mc_{0}.ClearSelection();", this.ClientID); + */ + + RenderJSComponents(); + + /* + if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack) + { + ScriptManager.RegisterStartupScript(this, this.GetType(), this.ClientID + "TreePicker", GetJSScript(), true); + } + else + { + Page.ClientScript.RegisterStartupScript(this.GetType(), this.ClientID + "TreePicker", GetJSScript(), true); + }*/ + + } + + + } +} diff --git a/src/Umbraco.Web/_Legacy/Controls/CodeArea.cs b/src/Umbraco.Web/_Legacy/Controls/CodeArea.cs new file mode 100644 index 0000000000..361fe4b3ca --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Controls/CodeArea.cs @@ -0,0 +1,243 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Web; +using System.Web.SessionState; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.HtmlControls; +using ClientDependency.Core; +using System.Linq; +using ClientDependency.Core.Controls; +using Umbraco.Core.Configuration; + +namespace Umbraco.Web._Legacy.Controls +{ + + [ClientDependency(ClientDependencyType.Javascript, "CodeArea/javascript.js", "UmbracoClient")] + [ClientDependency(ClientDependencyType.Javascript, "CodeArea/UmbracoEditor.js", "UmbracoClient")] + [ClientDependency(ClientDependencyType.Css, "CodeArea/styles.css", "UmbracoClient")] + [ClientDependency(ClientDependencyType.Javascript, "Application/jQuery/jquery-fieldselection.js", "UmbracoClient")] + public class CodeArea : WebControl + { + + public CodeArea() + { + //set the default to Css + CodeBase = EditorType.Css; + } + + protected TextBox CodeTextBox; + + public bool AutoResize { get; set; } + public bool AutoSuggest { get; set; } + public string EditorMimeType { get; set; } + + public ScrollingMenu Menu = new ScrollingMenu(); + + public int OffSetX { get; set; } + public int OffSetY { get; set; } + public string Text + { + get + { + EnsureChildControls(); + return CodeTextBox.Text; + } + set + { + EnsureChildControls(); + CodeTextBox.Text = value; + } + } + + public bool CodeMirrorEnabled + { + get + { + return UmbracoConfig.For.UmbracoSettings().Content.ScriptEditorDisable == false; + } + } + + public EditorType CodeBase { get; set; } + public string ClientSaveMethod { get; set; } + + public enum EditorType { JavaScript, Css, XML, HTML, Razor, HtmlMixed } + + protected override void OnInit(EventArgs e) + { + base.OnInit(e); + EnsureChildControls(); + + if (CodeMirrorEnabled) + { + ClientDependencyLoader.Instance.RegisterDependency(0, "lib/CodeMirror/lib/codemirror.js", "UmbracoRoot", ClientDependencyType.Javascript); + + + ClientDependencyLoader.Instance.RegisterDependency(2, "lib/CodeMirror/mode/" + CodeBase.ToString().ToLower() + "/" + CodeBase.ToString().ToLower() + ".js", "UmbracoRoot", ClientDependencyType.Javascript); + if (CodeBase == EditorType.HtmlMixed) + { + ClientDependencyLoader.Instance.RegisterDependency(1, "lib/CodeMirror/mode/xml/xml.js", "UmbracoRoot", ClientDependencyType.Javascript); + ClientDependencyLoader.Instance.RegisterDependency(1, "lib/CodeMirror/mode/javascript/javascript.js", "UmbracoRoot", ClientDependencyType.Javascript); + ClientDependencyLoader.Instance.RegisterDependency(1, "lib/CodeMirror/mode/css/css.js", "UmbracoRoot", ClientDependencyType.Javascript); + ClientDependencyLoader.Instance.RegisterDependency(1, "lib/CodeMirror/mode/htmlmixed/htmlmixed.js", "UmbracoRoot", ClientDependencyType.Javascript); + + } + + ClientDependencyLoader.Instance.RegisterDependency(1, "lib/CodeMirror/addon/edit/matchbrackets.js", "UmbracoRoot", ClientDependencyType.Javascript); + + ClientDependencyLoader.Instance.RegisterDependency(2, "lib/CodeMirror/addon/search/search.js", "UmbracoRoot", ClientDependencyType.Javascript); + ClientDependencyLoader.Instance.RegisterDependency(2, "lib/CodeMirror/addon/search/searchcursor.js", "UmbracoRoot", ClientDependencyType.Javascript); + ClientDependencyLoader.Instance.RegisterDependency(2, "lib/CodeMirror/addon/dialog/dialog.js", "UmbracoRoot", ClientDependencyType.Javascript); + ClientDependencyLoader.Instance.RegisterDependency(2, "lib/CodeMirror/addon/dialog/dialog.css", "UmbracoRoot", ClientDependencyType.Css); + + ClientDependencyLoader.Instance.RegisterDependency(2, "lib/CodeMirror/lib/codemirror.css", "UmbracoRoot", ClientDependencyType.Css); + //ClientDependencyLoader.Instance.RegisterDependency(3, "CodeMirror/css/umbracoCustom.css", "UmbracoClient", ClientDependencyType.Css); + ClientDependencyLoader.Instance.RegisterDependency(4, "CodeArea/styles.css", "UmbracoClient", ClientDependencyType.Css); + } + } + + protected override void CreateChildControls() + { + base.CreateChildControls(); + CodeTextBox = new TextBox(); + CodeTextBox.ID = "CodeTextBox"; + + if (CodeMirrorEnabled == false) + { + CodeTextBox.Attributes.Add("class", "codepress"); + CodeTextBox.Attributes.Add("wrap", "off"); + } + + CodeTextBox.TextMode = TextBoxMode.MultiLine; + + this.Controls.Add(Menu); + this.Controls.Add(CodeTextBox); + + } + + /// + /// Client ID is different if the code editor is turned on/off + /// + public override string ClientID + { + get + { + if (CodeMirrorEnabled == false) + return CodeTextBox.ClientID; + else + return base.ClientID; + } + } + + protected override void Render(HtmlTextWriter writer) + { + EnsureChildControls(); + + var jsEventCode = new StringBuilder(); + + + if (CodeMirrorEnabled == false) + { + CodeTextBox.RenderControl(writer); + jsEventCode.Append(RenderBasicEditor()); + } + else + { + writer.WriteBeginTag("div"); + writer.WriteAttribute("id", this.ClientID); + writer.WriteAttribute("class", "umb-editor umb-codeeditor " + this.CssClass); + this.ControlStyle.AddAttributesToRender(writer); + writer.Write(HtmlTextWriter.TagRightChar); + Menu.RenderControl(writer); + + writer.WriteBeginTag("div"); + writer.WriteAttribute("class", "code-container"); + this.ControlStyle.AddAttributesToRender(writer); + writer.Write(HtmlTextWriter.TagRightChar); + CodeTextBox.RenderControl(writer); + writer.WriteEndTag("div"); + writer.WriteEndTag("div"); + + jsEventCode.Append(RenderCodeEditor()); + } + + jsEventCode.Append(@" + //TODO: for now this is a global var, need to refactor all this so that is using proper js standards + //with correct objects, and proper accessors to these objects. + var UmbEditor; + $(document).ready(function () { + //create the editor + UmbEditor = new Umbraco.Controls.CodeEditor.UmbracoEditor(" + (CodeMirrorEnabled == false).ToString().ToLower() + @", '" + ClientID + @"');"); + + if (this.AutoResize) + { + if (CodeMirrorEnabled) + { + //reduce the width if using code mirror because of the line numbers + OffSetX += 20; + OffSetY += 50; + } + + //add the resize code + jsEventCode.Append(@" + var m_textEditor = jQuery('#" + ClientID + @"'); + + //with codemirror adding divs for line numbers, we need to target a different element + m_textEditor = m_textEditor.find('iframe').length > 0 ? m_textEditor.children('div').get(0) : m_textEditor.get(0); + + jQuery(window).resize(function(){ resizeTextArea(m_textEditor, " + OffSetX + "," + OffSetY + @"); }); + jQuery(document).ready(function(){ resizeTextArea(m_textEditor, " + OffSetX + "," + OffSetY + @"); });"); + + } + + jsEventCode.Append(@" + });"); + + writer.WriteLine(@"", jsEventCode); + + } + + protected string RenderBasicEditor() + { + string jsEventCode = @" + var m_textEditor = document.getElementById('" + this.ClientID + @"'); + tab.watch('" + this.ClientID + @"'); + "; + return jsEventCode; + } + + protected string RenderCodeEditor() + { + var extraKeys = ""; + var editorMimetype = ""; + + if (string.IsNullOrEmpty(EditorMimeType) == false) + editorMimetype = @", + mode: """ + EditorMimeType + "\""; + + + + var jsEventCode = @" + var textarea = document.getElementById('" + CodeTextBox.ClientID + @"'); + var codeEditor = CodeMirror.fromTextArea(textarea, { + tabMode: ""shift"", + matchBrackets: true, + indentUnit: 4, + indentWithTabs: true, + enterMode: ""keep"", + lineWrapping: false" + + editorMimetype + @", + lineNumbers: true" + + extraKeys + @" + }); + "; + + return jsEventCode; + } + } + +} diff --git a/src/Umbraco.Web/_Legacy/Controls/DataAttributes.cs b/src/Umbraco.Web/_Legacy/Controls/DataAttributes.cs new file mode 100644 index 0000000000..0f83ecd53e --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Controls/DataAttributes.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Web.UI.WebControls; + +namespace Umbraco.Web._Legacy.Controls +{ + internal class DataAttributes : Dictionary + { + + public void AppendTo(WebControl c) + { + foreach (var keyval in this) + c.Attributes.Add("data-" + keyval.Key, keyval.Value); + } + } +} diff --git a/src/Umbraco.Web/_Legacy/Controls/FieldDropDownList.cs b/src/Umbraco.Web/_Legacy/Controls/FieldDropDownList.cs new file mode 100644 index 0000000000..a5e07b074b --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Controls/FieldDropDownList.cs @@ -0,0 +1,72 @@ +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace Umbraco.Web._Legacy.Controls +{ + public class FieldDropDownList : DropDownList + { + private bool _customOptionsStarted; + private bool _standardOptionsStarted; + + public string CustomPropertiesLabel { get; set; } + public string StandardPropertiesLabel { get; set; } + public string ChooseText { get; set; } + + protected override void RenderContents(HtmlTextWriter writer) + { + if (Items.Count > 0 && Items[0].Text.StartsWith("#")) + { + Items.Insert(0, new ListItem(ChooseText, "")); + SelectedIndex = 0; + + base.RenderContents(writer); + return; + } + + writer.Write("", ChooseText); + + foreach (ListItem item in Items) + { + if (!_customOptionsStarted) + { + RenderOptionGroupBeginTag(CustomPropertiesLabel, writer); + _customOptionsStarted = true; + } + else if (item.Text.StartsWith("@") && !_standardOptionsStarted) + { + _standardOptionsStarted = true; + RenderOptionGroupEndTag(writer); + RenderOptionGroupBeginTag(StandardPropertiesLabel, writer); + } + + writer.WriteBeginTag("option"); + writer.WriteAttribute("value", item.Value, true); + + foreach (string key in item.Attributes.Keys) + writer.WriteAttribute(key, item.Attributes[key]); + + writer.Write(HtmlTextWriter.TagRightChar); + HttpUtility.HtmlEncode(item.Text.Replace("@", ""), writer); + writer.WriteEndTag("option"); + writer.WriteLine(); + } + + RenderOptionGroupEndTag(writer); + } + + private void RenderOptionGroupBeginTag(string name, HtmlTextWriter writer) + { + writer.WriteBeginTag("optgroup"); + writer.WriteAttribute("label", name); + writer.Write(HtmlTextWriter.TagRightChar); + writer.WriteLine(); + } + + private void RenderOptionGroupEndTag(HtmlTextWriter writer) + { + writer.WriteEndTag("optgroup"); + writer.WriteLine(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/_Legacy/Controls/MenuButton.cs b/src/Umbraco.Web/_Legacy/Controls/MenuButton.cs new file mode 100644 index 0000000000..77200efba5 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Controls/MenuButton.cs @@ -0,0 +1,70 @@ +using System; +using Umbraco.Core.IO; + +namespace Umbraco.Web._Legacy.Controls +{ + public class MenuButton : System.Web.UI.WebControls.LinkButton + { + public MenuButtonType ButtonType { get; set; } + internal DataAttributes Data { get; private set; } + public string Hotkey { get; set; } + + public string Icon { get; set; } + + public MenuButton() + { + Data = new DataAttributes(); + CssClass = "btn"; + } + + + protected override void Render(System.Web.UI.HtmlTextWriter writer) + { + //setup a hotkey if present + if (ButtonType == MenuButtonType.Primary && String.IsNullOrEmpty(Hotkey)) + Data.Add("hotkey", "ctrl+" + this.Text.ToLower()[0]); + else if (!string.IsNullOrEmpty(Hotkey)) + Data.Add("shortcut", Hotkey); + + Data.AppendTo(this); + + string cssClass = "btn"; + + if (Icon != null) + { + cssClass = "btn editorIcon"; + var i = Icon.Trim('.'); + + if (!string.IsNullOrEmpty(i)) + { + this.ToolTip = this.Text; + + if (i.Contains(".")) + this.Text = "" + this.ToolTip + " " + this.ToolTip; + else + this.Text = " " + this.ToolTip; + } + } + + cssClass += " btn-" + Enum.GetName(ButtonType.GetType(), ButtonType).ToLower() + " " + CssClass; + this.CssClass = cssClass.Trim(); + + + base.Render(writer); + } + + } + + + public enum MenuButtonType + { + Default, + Primary, + Info, + Success, + Warning, + Danger, + Inverse, + Link + } +} diff --git a/src/Umbraco.Web/_Legacy/Controls/MenuButtonI.cs b/src/Umbraco.Web/_Legacy/Controls/MenuButtonI.cs new file mode 100644 index 0000000000..9f0435a9d1 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Controls/MenuButtonI.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Web; +using System.Web.SessionState; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.HtmlControls; +using ClientDependency.Core; + +namespace Umbraco.Web._Legacy.Controls +{ + + public class MenuImageButton : System.Web.UI.WebControls.ImageButton, MenuIconI { + private string _OnClickCommand = ""; + + public string AltText { + get { return this.AlternateText; } + set { + this.AlternateText = value; + this.Attributes.Add("title", value); + } + } + public int IconWidth { + get { return (int)this.Width.Value; } + set { this.Width = value; } + } + public int IconHeight { + get { return (int)this.Height.Value; } + set { this.Height = value; } + } + + + public string ImageURL { + get { return base.ImageUrl; } + set { base.ImageUrl = value; } + } + + public string OnClickCommand { + get { return _OnClickCommand; } + set { _OnClickCommand = value; } + } + + protected override void CreateChildControls() + { + this.Width = Unit.Pixel(20); + this.Height = Unit.Pixel(20); + this.Style.Clear(); + this.Attributes.Add("class", "btn btn-default editorIcon"); + + + if (_OnClickCommand != "") + { + this.Attributes.Add("onClick", OnClickCommand); + } + base.CreateChildControls(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/_Legacy/Controls/MenuIcon.cs b/src/Umbraco.Web/_Legacy/Controls/MenuIcon.cs new file mode 100644 index 0000000000..0a144546d9 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Controls/MenuIcon.cs @@ -0,0 +1,70 @@ +using System.ComponentModel; +using System.Web.UI; +using ClientDependency.Core; + +namespace Umbraco.Web._Legacy.Controls +{ + + [ClientDependency(ClientDependencyType.Css, "menuicon/style.css", "UmbracoClient")] + internal class MenuIcon : System.Web.UI.WebControls.Image, MenuIconI + { + private string _OnClickCommand = ""; + private string _AltText = "init"; + + public string AltText { + get { return this.AlternateText; } + set { + _AltText = value; + this.AlternateText = value; + this.Attributes.Add("title", value); + } + } + public int IconWidth { + get { return (int)this.Width.Value; } + set { this.Width = value; } + } + public int IconHeight { + get { return (int)this.Height.Value; } + set { this.Height = value; } + } + + public string ImageURL { + get { return this.ImageUrl; } + set { this.ImageUrl = value; } + } + + public string OnClickCommand { + get { return _OnClickCommand; } + set { _OnClickCommand = value; } + } + + protected override void OnLoad(System.EventArgs EventArguments) { + + + // NH 17-01-2007. Trying to avoid inline styling soup + // Me.Width = WebControls.Unit.Pixel(22) + // Me.Height = WebControls.Unit.Pixel(23) + //Me.Style.Add("border", "0px") + this.Attributes.Add("class", "editorIcon"); + this.Attributes.Add("onMouseover", "this.className='editorIconOver'"); + string holder = ""; +// if (this.ID != "") { + //holder = this.ID.Substring(0, this.ID.LastIndexOf("_")) + "_menu"; + this.Attributes.Add("onMouseout", "hoverIconOut('" + holder + "','" + this.ID + "');"); + this.Attributes.Add("onMouseup", "hoverIconOut('" + holder + "','" + this.ID + "');"); +// } else { + this.Attributes.Add("onMouseout", "this.className='editorIcon'"); + this.Attributes.Add("onMouseup", "this.className='editorIcon'"); +// } + this.Attributes.Add("onMouseDown", "this.className='editorIconDown'; return false;"); + this.AlternateText = _AltText; + this.Attributes.Add("title", _AltText); + + if (_OnClickCommand != "") { + this.Attributes.Add("onClick", OnClickCommand); + } + } + + + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/_Legacy/Controls/MenuIconI.cs b/src/Umbraco.Web/_Legacy/Controls/MenuIconI.cs new file mode 100644 index 0000000000..06716c6cb1 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Controls/MenuIconI.cs @@ -0,0 +1,29 @@ +namespace Umbraco.Web._Legacy.Controls +{ + public interface MenuIconI { + string ImageURL { + get; + set; + } + string ID { + get; + set; + } + string OnClickCommand { + get; + set; + } + string AltText { + get; + set; + } + int IconWidth { + get; + set; + } + int IconHeight { + get; + set; + } + } +} diff --git a/src/Umbraco.Web/_Legacy/Controls/Panel.cs b/src/Umbraco.Web/_Legacy/Controls/Panel.cs new file mode 100644 index 0000000000..dd0655b100 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Controls/Panel.cs @@ -0,0 +1,114 @@ +using System; +using System.Web.UI.WebControls; +using System.Web.UI.HtmlControls; + +namespace Umbraco.Web._Legacy.Controls +{ + public class UmbracoPanel : Panel + { + private ScrollingMenu _menu = new ScrollingMenu(); + + private bool _hasMenu = false; + private string _StatusBarText = ""; + private string _text; + private bool _autoResize = true; + + public bool hasMenu + { + get { return _hasMenu; } + set { _hasMenu = value; } + } + + public bool AutoResize + { + get { return _autoResize; } + set { _autoResize = value; } + } + + public string Text + { + get + { + if (_text == "") + _text = " "; + + return _text; + } + set { _text = value; } + } + + public string StatusBarText + { + get { return _StatusBarText; } + set { _StatusBarText = value; } + } + + public ScrollingMenu Menu + { + get { return _menu; } + } + + protected override void OnInit(EventArgs e) + { + base.OnInit(e); + EnsureChildControls(); + } + + + internal HtmlGenericControl header = new HtmlGenericControl(); + internal HtmlGenericControl row = new HtmlGenericControl(); + internal HtmlGenericControl leftcol = new HtmlGenericControl(); + internal HtmlGenericControl rightcol = new HtmlGenericControl(); + internal HtmlGenericControl title = new HtmlGenericControl(); + + internal HtmlGenericControl body = new HtmlGenericControl(); + + protected override void CreateChildControls() + { + //fucking webforms controls and their rendering.. + CssClass = "umb-panel form-horizontal umb-panel-nobody"; + ID = base.ClientID + "_container"; + + header.TagName = "div"; + header.ID = base.ClientID + "_header"; + header.Attributes.Add("class","umb-panel-header"); + + row.TagName = "div"; + row.Attributes.Add("class", "row-fluid"); + header.Controls.Add(row); + + leftcol.TagName = "span"; + leftcol.Attributes.Add("class", "span8"); + + title.TagName = "h1"; + title.Attributes.Add("class", "headline"); + leftcol.Controls.Add(title); + + row.Controls.Add(leftcol); + + rightcol.TagName = "span"; + rightcol.Attributes.Add("class", "span4"); + rightcol.Controls.Add(Menu); + row.Controls.Add(rightcol); + + body.TagName = "div"; + body.Attributes.Add("class", "umb-panel-body row-fluid"); + + Width = Unit.Empty; + Height = Unit.Empty; + + Controls.AddAt(0,header); + + + base.CreateChildControls(); + } + + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + title.InnerHtml = Text; + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/_Legacy/Controls/ScrollingMenu.cs b/src/Umbraco.Web/_Legacy/Controls/ScrollingMenu.cs new file mode 100644 index 0000000000..739a3c0f3e --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Controls/ScrollingMenu.cs @@ -0,0 +1,154 @@ +using System; +using System.Collections; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.HtmlControls; + + +namespace Umbraco.Web._Legacy.Controls +{ + + [ToolboxData("<{0}:ScrollingMenu runat=server>")] + public class ScrollingMenu : System.Web.UI.WebControls.PlaceHolder + { + public ArrayList Icons = new ArrayList(); + private string iconIds; + private int extraMenuWidth = 0; + + public MenuIconI NewIcon(int Index) + { + MenuIcon Icon = new MenuIcon(); + Icons.Insert(Index, Icon); + return Icon; + } + + public MenuIconI NewIcon() + { + MenuIcon icon = new MenuIcon(); + Icons.Add(icon); + return icon; + } + + public MenuButton NewButton(int index = -1) + { + MenuButton btn = new MenuButton(); + + if (index > -1) + Icons.Insert(index, btn); + else + Icons.Add(btn); + + return btn; + } + + public MenuImageButton NewImageButton() + { + MenuImageButton icon = new MenuImageButton(); + Icons.Add(icon); + return icon; + } + + public MenuImageButton NewImageButton(int Index) + { + MenuImageButton icon = new MenuImageButton(); + Icons.Insert(Index, icon); + return icon; + } + + + public System.Web.UI.WebControls.DropDownList NewDropDownList() + { + DropDownList Icon = new DropDownList(); + Icons.Add(Icon); + return Icon; + } + + public void NewElement(string ElementName, string ElementId, string ElementClass, int ExtraWidth) + { + Icons.Add(new LiteralControl("<" + ElementName + " class=\"" + ElementClass + "\" id=\"" + ElementId + "\">")); + extraMenuWidth = extraMenuWidth + ExtraWidth; + } + + public void InsertSplitter() + { + Splitter icon = new Splitter(); + Icons.Add(icon); + } + public void InsertSplitter(int Index) + { + Splitter icon = new Splitter(); + Icons.Insert(Index, icon); + } + + /// + /// Inserts a new web control into the scrolling menu + /// + /// + /// The additional width to extend the scrolling menu by if the control being inserted is wider than the standard + public void InsertNewControl(Control control, int extraWidth = 0) + { + Icons.Add(control); + // _extraMenuWidth = _extraMenuWidth + extraWidth; + } + + + /// + /// Finds the index of the n-th Splitter in this Menu + /// + /// + /// The index of the n-th Splitter, or -1 if the number of Splitters is smaller than n + public int FindSplitter(int n) + { + var count = 0; + for (var i = 0; i < Icons.Count; i++) + { + if (Icons[i].GetType() == typeof(Splitter)) + { + count++; + + if (count == n) + return i; + } + } + + return -1; + } + + + private HtmlGenericControl toolbar; + private HtmlGenericControl wrap; + private HtmlGenericControl group; + + protected override void CreateChildControls() + { + toolbar = new HtmlGenericControl { TagName = "div" }; + toolbar.Attributes.Add("class", "btn-toolbar umb-btn-toolbar"); + this.Controls.Add(toolbar); + + group = new HtmlGenericControl { TagName = "div", ID = this.ClientID + "_group" }; + group.Attributes.Add("class", "btn-group"); + toolbar.Controls.Add(group); + } + + protected override void OnLoad(EventArgs e) + { + foreach (Control item in Icons) + { + group.Controls.Add(item); + if (item.ID != "") + iconIds = iconIds + item.ID + ","; + } + base.OnLoad(e); + } + + + + protected override void OnInit(EventArgs e) + { + + EnsureChildControls(); + base.OnInit(e); + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/_Legacy/Controls/Splitter.cs b/src/Umbraco.Web/_Legacy/Controls/Splitter.cs new file mode 100644 index 0000000000..f33ba2a3bf --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Controls/Splitter.cs @@ -0,0 +1,16 @@ +using System.ComponentModel; +using System.Web.UI; +using Umbraco.Core.IO; + +namespace Umbraco.Web._Legacy.Controls +{ + internal class Splitter : System.Web.UI.WebControls.Image { + + protected override void OnLoad(System.EventArgs EventArguments) { + this.Height = System.Web.UI.WebControls.Unit.Pixel(21); + this.Style.Add("border", "0px"); + this.Attributes.Add("class", "editorIconSplit"); + this.ImageUrl = SystemDirectories.UmbracoClient + "/menuicon/images/split.gif"; + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/_Legacy/Controls/TabPage.cs b/src/Umbraco.Web/_Legacy/Controls/TabPage.cs new file mode 100644 index 0000000000..9ca0ca0eec --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Controls/TabPage.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Web; +using System.Web.SessionState; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.HtmlControls; + +namespace Umbraco.Web._Legacy.Controls +{ + + public class TabPage : WebControl + { + // Ensure that a TabPage cannot be instatiated outside + // this assembly -> New instances of a tabpage can only be retrieved through the tabview + private bool _hasMenu = true; + protected LiteralControl ErrorHeaderControl = new LiteralControl(); + private LiteralControl _closeButtonControl = new LiteralControl(); + private readonly ValidationSummary _vs = new ValidationSummary(); + private readonly Control _tempErr = new Control(); + internal TabView parent; + + + public string Text { get; set; } + + internal TabPage() + { + + } + + public ValidationSummary ValidationSummaryControl + { + get { return _vs; } + } + + public string ErrorHeader { get; set; } + public string CloseCaption { get; set; } + public bool Active { get; set; } + + public Control ErrorControl + { + get { return _tempErr; } + } + + protected override void OnInit(EventArgs e) + { + base.OnInit(e); + + _vs.ShowSummary = true; + _vs.Attributes.Remove("style"); + _vs.Style.Clear(); + _vs.ForeColor = new Color(); + _vs.ID = String.Format("{0}_validationSummary", this.ID); + + // Add error pane + _tempErr.Visible = false; + _tempErr.ID = String.Format("{0}_errorPaneContainer", this.ID); + _tempErr.Controls.Add(_closeButtonControl); + _tempErr.Controls.Add(ErrorHeaderControl); + _tempErr.Controls.Add(new LiteralControl("

")); + _tempErr.Controls.Add(_vs); + _tempErr.Controls.Add(new LiteralControl("

")); + + this.Controls.Add(_tempErr); + } + + public ScrollingMenu Menu + { + get { return parent.Menu; } + } + + public bool HasMenu + { + get { return _hasMenu; } + set { _hasMenu = value; } + } + + protected override void Render(System.Web.UI.HtmlTextWriter writer) + { + _closeButtonControl.Text = "

"; + ErrorHeaderControl.Text = ErrorHeader; + + var activeClass = string.Empty; + + if (this.ID == parent.ActiveTabId) + activeClass = "active"; + + writer.WriteLine("
"); + writer.WriteLine("
"); + + this.RenderChildren(writer); + + writer.WriteLine("
"); + writer.WriteLine("
"); + } + } +} diff --git a/src/Umbraco.Web/_Legacy/Controls/TabView.cs b/src/Umbraco.Web/_Legacy/Controls/TabView.cs new file mode 100644 index 0000000000..03124c0124 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Controls/TabView.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Web; +using System.Web.SessionState; +using System.Web.UI; +using System.Web.UI.WebControls; +using ClientDependency.Core; +using System.Web.UI.HtmlControls; + +namespace Umbraco.Web._Legacy.Controls +{ + + public class TabView : Umbraco.Web._Legacy.Controls.UmbracoPanel + { + public readonly ArrayList Tabs = new ArrayList(); + protected ArrayList Panels = new ArrayList(); + protected Dictionary TabPages = new Dictionary(); + + private string _status = ""; + + private HtmlGenericControl _tabList = new HtmlGenericControl(); + private HtmlGenericControl _body = new HtmlGenericControl(); + private HtmlGenericControl _tabsHolder = new HtmlGenericControl(); + + private HiddenField _activeTabHolder = new HiddenField(); + + protected override void CreateChildControls() + { + base.CreateChildControls(); + + _tabList.TagName = "ul"; + _tabList.Attributes.Add("class", "nav nav-tabs umb-nav-tabs span12 -padding-left"); + base.row.Controls.Add(_tabList); + + _body.TagName = "div"; + _body.Attributes.Add("class", "umb-panel-body umb-scrollable row-fluid"); + base.Controls.Add(_body); + + _tabsHolder.TagName = "div"; + _tabsHolder.Attributes.Add("class", "tab-content form-horizontal"); + _tabsHolder.ID = this.ID + "_content"; + _body.Controls.Add(_tabsHolder); + + for (int i = 0; i < Tabs.Count; i++) + { + var tabPage = TabPages.ElementAt(i).Value; + tabPage.Active = false || tabPage.ID == ActiveTabId; + + _tabsHolder.Controls.Add(tabPage); + } + + _activeTabHolder.ID = "activeTabHolder"; + _body.Controls.Add(_activeTabHolder); + + } + + protected override void OnInit(EventArgs e) + { + base.OnInit(e); + base.CssClass = "umb-panel tabbable"; + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + if (string.IsNullOrEmpty(Text)) + Text = " "; + + + for (int i = 0; i < Tabs.Count; i++) + { + var tabPage = TabPages.ElementAt(i).Value; + string tabPageCaption = tabPage.Text; + string tabId = tabPage.ID; + + HtmlGenericControl li = new HtmlGenericControl(); + li.TagName = "li"; + if (tabId == ActiveTabId) + li.Attributes.Add("class", "active"); + _tabList.Controls.Add(li); + + HtmlGenericControl a = new HtmlGenericControl(); + a.TagName = "a"; + a.Attributes.Add("href", "#"+tabId); + a.Attributes.Add("onclick", "$('#" + _activeTabHolder.ClientID + "').val('" + tabId + "');"); + a.Attributes.Add("data-toggle", "tab"); + a.InnerText = tabPageCaption; + li.Controls.Add(a); + } + } + + public ArrayList GetPanels() + { + return Panels; + } + + public TabPage NewTabPage(string text) + { + Tabs.Add(text); + TabPage tp = new TabPage(); + tp.Width = this.Width; + tp.ID = "tab0" + (TabPages.Count + 1); + tp.Text = text; + tp.parent = this; + + Panels.Add(tp); + TabPages.Add(tp.ID, tp); + + _tabsHolder.Controls.Add(tp); + return tp; + } + + + public string Status + { + get { return _status; } + set { _status = value; } + } + + + + public string ActiveTabId + { + get + { + + if (_activeTabHolder.Value != "") + return _activeTabHolder.Value; + + if (TabPages.Count > 0) + return TabPages.ElementAt(0).Value.ID; + + + + return "tab01"; + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/_Legacy/Controls/feedback.cs b/src/Umbraco.Web/_Legacy/Controls/feedback.cs new file mode 100644 index 0000000000..11b5cb74f0 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Controls/feedback.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Text; +using ClientDependency.Core; + +namespace Umbraco.Web._Legacy.Controls +{ + + [ClientDependency(ClientDependencyType.Css, "ui/default.css", "UmbracoClient")] + public class Feedback : System.Web.UI.WebControls.Panel + { + + public Feedback() { + + } + + protected override void OnInit(EventArgs e) { + } + + protected override void OnLoad(System.EventArgs EventArguments) { + } + + public feedbacktype type { get; set; } + + private string _text = string.Empty; + public string Text { + get { + + return _text; + + } + set { _text = value; } + } + + public enum feedbacktype{ + notice, + error, + success + } + + protected override void Render(System.Web.UI.HtmlTextWriter writer) { + if (_text != string.Empty) { + base.CreateChildControls(); + + string styleString = ""; + foreach (string key in this.Style.Keys) { + styleString += key + ":" + this.Style[key] + ";"; + } + + writer.WriteLine("

"); + writer.WriteLine(_text); + writer.WriteLine("

"); + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/_Legacy/PackageActions/PackageHelper.cs b/src/Umbraco.Web/_Legacy/PackageActions/PackageHelper.cs index fdba5c1526..a0cd612d94 100644 --- a/src/Umbraco.Web/_Legacy/PackageActions/PackageHelper.cs +++ b/src/Umbraco.Web/_Legacy/PackageActions/PackageHelper.cs @@ -1,6 +1,8 @@ using System; using System.Xml; using Umbraco.Core; +using Umbraco.Core.IO; +using Umbraco.Core.Models; using Umbraco.Core.Xml; namespace Umbraco.Web._Legacy.PackageActions @@ -8,7 +10,7 @@ namespace Umbraco.Web._Legacy.PackageActions public class PackageHelper { //Helper method to replace umbraco tags that breaks the xml format.. - public static string ParseToValidXml(global::umbraco.cms.businesslogic.template.Template templateObj, ref bool hasAspNetContentBeginning, string template, bool toValid) + public static string ParseToValidXml(ITemplate templateObj, ref bool hasAspNetContentBeginning, string template, bool toValid) { string retVal = template; if (toValid) @@ -55,7 +57,7 @@ namespace Umbraco.Web._Legacy.PackageActions // add asp content element if (hasAspNetContentBeginning) { - retVal = templateObj.GetMasterContentElement(templateObj.MasterTemplate) + retVal + ""; + retVal = MasterPageHelper.GetMasterContentElement(templateObj/*templateObj.MasterTemplate*/) + retVal + ""; } } diff --git a/src/Umbraco.Web/_Legacy/PackageActions/addStringToHtmlElement.cs b/src/Umbraco.Web/_Legacy/PackageActions/addStringToHtmlElement.cs index 39f443fc63..d1ffcaed87 100644 --- a/src/Umbraco.Web/_Legacy/PackageActions/addStringToHtmlElement.cs +++ b/src/Umbraco.Web/_Legacy/PackageActions/addStringToHtmlElement.cs @@ -2,7 +2,9 @@ using System; using System.Xml; using Umbraco.Core; using Umbraco.Core.Configuration; +using Umbraco.Core.IO; using Umbraco.Core.Logging; +using Umbraco.Core.Models; using Umbraco.Core.Xml; using Umbraco.Core._Legacy.PackageActions; using Umbraco.Web.Composing; @@ -38,10 +40,11 @@ namespace Umbraco.Web._Legacy.PackageActions string htmlElementId = xmlData.Attributes["htmlElementId"].Value; string position = xmlData.Attributes["position"].Value; string value = XmlHelper.GetNodeValue(xmlData); - global::umbraco.cms.businesslogic.template.Template tmp = global::umbraco.cms.businesslogic.template.Template.GetByAlias(templateAlias); + var tmp = Current.Services.FileService.GetTemplate(templateAlias); - if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) - value = tmp.EnsureMasterPageSyntax(value); + if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) + //value = tmp.EnsureMasterPageSyntax(value); + value = MasterPageHelper.EnsureMasterPageSyntax(templateAlias, value); _addStringToHtmlElement(tmp, value, htmlElementId, position); @@ -60,12 +63,13 @@ namespace Umbraco.Web._Legacy.PackageActions string templateAlias = xmlData.Attributes["templateAlias"].Value; string htmlElementId = xmlData.Attributes["htmlElementId"].Value; string value = XmlHelper.GetNodeValue(xmlData); - global::umbraco.cms.businesslogic.template.Template tmp = global::umbraco.cms.businesslogic.template.Template.GetByAlias(templateAlias); + var tmp = Current.Services.FileService.GetTemplate(templateAlias); - if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) - value = tmp.EnsureMasterPageSyntax(value); + if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) + //value = tmp.EnsureMasterPageSyntax(value); + value = MasterPageHelper.EnsureMasterPageSyntax(templateAlias, value); - _removeStringFromHtmlElement(tmp, value, htmlElementId); + _removeStringFromHtmlElement(tmp, value, htmlElementId); return true; } @@ -78,7 +82,7 @@ namespace Umbraco.Web._Legacy.PackageActions return "addStringToHtmlElement"; } - private void _addStringToHtmlElement(global::umbraco.cms.businesslogic.template.Template tmp, string value, string htmlElementId, string position) + private void _addStringToHtmlElement(ITemplate tmp, string value, string htmlElementId, string position) { bool hasAspNetContentBeginning = false; string design = ""; @@ -92,14 +96,14 @@ namespace Umbraco.Web._Legacy.PackageActions templateXml.PreserveWhitespace = true; //Make sure that directive is remove before hacked non html4 compatiple replacement action... - design = tmp.Design; + design = tmp.Content; splitDesignAndDirective(ref design, ref directive); - //making sure that the template xml has a root node... - if (tmp.MasterTemplate > 0) - templateXml.LoadXml(PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, "" + design + "", true)); + //making sure that the template xml has a root node... + if (string.IsNullOrWhiteSpace(tmp.MasterTemplateAlias) == false) + templateXml.LoadXml(PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, "" + design + "", true)); else templateXml.LoadXml(PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, design, true)); @@ -118,8 +122,8 @@ namespace Umbraco.Web._Legacy.PackageActions } } - tmp.Design = directive + "\n" + PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, templateXml.OuterXml, false); - tmp.Save(); + tmp.Content = directive + "\n" + PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, templateXml.OuterXml, false); + Current.Services.FileService.SaveTemplate(tmp); } catch (Exception ex) { @@ -132,7 +136,7 @@ namespace Umbraco.Web._Legacy.PackageActions } } - private void _removeStringFromHtmlElement(global::umbraco.cms.businesslogic.template.Template tmp, string value, string htmlElementId) + private void _removeStringFromHtmlElement(ITemplate tmp, string value, string htmlElementId) { bool hasAspNetContentBeginning = false; string design = ""; @@ -147,11 +151,11 @@ namespace Umbraco.Web._Legacy.PackageActions templateXml.PreserveWhitespace = true; //Make sure that directive is remove before hacked non html4 compatiple replacement action... - design = tmp.Design; + design = tmp.Content; splitDesignAndDirective(ref design, ref directive); //making sure that the template xml has a root node... - if (tmp.MasterTemplate > 0) + if (string.IsNullOrWhiteSpace(tmp.MasterTemplateAlias) == false) templateXml.LoadXml(PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, "" + design + "", true)); else templateXml.LoadXml(PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, design, true)); @@ -166,8 +170,8 @@ namespace Umbraco.Web._Legacy.PackageActions xmlElement.InnerXml = xmlElement.InnerXml.Replace(repValue, ""); } - tmp.Design = directive + "\n" + PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, templateXml.OuterXml, false); - tmp.Save(); + tmp.Content = directive + "\n" + PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, templateXml.OuterXml, false); + Current.Services.FileService.SaveTemplate(tmp); } catch (Exception ex) { diff --git a/src/Umbraco.Web/_Legacy/PackageActions/allowDoctype.cs b/src/Umbraco.Web/_Legacy/PackageActions/allowDoctype.cs index 3dda6041e2..841d651c43 100644 --- a/src/Umbraco.Web/_Legacy/PackageActions/allowDoctype.cs +++ b/src/Umbraco.Web/_Legacy/PackageActions/allowDoctype.cs @@ -2,7 +2,9 @@ using System; using System.Collections; using System.Linq; using System.Xml; +using Umbraco.Core.Models; using Umbraco.Core._Legacy.PackageActions; +using Umbraco.Web.Composing; namespace Umbraco.Web._Legacy.PackageActions { @@ -29,15 +31,17 @@ namespace Umbraco.Web._Legacy.PackageActions string doctypeName = xmlData.Attributes["documentTypeAlias"].Value; string parentDoctypeName = xmlData.Attributes["parentDocumentTypeAlias"].Value; - global::umbraco.cms.businesslogic.ContentType ct = global::umbraco.cms.businesslogic.ContentType.GetByAlias(doctypeName); - global::umbraco.cms.businesslogic.ContentType parentct = global::umbraco.cms.businesslogic.ContentType.GetByAlias(parentDoctypeName); + //global::umbraco.cms.businesslogic.ContentType ct = global::umbraco.cms.businesslogic.ContentType.GetByAlias(doctypeName); + //global::umbraco.cms.businesslogic.ContentType parentct = global::umbraco.cms.businesslogic.ContentType.GetByAlias(parentDoctypeName); + var ct = Current.Services.ContentTypeService.Get(doctypeName); + var parentct = Current.Services.ContentTypeService.Get(parentDoctypeName); - if (ct != null && parentct != null) + if (ct != null && parentct != null) { bool containsId = false; ArrayList tmp = new ArrayList(); - foreach (int i in parentct.AllowedChildContentTypeIDs.ToList()) + foreach (int i in parentct.AllowedContentTypes.Select(x => x.Id.Value).ToList()) { tmp.Add(i); if (i == ct.Id) @@ -51,8 +55,11 @@ namespace Umbraco.Web._Legacy.PackageActions for (int i = 0; i < tmp.Count; i++) ids[i] = (int)tmp[i]; ids[ids.Length - 1] = ct.Id; - parentct.AllowedChildContentTypeIDs = ids; - parentct.Save(); + //parentct.AllowedChildContentTypeIDs = ids; + var so = 0; + parentct.AllowedContentTypes = ids.Select(x => new ContentTypeSort(x, so++)); + //parentct.Save(); + Current.Services.ContentTypeService.Save(parentct); return true; } } diff --git a/src/Umbraco.Web/_Legacy/PackageActions/publishRootDocument.cs b/src/Umbraco.Web/_Legacy/PackageActions/publishRootDocument.cs index 1bea5f858b..ef28b3db8c 100644 --- a/src/Umbraco.Web/_Legacy/PackageActions/publishRootDocument.cs +++ b/src/Umbraco.Web/_Legacy/PackageActions/publishRootDocument.cs @@ -30,16 +30,14 @@ namespace Umbraco.Web._Legacy.PackageActions int parentDocid = 0; - global::umbraco.cms.businesslogic.web.Document[] rootDocs = global::umbraco.cms.businesslogic.web.Document.GetRootDocuments(); + //global::umbraco.cms.businesslogic.web.Document[] rootDocs = global::umbraco.cms.businesslogic.web.Document.GetRootDocuments(); + var rootDocs = Current.Services.ContentService.GetRootContent(); - foreach (global::umbraco.cms.businesslogic.web.Document rootDoc in rootDocs) + foreach (var rootDoc in rootDocs) { - if (rootDoc.Text.Trim() == documentName.Trim() && rootDoc != null && rootDoc.ContentType != null) + if (rootDoc.Name.Trim() == documentName.Trim() && rootDoc != null && rootDoc.ContentType != null) { - - rootDoc.PublishWithChildrenWithResult(Current.Services.UserService.GetUserById(0)); - - + Current.Services.ContentService.PublishWithChildrenWithStatus(rootDoc, 0, true); break; } } diff --git a/src/Umbraco.Web/_Legacy/Packager/FileResources/PackageFiles.Designer.cs b/src/Umbraco.Web/_Legacy/Packager/FileResources/PackageFiles.Designer.cs new file mode 100644 index 0000000000..b6f9c4ae4e --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/FileResources/PackageFiles.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace umbraco.cms.businesslogic.Packager.FileResources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class PackageFiles { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal PackageFiles() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("umbraco.cms.businesslogic.Packager.FileResources.PackageFiles", typeof(PackageFiles).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?> + ///<packages></packages>. + /// + internal static string Packages { + get { + return ResourceManager.GetString("Packages", resourceCulture); + } + } + } +} diff --git a/src/Umbraco.Web/_Legacy/Packager/FileResources/PackageFiles.resx b/src/Umbraco.Web/_Legacy/Packager/FileResources/PackageFiles.resx new file mode 100644 index 0000000000..544e9da936 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/FileResources/PackageFiles.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + packages.config;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + \ No newline at end of file diff --git a/src/Umbraco.Web/_Legacy/Packager/FileResources/Packages.config b/src/Umbraco.Web/_Legacy/Packager/FileResources/Packages.config new file mode 100644 index 0000000000..23363f82ce --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/FileResources/Packages.config @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/Umbraco.Web/_Legacy/Packager/Installer.cs b/src/Umbraco.Web/_Legacy/Packager/Installer.cs new file mode 100644 index 0000000000..aefacc06c8 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/Installer.cs @@ -0,0 +1,846 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Globalization; +using System.IO; +using System.Xml; +using System.Linq; +using ICSharpCode.SharpZipLib.Zip; +using Umbraco.Core; +using Umbraco.Core.IO; +using Umbraco.Core.Logging; +using System.Diagnostics; +using Umbraco.Core.Models; +using Umbraco.Core.Composing; +using Umbraco.Core.Events; +using Umbraco.Core.Models.Packaging; +using Umbraco.Core.Services; +using Umbraco.Core.Xml; +using File = System.IO.File; + +namespace umbraco.cms.businesslogic.packager +{ + /// + /// The packager is a component which enables sharing of both data and functionality components between different umbraco installations. + /// + /// The output is a .umb (a zip compressed file) which contains the exported documents/medias/macroes/documenttypes (etc.) + /// in a Xml document, along with the physical files used (images/usercontrols/xsl documents etc.) + /// + /// Partly implemented, import of packages is done, the export is *under construction*. + /// + /// + /// Ruben Verborgh 31/12/2007: I had to change some code, I marked my changes with "DATALAYER". + /// Reason: @@IDENTITY can't be used with the new datalayer. + /// I wasn't able to test the code, since I'm not aware how the code functions. + /// + public class Installer + { + private const string PackageServer = "packages.umbraco.org"; + + private readonly List _unsecureFiles = new List(); + private readonly Dictionary _conflictingMacroAliases = new Dictionary(); + private readonly Dictionary _conflictingTemplateAliases = new Dictionary(); + private readonly Dictionary _conflictingStyleSheetNames = new Dictionary(); + + private readonly List _binaryFileErrors = new List(); + private int _currentUserId = -1; + + + public string Name { get; private set; } + public string Version { get; private set; } + public string Url { get; private set; } + public string License { get; private set; } + public string LicenseUrl { get; private set; } + public string Author { get; private set; } + public string AuthorUrl { get; private set; } + public string ReadMe { get; private set; } + public string Control { get; private set; } + + public bool ContainsMacroConflict { get; private set; } + public IDictionary ConflictingMacroAliases { get { return _conflictingMacroAliases; } } + + public bool ContainsUnsecureFiles { get; private set; } + public List UnsecureFiles { get { return _unsecureFiles; } } + + public bool ContainsTemplateConflicts { get; private set; } + public IDictionary ConflictingTemplateAliases { get { return _conflictingTemplateAliases; } } + + /// + /// Indicates that the package contains assembly reference errors + /// + public bool ContainsBinaryFileErrors { get; private set; } + + /// + /// List each assembly reference error + /// + public List BinaryFileErrors { get { return _binaryFileErrors; } } + + public bool ContainsStyleSheeConflicts { get; private set; } + public IDictionary ConflictingStyleSheetNames { get { return _conflictingStyleSheetNames; } } + + public int RequirementsMajor { get; private set; } + public int RequirementsMinor { get; private set; } + public int RequirementsPatch { get; private set; } + + public RequirementsType RequirementsType { get; private set; } + + public string IconUrl { get; private set; } + + /// + /// The xmldocument, describing the contents of a package. + /// + public XmlDocument Config { get; private set; } + + /// + /// Constructor + /// + public Installer() + { + Initialize(); + } + + public Installer(int currentUserId) + { + Initialize(); + _currentUserId = currentUserId; + } + + private void Initialize() + { + ContainsBinaryFileErrors = false; + ContainsTemplateConflicts = false; + ContainsUnsecureFiles = false; + ContainsMacroConflict = false; + ContainsStyleSheeConflicts = false; + } + + [Obsolete("Use the ctor with all parameters")] + [EditorBrowsable(EditorBrowsableState.Never)] + public Installer(string name, string version, string url, string license, string licenseUrl, string author, string authorUrl, int requirementsMajor, int requirementsMinor, int requirementsPatch, string readme, string control) + { + } + + /// + /// Constructor + /// + /// The name of the package + /// The version of the package + /// The url to a descriptionpage + /// The license under which the package is released (preferably GPL ;)) + /// The url to a licensedescription + /// The original author of the package + /// The url to the Authors website + /// Umbraco version major + /// Umbraco version minor + /// Umbraco version patch + /// The readme text + /// The name of the usercontrol used to configure the package after install + /// + /// + public Installer(string name, string version, string url, string license, string licenseUrl, string author, string authorUrl, int requirementsMajor, int requirementsMinor, int requirementsPatch, string readme, string control, RequirementsType requirementsType, string iconUrl) + { + ContainsBinaryFileErrors = false; + ContainsTemplateConflicts = false; + ContainsUnsecureFiles = false; + ContainsMacroConflict = false; + ContainsStyleSheeConflicts = false; + this.Name = name; + this.Version = version; + this.Url = url; + this.License = license; + this.LicenseUrl = licenseUrl; + this.RequirementsMajor = requirementsMajor; + this.RequirementsMinor = requirementsMinor; + this.RequirementsPatch = requirementsPatch; + this.RequirementsType = requirementsType; + this.Author = author; + this.AuthorUrl = authorUrl; + this.IconUrl = iconUrl; + ReadMe = readme; + this.Control = control; + } + + #region Public Methods + + /// + /// Imports the specified package + /// + /// Filename of the umbracopackage + /// true if the input file should be deleted after import + /// + public string Import(string inputFile, bool deleteFile) + { + using (Current.ProfilingLogger.DebugDuration( + $"Importing package file {inputFile}.", + $"Package file {inputFile} imported.")) + { + var tempDir = ""; + if (File.Exists(IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + inputFile))) + { + var fi = new FileInfo(IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + inputFile)); + // Check if the file is a valid package + if (fi.Extension.ToLower() == ".umb") + { + try + { + tempDir = UnPack(fi.FullName, deleteFile); + LoadConfig(tempDir); + } + catch (Exception exception) + { + Current.Logger.Error(string.Format("Error importing file {0}", fi.FullName), exception); + throw; + } + } + else + throw new Exception("Error - file isn't a package (doesn't have a .umb extension). Check if the file automatically got named '.zip' upon download."); + } + else + throw new Exception("Error - file not found. Could find file named '" + IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + inputFile) + "'"); + return tempDir; + } + + } + + /// + /// Imports the specified package + /// + /// Filename of the umbracopackage + /// + public string Import(string inputFile) + { + return Import(inputFile, true); + } + + public int CreateManifest(string tempDir, string guid, string repoGuid) + { + //This is the new improved install rutine, which chops up the process into 3 steps, creating the manifest, moving files, and finally handling umb objects + var packName = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/name")); + var packAuthor = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/author/name")); + var packAuthorUrl = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/author/website")); + var packVersion = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/version")); + var packReadme = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/readme")); + var packLicense = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/license ")); + var packUrl = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/url ")); + var iconUrl = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/iconUrl")); + + var enableSkins = false; + var skinRepoGuid = ""; + + if (Config.DocumentElement.SelectSingleNode("/umbPackage/enableSkins") != null) + { + var skinNode = Config.DocumentElement.SelectSingleNode("/umbPackage/enableSkins"); + enableSkins = bool.Parse(XmlHelper.GetNodeValue(skinNode)); + if (skinNode.Attributes["repository"] != null && string.IsNullOrEmpty(skinNode.Attributes["repository"].Value) == false) + skinRepoGuid = skinNode.Attributes["repository"].Value; + } + + //Create a new package instance to record all the installed package adds - this is the same format as the created packages has. + //save the package meta data + var insPack = InstalledPackage.MakeNew(packName); + insPack.Data.Author = packAuthor; + insPack.Data.AuthorUrl = packAuthorUrl; + insPack.Data.Version = packVersion; + insPack.Data.Readme = packReadme; + insPack.Data.License = packLicense; + insPack.Data.Url = packUrl; + insPack.Data.IconUrl = iconUrl; + + //skinning + insPack.Data.EnableSkins = enableSkins; + insPack.Data.SkinRepoGuid = string.IsNullOrEmpty(skinRepoGuid) ? Guid.Empty : new Guid(skinRepoGuid); + + insPack.Data.PackageGuid = guid; //the package unique key. + insPack.Data.RepositoryGuid = repoGuid; //the repository unique key, if the package is a file install, the repository will not get logged. + insPack.Save(); + + return insPack.Data.Id; + } + + public void InstallFiles(int packageId, string tempDir) + { + using (Current.ProfilingLogger.DebugDuration( + "Installing package files for package id " + packageId + " into temp folder " + tempDir, + "Package file installation complete for package id " + packageId)) + { + //retrieve the manifest to continue installation + var insPack = InstalledPackage.GetById(packageId); + + //TODO: Depending on some files, some files should be installed differently. + //i.e. if stylsheets should probably be installed via business logic, media items should probably use the media IFileSystem! + + // Move files + //string virtualBasePath = System.Web.HttpContext.Current.Request.ApplicationPath; + string basePath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath; + + try + { + foreach (XmlNode n in Config.DocumentElement.SelectNodes("//file")) + { + var destPath = GetFileName(basePath, XmlHelper.GetNodeValue(n.SelectSingleNode("orgPath"))); + var sourceFile = GetFileName(tempDir, XmlHelper.GetNodeValue(n.SelectSingleNode("guid"))); + var destFile = GetFileName(destPath, XmlHelper.GetNodeValue(n.SelectSingleNode("orgName"))); + + // Create the destination directory if it doesn't exist + if (Directory.Exists(destPath) == false) + Directory.CreateDirectory(destPath); + //If a file with this name exists, delete it + else if (File.Exists(destFile)) + File.Delete(destFile); + + // Copy the file + // SJ: Note - this used to do a move but some packages included the same file to be + // copied to multiple locations like so: + // + // + // my-icon.png + // /umbraco/Images/ + // my-icon.png + // + // + // my-icon.png + // /App_Plugins/MyPlugin/Images + // my-icon.png + // + // + // Since this file unzips as a flat list of files, moving the file the first time means + // that when you try to do that a second time, it would result in a FileNotFoundException + File.Copy(sourceFile, destFile); + + //PPH log file install + insPack.Data.Files.Add(XmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")) + "/" + XmlHelper.GetNodeValue(n.SelectSingleNode("orgName"))); + + } + + // Once we're done copying, remove all the files + foreach (XmlNode n in Config.DocumentElement.SelectNodes("//file")) + { + var sourceFile = GetFileName(tempDir, XmlHelper.GetNodeValue(n.SelectSingleNode("guid"))); + if (File.Exists(sourceFile)) + File.Delete(sourceFile); + } + } + catch (Exception exception) + { + Current.Logger.Error("Package install error", exception); + throw; + } + + // log that a user has install files + if (_currentUserId > -1) + { + Current.Services.AuditService.Add(AuditType.PackagerInstall, + string.Format("Package '{0}' installed. Package guid: {1}", insPack.Data.Name, insPack.Data.PackageGuid), + _currentUserId, -1); + } + + insPack.Save(); + } + } + + public void InstallBusinessLogic(int packageId, string tempDir) + { + using (Current.ProfilingLogger.DebugDuration( + "Installing business logic for package id " + packageId + " into temp folder " + tempDir, + "Package business logic installation complete for package id " + packageId)) + { + InstalledPackage insPack; + try + { + //retrieve the manifest to continue installation + insPack = InstalledPackage.GetById(packageId); + //bool saveNeeded = false; + + // Get current user, with a fallback + var currentUser = Current.Services.UserService.GetUserById(0); + + //TODO: Get rid of this entire class! Until then all packages will be installed by the admin user + + + //Xml as XElement which is used with the new PackagingService + var rootElement = Config.DocumentElement.GetXElement(); + var packagingService = Current.Services.PackagingService; + + //Perhaps it would have been a good idea to put the following into methods eh?!? + + #region DataTypes + var dataTypeElement = rootElement.Descendants("DataTypes").FirstOrDefault(); + if (dataTypeElement != null) + { + var dataTypeDefinitions = packagingService.ImportDataTypeDefinitions(dataTypeElement, currentUser.Id); + foreach (var dataTypeDefinition in dataTypeDefinitions) + { + insPack.Data.DataTypes.Add(dataTypeDefinition.Id.ToString(CultureInfo.InvariantCulture)); + } + } + #endregion + + #region Languages + var languageItemsElement = rootElement.Descendants("Languages").FirstOrDefault(); + if (languageItemsElement != null) + { + var insertedLanguages = packagingService.ImportLanguages(languageItemsElement); + insPack.Data.Languages.AddRange(insertedLanguages.Select(l => l.Id.ToString(CultureInfo.InvariantCulture))); + } + + #endregion + + #region Dictionary items + var dictionaryItemsElement = rootElement.Descendants("DictionaryItems").FirstOrDefault(); + if (dictionaryItemsElement != null) + { + var insertedDictionaryItems = packagingService.ImportDictionaryItems(dictionaryItemsElement); + insPack.Data.DictionaryItems.AddRange(insertedDictionaryItems.Select(d => d.Id.ToString(CultureInfo.InvariantCulture))); + } + #endregion + + #region Macros + var macroItemsElement = rootElement.Descendants("Macros").FirstOrDefault(); + if (macroItemsElement != null) + { + var insertedMacros = packagingService.ImportMacros(macroItemsElement); + insPack.Data.Macros.AddRange(insertedMacros.Select(m => m.Id.ToString(CultureInfo.InvariantCulture))); + } + #endregion + + #region Templates + var templateElement = rootElement.Descendants("Templates").FirstOrDefault(); + if (templateElement != null) + { + var templates = packagingService.ImportTemplates(templateElement, currentUser.Id); + foreach (var template in templates) + { + insPack.Data.Templates.Add(template.Id.ToString(CultureInfo.InvariantCulture)); + } + } + #endregion + + #region DocumentTypes + //Check whether the root element is a doc type rather then a complete package + var docTypeElement = rootElement.Name.LocalName.Equals("DocumentType") || + rootElement.Name.LocalName.Equals("DocumentTypes") + ? rootElement + : rootElement.Descendants("DocumentTypes").FirstOrDefault(); + + if (docTypeElement != null) + { + var contentTypes = packagingService.ImportContentTypes(docTypeElement, currentUser.Id); + foreach (var contentType in contentTypes) + { + insPack.Data.Documenttypes.Add(contentType.Id.ToString(CultureInfo.InvariantCulture)); + //saveNeeded = true; + } + } + #endregion + + #region Stylesheets + foreach (XmlNode n in Config.DocumentElement.SelectNodes("Stylesheets/Stylesheet")) + { + //StyleSheet s = StyleSheet.Import(n, currentUser); + + + string stylesheetName = XmlHelper.GetNodeValue(n.SelectSingleNode("Name")); + //StyleSheet s = GetByName(stylesheetName); + var s = Current.Services.FileService.GetStylesheetByName(stylesheetName); + if (s == null) + { + s = new Stylesheet(XmlHelper.GetNodeValue(n.SelectSingleNode("FileName"))) { Content = XmlHelper.GetNodeValue(n.SelectSingleNode("Content")) }; + Current.Services.FileService.SaveStylesheet(s); + } + + foreach (XmlNode prop in n.SelectNodes("Properties/Property")) + { + string alias = XmlHelper.GetNodeValue(prop.SelectSingleNode("Alias")); + var sp = s.Properties.SingleOrDefault(p => p != null && p.Alias == alias); + string name = XmlHelper.GetNodeValue(prop.SelectSingleNode("Name")); + if (sp == null) + { + //sp = StylesheetProperty.MakeNew( + // name, + // s, + // u); + + sp = new StylesheetProperty(name, "#" + name.ToSafeAlias(), ""); + s.AddProperty(sp); + } + else + { + //sp.Text = name; + //Changing the name requires removing the current property and then adding another new one + if (sp.Name != name) + { + s.RemoveProperty(sp.Name); + var newProp = new StylesheetProperty(name, sp.Alias, sp.Value); + s.AddProperty(newProp); + sp = newProp; + } + } + sp.Alias = alias; + sp.Value = XmlHelper.GetNodeValue(prop.SelectSingleNode("Value")); + } + //s.saveCssToFile(); + Current.Services.FileService.SaveStylesheet(s); + + + + + insPack.Data.Stylesheets.Add(s.Id.ToString(CultureInfo.InvariantCulture)); + //saveNeeded = true; + } + + //if (saveNeeded) { insPack.Save(); saveNeeded = false; } + #endregion + + #region Documents + var documentElement = rootElement.Descendants("DocumentSet").FirstOrDefault(); + if (documentElement != null) + { + var content = packagingService.ImportContent(documentElement, -1, currentUser.Id); + var firstContentItem = content.First(); + insPack.Data.ContentNodeId = firstContentItem.Id.ToString(CultureInfo.InvariantCulture); + } + #endregion + + #region Package Actions + foreach (XmlNode n in Config.DocumentElement.SelectNodes("Actions/Action")) + { + if (n.Attributes["undo"] == null || n.Attributes["undo"].Value == "true") + { + insPack.Data.Actions += n.OuterXml; + } + + //Run the actions tagged only for 'install' + + if (n.Attributes["runat"] != null && n.Attributes["runat"].Value == "install") + { + var alias = n.Attributes["alias"] != null ? n.Attributes["alias"].Value : ""; + + if (alias.IsNullOrWhiteSpace() == false) + { + PackageAction.RunPackageAction(insPack.Data.Name, alias, n); + } + } + } + #endregion + + insPack.Save(); + } + catch (Exception exception) + { + Current.Logger.Error("Error installing businesslogic", exception); + throw; + } + + OnPackageBusinessLogicInstalled(insPack); + OnPackageInstalled(insPack); + } + } + + /// + /// Remove the temp installation folder + /// + /// + /// + public void InstallCleanUp(int packageId, string tempDir) + { + if (Directory.Exists(tempDir)) + { + Directory.Delete(tempDir, true); + } + } + + /// + /// Reads the configuration of the package from the configuration xmldocument + /// + /// The folder to which the contents of the package is extracted + public void LoadConfig(string tempDir) + { + Config = new XmlDocument(); + Config.Load(tempDir + Path.DirectorySeparatorChar + "package.xml"); + + Name = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/name").FirstChild.Value; + Version = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/version").FirstChild.Value; + Url = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/url").FirstChild.Value; + License = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/license").FirstChild.Value; + LicenseUrl = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/license").Attributes.GetNamedItem("url").Value; + + RequirementsMajor = int.Parse(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/major").FirstChild.Value); + RequirementsMinor = int.Parse(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/minor").FirstChild.Value); + RequirementsPatch = int.Parse(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/patch").FirstChild.Value); + + var reqNode = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements"); + RequirementsType = reqNode != null && reqNode.Attributes != null && reqNode.Attributes["type"] != null + ? Enum.Parse(reqNode.Attributes["type"].Value, true) + : RequirementsType.Legacy; + var iconNode = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/iconUrl"); + if (iconNode != null && iconNode.FirstChild != null) + { + IconUrl = iconNode.FirstChild.Value; + } + + Author = Config.DocumentElement.SelectSingleNode("/umbPackage/info/author/name").FirstChild.Value; + AuthorUrl = Config.DocumentElement.SelectSingleNode("/umbPackage/info/author/website").FirstChild.Value; + + var basePath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath; + var dllBinFiles = new List(); + + foreach (XmlNode n in Config.DocumentElement.SelectNodes("//file")) + { + var badFile = false; + var destPath = GetFileName(basePath, XmlHelper.GetNodeValue(n.SelectSingleNode("orgPath"))); + var orgName = XmlHelper.GetNodeValue(n.SelectSingleNode("orgName")); + var destFile = GetFileName(destPath, orgName); + + if (destPath.ToLower().Contains(IOHelper.DirSepChar + "app_code")) + { + badFile = true; + } + + if (destPath.ToLower().Contains(IOHelper.DirSepChar + "bin")) + { + badFile = true; + } + + if (destFile.ToLower().EndsWith(".dll")) + { + badFile = true; + dllBinFiles.Add(Path.Combine(tempDir, orgName)); + } + + if (badFile) + { + ContainsUnsecureFiles = true; + _unsecureFiles.Add(XmlHelper.GetNodeValue(n.SelectSingleNode("orgName"))); + } + } + + + + //this will check for existing macros with the same alias + //since we will not overwrite on import it's a good idea to inform the user what will be overwritten + foreach (XmlNode n in Config.DocumentElement.SelectNodes("//macro")) + { + var alias = n.SelectSingleNode("alias").InnerText; + if (!string.IsNullOrEmpty(alias)) + { + var m = Current.Services.MacroService.GetByAlias(alias); + if (m != null) + { + ContainsMacroConflict = true; + if (_conflictingMacroAliases.ContainsKey(m.Name) == false) + { + _conflictingMacroAliases.Add(m.Name, alias); + } + } + } + } + + foreach (XmlNode n in Config.DocumentElement.SelectNodes("Templates/Template")) + { + var alias = n.SelectSingleNode("Alias").InnerText; + if (!string.IsNullOrEmpty(alias)) + { + var t = Current.Services.FileService.GetTemplate(alias); + if (t != null) + { + ContainsTemplateConflicts = true; + if (_conflictingTemplateAliases.ContainsKey(t.Alias) == false) + { + _conflictingTemplateAliases.Add(t.Alias, alias); + } + } + } + } + + foreach (XmlNode n in Config.DocumentElement.SelectNodes("Stylesheets/Stylesheet")) + { + var alias = n.SelectSingleNode("Name").InnerText; + if (!string.IsNullOrEmpty(alias)) + { + var s = Current.Services.FileService.GetStylesheetByName(alias); + if (s != null) + { + ContainsStyleSheeConflicts = true; + if (_conflictingStyleSheetNames.ContainsKey(s.Alias) == false) + { + _conflictingStyleSheetNames.Add(s.Alias, alias); + } + } + } + } + + var readmeNode = Config.DocumentElement.SelectSingleNode("/umbPackage/info/readme"); + if (readmeNode != null) + { + ReadMe = XmlHelper.GetNodeValue(readmeNode); + } + + var controlNode = Config.DocumentElement.SelectSingleNode("/umbPackage/control"); + if (controlNode != null) + { + Control = XmlHelper.GetNodeValue(controlNode); + } + } + + /// + /// This uses the old method of fetching and only supports the packages.umbraco.org repository. + /// + /// + /// + public string Fetch(Guid Package) + { + // Check for package directory + if (Directory.Exists(IOHelper.MapPath(SystemDirectories.Packages)) == false) + Directory.CreateDirectory(IOHelper.MapPath(SystemDirectories.Packages)); + + var wc = new System.Net.WebClient(); + + wc.DownloadFile( + "http://" + PackageServer + "/fetch?package=" + Package.ToString(), + IOHelper.MapPath(SystemDirectories.Packages + "/" + Package + ".umb")); + + return "packages\\" + Package + ".umb"; + } + + #endregion + + #region Private Methods + + /// + /// Gets the name of the file in the specified path. + /// Corrects possible problems with slashes that would result from a simple concatenation. + /// Can also be used to concatenate paths. + /// + /// The path. + /// Name of the file. + /// The name of the file in the specified path. + private static string GetFileName(string path, string fileName) + { + // virtual dir support + fileName = IOHelper.FindFile(fileName); + + if (path.Contains("[$")) + { + //this is experimental and undocumented... + path = path.Replace("[$UMBRACO]", SystemDirectories.Umbraco); + path = path.Replace("[$UMBRACOCLIENT]", SystemDirectories.UmbracoClient); + path = path.Replace("[$CONFIG]", SystemDirectories.Config); + path = path.Replace("[$DATA]", SystemDirectories.Data); + } + + //to support virtual dirs we try to lookup the file... + path = IOHelper.FindFile(path); + + + + Debug.Assert(path != null && path.Length >= 1); + Debug.Assert(fileName != null && fileName.Length >= 1); + + path = path.Replace('/', '\\'); + fileName = fileName.Replace('/', '\\'); + + // Does filename start with a slash? Does path end with one? + bool fileNameStartsWithSlash = (fileName[0] == Path.DirectorySeparatorChar); + bool pathEndsWithSlash = (path[path.Length - 1] == Path.DirectorySeparatorChar); + + // Path ends with a slash + if (pathEndsWithSlash) + { + if (!fileNameStartsWithSlash) + // No double slash, just concatenate + return path + fileName; + return path + fileName.Substring(1); + } + if (fileNameStartsWithSlash) + // Required slash specified, just concatenate + return path + fileName; + return path + Path.DirectorySeparatorChar + fileName; + } + + private static string UnPack(string zipName, bool deleteFile) + { + // Unzip + + //the temp directory will be the package GUID - this keeps it consistent! + //the zipName is always the package Guid.umb + + var packageFileName = Path.GetFileNameWithoutExtension(zipName); + var packageId = Guid.NewGuid(); + Guid.TryParse(packageFileName, out packageId); + + string tempDir = IOHelper.MapPath(SystemDirectories.Data) + Path.DirectorySeparatorChar + packageId.ToString(); + //clear the directory if it exists + if (Directory.Exists(tempDir)) Directory.Delete(tempDir, true); + Directory.CreateDirectory(tempDir); + + var s = new ZipInputStream(File.OpenRead(zipName)); + + ZipEntry theEntry; + while ((theEntry = s.GetNextEntry()) != null) + { + string fileName = Path.GetFileName(theEntry.Name); + + if (fileName != String.Empty) + { + FileStream streamWriter = File.Create(tempDir + Path.DirectorySeparatorChar + fileName); + + int size = 2048; + byte[] data = new byte[2048]; + while (true) + { + size = s.Read(data, 0, data.Length); + if (size > 0) + { + streamWriter.Write(data, 0, size); + } + else + { + break; + } + } + + streamWriter.Close(); + + } + } + + // Clean up + s.Close(); + + if (deleteFile) + { + File.Delete(zipName); + } + + + return tempDir; + + } + + #endregion + + internal static event EventHandler PackageBusinessLogicInstalled; + + private static void OnPackageBusinessLogicInstalled(InstalledPackage e) + { + EventHandler handler = PackageBusinessLogicInstalled; + if (handler != null) handler(null, e); + } + + private void OnPackageInstalled(InstalledPackage insPack) + { + // getting an InstallationSummary for sending to the PackagingService.ImportedPackage event + var fileService = Current.Services.FileService; + var macroService = Current.Services.MacroService; + var contentTypeService = Current.Services.ContentTypeService; + var dataTypeService = Current.Services.DataTypeService; + var localizationService = Current.Services.LocalizationService; + + var installationSummary = insPack.GetInstallationSummary(contentTypeService, dataTypeService, fileService, localizationService, macroService); + installationSummary.PackageInstalled = true; + + var args = new ImportPackageEventArgs(installationSummary, false); + PackagingService.OnImportedPackage(args); + } + } +} diff --git a/src/Umbraco.Web/_Legacy/Packager/Package.cs b/src/Umbraco.Web/_Legacy/Packager/Package.cs new file mode 100644 index 0000000000..826675d009 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/Package.cs @@ -0,0 +1,145 @@ +using System; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using Umbraco.Core.Composing; +using Umbraco.Core.Models.Membership; + +namespace umbraco.cms.businesslogic.packager +{ + [Obsolete("This class is not used and will be removed in future versions")] + [EditorBrowsable(EditorBrowsableState.Never)] + public class Package + { + public Package() + { + } + + /// + /// Initialize package install status object by specifying the internal id of the installation. + /// The id is specific to the local umbraco installation and cannot be used to identify the package in general. + /// Use the Package(Guid) constructor to check whether a package has been installed + /// + /// The internal id. + public Package(int Id) + { + Initialize(Id); + } + + public Package(Guid Id) + { + using (var scope = Current.ScopeProvider.CreateScope()) + { + int installStatusId = scope.Database.ExecuteScalar( + "select id from umbracoInstalledPackages where package = @package and upgradeId = 0", new { package = Id}); + + if (installStatusId > 0) + Initialize(installStatusId); + else + throw new ArgumentException("Package with id '" + Id.ToString() + "' is not installed"); + + scope.Complete(); + } + } + + private void Initialize(int id) + { + using (var scope = Current.ScopeProvider.CreateScope()) + { + var f = scope.Database.Fetch( + "select id, uninstalled, upgradeId, installDate, userId, package, versionMajor, versionMinor, versionPatch from umbracoInstalledPackages where id = @id", + new { id }).FirstOrDefault(); + if (f != null) + { + Id = id; + Uninstalled = f.uninstalled; + UpgradeId = f.upgradeId; + InstallDate = f.installDate; + User = Current.Services.UserService.GetUserById(f.userId); + PackageId = f.package; + VersionMajor = f.versionMajor; + VersionMinor = f.versionMinor; + VersionPatch = f.versionPatch; + } + + scope.Complete(); + } + } + + [MethodImpl(MethodImplOptions.Synchronized)] // ;-(( + public void Save() + { + using (var scope = Current.ScopeProvider.CreateScope()) + { + // check if package status exists + if (Id == 0) + { + // The method is synchronized + scope.Database.Execute("INSERT INTO umbracoInstalledPackages (uninstalled, upgradeId, installDate, userId, versionMajor, versionMinor, versionPatch) VALUES (@uninstalled, @upgradeId, @installDate, @userId, @versionMajor, @versionMinor, @versionPatch)", + new + { + uninstalled = Uninstalled, + upgradeId = UpgradeId, + installData = InstallDate, + userId = User.Id, + versionMajor = VersionMajor, + versionMinor = VersionMinor, + versionPath = VersionPatch, + id = Id + }); + Id = scope.Database.ExecuteScalar("SELECT MAX(id) FROM umbracoInstalledPackages"); + } + + scope.Database.Execute( + "update umbracoInstalledPackages set " + + "uninstalled = @uninstalled, " + + "upgradeId = @upgradeId, " + + "installDate = @installDate, " + + "userId = @userId, " + + "versionMajor = @versionMajor, " + + "versionMinor = @versionMinor, " + + "versionPatch = @versionPatch " + + "where id = @id", + new + { + uninstalled = Uninstalled, + upgradeId = UpgradeId, + installData = InstallDate, + userId = User.Id, + versionMajor = VersionMajor, + versionMinor = VersionMinor, + versionPath = VersionPatch, + id = Id + }); + + scope.Complete(); + } + } + + public bool Uninstalled { get; set; } + + + public IUser User { get; set; } + + + public DateTime InstallDate { get; set; } + + + public int Id { get; set; } + + + public int UpgradeId { get; set; } + + + public Guid PackageId { get; set; } + + + public int VersionPatch { get; set; } + + + public int VersionMinor { get; set; } + + + public int VersionMajor { get; set; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/_Legacy/Packager/PackageInstance/CreatedPackage.cs b/src/Umbraco.Web/_Legacy/Packager/PackageInstance/CreatedPackage.cs new file mode 100644 index 0000000000..5d811ed3d8 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/PackageInstance/CreatedPackage.cs @@ -0,0 +1,389 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml; +using Lucene.Net.Documents; +using Umbraco.Core; +using Umbraco.Core.Composing; +using Umbraco.Core.IO; +using Umbraco.Core.Models; +using Umbraco.Core.Services; +using File = System.IO.File; + + +namespace umbraco.cms.businesslogic.packager +{ + public class CreatedPackage + { + + public static CreatedPackage GetById(int id) + { + var pack = new CreatedPackage(); + pack.Data = data.Package(id, IOHelper.MapPath(Settings.CreatedPackagesSettings)); + return pack; + } + + public static CreatedPackage MakeNew(string name) + { + var pack = new CreatedPackage + { + Data = data.MakeNew(name, IOHelper.MapPath(Settings.CreatedPackagesSettings)) + }; + + + return pack; + } + + public void Save() + { + data.Save(this.Data, IOHelper.MapPath(Settings.CreatedPackagesSettings)); + } + + public void Delete() + { + data.Delete(this.Data.Id, IOHelper.MapPath(Settings.CreatedPackagesSettings)); + } + + public PackageInstance Data { get; set; } + + public static List GetAllCreatedPackages() + { + var val = new List(); + + foreach (var pack in data.GetAllPackages(IOHelper.MapPath(Settings.CreatedPackagesSettings))) + { + var crPack = new CreatedPackage(); + crPack.Data = pack; + val.Add(crPack); + } + + return val; + } + + private static XmlDocument _packageManifest; + private static void CreatePackageManifest() + { + _packageManifest = new XmlDocument(); + var xmldecl = _packageManifest.CreateXmlDeclaration("1.0", "UTF-8", "no"); + + _packageManifest.AppendChild(xmldecl); + + //root node + XmlNode umbPackage = _packageManifest.CreateElement("umbPackage"); + _packageManifest.AppendChild(umbPackage); + //Files node + umbPackage.AppendChild(_packageManifest.CreateElement("files")); + } + + private static void AppendElement(XmlNode node) + { + var root = _packageManifest.SelectSingleNode("/umbPackage"); + root.AppendChild(node); + } + + + public void Publish() + { + + var package = this; + var pack = package.Data; + + var outInt = 0; + + //Path checking... + var localPath = IOHelper.MapPath(SystemDirectories.Media + "/" + pack.Folder); + + if (Directory.Exists(localPath) == false) + Directory.CreateDirectory(localPath); + + //Init package file... + CreatePackageManifest(); + //Info section.. + AppendElement(PackagerUtility.PackageInfo(pack, _packageManifest)); + + //Documents and tags... + var contentNodeId = 0; + if (string.IsNullOrEmpty(pack.ContentNodeId) == false && int.TryParse(pack.ContentNodeId, out contentNodeId)) + { + if (contentNodeId > 0) + { + //Create the Documents/DocumentSet node + XmlNode documents = _packageManifest.CreateElement("Documents"); + XmlNode documentSet = _packageManifest.CreateElement("DocumentSet"); + XmlAttribute importMode = _packageManifest.CreateAttribute("importMode", ""); + importMode.Value = "root"; + documentSet.Attributes.Append(importMode); + documents.AppendChild(documentSet); + + //load content from umbraco. + //var umbDocument = new Document(contentNodeId); + //var x = umbDocument.ToXml(_packageManifest, pack.ContentLoadChildNodes); + var udoc = Current.Services.ContentService.GetById(contentNodeId); + var xe = pack.ContentLoadChildNodes ? udoc.ToDeepXml(Current.Services.PackagingService) : udoc.ToXml(Current.Services.PackagingService); + var x = xe.GetXmlNode(_packageManifest); + documentSet.AppendChild(x); + + AppendElement(documents); + + ////Create the TagProperties node - this is used to store a definition for all + //// document properties that are tags, this ensures that we can re-import tags properly + //XmlNode tagProps = _packageManifest.CreateElement("TagProperties"); + + ////before we try to populate this, we'll do a quick lookup to see if any of the documents + //// being exported contain published tags. + //var allExportedIds = documents.SelectNodes("//@id").Cast() + // .Select(x => x.Value.TryConvertTo()) + // .Where(x => x.Success) + // .Select(x => x.Result) + // .ToArray(); + //var allContentTags = new List(); + //foreach (var exportedId in allExportedIds) + //{ + // allContentTags.AddRange( + // Current.Services.TagService.GetTagsForEntity(exportedId)); + //} + + ////This is pretty round-about but it works. Essentially we need to get the properties that are tagged + //// but to do that we need to lookup by a tag (string) + //var allTaggedEntities = new List(); + //foreach (var group in allContentTags.Select(x => x.Group).Distinct()) + //{ + // allTaggedEntities.AddRange( + // Current.Services.TagService.GetTaggedContentByTagGroup(group)); + //} + + ////Now, we have all property Ids/Aliases and their referenced document Ids and tags + //var allExportedTaggedEntities = allTaggedEntities.Where(x => allExportedIds.Contains(x.EntityId)) + // .DistinctBy(x => x.EntityId) + // .OrderBy(x => x.EntityId); + + //foreach (var taggedEntity in allExportedTaggedEntities) + //{ + // foreach (var taggedProperty in taggedEntity.TaggedProperties.Where(x => x.Tags.Any())) + // { + // XmlNode tagProp = _packageManifest.CreateElement("TagProperty"); + // var docId = _packageManifest.CreateAttribute("docId", ""); + // docId.Value = taggedEntity.EntityId.ToString(CultureInfo.InvariantCulture); + // tagProp.Attributes.Append(docId); + + // var propertyAlias = _packageManifest.CreateAttribute("propertyAlias", ""); + // propertyAlias.Value = taggedProperty.PropertyTypeAlias; + // tagProp.Attributes.Append(propertyAlias); + + // var group = _packageManifest.CreateAttribute("group", ""); + // group.Value = taggedProperty.Tags.First().Group; + // tagProp.Attributes.Append(group); + + // tagProp.AppendChild(_packageManifest.CreateCDataSection( + // JsonConvert.SerializeObject(taggedProperty.Tags.Select(x => x.Text).ToArray()))); + + // tagProps.AppendChild(tagProp); + // } + //} + + //AppendElement(tagProps); + + } + } + + //Document types.. + var dtl = new List(); + var docTypes = _packageManifest.CreateElement("DocumentTypes"); + foreach (var dtId in pack.Documenttypes) + { + if (int.TryParse(dtId, out outInt)) + { + var docT = Current.Services.ContentTypeService.Get(outInt); + //DocumentType docT = new DocumentType(outInt); + + AddDocumentType(docT, ref dtl); + + } + } + + var exporter = new EntityXmlSerializer(); + + foreach (var d in dtl) + { + var xml = exporter.Serialize(Current.Services.DataTypeService, Current.Services.ContentTypeService, d); + var xNode = xml.GetXmlNode(); + var n = (XmlElement) _packageManifest.ImportNode(xNode, true); + docTypes.AppendChild(n); + } + + AppendElement(docTypes); + + //Templates + var templates = _packageManifest.CreateElement("Templates"); + foreach (var templateId in pack.Templates) + { + if (int.TryParse(templateId, out outInt)) + { + var t = Current.Services.FileService.GetTemplate(outInt); + + var serializer = new EntityXmlSerializer(); + var serialized = serializer.Serialize(t); + var n = serialized.GetXmlNode(_packageManifest); + + + templates.AppendChild(n); + } + } + AppendElement(templates); + + //Stylesheets + var stylesheets = _packageManifest.CreateElement("Stylesheets"); + foreach (var stylesheetName in pack.Stylesheets) + { + if (stylesheetName.IsNullOrWhiteSpace()) continue; + var stylesheetXmlNode = PackagerUtility.Stylesheet(stylesheetName, true, _packageManifest); + if (stylesheetXmlNode != null) + stylesheets.AppendChild(stylesheetXmlNode); + } + AppendElement(stylesheets); + + //Macros + var macros = _packageManifest.CreateElement("Macros"); + foreach (var macroId in pack.Macros) + { + if (int.TryParse(macroId, out outInt)) + { + macros.AppendChild(PackagerUtility.Macro(int.Parse(macroId), true, localPath, _packageManifest)); + } + } + AppendElement(macros); + + //Dictionary Items + var dictionaryItems = _packageManifest.CreateElement("DictionaryItems"); + foreach (var dictionaryId in pack.DictionaryItems) + { + if (int.TryParse(dictionaryId, out outInt)) + { + var di = Current.Services.LocalizationService.GetDictionaryItemById(outInt); + var entitySerializer = new EntityXmlSerializer(); + var xmlNode = entitySerializer.Serialize(di).GetXmlNode(_packageManifest); + dictionaryItems.AppendChild(xmlNode); + } + } + AppendElement(dictionaryItems); + + //Languages + var languages = _packageManifest.CreateElement("Languages"); + foreach (var langId in pack.Languages) + { + if (int.TryParse(langId, out outInt)) + { + var lang = Current.Services.LocalizationService.GetLanguageById(outInt); + + var serializer = new EntityXmlSerializer(); + var xml = serializer.Serialize(lang); + var n = xml.GetXmlNode(_packageManifest); + + languages.AppendChild(n); + } + } + AppendElement(languages); + + //TODO: Fix this! ... actually once we use the new packager we don't need to + + ////Datatypes + //var dataTypes = _packageManifest.CreateElement("DataTypes"); + //foreach (var dtId in pack.DataTypes) + //{ + // if (int.TryParse(dtId, out outInt)) + // { + // datatype.DataTypeDefinition dtd = new datatype.DataTypeDefinition(outInt); + // dataTypes.AppendChild(dtd.ToXml(_packageManifest)); + // } + //} + //AppendElement(dataTypes); + + //Files + foreach (var fileName in pack.Files) + { + PackagerUtility.AppendFileToManifest(fileName, localPath, _packageManifest); + } + + //Load control on install... + if (string.IsNullOrEmpty(pack.LoadControl) == false) + { + XmlNode control = _packageManifest.CreateElement("control"); + control.InnerText = pack.LoadControl; + PackagerUtility.AppendFileToManifest(pack.LoadControl, localPath, _packageManifest); + AppendElement(control); + } + + //Actions + if (string.IsNullOrEmpty(pack.Actions) == false) + { + try + { + var xdActions = new XmlDocument(); + xdActions.LoadXml("" + pack.Actions + ""); + var actions = xdActions.DocumentElement.SelectSingleNode("."); + + + if (actions != null) + { + actions = _packageManifest.ImportNode(actions, true).Clone(); + AppendElement(actions); + } + } + catch { } + } + + var manifestFileName = localPath + "/package.xml"; + + if (File.Exists(manifestFileName)) + File.Delete(manifestFileName); + + _packageManifest.Save(manifestFileName); + _packageManifest = null; + + + //string packPath = Settings.PackagerRoot.Replace(System.IO.Path.DirectorySeparatorChar.ToString(), "/") + "/" + pack.Name.Replace(' ', '_') + "_" + pack.Version.Replace(' ', '_') + "." + Settings.PackageFileExtension; + + // check if there's a packages directory below media + var packagesDirectory = SystemDirectories.Media + "/created-packages"; + if (Directory.Exists(IOHelper.MapPath(packagesDirectory)) == false) + { + Directory.CreateDirectory(IOHelper.MapPath(packagesDirectory)); + } + + + var packPath = packagesDirectory + "/" + (pack.Name + "_" + pack.Version).Replace(' ', '_') + "." + Settings.PackageFileExtension; + PackagerUtility.ZipPackage(localPath, IOHelper.MapPath(packPath)); + + pack.PackagePath = packPath; + + if (pack.PackageGuid.Trim() == "") + pack.PackageGuid = Guid.NewGuid().ToString(); + + package.Save(); + + //Clean up.. + File.Delete(localPath + "/package.xml"); + Directory.Delete(localPath, true); + } + + private void AddDocumentType(IContentType dt, ref List dtl) + { + if (dt.ParentId > 0) + { + var parent = Current.Services.ContentTypeService.Get(dt.ParentId); + if (parent != null) // could be a container + { + AddDocumentType(parent, ref dtl); + } + } + + if (dtl.Contains(dt) == false) + { + dtl.Add(dt); + } + } + + + + } +} diff --git a/src/Umbraco.Web/_Legacy/Packager/PackageInstance/IPackageInstance.cs b/src/Umbraco.Web/_Legacy/Packager/PackageInstance/IPackageInstance.cs new file mode 100644 index 0000000000..28c7c05b6b --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/PackageInstance/IPackageInstance.cs @@ -0,0 +1,28 @@ +using System; +namespace umbraco.cms.businesslogic.packager{ + public interface IPackageInstance { + string Actions { get; set; } + string Author { get; set; } + string AuthorUrl { get; set; } + bool ContentLoadChildNodes { get; set; } + string ContentNodeId { get; set; } + System.Collections.Generic.List Documenttypes { get; set; } + System.Collections.Generic.List Files { get; set; } + string Folder { get; set; } + bool HasUpdate { get; set; } + int Id { get; set; } + string License { get; set; } + string LicenseUrl { get; set; } + string LoadControl { get; set; } + System.Collections.Generic.List Macros { get; set; } + string Name { get; set; } + string PackageGuid { get; set; } + string PackagePath { get; set; } + string Readme { get; set; } + string RepositoryGuid { get; set; } + System.Collections.Generic.List Stylesheets { get; set; } + System.Collections.Generic.List Templates { get; set; } + string Url { get; set; } + string Version { get; set; } + } +} diff --git a/src/Umbraco.Web/_Legacy/Packager/PackageInstance/InstalledPackage.cs b/src/Umbraco.Web/_Legacy/Packager/PackageInstance/InstalledPackage.cs new file mode 100644 index 0000000000..b95e7318b9 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/PackageInstance/InstalledPackage.cs @@ -0,0 +1,199 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Umbraco.Core; +using Umbraco.Core.Composing; +using Umbraco.Core.Logging; +using Umbraco.Core.IO; +using Umbraco.Core.Models; +using Umbraco.Core.Models.Packaging; +using Umbraco.Core.Services; + +namespace umbraco.cms.businesslogic.packager { + public class InstalledPackage + { + + private int _saveHitCount = 0; + + public static InstalledPackage GetById(int id) { + InstalledPackage pack = new InstalledPackage(); + pack.Data = data.Package(id, IOHelper.MapPath(Settings.InstalledPackagesSettings)); + return pack; + } + + public static InstalledPackage GetByGuid(string packageGuid) { + InstalledPackage pack = new InstalledPackage(); + pack.Data = data.Package(packageGuid, IOHelper.MapPath(Settings.InstalledPackagesSettings)); + return pack; + } + + public static InstalledPackage MakeNew(string name) { + InstalledPackage pack = new InstalledPackage(); + pack.Data = data.MakeNew(name, IOHelper.MapPath(Settings.InstalledPackagesSettings)); + pack.OnNew(EventArgs.Empty); + return pack; + } + + public void Save() + { +#if DEBUG + _saveHitCount++; + Current.Logger.Info("The InstalledPackage class save method has been hit " + _saveHitCount + " times."); +#endif + this.FireBeforeSave(EventArgs.Empty); + data.Save(this.Data, IOHelper.MapPath(Settings.InstalledPackagesSettings)); + this.FireAfterSave(EventArgs.Empty); + } + + public static List GetAllInstalledPackages() { + + List val = new List(); + + foreach (PackageInstance pack in data.GetAllPackages(IOHelper.MapPath(Settings.InstalledPackagesSettings))) + { + InstalledPackage insPackage = new InstalledPackage(); + insPackage.Data = pack; + val.Add(insPackage); + } + + return val; + } + + private PackageInstance m_data; + public PackageInstance Data { + get { return m_data; } + set { m_data = value; } + } + + public void Delete(int userId) + { + Current.Services.AuditService.Add(AuditType.PackagerUninstall, string.Format("Package '{0}' uninstalled. Package guid: {1}", Data.Name, Data.PackageGuid), userId, -1); + Delete(); + } + + public void Delete() { + this.FireBeforeDelete(EventArgs.Empty); + data.Delete(this.Data.Id, IOHelper.MapPath(Settings.InstalledPackagesSettings)); + this.FireAfterDelete(EventArgs.Empty); + } + + public static bool isPackageInstalled(string packageGuid) { + try + { + if (data.GetFromGuid(packageGuid, IOHelper.MapPath(Settings.InstalledPackagesSettings), true) == null) + return false; + else + return true; + } + catch (Exception ex) + { + Current.Logger.Error("An error occured in isPackagedInstalled", ex); + return false; + } + } + + //EVENTS + public delegate void SaveEventHandler(InstalledPackage sender, EventArgs e); + public delegate void NewEventHandler(InstalledPackage sender, EventArgs e); + public delegate void DeleteEventHandler(InstalledPackage sender, EventArgs e); + + /// + /// Occurs when a macro is saved. + /// + public static event SaveEventHandler BeforeSave; + protected virtual void FireBeforeSave(EventArgs e) { + if (BeforeSave != null) + BeforeSave(this, e); + } + + public static event SaveEventHandler AfterSave; + protected virtual void FireAfterSave(EventArgs e) { + if (AfterSave != null) + AfterSave(this, e); + } + + public static event NewEventHandler New; + protected virtual void OnNew(EventArgs e) { + if (New != null) + New(this, e); + } + + public static event DeleteEventHandler BeforeDelete; + protected virtual void FireBeforeDelete(EventArgs e) { + if (BeforeDelete != null) + BeforeDelete(this, e); + } + + public static event DeleteEventHandler AfterDelete; + protected virtual void FireAfterDelete(EventArgs e) { + if (AfterDelete != null) + AfterDelete(this, e); + } + + + /// + /// Used internally for creating an InstallationSummary (used in new PackagingService) representation of this InstalledPackage object. + /// + /// + /// + /// + /// + /// + /// + internal InstallationSummary GetInstallationSummary(IContentTypeService contentTypeService, IDataTypeService dataTypeService, IFileService fileService, ILocalizationService localizationService, IMacroService macroService) + { + var macros = TryGetIntegerIds(Data.Macros).Select(macroService.GetById).ToList(); + var templates = TryGetIntegerIds(Data.Templates).Select(fileService.GetTemplate).ToList(); + var contentTypes = TryGetIntegerIds(Data.Documenttypes).Select(contentTypeService.Get).ToList(); // fixme - media types? + var dataTypes = TryGetIntegerIds(Data.DataTypes).Select(dataTypeService.GetDataTypeDefinitionById).ToList(); + var dictionaryItems = TryGetIntegerIds(Data.DictionaryItems).Select(localizationService.GetDictionaryItemById).ToList(); + var languages = TryGetIntegerIds(Data.Languages).Select(localizationService.GetLanguageById).ToList(); + + for (var i = 0; i < Data.Files.Count; i++) + { + var filePath = Data.Files[i]; + Data.Files[i] = filePath.GetRelativePath(); + } + + return new InstallationSummary + { + ContentTypesInstalled = contentTypes, + DataTypesInstalled = dataTypes, + DictionaryItemsInstalled = dictionaryItems, + FilesInstalled = Data.Files, + LanguagesInstalled = languages, + MacrosInstalled = macros, + MetaData = GetMetaData(), + TemplatesInstalled = templates, + }; + } + + internal MetaData GetMetaData() + { + return new MetaData() + { + AuthorName = Data.Author, + AuthorUrl = Data.AuthorUrl, + Control = Data.LoadControl, + License = Data.License, + LicenseUrl = Data.LicenseUrl, + Name = Data.Name, + Readme = Data.Readme, + Url = Data.Url, + Version = Data.Version + }; + } + + private static IEnumerable TryGetIntegerIds(IEnumerable ids) + { + var intIds = new List(); + foreach (var id in ids) + { + int parsed; + if (int.TryParse(id, out parsed)) + intIds.Add(parsed); + } + return intIds; + } + } +} diff --git a/src/Umbraco.Web/_Legacy/Packager/PackageInstance/PackageActions.cs b/src/Umbraco.Web/_Legacy/Packager/PackageInstance/PackageActions.cs new file mode 100644 index 0000000000..ff7a610f00 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/PackageInstance/PackageActions.cs @@ -0,0 +1,71 @@ +using System; +using System.Xml; +using Umbraco.Core; +using Umbraco.Core.Composing; +using Umbraco.Core.Logging; +using Umbraco.Core._Legacy.PackageActions; + + +namespace umbraco.cms.businesslogic.packager +{ + + /// + /// Package actions are executed on packge install / uninstall. + /// + public class PackageAction + { + + /// + /// Runs the package action with the specified action alias. + /// + /// Name of the package. + /// The action alias. + /// The action XML. + public static void RunPackageAction(string packageName, string actionAlias, XmlNode actionXml) + { + + foreach (var ipa in Current.PackageActions) + { + try + { + if (ipa.Alias() == actionAlias) + { + + ipa.Execute(packageName, actionXml); + } + } + catch (Exception ipaExp) + { + Current.Logger.Error(string.Format("Error loading package action '{0}' for package {1}", ipa.Alias(), packageName), ipaExp); + } + } + } + + /// + /// Undos the package action with the specified action alias. + /// + /// Name of the package. + /// The action alias. + /// The action XML. + public static void UndoPackageAction(string packageName, string actionAlias, System.Xml.XmlNode actionXml) + { + + foreach (IPackageAction ipa in Current.PackageActions) + { + try + { + if (ipa.Alias() == actionAlias) + { + + ipa.Undo(packageName, actionXml); + } + } + catch (Exception ipaExp) + { + Current.Logger.Error(string.Format("Error undoing package action '{0}' for package {1}", ipa.Alias(), packageName), ipaExp); + } + } + } + + } +} diff --git a/src/Umbraco.Web/_Legacy/Packager/PackageInstance/PackageInstance.cs b/src/Umbraco.Web/_Legacy/Packager/PackageInstance/PackageInstance.cs new file mode 100644 index 0000000000..74c5a619b8 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/PackageInstance/PackageInstance.cs @@ -0,0 +1,103 @@ +using System; + +using System.Xml; +using System.Xml.XPath; +using System.Collections.Generic; + +namespace umbraco.cms.businesslogic.packager +{ + public class PackageInstance + { + public int Id { get; set; } + + public string RepositoryGuid { get; set; } + + public string PackageGuid { get; set; } + + public bool HasUpdate { get; set; } + + public bool EnableSkins { get; set; } + + public Guid SkinRepoGuid { get; set; } + + public string Name { get; set; } + + public string Url { get; set; } + + public string Folder { get; set; } + + public string PackagePath { get; set; } + + public string Version { get; set; } + + /// + /// The minimum umbraco version that this package requires + /// + public Version UmbracoVersion { get; set; } + + public string Author { get; set; } + + public string AuthorUrl { get; set; } + + public string License { get; set; } + + public string LicenseUrl { get; set; } + + public string Readme { get; set; } + + public bool ContentLoadChildNodes { get; set; } + + public string ContentNodeId { get; set; } + + public List Macros { get; set; } + + public List Languages { get; set; } + + public List DictionaryItems { get; set; } + + public List Templates { get; set; } + + public List Documenttypes { get; set; } + + public List Stylesheets { get; set; } + + public List Files { get; set; } + + public string LoadControl { get; set; } + + public string Actions { get; set; } + + public List DataTypes { get; set; } + + public string IconUrl { get; set; } + + public PackageInstance() + { + SkinRepoGuid = Guid.Empty; + Name = string.Empty; + Url = string.Empty; + Folder = string.Empty; + PackagePath = string.Empty; + Version = string.Empty; + UmbracoVersion = null; + Author = string.Empty; + AuthorUrl = string.Empty; + License = string.Empty; + LicenseUrl = string.Empty; + Readme = string.Empty; + ContentNodeId = string.Empty; + IconUrl = string.Empty; + Macros = new List(); + Languages = new List(); + DictionaryItems = new List(); + Templates = new List(); + Documenttypes = new List(); + Stylesheets = new List(); + Files = new List(); + LoadControl = string.Empty; + DataTypes = new List(); + EnableSkins = false; + ContentLoadChildNodes = false; + } + } +} diff --git a/src/Umbraco.Web/_Legacy/Packager/PackageInstance/PackagerUtility.cs b/src/Umbraco.Web/_Legacy/Packager/PackageInstance/PackagerUtility.cs new file mode 100644 index 0000000000..5f2bd46498 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/PackageInstance/PackagerUtility.cs @@ -0,0 +1,334 @@ +using System; +using System.Collections; +using System.IO; +using System.Xml; +using ICSharpCode.SharpZipLib.Zip; +using Umbraco.Core; +using Umbraco.Core.Composing; +using Umbraco.Core.IO; +using Umbraco.Core.Services; + +namespace umbraco.cms.businesslogic.packager +{ + /// + /// A utillity class for working with packager data. + /// It provides basic methods for adding new items to a package manifest, moving files and other misc. + /// + public class PackagerUtility + { + /// + /// Creates a package manifest containing name, license, version and other meta data. + /// + /// The packinstance. + /// The xml document. + /// + public static XmlNode PackageInfo(PackageInstance pack, XmlDocument doc) + { + XmlNode info = doc.CreateElement("info"); + + //Package info + XmlNode package = doc.CreateElement("package"); + package.AppendChild(CreateNode("name", pack.Name, doc)); + package.AppendChild(CreateNode("version", pack.Version, doc)); + package.AppendChild(CreateNode("iconUrl", pack.IconUrl, doc)); + + XmlNode license = CreateNode("license", pack.License, doc); + license.Attributes.Append(CreateAttribute("url", pack.LicenseUrl, doc)); + package.AppendChild(license); + + package.AppendChild(CreateNode("url", pack.Url, doc)); + + XmlNode requirements = doc.CreateElement("requirements"); + //NOTE: The defaults are 3.0.0 - I'm just leaving that here since that's the way it's been //SD + requirements.AppendChild(CreateNode("major", pack.UmbracoVersion == null ? "3" : pack.UmbracoVersion.Major.ToInvariantString(), doc)); + requirements.AppendChild(CreateNode("minor", pack.UmbracoVersion == null ? "0" : pack.UmbracoVersion.Minor.ToInvariantString(), doc)); + requirements.AppendChild(CreateNode("patch", pack.UmbracoVersion == null ? "0" : pack.UmbracoVersion.Build.ToInvariantString(), doc)); + if (pack.UmbracoVersion != null) + requirements.Attributes.Append(CreateAttribute("type", "strict", doc)); + + package.AppendChild(requirements); + info.AppendChild(package); + + //Author + XmlNode author = CreateNode("author", "", doc); + author.AppendChild(CreateNode("name", pack.Author, doc)); + author.AppendChild(CreateNode("website", pack.AuthorUrl, doc)); + info.AppendChild(author); + + info.AppendChild(CreateNode("readme", "", doc)); + + return info; + } + + + /// + /// Converts an umbraco template to a package xml node + /// + /// The template id. + /// The xml doc. + /// + public static XmlNode Template(int templateId, XmlDocument doc) + { + var tmpl = Current.Services.FileService.GetTemplate(templateId); + //Template tmpl = new Template(templateId); + + XmlNode template = doc.CreateElement("Template"); + template.AppendChild(CreateNode("Name", tmpl.Name, doc)); + template.AppendChild(CreateNode("Alias", tmpl.Alias, doc)); + + //if (tmpl.MasterTemplate != 0) + if (string.IsNullOrWhiteSpace(tmpl.MasterTemplateAlias) == false) + template.AppendChild(CreateNode("Master", tmpl.MasterTemplateAlias, doc)); + + template.AppendChild(CreateNode("Design", "", doc)); + + return template; + } + + /// + /// Converts a umbraco stylesheet to a package xml node + /// + /// The name of the stylesheet. + /// if set to true [incluce properties]. + /// The doc. + /// + public static XmlNode Stylesheet(string name, bool includeProperties, XmlDocument doc) + { + if (doc == null) throw new ArgumentNullException("doc"); + if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", "name"); + + var fileService = Current.Services.FileService; + var sts = fileService.GetStylesheetByName(name); + var stylesheet = doc.CreateElement("Stylesheet"); + stylesheet.AppendChild(CreateNode("Name", sts.Alias, doc)); + stylesheet.AppendChild(CreateNode("FileName", sts.Name, doc)); + stylesheet.AppendChild(CreateNode("Content", "", doc)); + if (includeProperties) + { + var properties = doc.CreateElement("Properties"); + foreach (var ssP in sts.Properties) + { + var property = doc.CreateElement("Property"); + property.AppendChild(CreateNode("Name", ssP.Name, doc)); + property.AppendChild(CreateNode("Alias", ssP.Alias, doc)); + property.AppendChild(CreateNode("Value", ssP.Value, doc)); + } + stylesheet.AppendChild(properties); + } + return stylesheet; + } + + /// + /// Converts a macro to a package xml node + /// + /// The macro id. + /// if set to true [append file]. + /// The package directory. + /// The doc. + /// + public static XmlNode Macro(int macroId, bool appendFile, string packageDirectory, XmlDocument doc) + { + var mcr = Current.Services.MacroService.GetById(macroId); + + if (appendFile) + { + if (!string.IsNullOrEmpty(mcr.XsltPath)) + AppendFileToManifest(IOHelper.ResolveUrl(SystemDirectories.Xslt) + "/" + mcr.XsltPath, packageDirectory, doc); + + //TODO: Clearly the packager hasn't worked very well for packaging Partial Views to date since there is no logic in here for that + + //if (!string.IsNullOrEmpty(mcr.ScriptingFile)) + // AppendFileToManifest(IOHelper.ResolveUrl(SystemDirectories.MacroScripts) + "/" + mcr.ScriptingFile, packageDirectory, doc); + + if (!string.IsNullOrEmpty(mcr.ControlType)) + AppendFileToManifest(mcr.ControlType, packageDirectory, doc); + } + + var serializer = new EntityXmlSerializer(); + var xml = serializer.Serialize(mcr); + return xml.GetXmlNode(doc); + } + + + /// + /// Appends a file to package manifest and copies the file to the correct folder. + /// + /// The path. + /// The package directory. + /// The doc. + public static void AppendFileToManifest(string path, string packageDirectory, XmlDocument doc) + { + if (!path.StartsWith("~/") && !path.StartsWith("/")) + path = "~/" + path; + + string serverPath = IOHelper.MapPath(path); + + if (System.IO.File.Exists(serverPath)) + + AppendFileXml(path, packageDirectory, doc); + else if (System.IO.Directory.Exists(serverPath)) + ProcessDirectory(path, packageDirectory, doc); + } + + + + //Process files in directory and add them to package + private static void ProcessDirectory(string path, string packageDirectory, XmlDocument doc) + { + string serverPath = IOHelper.MapPath(path); + if (System.IO.Directory.Exists(serverPath)) + { + System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(serverPath); + + foreach (System.IO.FileInfo file in di.GetFiles()) + AppendFileXml(path + "/" + file.Name, packageDirectory, doc); + + foreach (System.IO.DirectoryInfo dir in di.GetDirectories()) + ProcessDirectory(path + "/" + dir.Name, packageDirectory, doc); + } + } + + private static void AppendFileXml(string path, string packageDirectory, XmlDocument doc) + { + + string serverPath = IOHelper.MapPath(path); + + string orgPath = path.Substring(0, (path.LastIndexOf('/'))); + string orgName = path.Substring((path.LastIndexOf('/') + 1)); + string newFileName = orgName; + + if (System.IO.File.Exists(packageDirectory + "/" + orgName)) + { + string fileGuid = System.Guid.NewGuid().ToString(); + newFileName = fileGuid + "_" + newFileName; + } + + //Copy file to directory for zipping... + System.IO.File.Copy(serverPath, packageDirectory + "/" + newFileName, true); + + //Append file info to files xml node + XmlNode files = doc.SelectSingleNode("/umbPackage/files"); + + XmlNode file = doc.CreateElement("file"); + file.AppendChild(CreateNode("guid", newFileName, doc)); + file.AppendChild(CreateNode("orgPath", orgPath == "" ? "/" : orgPath, doc)); + file.AppendChild(CreateNode("orgName", orgName, doc)); + + files.AppendChild(file); + } + + /// + /// Determines whether the file is in the package manifest + /// + /// The GUID. + /// The doc. + /// + /// true if [is file in manifest]; otherwise, false. + /// + public static bool IsFileInManifest(string guid, XmlDocument doc) + { + return false; + } + + private static XmlNode CreateNode(string name, string value, XmlDocument doc) + { + var node = doc.CreateElement(name); + node.InnerXml = value; + return node; + } + + private static XmlAttribute CreateAttribute(string name, string value, XmlDocument doc) + { + var attribute = doc.CreateAttribute(name); + attribute.Value = value; + return attribute; + } + + /// + /// Zips the package. + /// + /// The path. + /// The save path. + public static void ZipPackage(string Path, string savePath) + { + string OutPath = savePath; + + ArrayList ar = GenerateFileList(Path); + // generate file list + // find number of chars to remove from orginal file path + int TrimLength = (Directory.GetParent(Path)).ToString().Length; + + TrimLength += 1; + + //remove '\' + FileStream ostream; + + byte[] obuffer; + + ZipOutputStream oZipStream = new ZipOutputStream(System.IO.File.Create(OutPath)); + // create zip stream + + + oZipStream.SetLevel(9); + // 9 = maximum compression level + ZipEntry oZipEntry; + + foreach (string Fil in ar) // for each file, generate a zipentry + { + oZipEntry = new ZipEntry(Fil.Remove(0, TrimLength)); + oZipStream.PutNextEntry(oZipEntry); + + + if (!Fil.EndsWith(@"/")) // if a file ends with '/' its a directory + { + ostream = File.OpenRead(Fil); + + obuffer = new byte[ostream.Length]; + + // byte buffer + ostream.Read(obuffer, 0, obuffer.Length); + + oZipStream.Write(obuffer, 0, obuffer.Length); + ostream.Close(); + } + } + oZipStream.Finish(); + oZipStream.Close(); + oZipStream.Dispose(); + oZipStream = null; + + oZipEntry = null; + + + ostream = null; + ar.Clear(); + ar = null; + } + + private static ArrayList GenerateFileList(string Dir) + { + ArrayList mid = new ArrayList(); + + bool Empty = true; + + // add each file in directory + foreach (string file in Directory.GetFiles(Dir)) + { + mid.Add(file); + Empty = false; + } + + // if directory is completely empty, add it + if (Empty && Directory.GetDirectories(Dir).Length == 0) + mid.Add(Dir + @"/"); + + // do this recursively + foreach (string dirs in Directory.GetDirectories(Dir)) + { + foreach (object obj in GenerateFileList(dirs)) + mid.Add(obj); + } + return mid; // return file list + } + } +} diff --git a/src/Umbraco.Web/_Legacy/Packager/Repositories/Repository.cs b/src/Umbraco.Web/_Legacy/Packager/Repositories/Repository.cs new file mode 100644 index 0000000000..c7394ff935 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/Repositories/Repository.cs @@ -0,0 +1,291 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml; +using System.IO; +using System.Net; +using Umbraco.Core; +using Umbraco.Core.Configuration; +using Umbraco.Core.Composing; +using Umbraco.Core.Logging; +using Umbraco.Core.IO; +using Umbraco.Core.Models; + +namespace umbraco.cms.businesslogic.packager.repositories +{ + [Obsolete("This should not be used and will be removed in future Umbraco versions")] + public class Repository : DisposableObject + { + public string Guid { get; private set; } + + public string Name { get; private set; } + + public string RepositoryUrl { get; private set; } + + public string WebserviceUrl { get; private set; } + + + public RepositoryWebservice Webservice + { + get + { + var repo = new RepositoryWebservice(WebserviceUrl); + return repo; + } + } + + public SubmitStatus SubmitPackage(string authorGuid, PackageInstance package, byte[] doc) + { + + string packageName = package.Name; + string packageGuid = package.PackageGuid; + string description = package.Readme; + string packageFile = package.PackagePath; + + + System.IO.FileStream fs1 = null; + + try + { + + byte[] pack = new byte[0]; + fs1 = System.IO.File.Open(IOHelper.MapPath(packageFile), FileMode.Open, FileAccess.Read); + pack = new byte[fs1.Length]; + fs1.Read(pack, 0, (int) fs1.Length); + fs1.Close(); + fs1 = null; + + byte[] thumb = new byte[0]; //todo upload thumbnail... + + return Webservice.SubmitPackage(Guid, authorGuid, packageGuid, pack, doc, thumb, packageName, "", "", description); + } + catch (Exception ex) + { + Current.Logger.Error("An error occurred in SubmitPackage", ex); + + return SubmitStatus.Error; + } + } + + public static List getAll() + { + + var repositories = new List(); + + foreach (var r in UmbracoConfig.For.UmbracoSettings().PackageRepositories.Repositories) + { + var repository = new Repository + { + Guid = r.Id.ToString(), + Name = r.Name + }; + + repository.RepositoryUrl = r.RepositoryUrl; + repository.WebserviceUrl = repository.RepositoryUrl.Trim('/') + "/" + r.WebServiceUrl.Trim('/'); + if (r.HasCustomWebServiceUrl) + { + string wsUrl = r.WebServiceUrl; + + if (wsUrl.Contains("://")) + { + repository.WebserviceUrl = r.WebServiceUrl; + } + else + { + repository.WebserviceUrl = repository.RepositoryUrl.Trim('/') + "/" + wsUrl.Trim('/'); + } + } + + repositories.Add(repository); + } + + return repositories; + } + + public static Repository getByGuid(string repositoryGuid) + { + Guid id; + if (System.Guid.TryParse(repositoryGuid, out id) == false) + { + throw new FormatException("The repositoryGuid is not a valid GUID"); + } + + var found = UmbracoConfig.For.UmbracoSettings().PackageRepositories.Repositories.FirstOrDefault(x => x.Id == id); + if (found == null) + { + return null; + } + + var repository = new Repository + { + Guid = found.Id.ToString(), + Name = found.Name + }; + + repository.RepositoryUrl = found.RepositoryUrl; + repository.WebserviceUrl = repository.RepositoryUrl.Trim('/') + "/" + found.WebServiceUrl.Trim('/'); + + if (found.HasCustomWebServiceUrl) + { + string wsUrl = found.WebServiceUrl; + + if (wsUrl.Contains("://")) + { + repository.WebserviceUrl = found.WebServiceUrl; + } + else + { + repository.WebserviceUrl = repository.RepositoryUrl.Trim('/') + "/" + wsUrl.Trim('/'); + } + } + + return repository; + } + + //shortcut method to download pack from repo and place it on the server... + public string fetch(string packageGuid) + { + return fetch(packageGuid, string.Empty); + } + + public string fetch(string packageGuid, int userId) + { + // log + Current.Services.AuditService.Add(AuditType.PackagerInstall, + string.Format("Package {0} fetched from {1}", packageGuid, this.Guid), + userId, -1); + return fetch(packageGuid); + } + + /// + /// Used to get the correct package file from the repo for the current umbraco version + /// + /// + /// + /// + /// + public string GetPackageFile(string packageGuid, int userId, System.Version currentUmbracoVersion) + { + // log - obsolete + //Audit.Add(AuditTypes.PackagerInstall, + // string.Format("Package {0} fetched from {1}", packageGuid, this.Guid), + // userId, -1); + + var fileByteArray = Webservice.GetPackageFile(packageGuid, currentUmbracoVersion.ToString(3)); + + //successfull + if (fileByteArray.Length > 0) + { + // Check for package directory + if (Directory.Exists(IOHelper.MapPath(Settings.PackagerRoot)) == false) + Directory.CreateDirectory(IOHelper.MapPath(Settings.PackagerRoot)); + + using (var fs1 = new FileStream(IOHelper.MapPath(Settings.PackagerRoot + Path.DirectorySeparatorChar + packageGuid + ".umb"), FileMode.Create)) + { + fs1.Write(fileByteArray, 0, fileByteArray.Length); + fs1.Close(); + return "packages\\" + packageGuid + ".umb"; + } + } + + return ""; + } + + public bool HasConnection() + { + + string strServer = this.RepositoryUrl; + + try + { + + HttpWebRequest reqFP = (HttpWebRequest) HttpWebRequest.Create(strServer); + HttpWebResponse rspFP = (HttpWebResponse) reqFP.GetResponse(); + + if (HttpStatusCode.OK == rspFP.StatusCode) + { + + // HTTP = 200 - Internet connection available, server online + rspFP.Close(); + + return true; + + } + else + { + + // Other status - Server or connection not available + + rspFP.Close(); + + return false; + + } + + } + catch (WebException) + { + + // Exception - connection not available + + return false; + + } + } + + /// + /// This goes and fetches the Byte array for the package from OUR, but it's pretty strange + /// + /// + /// The package ID for the package file to be returned + /// + /// + /// This is a strange Umbraco version parameter - but it's not really an umbraco version, it's a special/odd version format like Version41 + /// but it's actually not used for the 7.5+ package installs so it's obsolete/unused. + /// + /// + public string fetch(string packageGuid, string key) + { + + byte[] fileByteArray = new byte[0]; + + if (key == string.Empty) + { + fileByteArray = Webservice.fetchPackageByVersion(packageGuid, Version.Version41); + } + else + { + fileByteArray = Webservice.fetchProtectedPackage(packageGuid, key); + } + + //successfull + if (fileByteArray.Length > 0) + { + + // Check for package directory + if (Directory.Exists(IOHelper.MapPath(Settings.PackagerRoot)) == false) + Directory.CreateDirectory(IOHelper.MapPath(Settings.PackagerRoot)); + + using (var fs1 = new FileStream(IOHelper.MapPath(Settings.PackagerRoot + Path.DirectorySeparatorChar + packageGuid + ".umb"), FileMode.Create)) + { + fs1.Write(fileByteArray, 0, fileByteArray.Length); + fs1.Close(); + return "packages\\" + packageGuid + ".umb"; + } + } + + // log + + return ""; + } + + /// + /// Handles the disposal of resources. Derived from abstract class which handles common required locking logic. + /// + protected override void DisposeResources() + { + Webservice.Dispose(); + } + } +} diff --git a/src/Umbraco.Web/_Legacy/Packager/Repositories/RepositoryWebservice.cs b/src/Umbraco.Web/_Legacy/Packager/Repositories/RepositoryWebservice.cs new file mode 100644 index 0000000000..36f0965e26 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/Repositories/RepositoryWebservice.cs @@ -0,0 +1,2002 @@ +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.Web.Services; +using System.Web.Services.Protocols; +using System.Xml.Serialization; + +namespace umbraco.cms.businesslogic.packager.repositories +{ + + + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Web.Services.WebServiceBindingAttribute(Name = "RepositorySoap", Namespace = "http://packages.umbraco.org/webservices/")] + public partial class RepositoryWebservice : System.Web.Services.Protocols.SoapHttpClientProtocol + { + + private System.Threading.SendOrPostCallback CategoriesOperationCompleted; + + private System.Threading.SendOrPostCallback NitrosOperationCompleted; + + private System.Threading.SendOrPostCallback NitrosByVersionOperationCompleted; + + private System.Threading.SendOrPostCallback NitrosCategorizedOperationCompleted; + + private System.Threading.SendOrPostCallback NitrosCategorizedByVersionOperationCompleted; + + private System.Threading.SendOrPostCallback StarterKitsOperationCompleted; + + private System.Threading.SendOrPostCallback StarterKitModulesCategorizedOperationCompleted; + + private System.Threading.SendOrPostCallback StarterKitModulesOperationCompleted; + + private System.Threading.SendOrPostCallback authenticateOperationCompleted; + + private System.Threading.SendOrPostCallback GetPackageFileOperationCompleted; + + private System.Threading.SendOrPostCallback fetchPackageByVersionOperationCompleted; + + private System.Threading.SendOrPostCallback fetchPackageOperationCompleted; + + private System.Threading.SendOrPostCallback fetchProtectedPackageOperationCompleted; + + private System.Threading.SendOrPostCallback SubmitPackageOperationCompleted; + + private System.Threading.SendOrPostCallback PackageByGuidOperationCompleted; + + private System.Threading.SendOrPostCallback SkinByGuidOperationCompleted; + + private System.Threading.SendOrPostCallback SkinsOperationCompleted; + + /// + public RepositoryWebservice(string url) + { + this.Url = url;//"http://our.umbraco.org/umbraco/webservices/api/repository.asmx"; + } + + /// + public event CategoriesCompletedEventHandler CategoriesCompleted; + + /// + public event NitrosCompletedEventHandler NitrosCompleted; + + /// + public event NitrosByVersionCompletedEventHandler NitrosByVersionCompleted; + + /// + public event NitrosCategorizedCompletedEventHandler NitrosCategorizedCompleted; + + /// + public event NitrosCategorizedByVersionCompletedEventHandler NitrosCategorizedByVersionCompleted; + + /// + public event StarterKitsCompletedEventHandler StarterKitsCompleted; + + /// + public event StarterKitModulesCategorizedCompletedEventHandler StarterKitModulesCategorizedCompleted; + + /// + public event StarterKitModulesCompletedEventHandler StarterKitModulesCompleted; + + /// + public event authenticateCompletedEventHandler authenticateCompleted; + + /// + public event GetPackageFileCompletedEventHandler GetPackageFileCompleted; + + /// + public event fetchPackageByVersionCompletedEventHandler fetchPackageByVersionCompleted; + + /// + public event fetchPackageCompletedEventHandler fetchPackageCompleted; + + /// + public event fetchProtectedPackageCompletedEventHandler fetchProtectedPackageCompleted; + + /// + public event SubmitPackageCompletedEventHandler SubmitPackageCompleted; + + /// + public event PackageByGuidCompletedEventHandler PackageByGuidCompleted; + + /// + public event SkinByGuidCompletedEventHandler SkinByGuidCompleted; + + /// + public event SkinsCompletedEventHandler SkinsCompleted; + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/Categories", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public Category[] Categories(string repositoryGuid) + { + object[] results = this.Invoke("Categories", new object[] { + repositoryGuid}); + return ((Category[])(results[0])); + } + + /// + public System.IAsyncResult BeginCategories(string repositoryGuid, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("Categories", new object[] { + repositoryGuid}, callback, asyncState); + } + + /// + public Category[] EndCategories(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((Category[])(results[0])); + } + + /// + public void CategoriesAsync(string repositoryGuid) + { + this.CategoriesAsync(repositoryGuid, null); + } + + /// + public void CategoriesAsync(string repositoryGuid, object userState) + { + if ((this.CategoriesOperationCompleted == null)) + { + this.CategoriesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCategoriesOperationCompleted); + } + this.InvokeAsync("Categories", new object[] { + repositoryGuid}, this.CategoriesOperationCompleted, userState); + } + + private void OnCategoriesOperationCompleted(object arg) + { + if ((this.CategoriesCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.CategoriesCompleted(this, new CategoriesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/Nitros", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public Package[] Nitros() + { + object[] results = this.Invoke("Nitros", new object[0]); + return ((Package[])(results[0])); + } + + /// + public System.IAsyncResult BeginNitros(System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("Nitros", new object[0], callback, asyncState); + } + + /// + public Package[] EndNitros(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((Package[])(results[0])); + } + + /// + public void NitrosAsync() + { + this.NitrosAsync(null); + } + + /// + public void NitrosAsync(object userState) + { + if ((this.NitrosOperationCompleted == null)) + { + this.NitrosOperationCompleted = new System.Threading.SendOrPostCallback(this.OnNitrosOperationCompleted); + } + this.InvokeAsync("Nitros", new object[0], this.NitrosOperationCompleted, userState); + } + + private void OnNitrosOperationCompleted(object arg) + { + if ((this.NitrosCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.NitrosCompleted(this, new NitrosCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/NitrosByVersion", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public Package[] NitrosByVersion(Version version) + { + object[] results = this.Invoke("NitrosByVersion", new object[] { + version}); + return ((Package[])(results[0])); + } + + /// + public System.IAsyncResult BeginNitrosByVersion(Version version, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("NitrosByVersion", new object[] { + version}, callback, asyncState); + } + + /// + public Package[] EndNitrosByVersion(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((Package[])(results[0])); + } + + /// + public void NitrosByVersionAsync(Version version) + { + this.NitrosByVersionAsync(version, null); + } + + /// + public void NitrosByVersionAsync(Version version, object userState) + { + if ((this.NitrosByVersionOperationCompleted == null)) + { + this.NitrosByVersionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnNitrosByVersionOperationCompleted); + } + this.InvokeAsync("NitrosByVersion", new object[] { + version}, this.NitrosByVersionOperationCompleted, userState); + } + + private void OnNitrosByVersionOperationCompleted(object arg) + { + if ((this.NitrosByVersionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.NitrosByVersionCompleted(this, new NitrosByVersionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/NitrosCategorized", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public Category[] NitrosCategorized() + { + object[] results = this.Invoke("NitrosCategorized", new object[0]); + return ((Category[])(results[0])); + } + + /// + public System.IAsyncResult BeginNitrosCategorized(System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("NitrosCategorized", new object[0], callback, asyncState); + } + + /// + public Category[] EndNitrosCategorized(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((Category[])(results[0])); + } + + /// + public void NitrosCategorizedAsync() + { + this.NitrosCategorizedAsync(null); + } + + /// + public void NitrosCategorizedAsync(object userState) + { + if ((this.NitrosCategorizedOperationCompleted == null)) + { + this.NitrosCategorizedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnNitrosCategorizedOperationCompleted); + } + this.InvokeAsync("NitrosCategorized", new object[0], this.NitrosCategorizedOperationCompleted, userState); + } + + private void OnNitrosCategorizedOperationCompleted(object arg) + { + if ((this.NitrosCategorizedCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.NitrosCategorizedCompleted(this, new NitrosCategorizedCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/NitrosCategorizedByVersion", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public Category[] NitrosCategorizedByVersion(Version version) + { + object[] results = this.Invoke("NitrosCategorizedByVersion", new object[] { + version}); + return ((Category[])(results[0])); + } + + /// + public System.IAsyncResult BeginNitrosCategorizedByVersion(Version version, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("NitrosCategorizedByVersion", new object[] { + version}, callback, asyncState); + } + + /// + public Category[] EndNitrosCategorizedByVersion(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((Category[])(results[0])); + } + + /// + public void NitrosCategorizedByVersionAsync(Version version) + { + this.NitrosCategorizedByVersionAsync(version, null); + } + + /// + public void NitrosCategorizedByVersionAsync(Version version, object userState) + { + if ((this.NitrosCategorizedByVersionOperationCompleted == null)) + { + this.NitrosCategorizedByVersionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnNitrosCategorizedByVersionOperationCompleted); + } + this.InvokeAsync("NitrosCategorizedByVersion", new object[] { + version}, this.NitrosCategorizedByVersionOperationCompleted, userState); + } + + private void OnNitrosCategorizedByVersionOperationCompleted(object arg) + { + if ((this.NitrosCategorizedByVersionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.NitrosCategorizedByVersionCompleted(this, new NitrosCategorizedByVersionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/StarterKits", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public Package[] StarterKits() + { + object[] results = this.Invoke("StarterKits", new object[0]); + return ((Package[])(results[0])); + } + + /// + public System.IAsyncResult BeginStarterKits(System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("StarterKits", new object[0], callback, asyncState); + } + + /// + public Package[] EndStarterKits(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((Package[])(results[0])); + } + + /// + public void StarterKitsAsync() + { + this.StarterKitsAsync(null); + } + + /// + public void StarterKitsAsync(object userState) + { + if ((this.StarterKitsOperationCompleted == null)) + { + this.StarterKitsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnStarterKitsOperationCompleted); + } + this.InvokeAsync("StarterKits", new object[0], this.StarterKitsOperationCompleted, userState); + } + + private void OnStarterKitsOperationCompleted(object arg) + { + if ((this.StarterKitsCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.StarterKitsCompleted(this, new StarterKitsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/StarterKitModulesCategorized", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public Category[] StarterKitModulesCategorized() + { + object[] results = this.Invoke("StarterKitModulesCategorized", new object[0]); + return ((Category[])(results[0])); + } + + /// + public System.IAsyncResult BeginStarterKitModulesCategorized(System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("StarterKitModulesCategorized", new object[0], callback, asyncState); + } + + /// + public Category[] EndStarterKitModulesCategorized(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((Category[])(results[0])); + } + + /// + public void StarterKitModulesCategorizedAsync() + { + this.StarterKitModulesCategorizedAsync(null); + } + + /// + public void StarterKitModulesCategorizedAsync(object userState) + { + if ((this.StarterKitModulesCategorizedOperationCompleted == null)) + { + this.StarterKitModulesCategorizedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnStarterKitModulesCategorizedOperationCompleted); + } + this.InvokeAsync("StarterKitModulesCategorized", new object[0], this.StarterKitModulesCategorizedOperationCompleted, userState); + } + + private void OnStarterKitModulesCategorizedOperationCompleted(object arg) + { + if ((this.StarterKitModulesCategorizedCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.StarterKitModulesCategorizedCompleted(this, new StarterKitModulesCategorizedCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/StarterKitModules", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public Package[] StarterKitModules() + { + object[] results = this.Invoke("StarterKitModules", new object[0]); + return ((Package[])(results[0])); + } + + /// + public System.IAsyncResult BeginStarterKitModules(System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("StarterKitModules", new object[0], callback, asyncState); + } + + /// + public Package[] EndStarterKitModules(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((Package[])(results[0])); + } + + /// + public void StarterKitModulesAsync() + { + this.StarterKitModulesAsync(null); + } + + /// + public void StarterKitModulesAsync(object userState) + { + if ((this.StarterKitModulesOperationCompleted == null)) + { + this.StarterKitModulesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnStarterKitModulesOperationCompleted); + } + this.InvokeAsync("StarterKitModules", new object[0], this.StarterKitModulesOperationCompleted, userState); + } + + private void OnStarterKitModulesOperationCompleted(object arg) + { + if ((this.StarterKitModulesCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.StarterKitModulesCompleted(this, new StarterKitModulesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/authenticate", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string authenticate(string email, string md5Password) + { + object[] results = this.Invoke("authenticate", new object[] { + email, + md5Password}); + return ((string)(results[0])); + } + + /// + public System.IAsyncResult Beginauthenticate(string email, string md5Password, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("authenticate", new object[] { + email, + md5Password}, callback, asyncState); + } + + /// + public string Endauthenticate(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((string)(results[0])); + } + + /// + public void authenticateAsync(string email, string md5Password) + { + this.authenticateAsync(email, md5Password, null); + } + + /// + public void authenticateAsync(string email, string md5Password, object userState) + { + if ((this.authenticateOperationCompleted == null)) + { + this.authenticateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnauthenticateOperationCompleted); + } + this.InvokeAsync("authenticate", new object[] { + email, + md5Password}, this.authenticateOperationCompleted, userState); + } + + private void OnauthenticateOperationCompleted(object arg) + { + if ((this.authenticateCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.authenticateCompleted(this, new authenticateCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + + + + + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/GetPackageFile", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute(DataType = "base64Binary")] + public byte[] GetPackageFile(string packageGuid, string umbracoVersion) + { + object[] results = this.Invoke("GetPackageFile", new object[] { + packageGuid, + umbracoVersion}); + return ((byte[])(results[0])); + } + + /// + public System.IAsyncResult BeginfetchPackageByVersion(string packageGuid, string umbracoVersion, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetPackageFile", new object[] { + packageGuid, + umbracoVersion}, callback, asyncState); + } + + /// + public byte[] EndGetPackageFile(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((byte[])(results[0])); + } + + /// + public void GetPackageFileAsync(string packageGuid, string umbracoVersion) + { + this.GetPackageFileAsync(packageGuid, umbracoVersion, null); + } + + /// + public void GetPackageFileAsync(string packageGuid, string umbracoVersion, object userState) + { + if ((this.GetPackageFileOperationCompleted == null)) + { + this.GetPackageFileOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetPackageFileOperationCompleted); + } + this.InvokeAsync("GetPackageFile", new object[] { + packageGuid, + umbracoVersion}, this.GetPackageFileOperationCompleted, userState); + } + + private void OnGetPackageFileOperationCompleted(object arg) + { + if ((this.GetPackageFileCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetPackageFileCompleted(this, new GetPackageFileCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + + + + + + + + + + + + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/fetchPackageByVersion", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute(DataType = "base64Binary")] + public byte[] fetchPackageByVersion(string packageGuid, Version schemaVersion) + { + object[] results = this.Invoke("fetchPackageByVersion", new object[] { + packageGuid, + schemaVersion}); + return ((byte[])(results[0])); + } + + /// + public System.IAsyncResult BeginfetchPackageByVersion(string packageGuid, Version schemaVersion, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("fetchPackageByVersion", new object[] { + packageGuid, + schemaVersion}, callback, asyncState); + } + + /// + public byte[] EndfetchPackageByVersion(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((byte[])(results[0])); + } + + /// + public void fetchPackageByVersionAsync(string packageGuid, Version schemaVersion) + { + this.fetchPackageByVersionAsync(packageGuid, schemaVersion, null); + } + + /// + public void fetchPackageByVersionAsync(string packageGuid, Version schemaVersion, object userState) + { + if ((this.fetchPackageByVersionOperationCompleted == null)) + { + this.fetchPackageByVersionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnfetchPackageByVersionOperationCompleted); + } + this.InvokeAsync("fetchPackageByVersion", new object[] { + packageGuid, + schemaVersion}, this.fetchPackageByVersionOperationCompleted, userState); + } + + private void OnfetchPackageByVersionOperationCompleted(object arg) + { + if ((this.fetchPackageByVersionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.fetchPackageByVersionCompleted(this, new fetchPackageByVersionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/fetchPackage", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute(DataType = "base64Binary")] + public byte[] fetchPackage(string packageGuid) + { + object[] results = this.Invoke("fetchPackage", new object[] { + packageGuid}); + return ((byte[])(results[0])); + } + + /// + public System.IAsyncResult BeginfetchPackage(string packageGuid, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("fetchPackage", new object[] { + packageGuid}, callback, asyncState); + } + + /// + public byte[] EndfetchPackage(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((byte[])(results[0])); + } + + /// + public void fetchPackageAsync(string packageGuid) + { + this.fetchPackageAsync(packageGuid, null); + } + + /// + public void fetchPackageAsync(string packageGuid, object userState) + { + if ((this.fetchPackageOperationCompleted == null)) + { + this.fetchPackageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnfetchPackageOperationCompleted); + } + this.InvokeAsync("fetchPackage", new object[] { + packageGuid}, this.fetchPackageOperationCompleted, userState); + } + + private void OnfetchPackageOperationCompleted(object arg) + { + if ((this.fetchPackageCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.fetchPackageCompleted(this, new fetchPackageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/fetchProtectedPackage", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute(DataType = "base64Binary")] + public byte[] fetchProtectedPackage(string packageGuid, string memberKey) + { + object[] results = this.Invoke("fetchProtectedPackage", new object[] { + packageGuid, + memberKey}); + return ((byte[])(results[0])); + } + + /// + public System.IAsyncResult BeginfetchProtectedPackage(string packageGuid, string memberKey, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("fetchProtectedPackage", new object[] { + packageGuid, + memberKey}, callback, asyncState); + } + + /// + public byte[] EndfetchProtectedPackage(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((byte[])(results[0])); + } + + /// + public void fetchProtectedPackageAsync(string packageGuid, string memberKey) + { + this.fetchProtectedPackageAsync(packageGuid, memberKey, null); + } + + /// + public void fetchProtectedPackageAsync(string packageGuid, string memberKey, object userState) + { + if ((this.fetchProtectedPackageOperationCompleted == null)) + { + this.fetchProtectedPackageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnfetchProtectedPackageOperationCompleted); + } + this.InvokeAsync("fetchProtectedPackage", new object[] { + packageGuid, + memberKey}, this.fetchProtectedPackageOperationCompleted, userState); + } + + private void OnfetchProtectedPackageOperationCompleted(object arg) + { + if ((this.fetchProtectedPackageCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.fetchProtectedPackageCompleted(this, new fetchProtectedPackageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/SubmitPackage", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public SubmitStatus SubmitPackage(string repositoryGuid, string authorGuid, string packageGuid, [System.Xml.Serialization.XmlElementAttribute(DataType = "base64Binary")] byte[] packageFile, [System.Xml.Serialization.XmlElementAttribute(DataType = "base64Binary")] byte[] packageDoc, [System.Xml.Serialization.XmlElementAttribute(DataType = "base64Binary")] byte[] packageThumbnail, string name, string author, string authorUrl, string description) + { + object[] results = this.Invoke("SubmitPackage", new object[] { + repositoryGuid, + authorGuid, + packageGuid, + packageFile, + packageDoc, + packageThumbnail, + name, + author, + authorUrl, + description}); + return ((SubmitStatus)(results[0])); + } + + /// + public System.IAsyncResult BeginSubmitPackage(string repositoryGuid, string authorGuid, string packageGuid, byte[] packageFile, byte[] packageDoc, byte[] packageThumbnail, string name, string author, string authorUrl, string description, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("SubmitPackage", new object[] { + repositoryGuid, + authorGuid, + packageGuid, + packageFile, + packageDoc, + packageThumbnail, + name, + author, + authorUrl, + description}, callback, asyncState); + } + + /// + public SubmitStatus EndSubmitPackage(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((SubmitStatus)(results[0])); + } + + /// + public void SubmitPackageAsync(string repositoryGuid, string authorGuid, string packageGuid, byte[] packageFile, byte[] packageDoc, byte[] packageThumbnail, string name, string author, string authorUrl, string description) + { + this.SubmitPackageAsync(repositoryGuid, authorGuid, packageGuid, packageFile, packageDoc, packageThumbnail, name, author, authorUrl, description, null); + } + + /// + public void SubmitPackageAsync(string repositoryGuid, string authorGuid, string packageGuid, byte[] packageFile, byte[] packageDoc, byte[] packageThumbnail, string name, string author, string authorUrl, string description, object userState) + { + if ((this.SubmitPackageOperationCompleted == null)) + { + this.SubmitPackageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSubmitPackageOperationCompleted); + } + this.InvokeAsync("SubmitPackage", new object[] { + repositoryGuid, + authorGuid, + packageGuid, + packageFile, + packageDoc, + packageThumbnail, + name, + author, + authorUrl, + description}, this.SubmitPackageOperationCompleted, userState); + } + + private void OnSubmitPackageOperationCompleted(object arg) + { + if ((this.SubmitPackageCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SubmitPackageCompleted(this, new SubmitPackageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/PackageByGuid", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public Package PackageByGuid(string packageGuid) + { + object[] results = this.Invoke("PackageByGuid", new object[] { + packageGuid}); + return ((Package)(results[0])); + } + + /// + public System.IAsyncResult BeginPackageByGuid(string packageGuid, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("PackageByGuid", new object[] { + packageGuid}, callback, asyncState); + } + + /// + public Package EndPackageByGuid(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((Package)(results[0])); + } + + /// + public void PackageByGuidAsync(string packageGuid) + { + this.PackageByGuidAsync(packageGuid, null); + } + + /// + public void PackageByGuidAsync(string packageGuid, object userState) + { + if ((this.PackageByGuidOperationCompleted == null)) + { + this.PackageByGuidOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPackageByGuidOperationCompleted); + } + this.InvokeAsync("PackageByGuid", new object[] { + packageGuid}, this.PackageByGuidOperationCompleted, userState); + } + + private void OnPackageByGuidOperationCompleted(object arg) + { + if ((this.PackageByGuidCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.PackageByGuidCompleted(this, new PackageByGuidCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/SkinByGuid", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public Skin SkinByGuid(string skinGuid) + { + object[] results = this.Invoke("SkinByGuid", new object[] { + skinGuid}); + return ((Skin)(results[0])); + } + + /// + public System.IAsyncResult BeginSkinByGuid(string skinGuid, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("SkinByGuid", new object[] { + skinGuid}, callback, asyncState); + } + + /// + public Skin EndSkinByGuid(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((Skin)(results[0])); + } + + /// + public void SkinByGuidAsync(string skinGuid) + { + this.SkinByGuidAsync(skinGuid, null); + } + + /// + public void SkinByGuidAsync(string skinGuid, object userState) + { + if ((this.SkinByGuidOperationCompleted == null)) + { + this.SkinByGuidOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSkinByGuidOperationCompleted); + } + this.InvokeAsync("SkinByGuid", new object[] { + skinGuid}, this.SkinByGuidOperationCompleted, userState); + } + + private void OnSkinByGuidOperationCompleted(object arg) + { + if ((this.SkinByGuidCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SkinByGuidCompleted(this, new SkinByGuidCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/Skins", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public Skin[] Skins(string starterKitGuid) + { + object[] results = this.Invoke("Skins", new object[] { + starterKitGuid}); + return ((Skin[])(results[0])); + } + + /// + public System.IAsyncResult BeginSkins(string starterKitGuid, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("Skins", new object[] { + starterKitGuid}, callback, asyncState); + } + + /// + public Skin[] EndSkins(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((Skin[])(results[0])); + } + + /// + public void SkinsAsync(string starterKitGuid) + { + this.SkinsAsync(starterKitGuid, null); + } + + /// + public void SkinsAsync(string starterKitGuid, object userState) + { + if ((this.SkinsOperationCompleted == null)) + { + this.SkinsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSkinsOperationCompleted); + } + this.InvokeAsync("Skins", new object[] { + starterKitGuid}, this.SkinsOperationCompleted, userState); + } + + private void OnSkinsOperationCompleted(object arg) + { + if ((this.SkinsCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SkinsCompleted(this, new SkinsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + public new void CancelAsync(object userState) + { + base.CancelAsync(userState); + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://packages.umbraco.org/webservices/")] + public partial class Category + { + + private string textField; + + private string descriptionField; + + private string urlField; + + private int idField; + + private Package[] packagesField; + + /// + public string Text + { + get + { + return this.textField; + } + set + { + this.textField = value; + } + } + + /// + public string Description + { + get + { + return this.descriptionField; + } + set + { + this.descriptionField = value; + } + } + + /// + public string Url + { + get + { + return this.urlField; + } + set + { + this.urlField = value; + } + } + + /// + public int Id + { + get + { + return this.idField; + } + set + { + this.idField = value; + } + } + + /// + public Package[] Packages + { + get + { + return this.packagesField; + } + set + { + this.packagesField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://packages.umbraco.org/webservices/")] + public partial class Package + { + + private System.Guid repoGuidField; + + private string textField; + + private string descriptionField; + + private string iconField; + + private string thumbnailField; + + private string documentationField; + + private string demoField; + + private bool acceptedField; + + private bool editorsPickField; + + private bool protectedField; + + private bool hasUpgradeField; + + private string upgradeVersionField; + + private string upgradeReadMeField; + + private string urlField; + + /// + public System.Guid RepoGuid + { + get + { + return this.repoGuidField; + } + set + { + this.repoGuidField = value; + } + } + + /// + public string Text + { + get + { + return this.textField; + } + set + { + this.textField = value; + } + } + + /// + public string Description + { + get + { + return this.descriptionField; + } + set + { + this.descriptionField = value; + } + } + + /// + public string Icon + { + get + { + return this.iconField; + } + set + { + this.iconField = value; + } + } + + /// + public string Thumbnail + { + get + { + return this.thumbnailField; + } + set + { + this.thumbnailField = value; + } + } + + /// + public string Documentation + { + get + { + return this.documentationField; + } + set + { + this.documentationField = value; + } + } + + /// + public string Demo + { + get + { + return this.demoField; + } + set + { + this.demoField = value; + } + } + + /// + public bool Accepted + { + get + { + return this.acceptedField; + } + set + { + this.acceptedField = value; + } + } + + /// + public bool EditorsPick + { + get + { + return this.editorsPickField; + } + set + { + this.editorsPickField = value; + } + } + + /// + public bool Protected + { + get + { + return this.protectedField; + } + set + { + this.protectedField = value; + } + } + + /// + public bool HasUpgrade + { + get + { + return this.hasUpgradeField; + } + set + { + this.hasUpgradeField = value; + } + } + + /// + public string UpgradeVersion + { + get + { + return this.upgradeVersionField; + } + set + { + this.upgradeVersionField = value; + } + } + + /// + public string UpgradeReadMe + { + get + { + return this.upgradeReadMeField; + } + set + { + this.upgradeReadMeField = value; + } + } + + /// + public string Url + { + get + { + return this.urlField; + } + set + { + this.urlField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://packages.umbraco.org/webservices/")] + public partial class Skin + { + + private System.Guid repoGuidField; + + private string textField; + + private string thumbnailField; + + private string previewField; + + private string descriptionField; + + private string authorField; + + private string authorUrlField; + + private string licenseField; + + private string licenseUrlField; + + /// + public System.Guid RepoGuid + { + get + { + return this.repoGuidField; + } + set + { + this.repoGuidField = value; + } + } + + /// + public string Text + { + get + { + return this.textField; + } + set + { + this.textField = value; + } + } + + /// + public string Thumbnail + { + get + { + return this.thumbnailField; + } + set + { + this.thumbnailField = value; + } + } + + /// + public string Preview + { + get + { + return this.previewField; + } + set + { + this.previewField = value; + } + } + + /// + public string Description + { + get + { + return this.descriptionField; + } + set + { + this.descriptionField = value; + } + } + + /// + public string Author + { + get + { + return this.authorField; + } + set + { + this.authorField = value; + } + } + + /// + public string AuthorUrl + { + get + { + return this.authorUrlField; + } + set + { + this.authorUrlField = value; + } + } + + /// + public string License + { + get + { + return this.licenseField; + } + set + { + this.licenseField = value; + } + } + + /// + public string LicenseUrl + { + get + { + return this.licenseUrlField; + } + set + { + this.licenseUrlField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://packages.umbraco.org/webservices/")] + public enum Version + { + + /// + Version3, + + /// + Version4, + + /// + /// This is apparently the version number we pass in for all installs + /// + Version41, + + /// + Version41Legacy, + + /// + Version50, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://packages.umbraco.org/webservices/")] + public enum SubmitStatus + { + + /// + Complete, + + /// + Exists, + + /// + NoAccess, + + /// + Error, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void CategoriesCompletedEventHandler(object sender, CategoriesCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class CategoriesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal CategoriesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public Category[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((Category[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void NitrosCompletedEventHandler(object sender, NitrosCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class NitrosCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal NitrosCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public Package[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((Package[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void NitrosByVersionCompletedEventHandler(object sender, NitrosByVersionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class NitrosByVersionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal NitrosByVersionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public Package[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((Package[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void NitrosCategorizedCompletedEventHandler(object sender, NitrosCategorizedCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class NitrosCategorizedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal NitrosCategorizedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public Category[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((Category[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void NitrosCategorizedByVersionCompletedEventHandler(object sender, NitrosCategorizedByVersionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class NitrosCategorizedByVersionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal NitrosCategorizedByVersionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public Category[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((Category[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void StarterKitsCompletedEventHandler(object sender, StarterKitsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class StarterKitsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal StarterKitsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public Package[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((Package[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void StarterKitModulesCategorizedCompletedEventHandler(object sender, StarterKitModulesCategorizedCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class StarterKitModulesCategorizedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal StarterKitModulesCategorizedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public Category[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((Category[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void StarterKitModulesCompletedEventHandler(object sender, StarterKitModulesCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class StarterKitModulesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal StarterKitModulesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public Package[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((Package[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void authenticateCompletedEventHandler(object sender, authenticateCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class authenticateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal authenticateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public string Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } + } + + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void GetPackageFileCompletedEventHandler(object sender, GetPackageFileCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetPackageFileCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetPackageFileCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public byte[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((byte[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void fetchPackageByVersionCompletedEventHandler(object sender, fetchPackageByVersionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class fetchPackageByVersionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal fetchPackageByVersionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public byte[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((byte[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void fetchPackageCompletedEventHandler(object sender, fetchPackageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class fetchPackageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal fetchPackageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public byte[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((byte[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void fetchProtectedPackageCompletedEventHandler(object sender, fetchProtectedPackageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class fetchProtectedPackageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal fetchProtectedPackageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public byte[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((byte[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void SubmitPackageCompletedEventHandler(object sender, SubmitPackageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SubmitPackageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal SubmitPackageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public SubmitStatus Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((SubmitStatus)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void PackageByGuidCompletedEventHandler(object sender, PackageByGuidCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class PackageByGuidCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal PackageByGuidCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public Package Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((Package)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void SkinByGuidCompletedEventHandler(object sender, SkinByGuidCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SkinByGuidCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal SkinByGuidCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public Skin Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((Skin)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + public delegate void SkinsCompletedEventHandler(object sender, SkinsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SkinsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal SkinsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public Skin[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((Skin[])(this.results[0])); + } + } + } +} diff --git a/src/Umbraco.Web/_Legacy/Packager/RequirementsType.cs b/src/Umbraco.Web/_Legacy/Packager/RequirementsType.cs new file mode 100644 index 0000000000..73022cda50 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/RequirementsType.cs @@ -0,0 +1,8 @@ +namespace umbraco.cms.businesslogic.packager +{ + public enum RequirementsType + { + Strict, + Legacy + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/_Legacy/Packager/Settings.cs b/src/Umbraco.Web/_Legacy/Packager/Settings.cs new file mode 100644 index 0000000000..d91b0c4871 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/Settings.cs @@ -0,0 +1,83 @@ +using System; +using System.Data; +using System.Configuration; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; +using System.IO; +using Umbraco.Core.IO; + +namespace umbraco.cms.businesslogic.packager +{ + public class Settings + { + + public static string PackagerRoot + { + get { return SystemDirectories.Packages; } + } + + public static string PackagesStorage + { + get { return SystemDirectories.Packages + IOHelper.DirSepChar + "created"; } + } + + public static string InstalledPackagesStorage + { + get { return SystemDirectories.Packages + IOHelper.DirSepChar + "installed"; } + } + + public static string InstalledPackagesSettings + { + get { return SystemDirectories.Packages + IOHelper.DirSepChar + "installed" + IOHelper.DirSepChar + "installedPackages.config"; } + } + + public static string CreatedPackagesSettings + { + get { return SystemDirectories.Packages + IOHelper.DirSepChar + "created" + IOHelper.DirSepChar + "createdPackages.config"; } + } + + public static string PackageFileExtension + { + get { return "zip"; } + } + + public static bool HasFileAccess(ref Exception exp) + { + bool hasAccess = false; + StreamWriter sw1 = null; + StreamWriter sw2 = null; + try + { + sw1 = System.IO.File.AppendText(IOHelper.MapPath(InstalledPackagesSettings)); + sw1.Close(); + + sw2 = System.IO.File.AppendText(IOHelper.MapPath(CreatedPackagesSettings)); + sw1.Close(); + + System.IO.Directory.CreateDirectory(IOHelper.MapPath(PackagesStorage) + IOHelper.DirSepChar + "__testFolder__"); + System.IO.Directory.CreateDirectory(IOHelper.MapPath(InstalledPackagesStorage) + IOHelper.DirSepChar + "__testFolder__"); + + System.IO.Directory.Delete(IOHelper.MapPath(PackagesStorage) + IOHelper.DirSepChar + "__testFolder__", true); + System.IO.Directory.Delete(IOHelper.MapPath(InstalledPackagesStorage) + IOHelper.DirSepChar + "__testFolder__", true); + + hasAccess = true; + } + finally + { + if (sw1 != null) + sw1.Close(); + if (sw2 != null) + sw2.Close(); + } + + return hasAccess; + } + + + } + +} diff --git a/src/Umbraco.Web/_Legacy/Packager/data.cs b/src/Umbraco.Web/_Legacy/Packager/data.cs new file mode 100644 index 0000000000..0edb1017c9 --- /dev/null +++ b/src/Umbraco.Web/_Legacy/Packager/data.cs @@ -0,0 +1,415 @@ +using System; +using System.Xml; +using System.Xml.XPath; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using Umbraco.Core; +using Umbraco.Core.Configuration; +using Umbraco.Core.Composing; +using Umbraco.Core.IO; +using Umbraco.Core.Logging; +using Umbraco.Core.Xml; + +namespace umbraco.cms.businesslogic.packager +{ + /// + /// This is the xml data for installed packages. This is not the same xml as a pckage format! + /// + public class data + { + private static XmlDocument _source; + + public static XmlDocument Source + { + get + { + return _source; + } + } + + public static void Reload(string dataSource) + { + //do some error checking and create the folders/files if they don't exist + if (!File.Exists(dataSource)) + { + if (!Directory.Exists(IOHelper.MapPath(Settings.PackagerRoot))) + { + Directory.CreateDirectory(IOHelper.MapPath(Settings.PackagerRoot)); + } + if (!Directory.Exists(IOHelper.MapPath(Settings.PackagesStorage))) + { + Directory.CreateDirectory(IOHelper.MapPath(Settings.PackagesStorage)); + } + if (!Directory.Exists(IOHelper.MapPath(Settings.InstalledPackagesStorage))) + { + Directory.CreateDirectory(IOHelper.MapPath(Settings.InstalledPackagesStorage)); + } + + using (StreamWriter sw = File.CreateText(dataSource)) + { + sw.Write(umbraco.cms.businesslogic.Packager.FileResources.PackageFiles.Packages); + sw.Flush(); + } + + } + + if (_source == null) + { + _source = new XmlDocument(); + } + + //error checking here + if (File.Exists(dataSource)) + { + var isEmpty = false; + using (var sr = new StreamReader(dataSource)) + { + if (sr.ReadToEnd().IsNullOrWhiteSpace()) + { + isEmpty = true; + } + } + if (isEmpty) + { + File.WriteAllText(dataSource, @""); + } + } + + _source.Load(dataSource); + } + + public static XmlNode GetFromId(int Id, string dataSource, bool reload) + { + if (reload) + Reload(dataSource); + + return Source.SelectSingleNode("/packages/package [@id = '" + Id.ToString().ToUpper() + "']"); + } + + public static XmlNode GetFromGuid(string guid, string dataSource, bool reload) + { + if (reload) + Reload(dataSource); + + return Source.SelectSingleNode("/packages/package [@packageGuid = '" + guid + "']"); + } + + public static PackageInstance MakeNew(string Name, string dataSource) + { + Reload(dataSource); + + int maxId = 1; + // Find max id + foreach (XmlNode n in Source.SelectNodes("packages/package")) + { + if (int.Parse(n.Attributes.GetNamedItem("id").Value) >= maxId) + maxId = int.Parse(n.Attributes.GetNamedItem("id").Value) + 1; + } + + XmlElement instance = Source.CreateElement("package"); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "id", maxId.ToString())); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "version", "")); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "url", "")); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "name", Name)); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "folder", Guid.NewGuid().ToString())); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "packagepath", "")); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "repositoryGuid", "")); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "iconUrl", "")); + //set to current version + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "umbVersion", UmbracoVersion.Current.ToString(3))); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "packageGuid", Guid.NewGuid().ToString())); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "hasUpdate", "false")); + + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "enableSkins", "false")); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "skinRepoGuid", "")); + + XmlElement license = Source.CreateElement("license"); + license.InnerText = "MIT License"; + license.Attributes.Append(XmlHelper.AddAttribute(Source, "url", "http://opensource.org/licenses/MIT")); + instance.AppendChild(license); + + XmlElement author = Source.CreateElement("author"); + author.InnerText = ""; + author.Attributes.Append(XmlHelper.AddAttribute(Source, "url", "")); + instance.AppendChild(author); + + instance.AppendChild(XmlHelper.AddTextNode(Source, "readme", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "actions", "")); + + instance.AppendChild(XmlHelper.AddTextNode(Source, "datatypes", "")); + + XmlElement content = Source.CreateElement("content"); + content.InnerText = ""; + content.Attributes.Append(XmlHelper.AddAttribute(Source, "nodeId", "")); + content.Attributes.Append(XmlHelper.AddAttribute(Source, "loadChildNodes", "false")); + instance.AppendChild(content); + + instance.AppendChild(XmlHelper.AddTextNode(Source, "templates", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "stylesheets", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "documenttypes", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "macros", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "files", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "languages", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "dictionaryitems", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "loadcontrol", "")); + + Source.SelectSingleNode("packages").AppendChild(instance); + Source.Save(dataSource); + var retVal = data.Package(maxId, dataSource); + + return retVal; + } + + public static PackageInstance Package(int id, string datasource) + { + return ConvertXmlToPackage(GetFromId(id, datasource, true)); + } + + public static PackageInstance Package(string guid, string datasource) + { + XmlNode node = GetFromGuid(guid, datasource, true); + if (node != null) + return ConvertXmlToPackage(node); + else + return new PackageInstance(); + } + + public static List GetAllPackages(string dataSource) + { + Reload(dataSource); + XmlNodeList nList = data.Source.SelectNodes("packages/package"); + + List retVal = new List(); + + for (int i = 0; i < nList.Count; i++) + { + try + { + retVal.Add(ConvertXmlToPackage(nList[i])); + } + catch (Exception ex) + { + Current.Logger.Error("An error occurred in GetAllPackages", ex); + } + } + + return retVal; + } + + private static PackageInstance ConvertXmlToPackage(XmlNode n) + { + PackageInstance retVal = new PackageInstance(); + + if (n != null) + { + retVal.Id = int.Parse(SafeAttribute("id", n)); + retVal.Name = SafeAttribute("name", n); + retVal.Folder = SafeAttribute("folder", n); + retVal.PackagePath = SafeAttribute("packagepath", n); + retVal.Version = SafeAttribute("version", n); + retVal.Url = SafeAttribute("url", n); + retVal.RepositoryGuid = SafeAttribute("repositoryGuid", n); + retVal.PackageGuid = SafeAttribute("packageGuid", n); + retVal.HasUpdate = bool.Parse(SafeAttribute("hasUpdate", n)); + + retVal.IconUrl = SafeAttribute("iconUrl", n); + var umbVersion = SafeAttribute("umbVersion", n); + Version parsedVersion; + if (umbVersion.IsNullOrWhiteSpace() == false && Version.TryParse(umbVersion, out parsedVersion)) + { + retVal.UmbracoVersion = parsedVersion; + } + + bool enableSkins = false; + bool.TryParse(SafeAttribute("enableSkins", n), out enableSkins); + retVal.EnableSkins = enableSkins; + + retVal.SkinRepoGuid = string.IsNullOrEmpty(SafeAttribute("skinRepoGuid", n)) ? Guid.Empty : new Guid(SafeAttribute("skinRepoGuid", n)); + + retVal.License = SafeNodeValue(n.SelectSingleNode("license")); + retVal.LicenseUrl = n.SelectSingleNode("license").Attributes.GetNamedItem("url").Value; + + retVal.Author = SafeNodeValue(n.SelectSingleNode("author")); + retVal.AuthorUrl = SafeAttribute("url", n.SelectSingleNode("author")); + + retVal.Readme = SafeNodeValue(n.SelectSingleNode("readme")); + retVal.Actions = SafeNodeInnerXml(n.SelectSingleNode("actions")); + + retVal.ContentNodeId = SafeAttribute("nodeId", n.SelectSingleNode("content")); + retVal.ContentLoadChildNodes = bool.Parse(SafeAttribute("loadChildNodes", n.SelectSingleNode("content"))); + + retVal.Macros = new List(SafeNodeValue(n.SelectSingleNode("macros")).Trim(',').Split(',')); + retVal.Macros = new List(SafeNodeValue(n.SelectSingleNode("macros")).Trim(',').Split(',')); + retVal.Templates = new List(SafeNodeValue(n.SelectSingleNode("templates")).Trim(',').Split(',')); + retVal.Stylesheets = new List(SafeNodeValue(n.SelectSingleNode("stylesheets")).Trim(',').Split(',')); + retVal.Documenttypes = new List(SafeNodeValue(n.SelectSingleNode("documenttypes")).Trim(',').Split(',')); + retVal.Languages = new List(SafeNodeValue(n.SelectSingleNode("languages")).Trim(',').Split(',')); + retVal.DictionaryItems = new List(SafeNodeValue(n.SelectSingleNode("dictionaryitems")).Trim(',').Split(',')); + retVal.DataTypes = new List(SafeNodeValue(n.SelectSingleNode("datatypes")).Trim(',').Split(',')); + + XmlNodeList xmlFiles = n.SelectNodes("files/file"); + retVal.Files = new List(); + + for (int i = 0; i < xmlFiles.Count; i++) + retVal.Files.Add(xmlFiles[i].InnerText); + + retVal.LoadControl = SafeNodeValue(n.SelectSingleNode("loadcontrol")); + } + + return retVal; + } + + public static void Delete(int Id, string dataSource) + { + Reload(dataSource); + // Remove physical xml file if any + //PackageInstance p = new PackageInstance(Id); + + //TODO DELETE PACKAGE FOLDER... + //p.Folder + + XmlNode n = data.GetFromId(Id, dataSource, true); + if (n != null) + { + data.Source.SelectSingleNode("/packages").RemoveChild(n); + data.Source.Save(dataSource); + } + + } + + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This method is no longer in use and will be removed in the future")] + public static void UpdateValue(XmlNode n, string Value) + { + if (n.FirstChild != null) + n.FirstChild.Value = Value; + else + { + n.AppendChild(Source.CreateTextNode(Value)); + } + } + + public static void Save(PackageInstance package, string dataSource) + { + Reload(dataSource); + var xmlDef = GetFromId(package.Id, dataSource, false); + XmlHelper.SetAttribute(Source, xmlDef, "name", package.Name); + XmlHelper.SetAttribute(Source, xmlDef, "version", package.Version); + XmlHelper.SetAttribute(Source, xmlDef, "url", package.Url); + XmlHelper.SetAttribute(Source, xmlDef, "packagepath", package.PackagePath); + XmlHelper.SetAttribute(Source, xmlDef, "repositoryGuid", package.RepositoryGuid); + XmlHelper.SetAttribute(Source, xmlDef, "packageGuid", package.PackageGuid); + XmlHelper.SetAttribute(Source, xmlDef, "hasUpdate", package.HasUpdate.ToString()); + XmlHelper.SetAttribute(Source, xmlDef, "enableSkins", package.EnableSkins.ToString()); + XmlHelper.SetAttribute(Source, xmlDef, "skinRepoGuid", package.SkinRepoGuid.ToString()); + XmlHelper.SetAttribute(Source, xmlDef, "iconUrl", package.IconUrl); + if (package.UmbracoVersion != null) + XmlHelper.SetAttribute(Source, xmlDef, "umbVersion", package.UmbracoVersion.ToString(3)); + + var licenseNode = xmlDef.SelectSingleNode("license"); + if (licenseNode == null) + { + licenseNode = Source.CreateElement("license"); + xmlDef.AppendChild(licenseNode); + } + licenseNode.InnerText = package.License; + XmlHelper.SetAttribute(Source, licenseNode, "url", package.LicenseUrl); + + var authorNode = xmlDef.SelectSingleNode("author"); + if (authorNode == null) + { + authorNode = Source.CreateElement("author"); + xmlDef.AppendChild(authorNode); + } + authorNode.InnerText = package.Author; + XmlHelper.SetAttribute(Source, authorNode, "url", package.AuthorUrl); + + XmlHelper.SetCDataNode(Source, xmlDef, "readme", package.Readme); + XmlHelper.SetInnerXmlNode(Source, xmlDef, "actions", package.Actions); + + var contentNode = xmlDef.SelectSingleNode("content"); + if (contentNode == null) + { + contentNode = Source.CreateElement("content"); + xmlDef.AppendChild(contentNode); + } + XmlHelper.SetAttribute(Source, contentNode, "nodeId", package.ContentNodeId); + XmlHelper.SetAttribute(Source, contentNode, "loadChildNodes", package.ContentLoadChildNodes.ToString()); + + XmlHelper.SetTextNode(Source, xmlDef, "macros", JoinList(package.Macros, ',')); + XmlHelper.SetTextNode(Source, xmlDef, "templates", JoinList(package.Templates, ',')); + XmlHelper.SetTextNode(Source, xmlDef, "stylesheets", JoinList(package.Stylesheets, ',')); + XmlHelper.SetTextNode(Source, xmlDef, "documenttypes", JoinList(package.Documenttypes, ',')); + XmlHelper.SetTextNode(Source, xmlDef, "languages", JoinList(package.Languages, ',')); + XmlHelper.SetTextNode(Source, xmlDef, "dictionaryitems", JoinList(package.DictionaryItems, ',')); + XmlHelper.SetTextNode(Source, xmlDef, "datatypes", JoinList(package.DataTypes, ',')); + + var filesNode = xmlDef.SelectSingleNode("files"); + if (filesNode == null) + { + filesNode = Source.CreateElement("files"); + xmlDef.AppendChild(filesNode); + } + filesNode.InnerXml = ""; + + foreach (var fileStr in package.Files) + { + if (string.IsNullOrWhiteSpace(fileStr) == false) + filesNode.AppendChild(XmlHelper.AddTextNode(Source, "file", fileStr)); + } + + XmlHelper.SetTextNode(Source, xmlDef, "loadcontrol", package.LoadControl); + + Source.Save(dataSource); + } + + + + private static string SafeAttribute(string name, XmlNode n) + { + return n.Attributes == null || n.Attributes[name] == null ? string.Empty : n.Attributes[name].Value; + } + + private static string SafeNodeValue(XmlNode n) + { + try + { + return XmlHelper.GetNodeValue(n); + } + catch + { + return string.Empty; + } + } + + private static string SafeNodeInnerXml(XmlNode n) + { + try + { + return n.InnerXml; + } + catch + { + return string.Empty; + } + } + + + private static string JoinList(List list, char seperator) + { + string retVal = ""; + foreach (string str in list) + { + retVal += str + seperator; + } + + return retVal.Trim(seperator); + } + + public data() + { + + } + } +} diff --git a/src/Umbraco.Web/umbraco.presentation/default.aspx.cs b/src/Umbraco.Web/umbraco.presentation/default.aspx.cs index 280a58de21..4fd469469e 100644 --- a/src/Umbraco.Web/umbraco.presentation/default.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/default.aspx.cs @@ -1,23 +1,16 @@ using System; -using System.Threading; using System.Web; using System.Web.Mvc; using System.Web.Routing; using System.Web.UI; using System.IO; -using System.Xml; -using System.Text.RegularExpressions; -using StackExchange.Profiling; using Umbraco.Core; using Umbraco.Core.Logging; -using Umbraco.Core.Profiling; using Umbraco.Web; using Umbraco.Web.Routing; using Umbraco.Core.Configuration; using Umbraco.Core.IO; using Umbraco.Web.Templates; -using umbraco.cms.businesslogic.web; -using umbraco.cms.businesslogic; using Umbraco.Web.Composing; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/helper.cs b/src/Umbraco.Web/umbraco.presentation/helper.cs index 66dcdef08b..9f53056692 100644 --- a/src/Umbraco.Web/umbraco.presentation/helper.cs +++ b/src/Umbraco.Web/umbraco.presentation/helper.cs @@ -1,18 +1,6 @@ using System; using System.Collections; -using System.Linq; -using System.Text.RegularExpressions; -using System.Web; -using Umbraco.Core; -using Umbraco.Core.CodeAnnotations; -using Umbraco.Core.Configuration; -using Umbraco.Core.Profiling; -using umbraco.BusinessLogic; -using System.Xml; -using umbraco.presentation; -using Umbraco.Web; using Umbraco.Web.Macros; -using Umbraco.Web.UI.Pages; namespace umbraco { @@ -26,7 +14,7 @@ namespace umbraco { int result; return int.TryParse(number, out result); - } + } public static string FindAttribute(IDictionary attributes, string key) { diff --git a/src/Umbraco.Web/umbraco.presentation/library.cs b/src/Umbraco.Web/umbraco.presentation/library.cs index 1749caf054..e7a6913009 100644 --- a/src/Umbraco.Web/umbraco.presentation/library.cs +++ b/src/Umbraco.Web/umbraco.presentation/library.cs @@ -20,15 +20,10 @@ using Umbraco.Core.Models; using Umbraco.Core.Services; using Umbraco.Web; using Umbraco.Web.Templates; -using umbraco.cms.businesslogic.web; using Umbraco.Core.IO; using Umbraco.Core.Xml; using Umbraco.Web.Composing; -using Umbraco.Web.PublishedCache; using Umbraco.Web.PublishedCache.XmlPublishedCache; -using Language = umbraco.cms.businesslogic.language.Language; -using Member = umbraco.cms.businesslogic.member.Member; -using PropertyType = umbraco.cms.businesslogic.propertytype.PropertyType; namespace umbraco { @@ -39,6 +34,7 @@ namespace umbraco /// Especially usefull in XSLT where any of these methods can be accesed using the umbraco.library name-space. Example: /// <xsl:value-of select="umbraco.library:NiceUrl(@id)"/> ///

+ [Obsolete("v8.kill.kill")] public class library { /// @@ -221,25 +217,6 @@ namespace umbraco return prop == null ? string.Empty : prop.Value.ToString(); } - /// - /// Checks with the Assigned domains settings and retuns an array the the Domains matching the node - /// - /// Identifier for the node that should be returned - /// A Domain array with all the Domains that matches the nodeId - public static Domain[] GetCurrentDomains(int nodeId) - { - string[] pathIds = GetItem(nodeId, "path").Split(','); - for (int i = pathIds.Length - 1; i > 0; i--) - { - Domain[] retVal = Domain.GetDomainsById(int.Parse(pathIds[i])); - if (retVal.Length > 0) - { - return retVal; - } - } - return null; - } - /// /// Returns a string with the data from the given element of the current node. Both elements (data-fields) /// and properties can be used - ie: @@ -262,49 +239,6 @@ namespace umbraco } } - /// - /// Returns that name of a generic property - /// - /// The Alias of the content type (ie. Document Type, Member Type or Media Type) - /// The Alias of the Generic property (ie. bodyText or umbracoNaviHide) - /// A string with the name. If nothing matches the alias, an empty string is returned - public static string GetPropertyTypeName(string contentTypeAlias, string propertyTypeAlias) - { - try - { - umbraco.cms.businesslogic.ContentType ct = umbraco.cms.businesslogic.ContentType.GetByAlias(contentTypeAlias); - PropertyType pt = ct.getPropertyType(propertyTypeAlias); - return pt.Name; - } - catch - { - return string.Empty; - } - } - - /// - /// Returns the Member Name from an umbraco member object - /// - /// The identifier of the Member - /// The Member name matching the MemberId, an empty string is member isn't found - public static string GetMemberName(int memberId) - { - if (memberId != 0) - { - try - { - Member m = new Member(memberId); - return m.Text; - } - catch - { - return string.Empty; - } - } - else - return string.Empty; - } - /// /// Get a media object as an xml object /// @@ -414,26 +348,6 @@ namespace umbraco return serialized; } - /// - /// Get the current member as an xml node - /// - /// Look in documentation for umbraco.library.GetMember(MemberId) for more information - public static XPathNodeIterator GetCurrentMember() - { - Member m = Member.GetCurrentMember(); - if (m != null) - { - var n = global::Umbraco.Web.UmbracoContext.Current.Facade.MemberCache.CreateNodeNavigator(m.Id, false); - if (n != null) - return n.Select("."); // vs "/node" vs "/node()" ? - } - - XmlDocument xd = new XmlDocument(); - xd.LoadXml( - "No current member exists (best practice is to validate with 'isloggedon()' prior to this call)"); - return xd.CreateNavigator().Select("/"); - } - /// /// Whether or not the current user is logged in (as a member) /// @@ -1147,61 +1061,6 @@ namespace umbraco } } - /// - /// Gets the dictionary item with the specified key and it's child dictionary items. - /// The language version is based on the culture of the current Url. - /// - /// The key. - /// A XpathNodeIterator in the format: - /// - /// [dictionaryItemValue] - /// - /// - public static XPathNodeIterator GetDictionaryItems(string Key) - { - XmlDocument xd = new XmlDocument(); - xd.LoadXml(""); - - try - { - //int languageId = GetCurrentLanguageId(); - int languageId = Language.GetByCultureCode(System.Threading.Thread.CurrentThread.CurrentUICulture.Name).id; - - var di = Current.Services.LocalizationService.GetDictionaryItemByKey(Key); - if (di == null) - { - return xd.CreateNavigator().Select("/"); - } - - var children = Current.Services.LocalizationService.GetDictionaryItemChildren(di.Key); - foreach (var item in children) - { - XmlNode xe; - try - { - if (languageId != 0) - xe = XmlHelper.AddTextNode(xd, "DictionaryItem", item.GetTranslatedValue(languageId)); - else - xe = XmlHelper.AddTextNode(xd, "DictionaryItem", item.GetDefaultValue()); - } - catch - { - xe = XmlHelper.AddTextNode(xd, "DictionaryItem", string.Empty); - } - xe.Attributes.Append(XmlHelper.AddAttribute(xd, "key", item.ItemKey)); - xd.DocumentElement.AppendChild(xe); - } - } - catch (Exception ee) - { - xd.DocumentElement.AppendChild( - XmlHelper.AddTextNode(xd, "Error", ee.ToString())); - } - - XPathNavigator xp = xd.CreateNavigator(); - return xp.Select("/"); - } - /// /// Gets the dictionary item with the specified key. /// diff --git a/src/Umbraco.Web/umbraco.presentation/page.cs b/src/Umbraco.Web/umbraco.presentation/page.cs index d1edc746b0..bc8eb697e8 100644 --- a/src/Umbraco.Web/umbraco.presentation/page.cs +++ b/src/Umbraco.Web/umbraco.presentation/page.cs @@ -12,7 +12,6 @@ using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; using Umbraco.Web.Editors; using Umbraco.Web.Routing; -using umbraco.cms.businesslogic.web; using Umbraco.Core.Configuration; using Umbraco.Core.PropertyEditors; using Umbraco.Web; @@ -50,47 +49,6 @@ namespace umbraco #region Constructors - /// - /// Initializes a new instance of the class for a yet unpublished document, identified by its id and version. - /// - /// The identifier of the document. - /// The version to be displayed. - public page(int id, Guid version) - : this(new Document(id, version)) - { } - - /// - /// Initializes a new instance of the class for a yet unpublished document. - /// - /// The document. - public page(Document document) - { - var docParentId = -1; - try - { - docParentId = document.ParentId; - } - catch (ArgumentException) - { - //ignore if no parent - } - - populatePageData(document.Id, - document.Text, document.ContentType.Id, document.ContentType.Alias, - document.User.Name, document.Creator.Name, document.CreateDateTime, document.UpdateDate, - document.Path, document.Version, docParentId); - - //TODO: Get this working again - Actually get rid of the 'page' class all together - - //foreach (Property prop in document.GenericProperties) - //{ - // string value = prop.Value != null ? prop.Value.ToString() : String.Empty; - // _elements.Add(prop.PropertyType.Alias, value); - //} - - _template = document.Template; - } - /// /// Initializes a new instance of the class for a published document request. /// @@ -145,51 +103,6 @@ namespace umbraco PopulateElementData(doc); } - /// - /// Initializes a new instance of the class for a published document. - /// - /// The XmlNode representing the document. - public page(XmlNode node) - { - populatePageData(node); - - if (UmbracoConfig.For.UmbracoSettings().WebRouting.DisableAlternativeTemplates == false) - { - // Check for alternative template - if (HttpContext.Current.Items[Constants.Conventions.Url.AltTemplate] != null && - HttpContext.Current.Items[Constants.Conventions.Url.AltTemplate].ToString() != String.Empty) - { - _template = - umbraco.cms.businesslogic.template.Template.GetTemplateIdFromAlias( - HttpContext.Current.Items[Constants.Conventions.Url.AltTemplate].ToString()); - _elements.Add("template", _template.ToString()); - } - else if (HttpContext.Current.Request.GetItemAsString(Constants.Conventions.Url.AltTemplate) != String.Empty) - { - _template = - umbraco.cms.businesslogic.template.Template.GetTemplateIdFromAlias( - HttpContext.Current.Request.GetItemAsString(Constants.Conventions.Url.AltTemplate).ToLower()); - _elements.Add("template", _template.ToString()); - } - } - - if (_template == 0) - { - try - { - _template = Convert.ToInt32(node.Attributes.GetNamedItem("template").Value); - _elements.Add("template", node.Attributes.GetNamedItem("template").Value); - } - catch - { - HttpContext.Current.Trace.Warn("umbracoPage", "No template defined"); - } - } - - populateElementData(node); - - } - /// /// Initializes a new instance of the page for a content. /// diff --git a/src/Umbraco.Web/umbraco.presentation/template.cs b/src/Umbraco.Web/umbraco.presentation/template.cs index 9d310fcf08..143ad82633 100644 --- a/src/Umbraco.Web/umbraco.presentation/template.cs +++ b/src/Umbraco.Web/umbraco.presentation/template.cs @@ -1,23 +1,16 @@ using System; -using System.Xml; -using System.Web.Caching; using System.Text; using System.IO; using System.Text.RegularExpressions; - -using System.Data; using System.Web.UI; using System.Collections; -using System.Collections.Generic; -using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Configuration; using Umbraco.Web; using Umbraco.Web.Cache; -using umbraco.DataLayer; -using umbraco.BusinessLogic; using Umbraco.Core.IO; using System.Web; +using Umbraco.Core.Models; using Umbraco.Core.Xml; using Umbraco.Web.Composing; using Umbraco.Web.Macros; @@ -534,8 +527,22 @@ where nodeId = @templateID", } else { if (_masterTemplate == templateID) { - cms.businesslogic.template.Template t = cms.businesslogic.template.Template.GetTemplate(templateID); - string templateName = (t != null) ? t.Text : string.Format("'Template with id: '{0}", templateID); + var t = Current.Services.FileService.GetTemplate(templateID); + var text = t.Name; + if (text.StartsWith("#")) + { + var lang = Current.Services.LocalizationService.GetLanguageByIsoCode(System.Threading.Thread.CurrentThread.CurrentCulture.Name); + if (lang != null && Current.Services.LocalizationService.DictionaryItemExists(text.Substring(1))) + { + var di = Current.Services.LocalizationService.GetDictionaryItemByKey(text.Substring(1)); + text = di.GetTranslatedValue(lang.Id); + } + else + { + text = "[" + text + "]"; + } + } + string templateName = (t != null) ? text : string.Format("'Template with id: '{0}", templateID); System.Web.HttpContext.Current.Trace.Warn("template", String.Format("Master template is the same as the current template. It would cause an endless loop! Make sure that the current template '{0}' has another Master Template than itself. You can change this in the template editor under 'Settings'", templateName)); _templateOutput.Append(_templateDesign); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseTree.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseTree.cs index 3865ab5747..5d06b1d36b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseTree.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseTree.cs @@ -1,17 +1,10 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq; using System.Text; -using System.Xml; using Umbraco.Core; using Umbraco.Core.Models.EntityBase; using Umbraco.Core.Services; -using Umbraco.Web.Trees; -using umbraco.BusinessLogic; -using umbraco.cms.businesslogic.media; -using umbraco.cms.businesslogic.web; -using Umbraco.Web; using Umbraco.Web.Composing; using Umbraco.Web._Legacy.Actions; @@ -489,38 +482,6 @@ namespace umbraco.cms.presentation.Trees AfterTreeRender(sender, e); } - [Obsolete("Do not use this method to raise events, it is no longer used and will cause very high performance spikes!")] - protected internal virtual void OnBeforeTreeRender(IEnumerable sender, TreeEventArgs e, bool isContent) - { - if (BeforeTreeRender != null) - { - if (isContent) - { - BeforeTreeRender(sender.Select(x => new Document(x, false)).ToArray(), e); - } - else - { - BeforeTreeRender(sender.Select(x => new Media(x, false)).ToArray(), e); - } - } - } - - [Obsolete("Do not use this method to raise events, it is no longer used and will cause very high performance spikes!")] - protected internal virtual void OnAfterTreeRender(IEnumerable sender, TreeEventArgs e, bool isContent) - { - if (AfterTreeRender != null) - { - if (isContent) - { - AfterTreeRender(sender.Select(x => new Document(x, false)).ToArray(), e); - } - else - { - AfterTreeRender(sender.Select(x => new Media(x, false)).ToArray(), e); - } - } - } - /// /// Event that is raised once actions are assigned to nodes /// diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeEventArgs.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeEventArgs.cs index 54dbc18622..6b4473375a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeEventArgs.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeEventArgs.cs @@ -1,5 +1,5 @@ using System; -using umbraco.cms.businesslogic.web; + namespace umbraco.cms.presentation.Trees { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeService.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeService.cs index 2c1d17f830..c9032c5cd5 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeService.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeService.cs @@ -1,5 +1,5 @@ using System.Text; -using umbraco.uicontrols; +using Umbraco.Web._Legacy.Controls; namespace umbraco.cms.presentation.Trees { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTranslationTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTranslationTasks.cs index 150f9be468..72c5631498 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTranslationTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTranslationTasks.cs @@ -2,11 +2,11 @@ using System; using System.Collections.Generic; using System.Text; -using umbraco.cms.businesslogic.task; using umbraco.cms.presentation.Trees; using Umbraco.Core.Models.Membership; using Umbraco.Web; using Umbraco.Web._Legacy.Actions; +using Umbraco.Web._Legacy.BusinessLogic; namespace umbraco { public class loadOpenTasks : BaseTree { @@ -47,7 +47,7 @@ namespace umbraco { xNode.Menu.Clear(); xNode.NodeID = t.Id.ToString(); - xNode.Text = t.Node.Text; + xNode.Text = t.TaskEntityEntity.Name; xNode.Action = "javascript:openTranslationTask(" + t.Id.ToString() + ")"; xNode.Icon = ".sprTreeSettingLanguage"; xNode.OpenIcon = ".sprTreeSettingLanguage"; @@ -98,7 +98,7 @@ namespace umbraco { XmlTreeNode xNode = XmlTreeNode.Create(this); xNode.Menu.Clear(); xNode.NodeID = t.Id.ToString(); - xNode.Text = t.Node.Text; + xNode.Text = t.TaskEntityEntity.Name; xNode.Action = "javascript:openTranslationTask(" + t.Id.ToString() + ")"; xNode.Icon = ".sprTreeSettingLanguage"; xNode.OpenIcon = ".sprTreeSettingLanguage"; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/actions/delete.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/actions/delete.aspx.cs index 54706f4d4b..9853b143d3 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/actions/delete.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/actions/delete.aspx.cs @@ -1,39 +1,40 @@ using System; -using umbraco.cms.businesslogic.web; using Umbraco.Core; +using Umbraco.Core.Models; using Umbraco.Core.Services; using Umbraco.Web; +using Umbraco.Web.Composing; using Umbraco.Web.UI.Pages; namespace umbraco.presentation.actions { public partial class delete : UmbracoEnsuredPage { - private Document d; + private IContent c; protected void Page_Load(object sender, EventArgs e) { - d = new Document(int.Parse(Request.GetItemAsString("id"))); + c = Current.Services.ContentService.GetById(int.Parse(Request.GetItemAsString("id"))); if (Security.ValidateUserApp(Constants.Applications.Content) == false) throw new ArgumentException("The current user doesn't have access to this application. Please contact the system administrator."); - if (Security.ValidateUserNodeTreePermissions(Security.CurrentUser, d.Path, "D") == false) + if (Security.ValidateUserNodeTreePermissions(Security.CurrentUser, c.Path, "D") == false) throw new ArgumentException("The current user doesn't have permissions to delete this document. Please contact the system administrator."); - pane_delete.Text = Services.TextService.Localize("delete") + " '" + d.Text + "'"; + pane_delete.Text = Services.TextService.Localize("delete") + " '" + c.Name + "'"; Panel2.Text = Services.TextService.Localize("delete"); - warning.Text = Services.TextService.Localize("confirmdelete") + " '" + d.Text + "'"; + warning.Text = Services.TextService.Localize("confirmdelete") + " '" + c.Name + "'"; deleteButton.Text = Services.TextService.Localize("delete"); } protected void deleteButton_Click(object sender, EventArgs e) { deleteMessage.Text = Services.TextService.Localize("deleted"); - deleted.Text = "'" + d.Text + "' " + Services.TextService.Localize("deleted"); + deleted.Text = "'" + c.Name + "' " + Services.TextService.Localize("deleted"); deleteMessage.Visible = true; confirm.Visible = false; - d.delete(); + Current.Services.ContentService.Delete(c); } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/actions/delete.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/actions/delete.aspx.designer.cs index 3f31422238..9eb36c9422 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/actions/delete.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/actions/delete.aspx.designer.cs @@ -20,7 +20,7 @@ namespace umbraco.presentation.actions { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoPanel Panel2; + protected global::Umbraco.Web._Legacy.Controls.UmbracoPanel Panel2; /// /// confirm control. @@ -38,7 +38,7 @@ namespace umbraco.presentation.actions { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_delete; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_delete; /// /// warning control. @@ -65,7 +65,7 @@ namespace umbraco.presentation.actions { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane deleteMessage; + protected global::Umbraco.Web._Legacy.Controls.Pane deleteMessage; /// /// deleted control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/actions/preview.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/actions/preview.aspx.cs index 6ac8c59d1d..1baebd3478 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/actions/preview.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/actions/preview.aspx.cs @@ -1,13 +1,4 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.HtmlControls; -using umbraco.cms.businesslogic.web; using Umbraco.Core; using Umbraco.Core.IO; using Umbraco.Web; @@ -30,8 +21,7 @@ namespace umbraco.presentation.actions /// The instance containing the event data. protected void Page_Load(object sender, EventArgs e) { - Document doc = new Document(int.Parse(Request.GetItemAsString("id"))); - Response.Redirect(IOHelper.ResolveUrl(string.Format("{0}/dialogs/preview.aspx?id= {1}", SystemDirectories.Umbraco, doc.Id))); + Response.Redirect(IOHelper.ResolveUrl(string.Format("{0}/dialogs/preview.aspx?id= {1}", SystemDirectories.Umbraco, int.Parse(Request.GetItemAsString("id"))))); } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/actions/publish.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/actions/publish.aspx.designer.cs index ecaab8363c..cf98a16379 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/actions/publish.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/actions/publish.aspx.designer.cs @@ -20,7 +20,7 @@ namespace umbraco.presentation.actions { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoPanel Panel2; + protected global::Umbraco.Web._Legacy.Controls.UmbracoPanel Panel2; /// /// confirm control. @@ -38,7 +38,7 @@ namespace umbraco.presentation.actions { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_publish; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_publish; /// /// warning control. @@ -65,7 +65,7 @@ namespace umbraco.presentation.actions { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane deleteMessage; + protected global::Umbraco.Web._Legacy.Controls.Pane deleteMessage; /// /// deleted control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs index dfadb066a5..68f68354fb 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs @@ -16,7 +16,7 @@ // //using umbraco.cms.businesslogic.web; //using umbraco.interfaces; -//using umbraco.uicontrols; +//using Umbraco.Web._Legacy.Controls; //using Content = umbraco.cms.businesslogic.Content; //using ContentType = umbraco.cms.businesslogic.ContentType; //using Media = umbraco.cms.businesslogic.media.Media; @@ -33,7 +33,7 @@ // public class ContentControl : TabView // { - + // internal Dictionary DataTypes = new Dictionary(); // private readonly Content _content; // private UmbracoEnsuredPage _prntpage; @@ -55,7 +55,7 @@ // private bool _savePropertyDataWhenInvalid = true; // private ContentType _contentType; - + // public Content ContentObject // { // get { return _content; } @@ -92,7 +92,7 @@ // { // } - + // /// // /// Constructor to set default properties. // /// @@ -134,7 +134,7 @@ // { // base.CreateChildControls(); - + // _prntpage = (UmbracoEnsuredPage)Page; // int i = 0; // Hashtable inTab = new Hashtable(); @@ -634,7 +634,7 @@ // } // else // { - + // var ph = new Panel(); // var pp = new Pane(); @@ -645,15 +645,15 @@ // }; // pp.addProperty(p.PropertyType.Name, missingPropertyEditorLabel); - + // ph.Attributes.Add("style", "padding: 0; position: relative;"); - + // ph.Controls.Add(pp); // tp.Controls.Add(ph); // } - + // } // public enum publishModes diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentPicker.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentPicker.cs index 6c11c9108f..81deeadbcf 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentPicker.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentPicker.cs @@ -1,5 +1,5 @@ using System; -using umbraco.uicontrols.TreePicker; +using Umbraco.Web._Legacy.Controls; using Umbraco.Core; using Umbraco.Core.Services; using Umbraco.Web; @@ -56,7 +56,8 @@ namespace umbraco.controls { if (Value != "" && Value != "-1") { - tempTitle = new cms.businesslogic.CMSNode(int.Parse(Value)).Text; + //tempTitle = new cms.businesslogic.CMSNode(int.Parse(Value)).Text; + tempTitle = Current.Services.EntityService.Get(int.Parse(Value)).Name; } else { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControl.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControl.cs index d03af7414f..8d76ce98fc 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControl.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControl.cs @@ -16,7 +16,7 @@ // /// // [Obsolete("No longer used, will be removed in v8")] // [EditorBrowsable(EditorBrowsableState.Never)] -// public class ContentTypeControl : uicontrols.TabView +// public class ContentTypeControl : Umbraco.Web._Legacy.Controls.TabView // { // public event System.EventHandler OnSave; // public event System.EventHandler OnPropertyTypeCreate; @@ -26,22 +26,22 @@ // protected TextBox AliasTxt = new TextBox(); // protected DropDownList IconDDL = new DropDownList(); // protected TextBox TabTxt = new TextBox(); -// protected uicontrols.Pane GenericPropertyTypes; -// private uicontrols.Pane TabsPane = new uicontrols.Pane(); +// protected Umbraco.Web._Legacy.Controls.Pane GenericPropertyTypes; +// private Umbraco.Web._Legacy.Controls.Pane TabsPane = new Umbraco.Web._Legacy.Controls.Pane(); // private NodeTypeAddPropertyTypeControl AddPropertyTypeCtrl; // private System.Collections.ArrayList tabDDLs = new ArrayList(); // private HtmlGenericControl br = new HtmlGenericControl(); // private NodeTypeEditorControl NodeTypeEditorCtrl; -// private uicontrols.Pane pp; -// private uicontrols.TabPage Panel1; -// private uicontrols.TabPage Panel2; -// private uicontrols.TabPage Panel3; -// private uicontrols.TabPage Panel4; +// private Umbraco.Web._Legacy.Controls.Pane pp; +// private Umbraco.Web._Legacy.Controls.TabPage Panel1; +// private Umbraco.Web._Legacy.Controls.TabPage Panel2; +// private Umbraco.Web._Legacy.Controls.TabPage Panel3; +// private Umbraco.Web._Legacy.Controls.TabPage Panel4; // private BasePages.BasePage prnt; // private ListBox AllowedContentTypes; // private ArrayList extraPropertyPanes = new ArrayList(); -// public void addPropertyPaneToGeneralTab(uicontrols.Pane pp) { +// public void addPropertyPaneToGeneralTab(Umbraco.Web._Legacy.Controls.Pane pp) { // extraPropertyPanes.Add(pp); // } // public ContentTypeControl(cms.businesslogic.ContentType ct, string id) { @@ -54,7 +54,7 @@ // this.Height = Unit.Pixel(600); // string UmbracoPath = SystemDirectories.Umbraco; // Panel1 = this.NewTabPage("Generelt"); -// uicontrols.MenuImageButton Save = Panel1.Menu.NewImageButton(); +// Umbraco.Web._Legacy.Controls.MenuImageButton Save = Panel1.Menu.NewImageButton(); // Save.Click += new System.Web.UI.ImageClickEventHandler(save_click); // Save.ID = "Panel1Save"; // Save.ImageUrl = UmbracoPath + "/images/editor/save.gif"; @@ -136,7 +136,7 @@ // {foreach (int i in allowedIds) if (i == ct.Id) li.Selected= true;} // } -// pp = new uicontrols.Pane(); +// pp = new Umbraco.Web._Legacy.Controls.Pane(); // pp.addProperty("Tilladte indholdstyper",AllowedContentTypes); // Panel3.Controls.Add(pp); // } @@ -183,7 +183,7 @@ // private void setupGeneralInfoTab() // { -// uicontrols.Pane pp = new uicontrols.Pane(); +// Umbraco.Web._Legacy.Controls.Pane pp = new Umbraco.Web._Legacy.Controls.Pane(); // DirectoryInfo dirInfo = new DirectoryInfo( IOHelper.MapPath(SystemDirectories.Umbraco + "/images/umbraco")); // FileInfo[] fileInfo = dirInfo.GetFiles(); @@ -210,7 +210,7 @@ // br = new HtmlGenericControl(); // br.TagName = "p"; // Panel1.Controls.Add(br); -// foreach (uicontrols.Pane p in extraPropertyPanes) { +// foreach (Umbraco.Web._Legacy.Controls.Pane p in extraPropertyPanes) { // Panel1.Controls.Add(p); // } // } @@ -220,7 +220,7 @@ // private void setupGenericPropertyTypesTab() // { // // Add new generic propertytype -// pp = new uicontrols.Pane(); +// pp = new Umbraco.Web._Legacy.Controls.Pane(); // AddPropertyTypeCtrl = new NodeTypeAddPropertyTypeControl(docType,this); // pp.addProperty(AddPropertyTypeCtrl); @@ -237,7 +237,7 @@ // private void loadGenericPropertyTypesOnPane() // { // // View/ Edit all propertytypes.. -// GenericPropertyTypes = new uicontrols.Pane(); +// GenericPropertyTypes = new Umbraco.Web._Legacy.Controls.Pane(); // NodeTypeEditorCtrl = new NodeTypeEditorControl(this); // GenericPropertyTypes.addProperty(NodeTypeEditorCtrl); @@ -250,7 +250,7 @@ // private void setupTabTab() // { -// pp = new uicontrols.Pane(); +// pp = new Umbraco.Web._Legacy.Controls.Pane(); // pp.addProperty("Ny tab", TabTxt); // Panel2.Controls.Add(pp); @@ -267,7 +267,7 @@ // private void LoadExistingTabsOnTabsPane() // { -// uicontrols.Pane TabsPane = new uicontrols.Pane(); +// Umbraco.Web._Legacy.Controls.Pane TabsPane = new Umbraco.Web._Legacy.Controls.Pane(); // foreach (cms.businesslogic.ContentType.TabI t in docType.getVirtualTabs.ToList()) // { // Button tb = new Button(); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeService.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeService.cs index 3758d14781..549b678481 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeService.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeService.cs @@ -33,7 +33,8 @@ namespace umbraco.controls.Tree { Authorize(); - var node = new CMSNode(id); + //var node = new CMSNode(id); + var node = Services.EntityService.Get(id); return new NodeInfo() { Id = node.Id, @@ -54,7 +55,8 @@ namespace umbraco.controls.Tree { return ids .Where(x => x != -1) - .Select(x => new CMSNode(x).Text).ToArray(); + //.Select(x => new CMSNode(x).Text).ToArray(); + .Select(x => Services.EntityService.Get(x).Name).ToArray(); } /// diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs index 4bf3961ad2..ecbd8d981f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs @@ -1,8 +1,5 @@ using System.Web.Security; -using Umbraco.Web.UI; -using umbraco.cms.businesslogic.member; using Umbraco.Core; -using Umbraco.Web; using Umbraco.Web.Composing; using Umbraco.Web._Legacy.UI; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs index c7ef4644a3..d7879dd264 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs @@ -1,5 +1,4 @@ using Umbraco.Core.CodeAnnotations; -using umbraco.BusinessLogic; using Umbraco.Core; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs index 4672e5d203..14a9a029f8 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs @@ -1,5 +1,4 @@ using Umbraco.Core.CodeAnnotations; -using umbraco.BusinessLogic; using Umbraco.Core; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/StylesheetTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/StylesheetTasks.cs index 0c37306a69..2a2d34303e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/StylesheetTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/StylesheetTasks.cs @@ -28,8 +28,11 @@ namespace umbraco public override bool PerformDelete() { - var s = cms.businesslogic.web.StyleSheet.GetByName(Alias); - s.delete(); + //var s = cms.businesslogic.web.StyleSheet.GetByName(Alias); + var s = Current.Services.FileService.GetStylesheetByName(Alias); + //s.delete(); + if (s!=null) + Current.Services.FileService.DeleteStylesheet(s.Path); return true; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/XsltTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/XsltTasks.cs index 8691191a67..046c138c81 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/XsltTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/XsltTasks.cs @@ -5,9 +5,11 @@ using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Web.UI; using Umbraco.Core.FileResources; +using Umbraco.Core.Models; using Umbraco.Web; using Umbraco.Web.Composing; using Umbraco.Web._Legacy.UI; +using File = System.IO.File; namespace umbraco { @@ -67,10 +69,16 @@ namespace umbraco name = name.Substring(0, name.Length - 5); name = name.SplitPascalCasing().ToFirstUpperInvariant(); - cms.businesslogic.macro.Macro m = - cms.businesslogic.macro.Macro.MakeNew(name); - m.Xslt = fileName; - m.Save(); + //cms.businesslogic.macro.Macro m = + // cms.businesslogic.macro.Macro.MakeNew(name); + var m = new Macro + { + Name = name, + Alias = name.Replace(" ", String.Empty) + }; + m.XsltPath = fileName; + //m.Save(); + Current.Services.MacroService.Save(m); } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/language.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/language.ascx.cs index 6fd456731b..24af1b4544 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/language.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/language.ascx.cs @@ -58,7 +58,7 @@ namespace umbraco.cms.presentation.create.controls /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp1; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp1; /// /// Cultures control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/languageTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/languageTasks.cs index ae8eed6984..6c2e5803ba 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/languageTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/languageTasks.cs @@ -1,5 +1,8 @@ +using System.Globalization; using Umbraco.Web.UI; using Umbraco.Core; +using Umbraco.Core.Models; +using Umbraco.Web.Composing; using Umbraco.Web._Legacy.UI; namespace umbraco @@ -9,13 +12,19 @@ namespace umbraco public override bool PerformSave() { - cms.businesslogic.language.Language.MakeNew(Alias); + //cms.businesslogic.language.Language.MakeNew(Alias); + var culture = new CultureInfo(Alias); + var l = new Language(Alias) { CultureName = culture.DisplayName }; + Current.Services.LocalizationService.Save(l); return true; } public override bool PerformDelete() { - new cms.businesslogic.language.Language(ParentID).Delete(); + //new cms.businesslogic.language.Language(ParentID).Delete(); + var l = Current.Services.LocalizationService.GetLanguageById(ParentID); + if (l != null) + Current.Services.LocalizationService.Delete(l); return false; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/macroTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/macroTasks.cs index b670993ca1..79a203355a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/macroTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/macroTasks.cs @@ -1,28 +1,29 @@ -using Umbraco.Web.UI; -using umbraco.BusinessLogic; -using umbraco.DataLayer; using Umbraco.Core; +using Umbraco.Core.Models; +using Umbraco.Web.Composing; using Umbraco.Web._Legacy.UI; namespace umbraco { public class macroTasks : LegacyDialogTask { - - public override bool PerformSave() { - var checkingMacro =cms.businesslogic.macro.Macro.GetByAlias(Alias); - var id = checkingMacro != null - ? checkingMacro.Id - : cms.businesslogic.macro.Macro.MakeNew(Alias).Id; - _returnUrl = string.Format("developer/Macros/editMacro.aspx?macroID={0}", id); + var macro = Current.Services.MacroService.GetByAlias(Alias); + if (macro == null) + { + macro = new Macro(Alias, Alias); + Current.Services.MacroService.Save(macro); + } + _returnUrl = string.Format("developer/Macros/editMacro.aspx?macroID={0}", macro.Id); return true; } public override bool PerformDelete() { - new cms.businesslogic.macro.Macro(ParentID).Delete(); + var macro = Current.Services.MacroService.GetById(ParentID); + if (macro != null) + Current.Services.MacroService.Delete(macro); return true; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/simple.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/simple.ascx.cs index e34a2fff6b..206fb1a3d8 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/simple.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/simple.ascx.cs @@ -1,11 +1,9 @@ using Umbraco.Core.Services; using System.Web; using Umbraco.Core; -using Umbraco.Web.UI; using Umbraco.Web; using System; using System.Web.UI.WebControls; -using umbraco.BusinessLogic; using System.Linq; using Umbraco.Web._Legacy.UI; using UmbracoUserControl = Umbraco.Web.UI.Controls.UmbracoUserControl; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs index 28326005bc..d4a821da43 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs @@ -1,5 +1,6 @@ using Umbraco.Core; using Umbraco.Core.Configuration; +using Umbraco.Web.Composing; using Umbraco.Web.UI; using Umbraco.Web._Legacy.UI; @@ -17,13 +18,16 @@ namespace umbraco if (masterId > 0) { - var id = cms.businesslogic.template.Template.MakeNew(Alias, User, new cms.businesslogic.template.Template(masterId)).Id; - _returnUrl = string.Format("{1}?treeType=templates&templateID={0}", id, editor); + //var id = cms.businesslogic.template.Template.MakeNew(Alias, User, new cms.businesslogic.template.Template(masterId)).Id; + var master = Current.Services.FileService.GetTemplate(masterId); + var t = Current.Services.FileService.CreateTemplateWithIdentity(Alias, null, master, User.Id); + _returnUrl = string.Format("{1}?treeType=templates&templateID={0}", t.Id, editor); } else { - var id = cms.businesslogic.template.Template.MakeNew(Alias, User).Id; - _returnUrl = string.Format("{1}?treeType=templates&templateID={0}", id, editor); + //var id = cms.businesslogic.template.Template.MakeNew(Alias, User).Id; + var t = Current.Services.FileService.CreateTemplateWithIdentity(Alias, null, null, User.Id); + _returnUrl = string.Format("{1}?treeType=templates&templateID={0}", t.Id, editor); } return true; @@ -31,7 +35,9 @@ namespace umbraco public override bool PerformDelete() { - new cms.businesslogic.template.Template(ParentID).delete(); + //new cms.businesslogic.template.Template(ParentID).delete(); + var t = Current.Services.FileService.GetTemplate(ParentID); + if (t != null) Current.Services.FileService.DeleteTemplate(t.Alias); return false; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs index 6b1796f0dc..1e4fae9e88 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs @@ -1,10 +1,7 @@ using System; using System.Web.Security; using Umbraco.Core.Logging; -using Umbraco.Web.UI; -using umbraco.BusinessLogic; using Umbraco.Core; -using Umbraco.Web; using Umbraco.Web.Composing; using Umbraco.Web._Legacy.UI; using MembershipProviderExtensions = Umbraco.Core.Security.MembershipProviderExtensions; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/assemblyBrowser.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/assemblyBrowser.aspx.cs index 6bbd4d15f6..d133caa951 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/assemblyBrowser.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/assemblyBrowser.aspx.cs @@ -1,26 +1,14 @@ using System; -using System.Collections; -using System.ComponentModel; -using System.Data; -using System.Drawing; using System.Linq; -using System.Web; -using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; -using System.Web.UI.HtmlControls; using System.Reflection; -using System.Collections.Specialized; using Umbraco.Core; using Umbraco.Core.IO; using Umbraco.Core.Models; using Umbraco.Web; -using Umbraco.Core.PropertyEditors; -using umbraco.BusinessLogic; -using System.Collections.Generic; using Umbraco.Web.Composing; using Umbraco.Web.UI.Pages; -using MacroProperty = umbraco.cms.businesslogic.macro.MacroProperty; namespace umbraco.developer { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/editMacro.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/editMacro.aspx.cs index 1ae12db451..6abe3f9ab0 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/editMacro.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/editMacro.aspx.cs @@ -9,8 +9,6 @@ using Umbraco.Core; using Umbraco.Core.IO; using Umbraco.Core.Models; using Umbraco.Core.PropertyEditors; -using umbraco.uicontrols; -using umbraco.DataLayer; using umbraco.cms.presentation.Trees; using System.Linq; using Umbraco.Web.UI; @@ -18,6 +16,7 @@ using Umbraco.Web.UI.Pages; using Umbraco.Core.Services; using Umbraco.Web; using Umbraco.Web.Composing; +using Umbraco.Web._Legacy.Controls; namespace umbraco.cms.presentation.developer { @@ -177,12 +176,6 @@ namespace umbraco.cms.presentation.developer return Convert.IsDBNull(test) ? 0 : test; } - [Obsolete("No longer used and will be removed in the future.")] - public IRecordsReader GetMacroPropertyTypes() - { - return null; - } - protected IEnumerable GetMacroParameterEditors() { // we need to show the depracated ones for backwards compatibility @@ -371,7 +364,7 @@ namespace umbraco.cms.presentation.developer /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.TabView TabView1; + protected global::Umbraco.Web._Legacy.Controls.TabView TabView1; /// /// Pane1 control. @@ -380,7 +373,7 @@ namespace umbraco.cms.presentation.developer /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane1; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane1; /// /// macroPane control. @@ -416,7 +409,7 @@ namespace umbraco.cms.presentation.developer /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane1_2; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane1_2; /// /// macroXslt control. @@ -497,7 +490,7 @@ namespace umbraco.cms.presentation.developer /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane1_3; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane1_3; /// /// Table1 control. @@ -533,7 +526,7 @@ namespace umbraco.cms.presentation.developer /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane1_4; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane1_4; /// /// Table3 control. @@ -578,7 +571,7 @@ namespace umbraco.cms.presentation.developer /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Panel2; + protected global::Umbraco.Web._Legacy.Controls.Pane Panel2; /// /// macroProperties control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs index 1541955977..563ee2438e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs @@ -7,13 +7,6 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.Xml; - -using umbraco.cms.businesslogic; -using umbraco.cms.businesslogic.language; -using umbraco.cms.businesslogic.macro; -using umbraco.cms.businesslogic.template; -using umbraco.cms.businesslogic.web; -using umbraco.cms.presentation.Trees; using umbraco.controls; using Umbraco.Core; using Umbraco.Core.IO; @@ -30,12 +23,12 @@ namespace umbraco.presentation.developer.packages CurrentApp = Constants.Applications.Developer.ToString(); } - public uicontrols.TabPage packageInfo; - public uicontrols.TabPage packageContents; - public uicontrols.TabPage packageFiles; - public uicontrols.TabPage packageOutput; - public uicontrols.TabPage packageAbout; - public uicontrols.TabPage packageActions; + public Umbraco.Web._Legacy.Controls.TabPage packageInfo; + public Umbraco.Web._Legacy.Controls.TabPage packageContents; + public Umbraco.Web._Legacy.Controls.TabPage packageFiles; + public Umbraco.Web._Legacy.Controls.TabPage packageOutput; + public Umbraco.Web._Legacy.Controls.TabPage packageAbout; + public Umbraco.Web._Legacy.Controls.TabPage packageActions; protected ContentPicker cp; private cms.businesslogic.packager.PackageInstance pack; @@ -90,10 +83,11 @@ namespace umbraco.presentation.developer.packages /*TEMPLATES */ - Template[] umbTemplates = Template.GetAllAsList().ToArray(); - foreach (Template tmp in umbTemplates) + var nTemplates = Services.FileService.GetTemplates(); + //Template[] umbTemplates = Template.GetAllAsList().ToArray(); + foreach (var tmp in nTemplates) { - ListItem li = new ListItem(tmp.Text, tmp.Id.ToString()); + ListItem li = new ListItem(tmp.Name, tmp.Id.ToString()); if (pack.Templates.Contains(tmp.Id.ToString())) li.Selected = true; @@ -102,10 +96,12 @@ namespace umbraco.presentation.developer.packages } /* DOC TYPES */ - DocumentType[] docs = DocumentType.GetAllAsList().ToArray(); - foreach (DocumentType dc in docs) + // fixme - media types? member types? + var nContentTypes = Services.ContentTypeService.GetAll(); + //DocumentType[] docs = DocumentType.GetAllAsList().ToArray(); + foreach (var dc in nContentTypes) { - ListItem li = new ListItem(dc.Text, dc.Id.ToString()); + ListItem li = new ListItem(dc.Name, dc.Id.ToString()); if (pack.Documenttypes.Contains(dc.Id.ToString())) li.Selected = true; @@ -126,8 +122,9 @@ namespace umbraco.presentation.developer.packages } /* MACROS */ - Macro[] umbMacros = Macro.GetAll(); - foreach (Macro m in umbMacros) + var nMacros = Services.MacroService.GetAll(); + //Macro[] umbMacros = Macro.GetAll(); + foreach (var m in nMacros) { ListItem li = new ListItem(m.Name, m.Id.ToString()); if (pack.Macros.Contains(m.Id.ToString())) @@ -137,11 +134,12 @@ namespace umbraco.presentation.developer.packages } /*Langauges */ - Language[] umbLanguages = Language.getAll; - foreach (Language l in umbLanguages) + var nLanguages = Services.LocalizationService.GetAllLanguages(); + //Language[] umbLanguages = Language.getAll; + foreach (var l in nLanguages) { - ListItem li = new ListItem(l.FriendlyName, l.id.ToString()); - if (pack.Languages.Contains(l.id.ToString())) + ListItem li = new ListItem(l.CultureName, l.Id.ToString()); + if (pack.Languages.Contains(l.Id.ToString())) li.Selected = true; languages.Items.Add(li); @@ -439,7 +437,7 @@ namespace umbraco.presentation.developer.packages saves.Text = Services.TextService.Localize("save"); saves.CommandName = "save"; saves.Command += new CommandEventHandler(saveOrPublish); - saves.ButtonType = uicontrols.MenuButtonType.Primary; + saves.ButtonType = Umbraco.Web._Legacy.Controls.MenuButtonType.Primary; saves.ID = "save"; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.designer.cs index dfd3eaa5d7..636f35848a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.designer.cs @@ -19,7 +19,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.TabView TabView1; + protected global::Umbraco.Web._Legacy.Controls.TabView TabView1; /// /// Pane1 control. @@ -28,7 +28,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane1; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane1; /// /// pp_name control. @@ -37,13 +37,13 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_name; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_name; - protected global::umbraco.uicontrols.PropertyPanel pp_icon; - protected global::umbraco.uicontrols.PropertyPanel pp_umbracoVersion; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_icon; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_umbracoVersion; protected global::System.Web.UI.WebControls.TextBox iconUrl; protected global::System.Web.UI.WebControls.TextBox umbracoVersion; - protected global::umbraco.uicontrols.Pane Pane5; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane5; protected global::System.Web.UI.WebControls.RegularExpressionValidator VersionValidator; protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator7; @@ -73,7 +73,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_url; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_url; /// /// packageUrl control. @@ -100,7 +100,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_version; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_version; /// /// packageVersion control. @@ -127,7 +127,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_file; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_file; /// /// packageUmbFile control. @@ -145,7 +145,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane1_1; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane1_1; /// /// pp_author control. @@ -154,7 +154,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_author; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_author; /// /// packageAuthorName control. @@ -181,7 +181,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_author_url; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_author_url; /// /// packageAuthorUrl control. @@ -208,7 +208,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane1_2; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane1_2; /// /// pp_licens control. @@ -217,7 +217,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_licens; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_licens; /// /// packageLicenseName control. @@ -244,7 +244,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_license_url; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_license_url; /// /// packageLicenseUrl control. @@ -271,7 +271,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane1_3; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane1_3; /// /// pp_readme control. @@ -280,7 +280,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_readme; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_readme; /// /// packageReadme control. @@ -298,7 +298,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane2; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane2; /// /// pp_content control. @@ -307,7 +307,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_content; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_content; /// /// content control. @@ -334,7 +334,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane2_1; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane2_1; /// /// documentTypes control. @@ -352,7 +352,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane2_2; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane2_2; /// /// templates control. @@ -370,7 +370,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane2_3; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane2_3; /// /// stylesheets control. @@ -388,7 +388,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane2_4; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane2_4; /// /// macros control. @@ -406,7 +406,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane2_5; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane2_5; /// /// languages control. @@ -424,7 +424,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane2_6; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane2_6; /// /// dictionary control. @@ -442,7 +442,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane2_7; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane2_7; /// /// cbl_datatypes control. @@ -460,7 +460,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane3; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane3; /// /// Pane3_1 control. @@ -469,7 +469,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane3_1; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane3_1; /// /// packageFilesRepeater control. @@ -505,7 +505,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane3_2; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane3_2; /// /// packageControlPath control. @@ -523,7 +523,7 @@ namespace umbraco.presentation.developer.packages { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane4; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane4; /// /// actionsVal control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs index 394a8475e0..a4198edb8a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs @@ -39,7 +39,7 @@ namespace umbraco.presentation.developer.packages if (!cms.businesslogic.packager.Settings.HasFileAccess(ref ex)) { fb.Style.Add("margin-top", "7px"); - fb.type = uicontrols.Feedback.feedbacktype.error; + fb.type = Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.error; fb.Text = "" + Services.TextService.Localize("errors/filePermissionsError") + ":
" + ex.Message; } @@ -91,7 +91,7 @@ namespace umbraco.presentation.developer.packages else { fb.Style.Add("margin-top", "7px"); - fb.type = uicontrols.Feedback.feedbacktype.error; + fb.type = Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.error; fb.Text = "No connection to repository. Runway could not be installed as there was no connection to: '" + _repo.RepositoryUrl + "'"; pane_upload.Visible = false; } @@ -116,7 +116,7 @@ namespace umbraco.presentation.developer.packages } catch (Exception ex) { - fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; + fb.type = global::Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.error; fb.Text = "Could not upload file
" + ex.ToString(); } } @@ -396,7 +396,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoPanel Panel1; + protected global::Umbraco.Web._Legacy.Controls.UmbracoPanel Panel1; /// /// fb control. @@ -405,7 +405,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Feedback fb; + protected global::Umbraco.Web._Legacy.Controls.Feedback fb; /// /// pane_upload control. @@ -414,7 +414,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_upload; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_upload; /// /// PropertyPanel9 control. @@ -423,7 +423,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel9; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel9; /// /// file1 control. @@ -450,7 +450,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.ProgressBar progbar1; + protected global::Umbraco.Web._Legacy.Controls.ProgressBar progbar1; /// /// pane_authenticate control. @@ -459,7 +459,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_authenticate; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_authenticate; /// /// tb_email control. @@ -477,7 +477,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel1; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel1; /// /// tb_password control. @@ -495,7 +495,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel2; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel2; /// /// Button1 control. @@ -522,7 +522,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_acceptLicenseInner; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_acceptLicenseInner; /// /// PropertyPanel3 control. @@ -531,7 +531,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel3; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel3; /// /// LabelName control. @@ -549,7 +549,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel5; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel5; /// /// LabelAuthor control. @@ -567,7 +567,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel4; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel4; /// /// LabelMore control. @@ -585,7 +585,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel6; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel6; /// /// LabelLicense control. @@ -603,7 +603,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel7; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel7; /// /// acceptCheckbox control. @@ -621,7 +621,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel8; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel8; /// /// readme control. @@ -639,7 +639,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_unsecureFiles; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_unsecureFiles; /// /// lt_files control. @@ -657,7 +657,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_macroConflicts; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_macroConflicts; /// /// ltrMacroAlias control. @@ -675,10 +675,10 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_templateConflicts; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_templateConflicts; - protected global::umbraco.uicontrols.PropertyPanel BinaryFileErrorsPanel; - protected global::umbraco.uicontrols.PropertyPanel LegacyPropertyEditorPanel; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel BinaryFileErrorsPanel; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel LegacyPropertyEditorPanel; protected global::System.Web.UI.WebControls.Literal BinaryFileErrorReport; /// @@ -697,7 +697,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_stylesheetConflicts; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_stylesheetConflicts; /// /// ltrStylesheetNames control. @@ -715,7 +715,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.ProgressBar _progbar1; + protected global::Umbraco.Web._Legacy.Controls.ProgressBar _progbar1; /// /// ButtonInstall control. @@ -733,9 +733,9 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_installing; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_installing; - protected global::umbraco.uicontrols.Pane pane_uninstalled; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_uninstalled; /// @@ -745,7 +745,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.ProgressBar progBar2; + protected global::Umbraco.Web._Legacy.Controls.ProgressBar progBar2; /// /// lit_installStatus control. @@ -763,7 +763,7 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_optional; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_optional; /// /// pane_success control. @@ -772,9 +772,9 @@ namespace umbraco.presentation.developer.packages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_success; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_success; - protected global::umbraco.uicontrols.Pane pane_refresh; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_refresh; /// /// bt_viewInstalledPackage control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/RelationTypes/EditRelationType.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/RelationTypes/EditRelationType.aspx.designer.cs index 4905e36375..8f92c9f32a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/RelationTypes/EditRelationType.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/RelationTypes/EditRelationType.aspx.designer.cs @@ -19,7 +19,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.TabView tabControl; + protected global::Umbraco.Web._Legacy.Controls.TabView tabControl; /// /// idPane control. @@ -28,7 +28,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane idPane; + protected global::Umbraco.Web._Legacy.Controls.Pane idPane; /// /// idPropertyPanel control. @@ -37,7 +37,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel idPropertyPanel; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel idPropertyPanel; /// /// idLiteral control. @@ -55,7 +55,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane nameAliasPane; + protected global::Umbraco.Web._Legacy.Controls.Pane nameAliasPane; /// /// nameProperyPanel control. @@ -64,7 +64,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel nameProperyPanel; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel nameProperyPanel; /// /// nameTextBox control. @@ -91,7 +91,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel aliasPropertyPanel; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel aliasPropertyPanel; /// /// aliasTextBox control. @@ -127,7 +127,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane directionPane; + protected global::Umbraco.Web._Legacy.Controls.Pane directionPane; /// /// dualPropertyPanel control. @@ -136,7 +136,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel dualPropertyPanel; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel dualPropertyPanel; /// /// dualRadioButtonList control. @@ -154,7 +154,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane objectTypePane; + protected global::Umbraco.Web._Legacy.Controls.Pane objectTypePane; /// /// parentPropertyPanel control. @@ -163,7 +163,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel parentPropertyPanel; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel parentPropertyPanel; /// /// parentLiteral control. @@ -181,7 +181,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel childPropertyPanel; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel childPropertyPanel; /// /// childLiteral control. @@ -199,7 +199,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane relationsCountPane; + protected global::Umbraco.Web._Legacy.Controls.Pane relationsCountPane; /// /// relationsCountPropertyPanel control. @@ -208,7 +208,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel relationsCountPropertyPanel; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel relationsCountPropertyPanel; /// /// relationsCountLiteral control. @@ -226,7 +226,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane relationsPane; + protected global::Umbraco.Web._Legacy.Controls.Pane relationsPane; /// /// relationsPropertyPanel control. @@ -235,7 +235,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel relationsPropertyPanel; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel relationsPropertyPanel; /// /// relationsRepeater control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/RelationTypes/NewRelationType.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/RelationTypes/NewRelationType.aspx.cs index 8911e0de8f..c37feb57bd 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/RelationTypes/NewRelationType.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/RelationTypes/NewRelationType.aspx.cs @@ -2,7 +2,6 @@ using System.Web.UI.WebControls; using Umbraco.Core; using Umbraco.Web.UI.Pages; -using umbraco.BusinessLogic; using Umbraco.Core.Models; namespace umbraco.cms.presentation.developer.RelationTypes diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/RelationTypes/NewRelationType.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/RelationTypes/NewRelationType.aspx.designer.cs index 6fc773af24..09080af7d9 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/RelationTypes/NewRelationType.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/RelationTypes/NewRelationType.aspx.designer.cs @@ -19,7 +19,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane nameAliasPane; + protected global::Umbraco.Web._Legacy.Controls.Pane nameAliasPane; /// /// nameProperyPanel control. @@ -28,7 +28,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel nameProperyPanel; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel nameProperyPanel; /// /// descriptionTextBox control. @@ -55,7 +55,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel aliasPropertyPanel; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel aliasPropertyPanel; /// /// aliasTextBox control. @@ -91,7 +91,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane directionPane; + protected global::Umbraco.Web._Legacy.Controls.Pane directionPane; /// /// PropertyPanel1 control. @@ -100,7 +100,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel1; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel1; /// /// dualRadioButtonList control. @@ -118,7 +118,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane objectTypePane; + protected global::Umbraco.Web._Legacy.Controls.Pane objectTypePane; /// /// PropertyPanel2 control. @@ -127,7 +127,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel2; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel2; /// /// parentDropDownList control. @@ -145,7 +145,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel3; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel3; /// /// childDropDownList control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/editXslt.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/editXslt.aspx.cs index 62ac9b38ef..53133358ce 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/editXslt.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/editXslt.aspx.cs @@ -6,7 +6,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using Umbraco.Core; using Umbraco.Core.IO; -using umbraco.uicontrols; +using Umbraco.Web._Legacy.Controls; using umbraco.cms.presentation.Trees; using Umbraco.Web.UI.Pages; @@ -142,7 +142,7 @@ namespace umbraco.cms.presentation.developer /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.TabView UmbracoPanel1; + protected global::Umbraco.Web._Legacy.Controls.TabView UmbracoPanel1; /// /// Pane1 control. @@ -151,8 +151,8 @@ namespace umbraco.cms.presentation.developer /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane1; - protected global::umbraco.uicontrols.Pane pane2; + protected global::Umbraco.Web._Legacy.Controls.Pane pane1; + protected global::Umbraco.Web._Legacy.Controls.Pane pane2; /// /// pp_filename control. @@ -161,7 +161,7 @@ namespace umbraco.cms.presentation.developer /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_filename; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_filename; /// /// xsltFileName control. @@ -179,7 +179,7 @@ namespace umbraco.cms.presentation.developer /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_errorMsg; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_errorMsg; /// /// editorSource control. @@ -188,7 +188,7 @@ namespace umbraco.cms.presentation.developer /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.CodeArea editorSource; + protected global::Umbraco.Web._Legacy.Controls.CodeArea editorSource; /// /// editorJs control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltInsertValueOf.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltInsertValueOf.aspx.cs index 7fd89c94d8..35c9fdbd2c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltInsertValueOf.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltInsertValueOf.aspx.cs @@ -1,16 +1,7 @@ using System; using System.Collections; -using System.ComponentModel; -using System.Data; -using System.Drawing; using System.Linq; -using System.Web; -using System.Web.SessionState; -using System.Web.UI; using System.Web.UI.WebControls; -using System.Web.UI.HtmlControls; -using Umbraco.Core.Configuration; -using umbraco.cms.businesslogic.propertytype; using Umbraco.Core; using Umbraco.Web.UI.Pages; @@ -34,14 +25,17 @@ namespace umbraco.developer // generic properties string existingGenProps = ","; var exclude = Constants.Conventions.Member.GetStandardPropertyTypeStubs().Select(x => x.Key).ToArray(); - foreach (PropertyType pt in PropertyType.GetAll().Where(x => exclude.Contains(x.Alias) == false)) + + var propertyTypes = Services.ContentTypeService.GetAllPropertyTypeAliases(); + + foreach (var ptAlias in propertyTypes.Where(x => exclude.Contains(x) == false)) { - if (!existingGenProps.Contains("," + pt.Alias + ",")) + if (!existingGenProps.Contains("," + ptAlias + ",")) { - preValuesSource.Add(pt.Alias); + preValuesSource.Add(ptAlias); - existingGenProps += pt.Alias + ","; + existingGenProps += ptAlias + ","; } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltVisualize.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltVisualize.aspx.designer.cs index 647af23d3e..704948a622 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltVisualize.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltVisualize.aspx.designer.cs @@ -20,7 +20,7 @@ namespace umbraco.presentation.umbraco.developer.Xslt { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane1; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane1; /// /// PropertyPanel1 control. @@ -29,7 +29,7 @@ namespace umbraco.presentation.umbraco.developer.Xslt { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel1; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel1; /// /// xsltSelection control. @@ -65,7 +65,7 @@ namespace umbraco.presentation.umbraco.developer.Xslt { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane visualizeContainer; + protected global::Umbraco.Web._Legacy.Controls.Pane visualizeContainer; /// /// visualizePanel control. @@ -74,7 +74,7 @@ namespace umbraco.presentation.umbraco.developer.Xslt { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel visualizePanel; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel visualizePanel; /// /// visualizeArea control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/autoDoc.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/autoDoc.aspx.cs index fc3d32b58f..288b5fab1b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/autoDoc.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/autoDoc.aspx.cs @@ -1,16 +1,9 @@ using System; -using System.Collections; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Web; -using System.Web.SessionState; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.HtmlControls; +using System.Collections.Generic; using System.Linq; -using umbraco.BusinessLogic; +using System.Text; using Umbraco.Core; +using Umbraco.Core.Models; using Umbraco.Web.UI.Pages; namespace umbraco.developer @@ -27,33 +20,40 @@ namespace umbraco.developer protected void Page_Load(object sender, EventArgs e) { - // Put user code to initialize the page here - foreach(var dt in cms.businesslogic.web.DocumentType.GetAllAsList()) - { - LabelDoc.Text += - "

" + dt.Text + "

Id: " + dt.Id.ToString() + ", Alias: " + dt.Alias + ")

"; - if (dt.PropertyTypes.Count > 0) - LabelDoc.Text += "

Property Types:

"; - foreach (var pt in dt.PropertyTypes) - LabelDoc.Text += - "

" + pt.Id.ToString() + ", " + pt.Alias + ", " + pt.Name + "

"; - if (dt.getVirtualTabs.Length > 0) - LabelDoc.Text += "

Tabs:

"; - foreach (var t in dt.getVirtualTabs.ToList()) - LabelDoc.Text += - "

" + t.Id.ToString() + ", " + t.Caption + "

"; - if (dt.AllowedChildContentTypeIDs.Length > 0) - LabelDoc.Text += "

Allowed children:

"; - foreach (var child in dt.AllowedChildContentTypeIDs.ToList()) - { - var contentType = new cms.businesslogic.ContentType(child); - LabelDoc.Text += - "

" + contentType.Id.ToString() + ", " + contentType.Text + "

"; - } - - LabelDoc.Text += "
"; - } + var sb = new StringBuilder(); + AppendTypes(sb, Services.ContentTypeService.GetAll()); + AppendTypes(sb, Services.MediaTypeService.GetAll()); + AppendTypes(sb, Services.MemberTypeService.GetAll()); + LabelDoc.Text = sb.ToString(); } - } + private void AppendTypes(StringBuilder text, IEnumerable types) + { + foreach (var type in types) + { + text.Append( + "

" + type.Name + "

Id: " + type.Id + ", Alias: " + type.Alias + ")

"); + if (type.PropertyTypes.Any()) + text.Append("

Property Types:

"); + foreach (var pt in type.PropertyTypes) + text.Append( + "

" + pt.Id + ", " + pt.Alias + ", " + pt.Name + "

"); + if (type.PropertyGroups.Count > 0) + text.Append("

Tabs:

"); + foreach (var t in type.PropertyGroups) + text.Append( + "

" + t.Id + ", " + t.Name + "

"); + if (type.AllowedContentTypes.Any()) + text.Append("

Allowed children:

"); + foreach (var child in type.AllowedContentTypes) + { + var contentType = types.First(x => x.Id == child.Id.Value); + text.Append( + "

" + child.Id + ", " + contentType.Name + "

"); + } + + text.Append("
"); + } + } + } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain2.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain2.aspx.designer.cs index 8d2a322918..588946d2ff 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain2.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain2.aspx.designer.cs @@ -28,7 +28,7 @@ namespace umbraco.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Feedback feedback; + protected global::Umbraco.Web._Legacy.Controls.Feedback feedback; /// /// pane_language control. @@ -37,7 +37,7 @@ namespace umbraco.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_language; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_language; /// /// prop_language control. @@ -46,7 +46,7 @@ namespace umbraco.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel prop_language; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel prop_language; /// /// pane_domains control. @@ -55,7 +55,7 @@ namespace umbraco.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_domains; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_domains; /// /// p_buttons control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/Preview.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/Preview.aspx.designer.cs index 2d311c5655..aac79aa1eb 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/Preview.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/Preview.aspx.designer.cs @@ -20,7 +20,7 @@ namespace umbraco.presentation.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Feedback feedback1; + protected global::Umbraco.Web._Legacy.Controls.Feedback feedback1; /// /// pane_form control. @@ -29,7 +29,7 @@ namespace umbraco.presentation.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_form; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_form; /// /// PropertyPanel1 control. @@ -38,7 +38,7 @@ namespace umbraco.presentation.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel1; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel1; /// /// docLit control. @@ -56,7 +56,7 @@ namespace umbraco.presentation.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel2; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel2; /// /// changeSetUrl control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs index 62e62abdbf..30ad7bce2e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs @@ -1,16 +1,5 @@ using System; -using System.Collections; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Web; -using System.Web.SessionState; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.HtmlControls; using Umbraco.Web; -using umbraco.BusinessLogic; -using umbraco.cms.businesslogic.web; using Umbraco.Core; using Umbraco.Web._Legacy.Actions; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/create.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/create.aspx.cs index 112e1fb378..4154e3edea 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/create.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/create.aspx.cs @@ -3,15 +3,18 @@ using System.Linq; using System.Globalization; using System.Linq; using System.Web.UI; -using System.Web.UI.WebControls; using System.Xml; using Umbraco.Core.IO; using Umbraco.Web; using umbraco.cms.businesslogic; using Umbraco.Core; +using Umbraco.Core.Models; using Umbraco.Core.Services; +using Umbraco.Web.Composing; using Umbraco.Web.UI.Pages; using Umbraco.Web._Legacy.Actions; +using Button = System.Web.UI.WebControls.Button; +using UserControl = System.Web.UI.UserControl; namespace umbraco.dialogs { @@ -56,7 +59,8 @@ namespace umbraco.dialogs //ensure they have access to create under this node!! if (App.InvariantEquals(Constants.Applications.Media) || CheckCreatePermissions(nodeId)) { - var c = new CMSNode(nodeId); + //var c = new CMSNode(nodeId); + var c = Services.EntityService.Get(nodeId); path.Value = c.Path; pane_chooseNode.Visible = false; panel_buttons.Visible = false; @@ -72,12 +76,11 @@ namespace umbraco.dialogs } else { - PageNameHolder.type = uicontrols.Feedback.feedbacktype.error; + PageNameHolder.type = Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.error; PageNameHolder.Text = Services.TextService.Localize("rights") + " " + Services.TextService.Localize("error"); JTree.DataBind(); } } - } protected override void OnPreRender(EventArgs e) @@ -89,7 +92,8 @@ namespace umbraco.dialogs private bool CheckCreatePermissions(int nodeId) { - var permission = Services.UserService.GetPermissions(Security.CurrentUser, new CMSNode(nodeId).Path); + var c = Services.EntityService.Get(nodeId); + var permission = Services.UserService.GetPermissions(Security.CurrentUser, c.Path); return permission.AssignedPermissions.Contains(ActionNew.Instance.Letter.ToString(CultureInfo.InvariantCulture), StringComparer.Ordinal); } @@ -110,7 +114,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_chooseNode; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_chooseNode; /// /// JTree control. @@ -137,7 +141,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Feedback PageNameHolder; + protected global::Umbraco.Web._Legacy.Controls.Feedback PageNameHolder; /// /// pane_chooseName control. @@ -146,7 +150,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_chooseName; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_chooseName; /// /// phCreate control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs index b895fc3b24..2ea7149351 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Umbraco.Core; using Umbraco.Web; using umbraco.cms.businesslogic; +using Umbraco.Core.Models.EntityBase; using Umbraco.Web.Composing; using Umbraco.Web.UI.Pages; using Umbraco.Web._Legacy.Actions; @@ -26,19 +27,19 @@ namespace umbraco.dialogs } private readonly Dictionary _permissions = new Dictionary(); - private CMSNode _node; + private IUmbracoEntity _node; protected void Page_Load(object sender, EventArgs e) { Button1.Text = Services.TextService.Localize("update"); - pane_form.Text = Services.TextService.Localize("actions/SetPermissionsForThePage",_node.Text); + pane_form.Text = Services.TextService.Localize("actions/SetPermissionsForThePage",_node.Name); } override protected void OnInit(EventArgs e) { base.OnInit(e); - _node = new CMSNode(Request.GetItemAs("id")); + _node = Services.EntityService.Get(Request.GetItemAs("id")); var ht = new HtmlTable(); ht.Attributes.Add("class", "table"); @@ -157,12 +158,16 @@ namespace umbraco.dialogs { cruds = user.Value; } - BusinessLogic.Permission.UpdateCruds(user.Key, _node, cruds); + //BusinessLogic.Permission.UpdateCruds(user.Key, _node, cruds); + Current.Services.UserService.ReplaceUserPermissions( + user.Key.Id, + cruds.ToCharArray(), + _node.Id); } // Update feedback message //FeedBackMessage.Text = "
" + Services.TextService.Localize("rights") + " " + Services.TextService.Localize("ok") + "
"; - feedback1.type = uicontrols.Feedback.feedbacktype.success; + feedback1.type = Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.success; feedback1.Text = Services.TextService.Localize("rights") + " " + Services.TextService.Localize("ok"); PlaceHolder1.Visible = false; panel_buttons.Visible = false; @@ -177,7 +182,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_form; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_form; /// /// feedback1 control. @@ -186,7 +191,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Feedback feedback1; + protected global::Umbraco.Web._Legacy.Controls.Feedback feedback1; /// /// PlaceHolder1 control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/exportDocumenttype.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/exportDocumenttype.aspx.cs index 3e3454d58f..b9c73d4aa1 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/exportDocumenttype.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/exportDocumenttype.aspx.cs @@ -1,18 +1,4 @@ using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Web; -using System.Web.SessionState; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.HtmlControls; - -using umbraco.cms.businesslogic.web; -using System.Xml; using Umbraco.Core; using Umbraco.Core.Services; using Umbraco.Web; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpageContent.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpageContent.aspx.cs index 5b3cf7b60a..7e79b60312 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpageContent.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpageContent.aspx.cs @@ -1,7 +1,9 @@ using Umbraco.Core.Services; using System; +using System.Linq; using System.Web.UI.WebControls; using Umbraco.Core; +using Umbraco.Core.IO; namespace umbraco.presentation.umbraco.dialogs { @@ -22,16 +24,20 @@ namespace umbraco.presentation.umbraco.dialogs li.Selected = true; dd_detectedAlias.Items.Add(li); - var t = new cms.businesslogic.template.Template(int.Parse(Request["id"])); + //var t = new cms.businesslogic.template.Template(int.Parse(Request["id"])); + var t = Services.FileService.GetTemplate(int.Parse(Request["id"])); - if (t.MasterTemplate > 0) + //if (t.MasterTemplate > 0) + if (string.IsNullOrWhiteSpace(t.MasterTemplateAlias) != true) { - t = new cms.businesslogic.template.Template(t.MasterTemplate); + //t = new cms.businesslogic.template.Template(t.MasterTemplate); + t = Services.FileService.GetTemplate(t.MasterTemplateAlias); } - foreach (string cpId in t.contentPlaceholderIds()) + //foreach (string cpId in t.contentPlaceholderIds()) + foreach (string cpId in MasterPageHelper.GetContentPlaceholderIds(t)) { dd_detectedAlias.Items.Add(cpId); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpageContent.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpageContent.aspx.designer.cs index f5308c1905..fbda589028 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpageContent.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpageContent.aspx.designer.cs @@ -19,7 +19,7 @@ namespace umbraco.presentation.umbraco.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_insert; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_insert; /// /// pp_placeholder control. @@ -28,7 +28,7 @@ namespace umbraco.presentation.umbraco.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_placeholder; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_placeholder; /// /// dd_detectedAlias control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpagePlaceholder.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpagePlaceholder.aspx.designer.cs index 624826f390..5fb7cb041a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpagePlaceholder.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpagePlaceholder.aspx.designer.cs @@ -21,6 +21,6 @@ namespace umbraco.presentation.umbraco.dialogs { /// protected global::System.Web.UI.WebControls.TextBox tb_alias; - protected global::umbraco.uicontrols.PropertyPanel pp_placeholder; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_placeholder; } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/notifications.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/notifications.aspx.cs index cd405b4fa2..307d1e8d74 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/notifications.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/notifications.aspx.cs @@ -58,7 +58,7 @@ namespace umbraco.dialogs if (notifications.Any(x => x.Action == a.Letter.ToString())) c.Checked = true; - uicontrols.PropertyPanel pp = new umbraco.uicontrols.PropertyPanel(); + var pp = new Umbraco.Web._Legacy.Controls.PropertyPanel(); pp.CssClass = "inline"; pp.Text = Services.TextService.Localize("actions", a.Alias); pp.Controls.Add(c); @@ -96,9 +96,9 @@ namespace umbraco.dialogs Current.Services.NotificationService.SetNotifications(Security.CurrentUser, node, notifications.ToCharArray().Select(x => x.ToString()).ToArray()); - var feedback = new umbraco.uicontrols.Feedback(); + var feedback = new Umbraco.Web._Legacy.Controls.Feedback(); feedback.Text = Services.TextService.Localize("notifications") + " " + Services.TextService.Localize("ok") + "

" + Services.TextService.Localize("closeThisWindow") + ""; - feedback.type = umbraco.uicontrols.Feedback.feedbacktype.success; + feedback.type = Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.success; pane_form.Controls.Clear(); pane_form.Controls.Add(feedback); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/notifications.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/notifications.aspx.designer.cs index 7ab5c11751..5c92ddede5 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/notifications.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/notifications.aspx.designer.cs @@ -19,7 +19,7 @@ namespace umbraco.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_form; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_form; ///

/// pl_buttons control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs index 0ad5ee6f9c..86dd3a2c29 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs @@ -4,21 +4,16 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Web.Security; -using System.Web.UI; using System.Web.UI.WebControls; -using System.Windows.Forms.VisualStyles; using Umbraco.Core; using Umbraco.Core.Logging; -using umbraco.cms.businesslogic.web; using umbraco.controls; using Umbraco.Core.Models; -using Umbraco.Core.Persistence; using Umbraco.Core.Security; using Umbraco.Web; using Umbraco.Web.Composing; using Umbraco.Web.UI.Pages; using MembershipProviderExtensions = Umbraco.Core.Security.MembershipProviderExtensions; -using MemberType = umbraco.cms.businesslogic.member.MemberType; namespace umbraco.presentation.umbraco.dialogs { @@ -127,13 +122,13 @@ namespace umbraco.presentation.umbraco.dialogs private void ProtectPage(bool Simple, int DocumentId, int LoginDocumentId, int ErrorDocumentId) { - var doc = new Document(DocumentId); + var content = Current.Services.ContentService.GetById(DocumentId); var loginContent = Services.ContentService.GetById(LoginDocumentId); if (loginContent == null) throw new NullReferenceException("No content item found with id " + LoginDocumentId); var noAccessContent = Services.ContentService.GetById(ErrorDocumentId); if (noAccessContent == null) throw new NullReferenceException("No content item found with id " + ErrorDocumentId); - var entry = Services.PublicAccessService.GetEntryForContent(doc.ContentEntity.Id.ToString()); + var entry = Services.PublicAccessService.GetEntryForContent(content.Id.ToString()); if (entry != null) { if (Simple) @@ -148,7 +143,7 @@ namespace umbraco.presentation.umbraco.dialogs } else { - entry = new PublicAccessEntry(doc.ContentEntity, + entry = new PublicAccessEntry(content, Services.ContentService.GetById(LoginDocumentId), Services.ContentService.GetById(ErrorDocumentId), new List()); @@ -159,10 +154,10 @@ namespace umbraco.presentation.umbraco.dialogs private void AddMembershipRoleToDocument(int documentId, string role) { //event - var doc = new Document(documentId); + var content = Current.Services.ContentService.GetById(documentId); var entry = Services.PublicAccessService.AddRule( - doc.ContentEntity, + content, Constants.Conventions.PublicAccess.MemberRoleRuleType, role); @@ -175,9 +170,9 @@ namespace umbraco.presentation.umbraco.dialogs private void AddMembershipUserToDocument(int documentId, string membershipUserName) { //event - var doc = new Document(documentId); + var content = Current.Services.ContentService.GetById(documentId); var entry = Services.PublicAccessService.AddRule( - doc.ContentEntity, + content, Constants.Conventions.PublicAccess.MemberUsernameRuleType, membershipUserName); @@ -189,17 +184,17 @@ namespace umbraco.presentation.umbraco.dialogs private void RemoveMembershipRoleFromDocument(int documentId, string role) { - var doc = new Document(documentId); + var content = Current.Services.ContentService.GetById(documentId); Services.PublicAccessService.RemoveRule( - doc.ContentEntity, + content, Constants.Conventions.PublicAccess.MemberRoleRuleType, role); } private void RemoveProtection(int documentId) { - var doc = new Document(documentId); - var entry = Services.PublicAccessService.GetEntryForContent(doc.ContentEntity); + var content = Current.Services.ContentService.GetById(documentId); + var entry = Services.PublicAccessService.GetEntryForContent(content); if (entry != null) { Services.PublicAccessService.Delete(entry); @@ -210,7 +205,7 @@ namespace umbraco.presentation.umbraco.dialogs { // Check for editing int documentId = int.Parse(Request.GetItemAsString("nodeId")); - var documentObject = new Document(documentId); + var content = Current.Services.ContentService.GetById(documentId); jsShowWindow.Text = ""; ph_errorpage.Controls.Add(errorPagePicker); @@ -235,16 +230,16 @@ namespace umbraco.presentation.umbraco.dialogs bt_buttonRemoveProtection.Attributes.Add("onClick", "return confirm('" + Services.TextService.Localize("areyousure") + "')"); // Get login and error pages - int errorPage = GetErrorPage(documentObject.Path); - int loginPage = GetLoginPage(documentObject.Path); + int errorPage = GetErrorPage(content.Path); + int loginPage = GetLoginPage(content.Path); try { - var loginPageObj = new Document(loginPage); - if (loginPageObj != null) + var loginPageContent = Current.Services.ContentService.GetById(loginPage); + if (loginPageContent != null) { loginPagePicker.Value = loginPage.ToString(CultureInfo.InvariantCulture); } - var errorPageObj = new Document(errorPage); + var errorPageContent = Current.Services.ContentService.GetById(errorPage); errorPagePicker.Value = errorPage.ToString(CultureInfo.InvariantCulture); } catch (Exception ex) @@ -355,9 +350,11 @@ namespace umbraco.presentation.umbraco.dialogs else { //if it's the umbraco membership provider, then we need to tell it what member type to create it with - if (MemberType.GetByAlias(Constants.Conventions.MemberTypes.SystemDefaultProtectType) == null) + if (Current.Services.MemberTypeService.Get(Constants.Conventions.MemberTypes.SystemDefaultProtectType) == null) + //if (MemberType.GetByAlias(Constants.Conventions.MemberTypes.SystemDefaultProtectType) == null) { - MemberType.MakeNew(Services.UserService.GetUserById(0), Constants.Conventions.MemberTypes.SystemDefaultProtectType); + var defm = new MemberType(null, Constants.Conventions.MemberTypes.SystemDefaultProtectType); + Current.Services.MemberTypeService.Save(defm); } var castedProvider = provider.AsUmbracoMembershipProvider(); MembershipCreateStatus status; @@ -415,17 +412,19 @@ namespace umbraco.presentation.umbraco.dialogs } } - feedback.Text = Services.TextService.Localize("publicAccess/paIsProtected", new[] { new cms.businesslogic.CMSNode(pageId).Text}) + "

" + Services.TextService.Localize("closeThisWindow") + ""; + var content = Services.ContentService.GetById(pageId); + var text = content == null ? "" : content.Name; + feedback.Text = Services.TextService.Localize("publicAccess/paIsProtected", new[] { text }) + "

" + Services.TextService.Localize("closeThisWindow") + ""; p_buttons.Visible = false; pane_advanced.Visible = false; pane_simple.Visible = false; - var content = Services.ContentService.GetById(pageId); + //reloads the current node in the tree ClientTools.SyncTree(content.Path, true); //reloads the current node's children in the tree ClientTools.ReloadActionNode(false, true); - feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; + feedback.type = global::Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.success; } @@ -438,14 +437,15 @@ namespace umbraco.presentation.umbraco.dialogs RemoveProtection(pageId); - feedback.Text = Services.TextService.Localize("publicAccess/paIsRemoved", new[] { new cms.businesslogic.CMSNode(pageId).Text}) + "

" + Services.TextService.Localize("closeThisWindow") + ""; - var content = Services.ContentService.GetById(pageId); + var text = content == null ? "" : content.Name; + feedback.Text = Services.TextService.Localize("publicAccess/paIsRemoved", new[] { text }) + "

" + Services.TextService.Localize("closeThisWindow") + ""; + //reloads the current node in the tree ClientTools.SyncTree(content.Path, true); //reloads the current node's children in the tree ClientTools.ReloadActionNode(false, true); - feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; + feedback.type = global::Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.success; } protected CustomValidator SimpleLoginNameValidator; @@ -467,7 +467,7 @@ namespace umbraco.presentation.umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Feedback feedback; + protected global::Umbraco.Web._Legacy.Controls.Feedback feedback; ///

/// p_mode control. @@ -485,7 +485,7 @@ namespace umbraco.presentation.umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_chooseMode; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_chooseMode; /// /// rb_simple control. @@ -530,7 +530,7 @@ namespace umbraco.presentation.umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_simple; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_simple; /// /// PropertyPanel1 control. @@ -539,7 +539,7 @@ namespace umbraco.presentation.umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel1; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel1; /// /// pp_login control. @@ -548,7 +548,7 @@ namespace umbraco.presentation.umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_login; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_login; /// /// simpleLogin control. @@ -566,7 +566,7 @@ namespace umbraco.presentation.umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_pass; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_pass; /// /// simplePassword control. @@ -584,7 +584,7 @@ namespace umbraco.presentation.umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_advanced; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_advanced; /// /// PropertyPanel3 control. @@ -593,7 +593,7 @@ namespace umbraco.presentation.umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel3; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel3; /// /// PropertyPanel2 control. @@ -602,7 +602,7 @@ namespace umbraco.presentation.umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel2; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel PropertyPanel2; /// /// groupsSelector control. @@ -629,7 +629,7 @@ namespace umbraco.presentation.umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_pages; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_pages; /// /// pp_loginPage control. @@ -638,7 +638,7 @@ namespace umbraco.presentation.umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_loginPage; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_loginPage; /// /// ph_loginpage control. @@ -665,7 +665,7 @@ namespace umbraco.presentation.umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_errorPage; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_errorPage; /// /// ph_errorpage control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/republish.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/republish.aspx.designer.cs index 901e05f9e1..81bd26801d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/republish.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/republish.aspx.designer.cs @@ -38,7 +38,7 @@ namespace umbraco.cms.presentation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.ProgressBar progbar; + protected global::Umbraco.Web._Legacy.Controls.ProgressBar progbar; /// /// p_done control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.cs index a070e50d4a..225e4a154e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.cs @@ -27,7 +27,7 @@ // } // private Document currentDoc = new Document(int.Parse(helper.Request("nodeId"))); - + // protected void version_load(object sender, EventArgs e) { // if (allVersions.SelectedValue != "") @@ -95,7 +95,7 @@ // } // Button1.Visible = true; - + // } // else @@ -135,7 +135,7 @@ // InitializeComponent(); // base.OnInit(e); // } - + // /// // /// Required method for Designer support - do not modify // /// the contents of this method with the code editor. @@ -151,13 +151,13 @@ // if (allVersions.SelectedValue.Trim() != "") { // Document d = new Document(int.Parse(helper.Request("nodeId"))); // d.RollBack(new Guid(allVersions.SelectedValue), Security.CurrentUser); - + // BusinessLogic.Log.Add(BusinessLogic.LogTypes.RollBack, Security.CurrentUser, d.Id, "Version rolled back to revision '" + allVersions.SelectedValue + "'"); - + // Document rollback = new Document(d.Id, new Guid(allVersions.SelectedValue)); -// feedBackMsg.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; +// feedBackMsg.type = global::Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.success; // string[] vars = {rollback.Text, rollback.VersionDate.ToLongDateString()}; - + // feedBackMsg.Text = ui.Text("rollback", "documentRolledBack", vars, new global::umbraco.BusinessLogic.User(0)) + "

" + Services.TextService.Localize("closeThisWindow") + ""; // diffPanel.Visible = false; // pl_buttons.Visible = false; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.designer.cs index ff4420468b..5f33bfb0bb 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.designer.cs @@ -28,7 +28,7 @@ namespace umbraco.presentation.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Feedback feedBackMsg; + protected global::Umbraco.Web._Legacy.Controls.Feedback feedBackMsg; ///

/// pp_selectVersion control. @@ -37,7 +37,7 @@ namespace umbraco.presentation.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pp_selectVersion; + protected global::Umbraco.Web._Legacy.Controls.Pane pp_selectVersion; /// /// pp_currentVersion control. @@ -46,7 +46,7 @@ namespace umbraco.presentation.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_currentVersion; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_currentVersion; /// /// currentVersionTitle control. @@ -73,7 +73,7 @@ namespace umbraco.presentation.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_rollBackTo; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_rollBackTo; /// /// allVersions control. @@ -91,7 +91,7 @@ namespace umbraco.presentation.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_view; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_view; /// /// rbl_mode control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.designer.cs index f8a12de376..efc60d5bed 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.designer.cs @@ -19,7 +19,7 @@ namespace umbraco.presentation.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Wizard; + protected global::Umbraco.Web._Legacy.Controls.Pane Wizard; /// /// keyword control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.cs index 5af8a13cb2..39f65bd468 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.cs @@ -1,26 +1,24 @@ using System; -using System.Linq; using System.Net.Mail; using System.Web; +using System.Linq; using System.Web.UI.WebControls; -using umbraco.cms.businesslogic; -using umbraco.uicontrols; using Umbraco.Core; using Umbraco.Core.Services; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Models; +using Umbraco.Core.Models.EntityBase; using Umbraco.Core.Models.Membership; using Umbraco.Web; using Umbraco.Web.Composing; using Umbraco.Web.UI.Pages; -using Language = umbraco.cms.businesslogic.language.Language; namespace umbraco.presentation.dialogs { public partial class sendToTranslation : UmbracoEnsuredPage { - private CMSNode _currentPage; + private IUmbracoEntity _currentPage; public sendToTranslation() { @@ -29,45 +27,48 @@ namespace umbraco.presentation.dialogs protected void Page_Load(object sender, EventArgs e) { - _currentPage = new CMSNode(Int32.Parse(Request.GetItemAsString("id"))); + _currentPage = Services.EntityService.Get(Int32.Parse(Request.GetItemAsString("id"))); pp_translator.Text = Services.TextService.Localize("translation/translator"); pp_language.Text = Services.TextService.Localize("translation/translateTo"); pp_includeSubs.Text = Services.TextService.Localize("translation/includeSubpages"); pp_comment.Text = Services.TextService.Localize("comment"); - pane_form.Text = Services.TextService.Localize("translation/sendToTranslate", new[] { _currentPage.Text}); - + pane_form.Text = Services.TextService.Localize("translation/sendToTranslate", new[] { _currentPage.Name}); + if (!IsPostBack) { // default language var selectedLanguage = 0; - var domains = library.GetCurrentDomains(_currentPage.Id); + var domains = Current.Services.DomainService.GetAssignedDomains(_currentPage.Id, false).ToArray(); + //var domains = library.GetCurrentDomains(_currentPage.Id); if (domains != null) { - selectedLanguage = domains[0].Language.id; - defaultLanguage.Text = Services.TextService.Localize("defaultLanguageIs") + " " + domains[0].Language.FriendlyName; + var lang = Current.Services.LocalizationService.GetLanguageById(domains[0].LanguageId.Value); + selectedLanguage = lang.Id; + defaultLanguage.Text = Services.TextService.Localize("defaultLanguageIs") + " " + lang.CultureName; } else { defaultLanguage.Text = Services.TextService.Localize("defaultLanguageIsNotAssigned"); } - + // languages language.Items.Add(new ListItem(Services.TextService.Localize("general/choose"), "")); - foreach (var l in Language.getAll) + foreach (var l in Current.Services.LocalizationService.GetAllLanguages()) { var li = new ListItem(); - li.Text = l.FriendlyName; - li.Value = l.id.ToString(); - if (selectedLanguage == l.id) + li.Text = l.CultureName; + li.Value = l.Id.ToString(); + if (selectedLanguage == l.Id) li.Selected = true; language.Items.Add(li); } // Subpages - if (_currentPage.Children.Length == 0) + var c = Services.EntityService.GetChildren(_currentPage.Id); + if (c.Any()) includeSubpages.Enabled = false; // Translators @@ -78,7 +79,7 @@ namespace umbraco.presentation.dialogs if (translator.Items.Count == 0) { feedback.Text = Services.TextService.Localize("translation/noTranslators"); - feedback.type = Feedback.feedbacktype.error; + feedback.type = Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.error; doTranslation.Enabled = false; } @@ -87,9 +88,9 @@ namespace umbraco.presentation.dialogs } } - private bool UserHasTranslatePermission(IUser u, CMSNode node) + private bool UserHasTranslatePermission(IUser u, IUmbracoEntity node) { - //the permissions column in umbracoUserType is legacy and needs to be rewritten but for now this is the only way to test + //the permissions column in umbracoUserType is legacy and needs to be rewritten but for now this is the only way to test var permissions = Services.UserService.GetPermissions(u, node.Path); return permissions.AssignedPermissions.Contains("4"); } @@ -104,41 +105,41 @@ namespace umbraco.presentation.dialogs _currentPage, Security.CurrentUser, Services.UserService.GetUserById(int.Parse(translator.SelectedValue)), - new Language(int.Parse(language.SelectedValue)), + Current.Services.LocalizationService.GetLanguageById(int.Parse(language.SelectedValue)), comment.Text, includeSubpages.Checked, true); pane_form.Visible = false; pl_buttons.Visible = false; - feedback.Text = Services.TextService.Localize("translation/pageHasBeenSendToTranslation", _currentPage.Text) + + feedback.Text = Services.TextService.Localize("translation/pageHasBeenSendToTranslation", _currentPage.Name) + "

" + Services.TextService.Localize("defaultdialogs/closeThisWindow") + "

"; - feedback.type = Feedback.feedbacktype.success; + feedback.type = Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.success; } else { feedback.Text = Services.TextService.Localize("translation/noLanguageSelected"); - feedback.type = Feedback.feedbacktype.error; + feedback.type = Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.error; } } - - public void MakeNew(CMSNode Node, IUser User, IUser Translator, Language Language, string Comment, + + public void MakeNew(IUmbracoEntity Node, IUser User, IUser Translator, ILanguage Language, string Comment, bool IncludeSubpages, bool SendEmail) { // Get translation taskType for obsolete task constructor var taskType = Services.TaskService.GetTaskTypeByAlias("toTranslate"); // Create pending task - var t = new cms.businesslogic.task.Task(new Task(taskType)); + var t = new Umbraco.Web._Legacy.BusinessLogic.Task(new Task(taskType)); t.Comment = Comment; - t.Node = Node; + t.TaskEntity.EntityId = Node.Id; t.ParentUser = User; t.User = Translator; t.Save(); Services.AuditService.Add(AuditType.SendToTranslate, - "Translator: " + Translator.Name + ", Language: " + Language.FriendlyName, + "Translator: " + Translator.Name + ", Language: " + Language.CultureName, User.Id, Node.Id); // send it @@ -153,17 +154,17 @@ namespace umbraco.presentation.dialogs serverName += IOHelper.ResolveUrl(SystemDirectories.Umbraco); // Send mail - string[] subjectVars = { serverName, Node.Text }; + string[] subjectVars = { serverName, Node.Name }; string[] bodyVars = { - Translator.Name, Node.Text, User.Name, + Translator.Name, Node.Name, User.Name, serverName, t.Id.ToString(), - Language.FriendlyName + Language.CultureName }; if (User.Email != "" && User.Email.Contains("@") && Translator.Email != "" && Translator.Email.Contains("@")) { - // create the mail message + // create the mail message using (MailMessage mail = new MailMessage(User.Email, Translator.Email)) { // populate the message @@ -182,7 +183,7 @@ namespace umbraco.presentation.dialogs Current.Logger.Error("Error sending translation e-mail", ex); } } - + } else { @@ -194,8 +195,9 @@ namespace umbraco.presentation.dialogs if (IncludeSubpages) { //store children array here because iterating over an Array property object is very inneficient. - var c = Node.Children; - foreach (CMSNode n in c) + var c = Services.EntityService.GetChildren(Node.Id); + //var c = Node.Children; + foreach (var n in c) { MakeNew(n, User, Translator, Language, Comment, true, false); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.designer.cs index 181a94beba..626f1fc8cd 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.designer.cs @@ -8,7 +8,7 @@ //------------------------------------------------------------------------------ using System.Web.UI.WebControls; -using umbraco.uicontrols; + namespace umbraco.presentation.dialogs { @@ -23,7 +23,7 @@ namespace umbraco.presentation.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected Feedback feedback; + protected Umbraco.Web._Legacy.Controls.Feedback feedback; /// /// pane_form control. @@ -32,7 +32,7 @@ namespace umbraco.presentation.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected Pane pane_form; + protected Umbraco.Web._Legacy.Controls.Pane pane_form; /// /// pp_translator control. @@ -41,7 +41,7 @@ namespace umbraco.presentation.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected PropertyPanel pp_translator; + protected Umbraco.Web._Legacy.Controls.PropertyPanel pp_translator; /// /// translator control. @@ -59,7 +59,7 @@ namespace umbraco.presentation.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected PropertyPanel pp_language; + protected Umbraco.Web._Legacy.Controls.PropertyPanel pp_language; /// /// language control. @@ -86,7 +86,7 @@ namespace umbraco.presentation.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected PropertyPanel pp_includeSubs; + protected Umbraco.Web._Legacy.Controls.PropertyPanel pp_includeSubs; /// /// includeSubpages control. @@ -104,7 +104,7 @@ namespace umbraco.presentation.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected PropertyPanel pp_comment; + protected Umbraco.Web._Legacy.Controls.PropertyPanel pp_comment; /// /// comment control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sort.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sort.aspx.cs index fbb632bb2c..227a4bb507 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sort.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sort.aspx.cs @@ -179,7 +179,7 @@ namespace umbraco.cms.presentation /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.ProgressBar prog1; + protected global::Umbraco.Web._Legacy.Controls.ProgressBar prog1; /// /// sortDone control. @@ -197,7 +197,7 @@ namespace umbraco.cms.presentation /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane sortPane; + protected global::Umbraco.Web._Legacy.Controls.Pane sortPane; /// /// lt_nodes control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/umbracoField.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/umbracoField.aspx.cs index edf89e4e5d..84f98d9de8 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/umbracoField.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/umbracoField.aspx.cs @@ -132,7 +132,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_form; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_form; /// /// pp_insertField control. @@ -141,7 +141,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_insertField; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_insertField; /// /// fieldPicker control. @@ -150,7 +150,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.FieldDropDownList fieldPicker; + protected global::Umbraco.Web._Legacy.Controls.FieldDropDownList fieldPicker; /// /// pp_insertAltField control. @@ -159,7 +159,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_insertAltField; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_insertAltField; /// /// altFieldPicker control. @@ -168,7 +168,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.FieldDropDownList altFieldPicker; + protected global::Umbraco.Web._Legacy.Controls.FieldDropDownList altFieldPicker; /// /// pp_insertAltText control. @@ -177,7 +177,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_insertAltText; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_insertAltText; /// /// pp_recursive control. @@ -186,7 +186,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_recursive; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_recursive; /// /// pp_insertBefore control. @@ -195,7 +195,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_insertBefore; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_insertBefore; /// /// pp_insertAfter control. @@ -204,7 +204,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_insertAfter; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_insertAfter; /// /// pp_FormatAsDate control. @@ -213,7 +213,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_FormatAsDate; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_FormatAsDate; /// /// pp_casing control. @@ -222,7 +222,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_casing; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_casing; /// /// pp_encode control. @@ -231,7 +231,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_encode; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_encode; /// /// pp_convertLineBreaks control. @@ -240,7 +240,7 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_convertLineBreaks; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_convertLineBreaks; /// /// pp_removePTags control. @@ -249,6 +249,6 @@ namespace umbraco.dialogs /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_removePTags; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_removePTags; } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/DictionaryItemList.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/DictionaryItemList.aspx.cs index afb0820b71..b0c3885c79 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/DictionaryItemList.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/DictionaryItemList.aspx.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; -using umbraco.cms.businesslogic; using Umbraco.Core; using Umbraco.Core.Models; +using Umbraco.Web.Composing; namespace umbraco.presentation.settings { @@ -11,15 +11,15 @@ namespace umbraco.presentation.settings { public partial class DictionaryItemList : Umbraco.Web.UI.Pages.UmbracoEnsuredPage { - private readonly cms.businesslogic.language.Language[] _languages = cms.businesslogic.language.Language.getAll; + private readonly ILanguage[] _languages = Current.Services.LocalizationService.GetAllLanguages().ToArray(); protected void Page_Load(object sender, EventArgs e) { string header = "Key"; - foreach (cms.businesslogic.language.Language lang in _languages) { - header += "" + lang.FriendlyName + ""; + foreach (var lang in _languages) { + header += "" + lang.CultureName + ""; } header += ""; @@ -43,7 +43,7 @@ namespace umbraco.presentation.settings { foreach (var lang in _languages) { lt_table.Text += ""; - var trans = di.Translations.FirstOrDefault(x => x.LanguageId == lang.id); + var trans = di.Translations.FirstOrDefault(x => x.LanguageId == lang.Id); if (trans == null || string.IsNullOrEmpty(trans.Value)) lt_table.Text += ""; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/DictionaryItemList.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/DictionaryItemList.aspx.designer.cs index d8d2688dcd..b314c8e7eb 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/DictionaryItemList.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/DictionaryItemList.aspx.designer.cs @@ -19,7 +19,7 @@ namespace umbraco.presentation.settings { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoPanel Panel1; + protected global::Umbraco.Web._Legacy.Controls.UmbracoPanel Panel1; /// /// pane1 control. @@ -28,7 +28,7 @@ namespace umbraco.presentation.settings { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane1; + protected global::Umbraco.Web._Legacy.Controls.Pane pane1; /// /// lt_table control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs index e7cb51a650..b8cbc0454d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs @@ -8,6 +8,7 @@ using Umbraco.Core.Models; using Umbraco.Core.Models.Membership; using Umbraco.Core.Services; using Umbraco.Web; +using Umbraco.Web.Composing; using Umbraco.Web.UI; namespace umbraco.settings @@ -19,7 +20,7 @@ namespace umbraco.settings public partial class EditDictionaryItem : Umbraco.Web.UI.Pages.UmbracoEnsuredPage { protected LiteralControl keyTxt = new LiteralControl(); - protected uicontrols.TabView tbv = new uicontrols.TabView(); + protected Umbraco.Web._Legacy.Controls.TabView tbv = new Umbraco.Web._Legacy.Controls.TabView(); private System.Collections.ArrayList languageFields = new System.Collections.ArrayList(); private IDictionaryItem currentItem; protected TextBox boxChangeKey; @@ -39,9 +40,9 @@ namespace umbraco.settings save.Click += save_Click; save.ToolTip = Services.TextService.Localize("save"); save.ID = "save"; - save.ButtonType = uicontrols.MenuButtonType.Primary; + save.ButtonType = Umbraco.Web._Legacy.Controls.MenuButtonType.Primary; - uicontrols.Pane p = new uicontrols.Pane(); + var p = new Umbraco.Web._Legacy.Controls.Pane(); boxChangeKey = new TextBox { @@ -68,21 +69,21 @@ namespace umbraco.settings txt.Text = "

" + Services.TextService.Localize("dictionaryItem/description", new[] { currentItem.ItemKey }) + "


"; p.addProperty(txt); - foreach (cms.businesslogic.language.Language l in cms.businesslogic.language.Language.getAll) + foreach (var l in Current.Services.LocalizationService.GetAllLanguages()) { TextBox languageBox = new TextBox(); languageBox.TextMode = TextBoxMode.MultiLine; - languageBox.ID = l.id.ToString(); + languageBox.ID = l.Id.ToString(); languageBox.CssClass = "umbEditorTextFieldMultiple"; if (!IsPostBack) { - languageBox.Text = currentItem.GetTranslatedValue(l.id); + languageBox.Text = currentItem.GetTranslatedValue(l.Id); } languageFields.Add(languageBox); - p.addProperty(l.FriendlyName, languageBox); + p.addProperty(l.CultureName, languageBox); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.designer.cs index 15921e7445..03448bce09 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.designer.cs @@ -19,6 +19,6 @@ namespace umbraco.settings { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoPanel Panel1; + protected global::Umbraco.Web._Legacy.Controls.UmbracoPanel Panel1; } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editLanguage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editLanguage.aspx.cs index 561165f6a9..9a20747e40 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editLanguage.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editLanguage.aspx.cs @@ -3,8 +3,10 @@ using System.Collections; using System.Globalization; using System.Web.UI.WebControls; using Umbraco.Core; +using Umbraco.Core.Models; using Umbraco.Core.Services; using Umbraco.Web; +using Umbraco.Web.Composing; using Umbraco.Web.UI; namespace umbraco.settings @@ -22,11 +24,13 @@ namespace umbraco.settings } protected System.Web.UI.WebControls.TextBox NameTxt; protected System.Web.UI.WebControls.Literal DisplayName; - cms.businesslogic.language.Language currentLanguage; + //cms.businesslogic.language.Language currentLanguage; + private ILanguage lang; protected void Page_Load(object sender, System.EventArgs e) { - currentLanguage = new cms.businesslogic.language.Language(int.Parse(Request.GetItemAsString("id"))); + //currentLanguage = new cms.businesslogic.language.Language(int.Parse(Request.GetItemAsString("id"))); + lang = Current.Services.LocalizationService.GetLanguageById(int.Parse(Request.GetItemAsString("id"))); // Put user code to initialize the page here @@ -55,17 +59,19 @@ namespace umbraco.settings while (ide.MoveNext()) { ListItem li = new ListItem(ide.Key.ToString().Substring(0, ide.Key.ToString().IndexOf("|||")), ide.Value.ToString()); - if (ide.Value.ToString() == currentLanguage.CultureAlias) + if (ide.Value.ToString() == lang.IsoCode) li.Selected = true; Cultures.Items.Add(li); } } - private void save_click(object sender, EventArgs e) + private void save_click(object sender, EventArgs e) { - currentLanguage.CultureAlias = Cultures.SelectedValue; - currentLanguage.Save(); + //currentLanguage.CultureAlias = Cultures.SelectedValue; + //currentLanguage.Save(); + lang.IsoCode = Cultures.SelectedValue; + Current.Services.LocalizationService.Save(lang); updateCultureList(); ClientTools.ShowSpeechBubble(SpeechBubbleIcon.Save, Services.TextService.Localize("speechBubbles/languageSaved"), ""); @@ -80,7 +86,7 @@ namespace umbraco.settings save.ToolTip = Services.TextService.Localize("save"); save.Text = Services.TextService.Localize("save"); save.ID = "save"; - save.ButtonType = uicontrols.MenuButtonType.Primary; + save.ButtonType = Umbraco.Web._Legacy.Controls.MenuButtonType.Primary; Panel1.Text = Services.TextService.Localize("language/editLanguage"); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editLanguage.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editLanguage.aspx.designer.cs index 4647664406..7abd800029 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editLanguage.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editLanguage.aspx.designer.cs @@ -19,7 +19,7 @@ namespace umbraco.settings { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoPanel Panel1; + protected global::Umbraco.Web._Legacy.Controls.UmbracoPanel Panel1; /// /// Pane7 control. @@ -28,7 +28,7 @@ namespace umbraco.settings { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane7; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane7; /// /// pp_language control. @@ -37,7 +37,7 @@ namespace umbraco.settings { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_language; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_language; /// /// Cultures control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs index 5847dc1bf5..e4f1fa516e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs @@ -8,9 +8,8 @@ using Umbraco.Core; using Umbraco.Core.Services; using Umbraco.Core.Configuration; using Umbraco.Core.IO; -using umbraco.cms.businesslogic.template; -using umbraco.uicontrols; -using Umbraco.Web; +using Umbraco.Core.Models; +using Umbraco.Web._Legacy.Controls; using Umbraco.Web.Composing; using Umbraco.Web.UI.Pages; @@ -21,7 +20,7 @@ namespace umbraco.cms.presentation.settings /// public partial class editTemplate : UmbracoEnsuredPage { - private Template _template; + private Umbraco.Core.Models.ITemplate _template; public MenuButton SaveButton; public editTemplate() @@ -49,28 +48,37 @@ namespace umbraco.cms.presentation.settings if (!IsPostBack) { MasterTemplate.Items.Add(new ListItem(Services.TextService.Localize("none"), "0")); - foreach (Template t in Template.GetAllAsList()) - { - if (t.Id != _template.Id) - { - var li = new ListItem(t.Text, t.Id.ToString()); - li.Attributes.Add("id", t.Alias.Replace(" ", "")); - MasterTemplate.Items.Add(li); - } - } + foreach (var t in Current.Services.FileService.GetTemplates()) + { + if (t.Id != _template.Id) + { + var text = t.Name; + if (text.StartsWith("#")) + { + var lang = Current.Services.LocalizationService.GetLanguageByIsoCode(System.Threading.Thread.CurrentThread.CurrentCulture.Name); + if (lang != null && Current.Services.LocalizationService.DictionaryItemExists(text.Substring(1))) + { + var di = Current.Services.LocalizationService.GetDictionaryItemByKey(text.Substring(1)); + text = di.GetTranslatedValue(lang.Id); + } + else + { + text = "[" + text + "]"; + } + } + var li = new ListItem(text, t.Id.ToString()); + li.Attributes.Add("id", t.Alias.Replace(" ", "")); + MasterTemplate.Items.Add(li); + } + } - NameTxt.Text = _template.GetRawText(); + NameTxt.Text = _template.Name; AliasTxt.Text = _template.Alias; - editorSource.Text = _template.Design; + editorSource.Text = _template.Content; - try - { - if (_template.MasterTemplate > 0) - MasterTemplate.SelectedValue = _template.MasterTemplate.ToString(); - } - catch (Exception ex) - { - } + var master = Current.Services.FileService.GetTemplate(_template.MasterTemplateAlias); + if (master != null) + MasterTemplate.SelectedValue = master.Id.ToString(); ClientTools .SetActiveTreeType(Constants.Trees.Templates) @@ -83,7 +91,7 @@ namespace umbraco.cms.presentation.settings protected override void OnInit(EventArgs e) { - _template = new Template(int.Parse(Request.QueryString["templateID"])); + _template = Current.Services.FileService.GetTemplate(int.Parse(Request.QueryString["templateID"])); // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // @@ -262,7 +270,7 @@ namespace umbraco.cms.presentation.settings /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.TabView Panel1; + protected global::Umbraco.Web._Legacy.Controls.TabView Panel1; /// /// Pane7 control. @@ -271,8 +279,8 @@ namespace umbraco.cms.presentation.settings /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane7; - protected global::umbraco.uicontrols.Pane Pane8; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane7; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane8; /// /// pp_name control. @@ -281,7 +289,7 @@ namespace umbraco.cms.presentation.settings /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_name; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_name; /// /// NameTxt control. @@ -299,7 +307,7 @@ namespace umbraco.cms.presentation.settings /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_alias; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_alias; /// /// AliasTxt control. @@ -317,7 +325,7 @@ namespace umbraco.cms.presentation.settings /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_masterTemplate; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_masterTemplate; /// /// MasterTemplate control. @@ -335,7 +343,7 @@ namespace umbraco.cms.presentation.settings /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_source; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_source; /// /// editorSource control. @@ -344,7 +352,7 @@ namespace umbraco.cms.presentation.settings /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.CodeArea editorSource; + protected global::Umbraco.Web._Legacy.Controls.CodeArea editorSource; /// /// rpt_codeTemplates control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/modals/ShowUmbracoTags.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/modals/ShowUmbracoTags.aspx.cs index 0938a1a377..3d23d12393 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/modals/ShowUmbracoTags.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/modals/ShowUmbracoTags.aspx.cs @@ -1,14 +1,4 @@ using System; -using System.Collections; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Web; -using System.Web.SessionState; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.HtmlControls; -using umbraco.BusinessLogic; using Umbraco.Core; namespace umbraco.cms.presentation.settings.modal @@ -38,6 +28,6 @@ namespace umbraco.cms.presentation.settings.modal /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected uicontrols.Pane Pane7; + protected Umbraco.Web._Legacy.Controls.Pane Pane7; } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs index 413da8a117..2d616cbe9e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Services; using Umbraco.Core.Configuration; using Umbraco.Core.IO; using umbraco.cms.presentation.Trees; -using umbraco.uicontrols; +using Umbraco.Web._Legacy.Controls; using Umbraco.Web; using Umbraco.Web.Composing; @@ -20,16 +20,16 @@ namespace umbraco.cms.presentation.settings.scripts } protected System.Web.UI.HtmlControls.HtmlForm Form1; - protected uicontrols.TabView Panel1; + protected Umbraco.Web._Legacy.Controls.TabView Panel1; protected System.Web.UI.WebControls.TextBox NameTxt; - protected uicontrols.Pane Pane7; - protected uicontrols.Pane Pane8; + protected Umbraco.Web._Legacy.Controls.Pane Pane7; + protected Umbraco.Web._Legacy.Controls.Pane Pane8; protected System.Web.UI.WebControls.Literal lttPath; protected System.Web.UI.WebControls.Literal editorJs; - protected umbraco.uicontrols.CodeArea editorSource; - protected umbraco.uicontrols.PropertyPanel pp_name; - protected umbraco.uicontrols.PropertyPanel pp_path; + protected Umbraco.Web._Legacy.Controls.CodeArea editorSource; + protected Umbraco.Web._Legacy.Controls.PropertyPanel pp_name; + protected Umbraco.Web._Legacy.Controls.PropertyPanel pp_path; protected MenuButton SaveButton; @@ -80,9 +80,9 @@ namespace umbraco.cms.presentation.settings.scripts //need to change the editor type if it is XML if (filename.EndsWith("xml")) - editorSource.CodeBase = uicontrols.CodeArea.EditorType.XML; + editorSource.CodeBase = Umbraco.Web._Legacy.Controls.CodeArea.EditorType.XML; else if (filename.EndsWith("master")) - editorSource.CodeBase = uicontrols.CodeArea.EditorType.HTML; + editorSource.CodeBase = Umbraco.Web._Legacy.Controls.CodeArea.EditorType.HTML; var editor = Panel1.NewTabPage(Services.TextService.Localize("settings/script")); @@ -98,17 +98,17 @@ namespace umbraco.cms.presentation.settings.scripts SaveButton.ID = "save"; SaveButton.CssClass = "client-side"; - if (editorSource.CodeBase == uicontrols.CodeArea.EditorType.HTML) + if (editorSource.CodeBase == Umbraco.Web._Legacy.Controls.CodeArea.EditorType.HTML) { // Editing buttons Panel1.Menu.InsertSplitter(); - uicontrols.MenuIconI umbField = Panel1.Menu.NewIcon(); + Umbraco.Web._Legacy.Controls.MenuIconI umbField = Panel1.Menu.NewIcon(); umbField.ImageURL = SystemDirectories.Umbraco + "/images/editor/insField.gif"; umbField.OnClickCommand = Umbraco.Web.UI.Pages.ClientTools.Scripts.OpenModalWindow(IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" + editorSource.ClientID + "&tagName=UMBRACOGETDATA", Services.TextService.Localize("template/insertPageField"), 640, 550); umbField.AltText = Services.TextService.Localize("template/insertPageField"); // TODO: Update icon - uicontrols.MenuIconI umbDictionary = Panel1.Menu.NewIcon(); + Umbraco.Web._Legacy.Controls.MenuIconI umbDictionary = Panel1.Menu.NewIcon(); umbDictionary.ImageURL = GlobalSettings.Path + "/images/editor/dictionaryItem.gif"; umbDictionary.OnClickCommand = Umbraco.Web.UI.Pages.ClientTools.Scripts.OpenModalWindow(IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" + editorSource.ClientID + "&tagName=UMBRACOGETDICTIONARY", Services.TextService.Localize("template/insertDictionaryItem"), 640, 550); umbDictionary.AltText = "Insert umbraco dictionary item"; @@ -116,7 +116,7 @@ namespace umbraco.cms.presentation.settings.scripts // Help Panel1.Menu.InsertSplitter(); - uicontrols.MenuIconI helpIcon = Panel1.Menu.NewIcon(); + Umbraco.Web._Legacy.Controls.MenuIconI helpIcon = Panel1.Menu.NewIcon(); helpIcon.OnClickCommand = Umbraco.Web.UI.Pages.ClientTools.Scripts.OpenModalWindow(Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco) + "/settings/modals/showumbracotags.aspx?alias=", Services.TextService.Localize("template/quickGuide"), 600, 580); helpIcon.ImageURL = SystemDirectories.Umbraco + "/images/editor/help.png"; helpIcon.AltText = Services.TextService.Localize("template/quickGuide"); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs index 9b2a5590ce..248cd8886f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs @@ -1,14 +1,9 @@ using Umbraco.Core.Services; using System; using System.IO; -using System.Linq; using System.Web.UI; -using Umbraco.Core.IO; -using Umbraco.Web; -using umbraco.BusinessLogic; -using umbraco.cms.businesslogic.web; using umbraco.cms.presentation.Trees; -using umbraco.uicontrols; +using Umbraco.Web._Legacy.Controls; using Umbraco.Core; using Umbraco.Web.UI.Pages; @@ -87,7 +82,7 @@ namespace umbraco.cms.presentation.settings.stylesheet /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.TabView Panel1; + protected global::Umbraco.Web._Legacy.Controls.TabView Panel1; /// /// Pane7 control. @@ -96,8 +91,8 @@ namespace umbraco.cms.presentation.settings.stylesheet /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane7; - protected global::umbraco.uicontrols.Pane Pane8; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane7; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane8; /// /// pp_name control. @@ -106,7 +101,7 @@ namespace umbraco.cms.presentation.settings.stylesheet /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_name; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_name; /// /// NameTxt control. @@ -124,7 +119,7 @@ namespace umbraco.cms.presentation.settings.stylesheet /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_path; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_path; /// /// lttPath control. @@ -142,7 +137,7 @@ namespace umbraco.cms.presentation.settings.stylesheet /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_source; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_source; /// /// editorSource control. @@ -151,7 +146,7 @@ namespace umbraco.cms.presentation.settings.stylesheet /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.CodeArea editorSource; + protected global::Umbraco.Web._Legacy.Controls.CodeArea editorSource; } } \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/property/EditStyleSheetProperty.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/property/EditStyleSheetProperty.aspx.cs index 2e95b585af..e1c3da39b8 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/property/EditStyleSheetProperty.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/property/EditStyleSheetProperty.aspx.cs @@ -46,7 +46,7 @@ namespace umbraco.cms.presentation.settings.stylesheet bt.Click += SaveClick; bt.Text = Services.TextService.Localize("save"); bt.ToolTip = Services.TextService.Localize("save"); - bt.ButtonType = uicontrols.MenuButtonType.Primary; + bt.ButtonType = Umbraco.Web._Legacy.Controls.MenuButtonType.Primary; bt.ID = "save"; } @@ -109,7 +109,7 @@ namespace umbraco.cms.presentation.settings.stylesheet /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoPanel Panel1; + protected global::Umbraco.Web._Legacy.Controls.UmbracoPanel Panel1; /// /// Pane7 control. @@ -118,7 +118,7 @@ namespace umbraco.cms.presentation.settings.stylesheet /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane Pane7; + protected global::Umbraco.Web._Legacy.Controls.Pane Pane7; protected global::System.Web.UI.WebControls.HiddenField OriginalName; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs index 63faa69d7f..06c09225e2 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs @@ -1,21 +1,13 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.IO; using System.Linq; using System.Text; using System.Web; -using System.Web.Caching; using System.Web.UI; using System.Xml; -using Umbraco.Core; -using Umbraco.Core.Cache; using Umbraco.Core.Macros; -using Umbraco.Web.PublishedCache.XmlPublishedCache; using Umbraco.Web.Templates; -using umbraco.cms.businesslogic; -using umbraco.cms.businesslogic.web; -using Umbraco.Web; using Umbraco.Web.Composing; namespace umbraco.presentation.templateControls diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs index be01ee51c1..1995cdb580 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs @@ -5,11 +5,10 @@ using System.Text; using System.Xml; using Umbraco.Core; using Umbraco.Core.Services; -using umbraco.cms.businesslogic.task; -//using umbraco.cms.businesslogic.utilities; using Umbraco.Core.IO; using System.Collections.Generic; using Umbraco.Web.UI.Pages; +using Umbraco.Web._Legacy.BusinessLogic; namespace umbraco.presentation.translation { @@ -61,8 +60,8 @@ namespace umbraco.presentation.translation DataRow task = tasks.NewRow(); task["Id"] = t.Id; task["Date"] = t.Date; - task["NodeId"] = t.Node.Id; - task["NodeName"] = t.Node.Text; + task["NodeId"] = t.TaskEntity.EntityId; + task["NodeName"] = t.TaskEntityEntity.Name; task["ReferingUser"] = t.ParentUser.Name; tasks.Rows.Add(task); } @@ -111,7 +110,7 @@ namespace umbraco.presentation.translation foreach (Task translation in ImportTranslatationFile(translationFileXml.FullName)) { - sb.Append("
  • " + translation.Node.Text + " " + Services.TextService.Localize("preview") + "
  • "); + sb.Append("
  • " + translation.TaskEntityEntity.Name + " " + Services.TextService.Localize("preview") + "
  • "); } } catch (Exception ee) @@ -120,12 +119,12 @@ namespace umbraco.presentation.translation } } - feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; + feedback.type = global::Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.success; feedback.Text = "

    " + Services.TextService.Localize("translation/MultipleTranslationDone") + "

    " + Services.TextService.Localize("translation/translationDoneHelp") + "

      " + sb.ToString() + "
    "; } catch (Exception ex) { - feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; + feedback.type = global::Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.error; feedback.Text = "

    " + Services.TextService.Localize("translation/translationFailed") + "

    " + ex.ToString() + ""; } } @@ -136,7 +135,7 @@ namespace umbraco.presentation.translation if (l.Count == 1) { - feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; + feedback.type = global::Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.success; feedback.Text = "

    " + Services.TextService.Localize("translation/translationDone") + "

    " + Services.TextService.Localize("translation/translationDoneHelp") + "

    " + Services.TextService.Localize("preview") + "

    "; } @@ -144,10 +143,10 @@ namespace umbraco.presentation.translation { foreach (Task t in l) { - sb.Append("
  • " + t.Node.Text + " " + Services.TextService.Localize("preview") + "
  • "); + sb.Append("
  • " + t.TaskEntityEntity.Name + " " + Services.TextService.Localize("preview") + "
  • "); } - feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; + feedback.type = global::Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.success; feedback.Text = "

    " + Services.TextService.Localize("translation/MultipleTranslationDone") + "

    " + Services.TextService.Localize("translation/translationDoneHelp") + "

      " + sb.ToString() + "
    "; } } @@ -181,7 +180,7 @@ namespace umbraco.presentation.translation if (t != null) { //user auth and content node validation - if (t.Node.Id == int.Parse(taskNode.Attributes.GetNamedItem("id").Value) && (t.User.Id == Security.CurrentUser.Id || t.ParentUser.Id == Security.CurrentUser.Id)) + if (t.TaskEntity.EntityId == int.Parse(taskNode.Attributes.GetNamedItem("id").Value) && (t.User.Id == Security.CurrentUser.Id || t.ParentUser.Id == Security.CurrentUser.Id)) { //TODO: Make this work again with correct APIs and angularized - so none of this code will exist anymore diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.designer.cs index 49ad42be0f..038b619259 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.designer.cs @@ -20,7 +20,7 @@ namespace umbraco.presentation.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoPanel Panel2; + protected global::Umbraco.Web._Legacy.Controls.UmbracoPanel Panel2; /// /// feedback control. @@ -29,7 +29,7 @@ namespace umbraco.presentation.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Feedback feedback; + protected global::Umbraco.Web._Legacy.Controls.Feedback feedback; /// /// pane_uploadFile control. @@ -38,7 +38,7 @@ namespace umbraco.presentation.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_uploadFile; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_uploadFile; /// /// translationFile control. @@ -65,7 +65,7 @@ namespace umbraco.presentation.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_tasks; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_tasks; /// /// lt_tasksHelp control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/details.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/details.aspx.cs index d3a0165056..bfc56a16fb 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/details.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/details.aspx.cs @@ -1,10 +1,10 @@ using System; using System.Data; using System.Web.UI.WebControls; -using umbraco.cms.businesslogic.task; -using umbraco.cms.businesslogic.web; using Umbraco.Core; using Umbraco.Core.Services; +using Umbraco.Web.Composing; +using Umbraco.Web._Legacy.BusinessLogic; namespace umbraco.presentation.umbraco.translation { public partial class details : Umbraco.Web.UI.Pages.UmbracoEnsuredPage { @@ -29,7 +29,8 @@ namespace umbraco.presentation.umbraco.translation { protected void Page_Load(object sender, EventArgs e) { int translationId = int.Parse(Request["id"]); Task t = new Task(translationId); - Document page = new Document(t.Node.Id); + //Document page = new Document(t.Node.Id); + var page = Current.Services.ContentService.GetById(t.TaskEntity.EntityId); //Bind meta data and language... Literal lt = new Literal(); @@ -83,7 +84,7 @@ namespace umbraco.presentation.umbraco.translation { DataRow pageRow = pageTable.NewRow(); pageRow[Services.TextService.Localize("name")] = Services.TextService.Localize("nodeName"); - pageRow[Services.TextService.Localize("value")] = page.Text; + pageRow[Services.TextService.Localize("value")] = page.Name; pageTable.Rows.Add(pageRow); //TODO: Make this work again with correct APIs and angularized - so none of this code will exist anymore diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/details.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/details.aspx.designer.cs index 52d09b7b07..e94d462516 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/details.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/details.aspx.designer.cs @@ -20,7 +20,7 @@ namespace umbraco.presentation.umbraco.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoPanel panel1; + protected global::Umbraco.Web._Legacy.Controls.UmbracoPanel panel1; /// /// pane_details control. @@ -29,7 +29,7 @@ namespace umbraco.presentation.umbraco.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_details; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_details; /// /// pp_date control. @@ -38,7 +38,7 @@ namespace umbraco.presentation.umbraco.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_date; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_date; /// /// pp_owner control. @@ -47,7 +47,7 @@ namespace umbraco.presentation.umbraco.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_owner; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_owner; /// /// pp_totalWords control. @@ -56,7 +56,7 @@ namespace umbraco.presentation.umbraco.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_totalWords; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_totalWords; /// /// pp_comment control. @@ -65,7 +65,7 @@ namespace umbraco.presentation.umbraco.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_comment; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_comment; /// /// pane_tasks control. @@ -74,7 +74,7 @@ namespace umbraco.presentation.umbraco.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_tasks; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_tasks; /// /// pp_xml control. @@ -83,7 +83,7 @@ namespace umbraco.presentation.umbraco.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_xml; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_xml; /// /// pp_upload control. @@ -92,7 +92,7 @@ namespace umbraco.presentation.umbraco.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_upload; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_upload; /// /// pp_closeTask control. @@ -101,7 +101,7 @@ namespace umbraco.presentation.umbraco.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_closeTask; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_closeTask; /// /// bt_close control. @@ -119,7 +119,7 @@ namespace umbraco.presentation.umbraco.translation { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pane_fields; + protected global::Umbraco.Web._Legacy.Controls.Pane pane_fields; /// /// dg_fields control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/preview.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/preview.aspx.cs index 9b2fc161e7..c1f370dab6 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/preview.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/preview.aspx.cs @@ -1,9 +1,8 @@ using System; using System.Linq; -using umbraco.cms.businesslogic.task; -using umbraco.cms.businesslogic.web; using Umbraco.Core; using Umbraco.Web; +using Umbraco.Web._Legacy.BusinessLogic; namespace umbraco.presentation.translation { @@ -23,16 +22,14 @@ namespace umbraco.presentation.translation var taskId = int.Parse(Request.GetItemAsString("id")); var t = new Task(taskId); - var translated = new Document(t.Node.Id); - translatedUrl = string.Format("../dialogs/preview.aspx?id={0}", translated.Id.ToString()); + translatedUrl = string.Format("../dialogs/preview.aspx?id={0}", t.TaskEntity.EntityId); - var orgRel = Services.RelationService.GetByParentOrChildId(t.Node.Id, "relateDocumentOnCopy").ToArray(); + var orgRel = Services.RelationService.GetByParentOrChildId(t.TaskEntity.EntityId, "relateDocumentOnCopy").ToArray(); if (orgRel.Length > 0) { - var original = new Document(orgRel[0].ParentId); - originalUrl = String.Format("../dialogs/preview.aspx?id={0}", original.Id.ToString()); + originalUrl = String.Format("../dialogs/preview.aspx?id={0}", orgRel[0].ParentId); } else { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs index 441d53f169..d6a1b2fbaf 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs @@ -1,23 +1,13 @@ using System; -using System.Data; -using System.Configuration; using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; - using System.Xml; -using System.Xml.Schema; using Umbraco.Core; using Umbraco.Core.Configuration; -using umbraco.BusinessLogic; -using umbraco.cms.businesslogic.task; -using umbraco.cms.businesslogic.web; using Umbraco.Core.IO; +using Umbraco.Core.Services; using Umbraco.Core.Xml; +using Umbraco.Web.Composing; +using Umbraco.Web._Legacy.BusinessLogic; namespace umbraco.presentation.translation { @@ -47,7 +37,7 @@ namespace umbraco.presentation.translation xmlContents.Text = root.OuterXml; - Response.AddHeader("Content-Disposition", "attachment; filename=" + t.Node.Text.Replace(" ", "_") + ".xml"); + Response.AddHeader("Content-Disposition", "attachment; filename=" + t.TaskEntityEntity.Name.Replace(" ", "_") + ".xml"); } } else @@ -57,11 +47,11 @@ namespace umbraco.presentation.translation foreach (Task t in Task.GetTasks(Security.CurrentUser, false)) { - if (!nodes.ContainsKey(t.Node.Path)) + if (!nodes.ContainsKey(t.TaskEntityEntity.Path)) { var xTask = CreateTaskNode(t, _xd); totalWords += int.Parse(xTask.Attributes.GetNamedItem("TotalWords").Value); - nodes.Add(t.Node.Path, xTask); + nodes.Add(t.TaskEntityEntity.Path, xTask); } } @@ -90,20 +80,26 @@ namespace umbraco.presentation.translation private XmlElement CreateTaskNode(Task t, XmlDocument xd) { - var d = new Document(t.Node.Id); - var x = d.ToPreviewXml(xd);// xd.CreateNode(XmlNodeType.Element, "node", ""); + //var d = new Document(t.Node.Id); + //var x = d.ToPreviewXml(xd);// xd.CreateNode(XmlNodeType.Element, "node", ""); + + var content = Current.Services.ContentService.GetById(t.TaskEntity.EntityId); + + var exs = new EntityXmlSerializer(); + var x = exs.Serialize(Current.Services.ContentService, Current.Services.DataTypeService, Current.Services.UserService, Current.UrlSegmentProviders, content); + var xTask = xd.CreateElement("task"); xTask.SetAttributeNode(XmlHelper.AddAttribute(xd, "Id", t.Id.ToString())); xTask.SetAttributeNode(XmlHelper.AddAttribute(xd, "Date", t.Date.ToString("s"))); - xTask.SetAttributeNode(XmlHelper.AddAttribute(xd, "NodeId", t.Node.Id.ToString())); + xTask.SetAttributeNode(XmlHelper.AddAttribute(xd, "NodeId", t.TaskEntity.EntityId.ToString())); //TODO: Make this work again with correct APIs and angularized - so none of this code will exist anymore //xTask.SetAttributeNode(XmlHelper.AddAttribute(xd, "TotalWords", cms.businesslogic.translation.Translation.CountWords(d.Id).ToString())); xTask.AppendChild(XmlHelper.AddCDataNode(xd, "Comment", t.Comment)); string protocol = GlobalSettings.UseSSL ? "https" : "http"; xTask.AppendChild(XmlHelper.AddTextNode(xd, "PreviewUrl", protocol + "://" + Request.ServerVariables["SERVER_NAME"] + SystemDirectories.Umbraco + "/translation/preview.aspx?id=" + t.Id.ToString())); // d.XmlPopulate(xd, ref x, false); - xTask.AppendChild(x); + xTask.AppendChild(x.ToXmlElement()); return xTask; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs index 7a5595d6e9..ffa044313d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs @@ -12,20 +12,16 @@ using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Web; using Umbraco.Web.Security; -using umbraco.BusinessLogic; using umbraco.controls; -using umbraco.uicontrols; -using umbraco.cms.presentation.Trees; using Umbraco.Core.IO; using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Models.Membership; using Umbraco.Web.UI; using Umbraco.Web.UI.Pages; -using System.Text.RegularExpressions; -using System.Text; using Umbraco.Core.Security; using Umbraco.Web.Composing; +using Umbraco.Web._Legacy.Controls; namespace umbraco.cms.presentation.user { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.designer.cs index ac1fddb9ec..a5849b71ab 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.designer.cs @@ -19,7 +19,7 @@ namespace umbraco.cms.presentation.user { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoPanel pnlUmbraco; + protected global::Umbraco.Web._Legacy.Controls.UmbracoPanel pnlUmbraco; /// /// pnl1 control. @@ -28,7 +28,7 @@ namespace umbraco.cms.presentation.user { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pnl1; + protected global::Umbraco.Web._Legacy.Controls.Pane pnl1; /// /// hidUserTypeID control. @@ -46,7 +46,7 @@ namespace umbraco.cms.presentation.user { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_name; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_name; /// /// txtUserTypeName control. @@ -64,7 +64,7 @@ namespace umbraco.cms.presentation.user { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_alias; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_alias; /// /// lblUserTypeAlias control. @@ -82,7 +82,7 @@ namespace umbraco.cms.presentation.user { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pnl2; + protected global::Umbraco.Web._Legacy.Controls.Pane pnl2; /// /// pp_rights control. @@ -91,7 +91,7 @@ namespace umbraco.cms.presentation.user { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.PropertyPanel pp_rights; + protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_rights; /// /// cbl_rights control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/NodePermissions.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/NodePermissions.ascx.cs index 66dfc8b466..90b41d6bfa 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/NodePermissions.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/NodePermissions.ascx.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; -using umbraco.BusinessLogic; + using Umbraco.Core.Models.Membership; -using Umbraco.Web; + using Umbraco.Web.UI.Controls; using Umbraco.Web._Legacy.Actions; using Action = Umbraco.Web._Legacy.Actions.Action; @@ -96,8 +96,11 @@ namespace umbraco.cms.presentation.user string names = ""; foreach (int id in m_nodeID) { - if(id > 0) - names += new cms.businesslogic.web.Document(id).Text + ", "; + if (id > 0) + { + var c = Services.ContentService.GetById(id); + names += c.Name + ", "; + } } lt_names.Text = names.Trim().Trim(','); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.cs index 4c564e2b95..9cada91e56 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.cs @@ -39,7 +39,7 @@ namespace umbraco.cms.presentation.user var save = pnlUmbraco.Menu.NewButton(); save.ID = "btnSave"; - save.ButtonType = uicontrols.MenuButtonType.Primary; + save.ButtonType = Umbraco.Web._Legacy.Controls.MenuButtonType.Primary; save.OnClientClick = "SavePermissions(); return false;"; save.Text = Services.TextService.Localize("save"); save.ToolTip = Services.TextService.Localize("save"); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.designer.cs index e0c1494dd4..00374a5562 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.designer.cs @@ -46,7 +46,7 @@ namespace umbraco.cms.presentation.user { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoPanel pnlUmbraco; + protected global::Umbraco.Web._Legacy.Controls.UmbracoPanel pnlUmbraco; /// /// pnl1 control. @@ -55,7 +55,7 @@ namespace umbraco.cms.presentation.user { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.Pane pnl1; + protected global::Umbraco.Web._Legacy.Controls.Pane pnl1; /// /// JTree control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionsHandler.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionsHandler.asmx.cs index 2e29214d16..70ef741aab 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionsHandler.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionsHandler.asmx.cs @@ -27,7 +27,7 @@ namespace umbraco.cms.presentation.user /// /// /// - [WebMethod] + [WebMethod] public string GetNodePermissions(int userID, string nodes) { AuthorizeRequest(true); @@ -40,7 +40,7 @@ namespace umbraco.cms.presentation.user nodePermissions.UserID = userID; nodePermissions.NodeID = toIntArray(nodes); nodePermissions.ID = "nodePermissions"; - + page.Controls.Add(nodePermissions); StringWriter sw = new StringWriter(); HttpContext.Current.Server.Execute(page, sw, false); @@ -48,7 +48,7 @@ namespace umbraco.cms.presentation.user } - + [WebMethod] public string SaveNodePermissions(int userID, string nodes, string permissions, bool replaceChild) @@ -61,7 +61,7 @@ namespace umbraco.cms.presentation.user return GetNodePermissions(userID, nodes); } - + private int[] toIntArray(string nodeIds) { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/UserPermissions.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/UserPermissions.cs index 4e6e032ece..732e12f548 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/UserPermissions.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/UserPermissions.cs @@ -1,9 +1,8 @@ using System.Collections.Generic; using System.Linq; -using Umbraco.Core; +using Umbraco.Core.Models; using Umbraco.Core.Services; using Umbraco.Web; -using umbraco.cms.businesslogic.web; using Umbraco.Core.Models.Membership; using Umbraco.Web.Composing; using Umbraco.Web._Legacy.Actions; @@ -106,13 +105,8 @@ namespace umbraco.cms.presentation.user /// private static string GetNodePath(int iNodeId) { - if (Document.IsDocument(iNodeId)) - { - var doc = new Document(iNodeId); - return doc.Path; - } - - return ""; + var e = Current.Services.EntityService.Get(iNodeId, UmbracoObjectTypes.Document); + return e == null ? string.Empty : e.Path; } /// @@ -122,15 +116,12 @@ namespace umbraco.cms.presentation.user /// private static IEnumerable FindChildNodes(int nodeId) { - var docs = Document.GetChildrenForTree(nodeId); + var docs = Current.Services.EntityService.GetChildren(nodeId, UmbracoObjectTypes.Document); var nodeIds = new List(); foreach (var doc in docs) { nodeIds.Add(doc.Id); - if (doc.HasChildren) - { - nodeIds.AddRange(FindChildNodes(doc.Id)); - } + nodeIds.AddRange(FindChildNodes(doc.Id)); } return nodeIds; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Developer.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Developer.asmx.cs index 127717b6ea..d73235b199 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Developer.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Developer.asmx.cs @@ -3,8 +3,6 @@ using System.Web.Services; using System.Xml; using Umbraco.Core; using Umbraco.Web.WebServices; -using umbraco.BusinessLogic; -using umbraco.presentation.webservices; using Umbraco.Core.Xml; namespace umbraco.webservices @@ -24,7 +22,7 @@ namespace umbraco.webservices { var xmlDoc = new XmlDocument(); var macros = xmlDoc.CreateElement("macros"); - foreach (var m in cms.businesslogic.macro.Macro.GetAll()) + foreach (var m in Services.MacroService.GetAll()) { var mXml = xmlDoc.CreateElement("macro"); mXml.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "id", m.Id.ToString(CultureInfo.InvariantCulture))); @@ -45,14 +43,14 @@ namespace umbraco.webservices { var xmlDoc = new XmlDocument(); var macro = xmlDoc.CreateElement("macro"); - var m = new cms.businesslogic.macro.Macro(Id); + var m = Services.MacroService.GetById(Id); //new cms.businesslogic.macro.Macro(Id); macro.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "id", m.Id.ToString(CultureInfo.InvariantCulture))); - macro.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "refreshRate", m.RefreshRate.ToString(CultureInfo.InvariantCulture))); + macro.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "refreshRate", m.CacheDuration.ToString(CultureInfo.InvariantCulture))); macro.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "useInEditor", m.UseInEditor.ToString())); macro.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "alias", m.Alias)); macro.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "name", m.Name)); - macro.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "type", m.Type)); - macro.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "xslt", m.Xslt)); + macro.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "type", m.ControlType)); + macro.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "xslt", m.XsltPath)); var properties = xmlDoc.CreateElement("properties"); foreach (var mp in m.Properties) { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/legacyAjaxCalls.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/legacyAjaxCalls.asmx.cs index 3634d351d9..a45af720e7 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/legacyAjaxCalls.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/legacyAjaxCalls.asmx.cs @@ -3,19 +3,13 @@ using System.Web; using System.Web.Services; using System.ComponentModel; using System.Web.Script.Services; -using System.IO; -using System.Text.RegularExpressions; using Umbraco.Core; -using Umbraco.Core.IO; using Umbraco.Web; using Umbraco.Web.WebServices; -using umbraco.cms.businesslogic.web; -using umbraco.cms.businesslogic.media; using Umbraco.Core.Models.Membership; -using Umbraco.Web.Macros; +using Umbraco.Web.Composing; using Umbraco.Web._Legacy.UI; - namespace umbraco.presentation.webservices { /// @@ -90,16 +84,18 @@ namespace umbraco.presentation.webservices case "mediaRecycleBin": //ensure user has access to media AuthorizeRequest(Constants.Applications.Media.ToString(), true); - - new Media(intNodeId).delete(true); + var media = Current.Services.MediaService.GetById(intNodeId); + if (media != null) + Current.Services.MediaService.Delete(media); break; case "content": case "contentRecycleBin": default: //ensure user has access to content AuthorizeRequest(Constants.Applications.Content.ToString(), true); - - new Document(intNodeId).delete(true); + var content = Current.Services.ContentService.GetById(intNodeId); + if (content != null) + Current.Services.ContentService.Delete(content); break; } } @@ -122,34 +118,6 @@ namespace umbraco.presentation.webservices Services.UserService.Save(user); } - [WebMethod] - [ScriptMethod] - public string GetNodeName(int nodeId) - { - - AuthorizeRequest(true); - - return new cms.businesslogic.CMSNode(nodeId).Text; - } - - [WebMethod] - [ScriptMethod] - public string[] GetNodeBreadcrumbs(int nodeId) - { - - AuthorizeRequest(true); - - var node = new cms.businesslogic.CMSNode(nodeId); - var crumbs = new System.Collections.Generic.List() { node.Text }; - while (node != null && node.Level > 1) - { - node = node.Parent; - crumbs.Add(node.Text); - } - crumbs.Reverse(); - return crumbs.ToArray(); - } - [WebMethod] [ScriptMethod] public string NiceUrl(int nodeId) @@ -168,248 +136,5 @@ namespace umbraco.presentation.webservices return Application[Context.Request.GetItemAsString("key")].ToString(); } - - [WebMethod] - [ScriptMethod] - public string TemplateMasterPageContentContainer(int templateId, int masterTemplateId) - { - AuthorizeRequest(Constants.Applications.Settings.ToString(), true); - return new cms.businesslogic.template.Template(templateId).GetMasterContentElement(masterTemplateId); - } - - [WebMethod] - [ScriptMethod] - public string SaveFile(string fileName, string fileAlias, string fileContents, string fileType, int fileID, int masterID, bool ignoreDebug) - { - switch (fileType) - { - case "xslt": - AuthorizeRequest(Constants.Applications.Developer.ToString(), true); - return SaveXslt(fileName, fileContents, ignoreDebug); - case "python": - AuthorizeRequest(Constants.Applications.Developer.ToString(), true); - return "true"; - case "css": - AuthorizeRequest(Constants.Applications.Settings.ToString(), true); - return SaveCss(fileName, fileContents, fileID); - case "script": - AuthorizeRequest(Constants.Applications.Settings.ToString(), true); - return SaveScript(fileName, fileContents); - case "template": - AuthorizeRequest(Constants.Applications.Settings.ToString(), true); - return SaveTemplate(fileName, fileAlias, fileContents, fileID, masterID); - default: - throw new ArgumentException(String.Format("Invalid fileType passed: '{0}'", fileType)); - } - - } - - private static string SaveCss(string fileName, string fileContents, int fileId) - { - string returnValue; - var stylesheet = new StyleSheet(fileId) - { - Content = fileContents, - Text = fileName - }; - - try - { - stylesheet.saveCssToFile(); - returnValue = "true"; - } - catch (Exception ee) - { - throw new Exception("Couldn't save file", ee); - } - - return returnValue; - } - - private string SaveXslt(string fileName, string fileContents, bool ignoreDebugging) - { - IOHelper.EnsurePathExists(SystemDirectories.Xslt); - - var tempFileName = IOHelper.MapPath(SystemDirectories.Xslt + "/" + System.DateTime.Now.Ticks + "_temp.xslt"); - using (var sw = File.CreateText(tempFileName)) - { - sw.Write(fileContents); - sw.Close(); - } - - // Test the xslt - var errorMessage = ""; - if (ignoreDebugging == false) - { - try - { - if (UmbracoContext.ContentCache.HasContent()) - XsltMacroEngine.TestXsltTransform(ProfilingLogger, fileContents); - - /* - // Check if there's any documents yet - if (content.Instance.XmlContent.SelectNodes("/root/node").Count > 0) - { - var macroXml = new XmlDocument(); - macroXml.LoadXml(""); - - var macroXslt = new XslCompiledTransform(); - var umbPage = new page(content.Instance.XmlContent.SelectSingleNode("//node [@parentID = -1]")); - - var xslArgs = macro.AddMacroXsltExtensions(); - var lib = new library(umbPage); - xslArgs.AddExtensionObject("urn:umbraco.library", lib); - HttpContext.Current.Trace.Write("umbracoMacro", "After adding extensions"); - - // Add the current node - xslArgs.AddParam("currentPage", "", library.GetXmlNodeById(umbPage.PageID.ToString())); - HttpContext.Current.Trace.Write("umbracoMacro", "Before performing transformation"); - - // Create reader and load XSL file - // We need to allow custom DTD's, useful for defining an ENTITY - var readerSettings = new XmlReaderSettings(); - readerSettings.ProhibitDtd = false; - using (var xmlReader = XmlReader.Create(tempFileName, readerSettings)) - { - var xslResolver = new XmlUrlResolver - { - Credentials = CredentialCache.DefaultCredentials - }; - macroXslt.Load(xmlReader, XsltSettings.TrustedXslt, xslResolver); - xmlReader.Close(); - // Try to execute the transformation - var macroResult = new HtmlTextWriter(new StringWriter()); - macroXslt.Transform(macroXml, xslArgs, macroResult); - macroResult.Close(); - } - } - */ - else - { - errorMessage = "stub"; - } - - } - catch (Exception errorXslt) - { - errorMessage = (errorXslt.InnerException ?? errorXslt).ToString(); - - // Full error message - errorMessage = errorMessage.Replace("\n", "
    \n"); - - // Find error - var m = Regex.Matches(errorMessage, @"\d*[^,],\d[^\)]", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); - foreach (Match mm in m) - { - var errorLine = mm.Value.Split(','); - - if (errorLine.Length > 0) - { - var theErrorLine = int.Parse(errorLine[0]); - var theErrorChar = int.Parse(errorLine[1]); - - errorMessage = "Error in XSLT at line " + errorLine[0] + ", char " + errorLine[1] + "
    "; - errorMessage += ""; - - var xsltText = fileContents.Split("\n".ToCharArray()); - for (var i = 0; i < xsltText.Length; i++) - { - if (i >= theErrorLine - 3 && i <= theErrorLine + 1) - if (i + 1 == theErrorLine) - { - errorMessage += "" + (i + 1) + ": >>>  " + Server.HtmlEncode(xsltText[i].Substring(0, theErrorChar)); - errorMessage += "" + Server.HtmlEncode(xsltText[i].Substring(theErrorChar, xsltText[i].Length - theErrorChar)).Trim() + ""; - errorMessage += " <<<
    "; - } - else - errorMessage += (i + 1) + ":      " + Server.HtmlEncode(xsltText[i]) + "
    "; - } - errorMessage += "
    "; - - } - } - } - - } - - - if (errorMessage == "" && fileName.ToLower().EndsWith(".xslt")) - { - //Hardcoded security-check... only allow saving files in xslt directory... - var savePath = IOHelper.MapPath(SystemDirectories.Xslt + "/" + fileName); - - if (savePath.StartsWith(IOHelper.MapPath(SystemDirectories.Xslt))) - { - using (var sw = File.CreateText(savePath)) - { - sw.Write(fileContents); - sw.Close(); - } - errorMessage = "true"; - } - else - { - errorMessage = "Illegal path"; - } - } - - File.Delete(tempFileName); - - return errorMessage; - } - - private static string SaveScript(string filename, string contents) - { - var val = contents; - string returnValue; - try - { - var savePath = IOHelper.MapPath(SystemDirectories.Scripts + "/" + filename); - - //Directory check.. only allow files in script dir and below to be edited - if (savePath.StartsWith(IOHelper.MapPath(SystemDirectories.Scripts + "/"))) - { - //ensure the folder exists before saving - Directory.CreateDirectory(Path.GetDirectoryName(savePath)); - - using (var sw = File.CreateText(IOHelper.MapPath(SystemDirectories.Scripts + "/" + filename))) - { - sw.Write(val); - sw.Close(); - returnValue = "true"; - } - - } - else - { - throw new ArgumentException("Couldnt save to file - Illegal path"); - } - } - catch (Exception ex) - { - throw new ArgumentException(String.Format("Couldnt save to file '{0}'", filename), ex); - } - - - return returnValue; - } - - private static string SaveTemplate(string templateName, string templateAlias, string templateContents, int templateID, int masterTemplateID) - { - var tp = new cms.businesslogic.template.Template(templateID); - var retVal = "false"; - - tp.Text = templateName; - tp.Alias = templateAlias; - tp.MasterTemplate = masterTemplateID; - tp.Design = templateContents; - - tp.Save(); - - retVal = "true"; - - return retVal; - } - } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx.cs index 41eec94fda..52bd4dadfa 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx.cs @@ -1,17 +1,9 @@ using System; -using System.Collections; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.Web; using System.Web.Services; -using System.Xml; using System.Web.Script.Services; using Umbraco.Core; using Umbraco.Core.IO; using Umbraco.Web.WebServices; -using umbraco.BusinessLogic; -using umbraco.presentation.webservices; namespace umbraco.webservices {