From 6f5689004dcee1d60cf1286522de6b308801ac92 Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Sat, 3 Nov 2012 05:48:23 +0600 Subject: [PATCH 01/14] Fixes: #U4-1113 --- src/Umbraco.Core/Configuration/GlobalSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index a91296c071..bc16642c23 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -100,7 +100,7 @@ namespace Umbraco.Core.Configuration get { return ConfigurationManager.AppSettings.ContainsKey("umbracoPath") - ? ConfigurationManager.AppSettings["umbracoPath"] + ? IOHelper.ResolveUrl(ConfigurationManager.AppSettings["umbracoPath"]) : string.Empty; } } From b337f4e5e490421d4a5398e85df0fc78f166fc4f Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Sat, 3 Nov 2012 07:18:12 +0600 Subject: [PATCH 02/14] Fixes issue with installing starter kits in the back office after upgrading the installer to install the starter kits properly. Not sure if this was actually working before 4.10 but in any case does work again now and installs them the correct way whilst waiting for the app pool to restart (we need to put this in place for the normal packages too!). Upgraded the StarterKits.aspx to have the correct code behind structure. Fixes issue with missing or invalid referenced images. --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 7 + .../Skinning/LoadStarterKits.ascx.designer.cs | 9 + .../steps/Skinning/loadStarterKitDesigns.ascx | 4 +- .../steps/Skinning/loadStarterKits.ascx | 5 +- .../developer/Packages/StarterKits.aspx | 50 ++++-- .../developer/Packages/StarterKits.aspx.cs | 11 ++ .../Packages/StarterKits.aspx.designer.cs | 15 ++ .../umbraco_client/Installer/css/all.css | 2 +- .../Installer/js/jquery.main.js | 5 +- src/Umbraco.Web/Umbraco.Web.csproj | 11 +- .../developer/Packages/StarterKits.aspx | 69 -------- .../developer/Packages/StarterKits.aspx.cs | 162 +++++++++++++----- .../Packages/StarterKits.aspx.designer.cs | 87 ---------- 13 files changed, 210 insertions(+), 227 deletions(-) create mode 100644 src/Umbraco.Web.UI/umbraco/developer/Packages/StarterKits.aspx.cs create mode 100644 src/Umbraco.Web.UI/umbraco/developer/Packages/StarterKits.aspx.designer.cs delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/StarterKits.aspx delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/StarterKits.aspx.designer.cs diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 19e5d15bfc..b3424a86ad 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -282,6 +282,13 @@ editMacro.aspx + + StarterKits.aspx + ASPXCodeBehind + + + StarterKits.aspx + ASPXCodeBehind diff --git a/src/Umbraco.Web.UI/install/steps/Skinning/LoadStarterKits.ascx.designer.cs b/src/Umbraco.Web.UI/install/steps/Skinning/LoadStarterKits.ascx.designer.cs index 45bce17cfb..f255e532ed 100644 --- a/src/Umbraco.Web.UI/install/steps/Skinning/LoadStarterKits.ascx.designer.cs +++ b/src/Umbraco.Web.UI/install/steps/Skinning/LoadStarterKits.ascx.designer.cs @@ -12,6 +12,15 @@ namespace Umbraco.Web.UI.Install.Steps.Skinning { public partial class LoadStarterKits { + /// + /// JsInclude1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; + /// /// LinkButton2 control. /// diff --git a/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx b/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx index 10957ef2f7..c475c273e3 100644 --- a/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx +++ b/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx @@ -26,8 +26,8 @@
  • - image description - image description + " alt="image description" width="152" height="129"> + " alt="image description" width="201" height="178">
    <%# ((Skin)Container.DataItem).Text %> diff --git a/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKits.ascx b/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKits.ascx index 5188bf77a6..898803deec 100644 --- a/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKits.ascx +++ b/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKits.ascx @@ -1,8 +1,11 @@ <%@ Control Language="C#" AutoEventWireup="True" CodeBehind="LoadStarterKits.ascx.cs" Inherits="Umbraco.Web.UI.Install.Steps.Skinning.LoadStarterKits" %> <%@ Import Namespace="umbraco.cms.businesslogic.packager.repositories" %> +<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> + + <% if (!CannotConnect) { %> - - - - - - - -

    Available skins

    -

    You can choose from the following skins.

    - -
    - - - - -

    Available starter kits

    -

    You can choose from the following starter kits, each having specific functionality.

    - -
    - - -

    Installation completed succesfully

    -
    -
    - - -
    \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/StarterKits.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/StarterKits.aspx.cs index d0fc0edf8c..e53e704762 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/StarterKits.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/StarterKits.aspx.cs @@ -9,63 +9,135 @@ using umbraco.IO; namespace umbraco.presentation.umbraco.developer.Packages { - public partial class StarterKits : UmbracoEnsuredPage - { - protected void Page_Load(object sender, EventArgs e) - { - if (!cms.businesslogic.skinning.Skinning.IsStarterKitInstalled()) - showStarterKits(); - else - showSkins((Guid)cms.businesslogic.skinning.Skinning.StarterKitGuid()); - } + public partial class StarterKits : UmbracoEnsuredPage + { + protected void Page_Load(object sender, EventArgs e) + { + if (!cms.businesslogic.skinning.Skinning.IsStarterKitInstalled()) + showStarterKits(); + else + showSkins((Guid)cms.businesslogic.skinning.Skinning.StarterKitGuid()); + } - private void showStarterKits() - { - install.steps.Skinning.loadStarterKits starterkitsctrl = - (install.steps.Skinning.loadStarterKits)new UserControl().LoadControl(SystemDirectories.Install + "/steps/Skinning/loadStarterKits.ascx"); - starterkitsctrl.StarterKitInstalled+=new install.steps.Skinning.StarterKitInstalledEventHandler(starterkitsctrl_StarterKitInstalled); - - ph_starterkits.Controls.Add(starterkitsctrl); + private void showStarterKits() + { + install.steps.Skinning.loadStarterKits starterkitsctrl = + (install.steps.Skinning.loadStarterKits)new UserControl().LoadControl(SystemDirectories.Install + "/steps/Skinning/loadStarterKits.ascx"); + starterkitsctrl.StarterKitInstalled += new install.steps.Skinning.StarterKitInstalledEventHandler(starterkitsctrl_StarterKitInstalled); - + ph_starterkits.Controls.Add(starterkitsctrl); - StarterKitNotInstalled.Visible = true; - StarterKitInstalled.Visible = false; - } - + StarterKitNotInstalled.Visible = true; + StarterKitInstalled.Visible = false; - public void showSkins(Guid starterKitGuid) - { + } - install.steps.Skinning.loadStarterKitDesigns ctrl = (install.steps.Skinning.loadStarterKitDesigns)new UserControl().LoadControl(SystemDirectories.Install + "/steps/Skinning/loadStarterKitDesigns.ascx"); - ctrl.ID = "StarterKitDesigns"; - ctrl.StarterKitGuid = starterKitGuid; - ctrl.StarterKitDesignInstalled += new install.steps.Skinning.StarterKitDesignInstalledEventHandler(ctrl_StarterKitDesignInstalled); - ph_skins.Controls.Add(ctrl); - StarterKitNotInstalled.Visible = false; - StarterKitInstalled.Visible = true; + public void showSkins(Guid starterKitGuid) + { - } + install.steps.Skinning.loadStarterKitDesigns ctrl = (install.steps.Skinning.loadStarterKitDesigns)new UserControl().LoadControl(SystemDirectories.Install + "/steps/Skinning/loadStarterKitDesigns.ascx"); + ctrl.ID = "StarterKitDesigns"; - void starterkitsctrl_StarterKitInstalled() - { - StarterKitNotInstalled.Visible = false; - StarterKitInstalled.Visible = false; + ctrl.StarterKitGuid = starterKitGuid; + ctrl.StarterKitDesignInstalled += new install.steps.Skinning.StarterKitDesignInstalledEventHandler(ctrl_StarterKitDesignInstalled); + ph_skins.Controls.Add(ctrl); - installationCompleted.Visible = true; - - } + StarterKitNotInstalled.Visible = false; + StarterKitInstalled.Visible = true; - void ctrl_StarterKitDesignInstalled() - { - StarterKitNotInstalled.Visible = false; - StarterKitInstalled.Visible = false; + } - installationCompleted.Visible = true; - } - } + void starterkitsctrl_StarterKitInstalled() + { + StarterKitNotInstalled.Visible = false; + StarterKitInstalled.Visible = false; + + installationCompleted.Visible = true; + + } + + void ctrl_StarterKitDesignInstalled() + { + StarterKitNotInstalled.Visible = false; + StarterKitInstalled.Visible = false; + + installationCompleted.Visible = true; + } + + /// + /// JsInclude1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; + + /// + /// Panel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.uicontrols.UmbracoPanel Panel1; + + /// + /// fb control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.uicontrols.Feedback fb; + + /// + /// StarterKitInstalled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.uicontrols.Pane StarterKitInstalled; + + /// + /// ph_skins control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder ph_skins; + + /// + /// StarterKitNotInstalled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.uicontrols.Pane StarterKitNotInstalled; + + /// + /// ph_starterkits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder ph_starterkits; + + /// + /// installationCompleted control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.uicontrols.Pane installationCompleted; + } } \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/StarterKits.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/StarterKits.aspx.designer.cs deleted file mode 100644 index 2b5787e1d5..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/StarterKits.aspx.designer.cs +++ /dev/null @@ -1,87 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace umbraco.presentation.umbraco.developer.Packages { - - - public partial class StarterKits { - - /// - /// JsInclude1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; - - /// - /// Panel1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.UmbracoPanel Panel1; - - /// - /// fb control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Feedback fb; - - /// - /// StarterKitInstalled control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Pane StarterKitInstalled; - - /// - /// ph_skins control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder ph_skins; - - /// - /// StarterKitNotInstalled control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Pane StarterKitNotInstalled; - - /// - /// ph_starterkits control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder ph_starterkits; - - /// - /// installationCompleted control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Pane installationCompleted; - } -} From e4d4aa935ace27ab315e339a5af67dbefaf9680e Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Sun, 4 Nov 2012 08:56:50 +0600 Subject: [PATCH 03/14] fixed attempt to initialize it's False property, changed IPublishedStore back to internal... was my mistake to make this public just yet. --- src/Umbraco.Core/Attempt.cs | 2 +- src/Umbraco.Web/IPublishedStore.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Core/Attempt.cs b/src/Umbraco.Core/Attempt.cs index 927f68d7a4..c184c5670a 100644 --- a/src/Umbraco.Core/Attempt.cs +++ b/src/Umbraco.Core/Attempt.cs @@ -41,7 +41,7 @@ namespace Umbraco.Core /// /// Represents an unsuccessful parse operation /// - public static readonly Attempt False; + public static readonly Attempt False = new Attempt(false, default(T)); /// /// Initializes a new instance of the struct. diff --git a/src/Umbraco.Web/IPublishedStore.cs b/src/Umbraco.Web/IPublishedStore.cs index 0eae294911..acc41a9d0a 100644 --- a/src/Umbraco.Web/IPublishedStore.cs +++ b/src/Umbraco.Web/IPublishedStore.cs @@ -6,7 +6,7 @@ namespace Umbraco.Web /// /// Defines the methods for published documents /// - public interface IPublishedStore + internal interface IPublishedStore { IPublishedContent GetDocumentById(UmbracoContext umbracoContext, int nodeId); IEnumerable GetRootDocuments(UmbracoContext umbracoContext); From a4a9b26d9399eba9938ab64c3c323cc9b935396a Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Sun, 4 Nov 2012 09:24:24 +0600 Subject: [PATCH 04/14] Committed first tests of strongly typed querying with strongly typed document types using what would be generated code and extension methods. --- .../StronglyTypedQueryTests.cs | 362 ++++++++++++++++++ src/Umbraco.Tests/Umbraco.Tests.csproj | 1 + src/Umbraco.Web/IPublishedStore.cs | 8 + 3 files changed, 371 insertions(+) create mode 100644 src/Umbraco.Tests/DynamicDocument/StronglyTypedQueryTests.cs diff --git a/src/Umbraco.Tests/DynamicDocument/StronglyTypedQueryTests.cs b/src/Umbraco.Tests/DynamicDocument/StronglyTypedQueryTests.cs new file mode 100644 index 0000000000..452086970b --- /dev/null +++ b/src/Umbraco.Tests/DynamicDocument/StronglyTypedQueryTests.cs @@ -0,0 +1,362 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using NUnit.Framework; +using Umbraco.Core; +using Umbraco.Core.Models; +using Umbraco.Tests.TestHelpers; +using Umbraco.Web; + +namespace Umbraco.Tests.DynamicDocument +{ + [TestFixture] + public class StronglyTypedQueryTests : BaseWebTest + { + protected override bool RequiresDbSetup + { + get { return false; } + } + + protected override string GetXmlContent(int templateId) + { + return @" + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + +"; + } + + internal IPublishedContent GetNode(int id) + { + var ctx = GetUmbracoContext("/test", 1234); + var contentStore = new DefaultPublishedContentStore(); + var doc = contentStore.GetDocumentById(ctx, id); + Assert.IsNotNull(doc); + return doc; + } + + [Test] + public void Type_Test() + { + var doc = GetNode(1); + var result = doc.NewsArticles(TraversalType.Descendants).ToArray(); + Assert.AreEqual("John doe", result[0].ArticleAuthor); + Assert.AreEqual("John Smith", result[1].ArticleAuthor); + } + + [Test] + public void As_Test() + { + var doc = GetNode(1); + var result = doc.AsHome(); + Assert.AreEqual("Test site", result.SiteName); + + Assert.Throws(() => doc.AsContentPage()); + } + + } + + //NOTE: Some of these class will be moved in to the core once all this is working the way we want + + #region Gen classes & supporting classes + + //TOOD: SD: This class could be the way that the UmbracoHelper deals with looking things up in the background, we might not + // even expose it publicly but it could handle any caching (per request) that might be required when looking up any objects... + // though we might not need it at all, not sure yet. + // However, what we need to do is implement the GetDocumentsByType method of the IPublishedStore, see the TODO there. + // It might be nicer to have a QueryContext on the UmbracoHelper (we can still keep the Content and TypedContent, etc... + // methods, but these would just wrap the QueryContext attached to it. Other methods on the QueryContext will be + // ContentByType, TypedContentByType, etc... then we can also have extension methods like below for strongly typed + // access like: GetAllHomes, GetAllNewsArticles, etc... + + //public class QueryDataContext + //{ + // private readonly IPublishedContentStore _contentStore; + // private readonly UmbracoContext _umbracoContext; + + // internal QueryDataContext(IPublishedContentStore contentStore, UmbracoContext umbracoContext) + // { + // _contentStore = contentStore; + // _umbracoContext = umbracoContext; + // } + + // public IPublishedContent GetDocumentById(int id) + // { + // return _contentStore.GetDocumentById(_umbracoContext, id); + // } + + // public IEnumerable GetByDocumentType(string alias) + // { + + // } + //} + + public enum TraversalType + { + Children, + Ancestors, + AncestorsOrSelf, + Descendants, + DescendantsOrSelf + } + + public static class StronglyTypedQueryExtensions + { + private static IEnumerable GetEnumerable(this IPublishedContent content, string docTypeAlias, TraversalType traversalType = TraversalType.Children) + { + switch (traversalType) + { + case TraversalType.Children: + return content.Children.Where(x => x.DocumentTypeAlias == docTypeAlias); + case TraversalType.Ancestors: + return content.Ancestors().Where(x => x.DocumentTypeAlias == docTypeAlias); + case TraversalType.AncestorsOrSelf: + return content.AncestorsOrSelf().Where(x => x.DocumentTypeAlias == docTypeAlias); + case TraversalType.Descendants: + return content.Descendants().Where(x => x.DocumentTypeAlias == docTypeAlias); + case TraversalType.DescendantsOrSelf: + return content.DescendantsOrSelf().Where(x => x.DocumentTypeAlias == docTypeAlias); + default: + throw new ArgumentOutOfRangeException("traversalType"); + } + } + + private static T AsDocumentType(this IPublishedContent content, string alias, Func creator) + { + if (content.DocumentTypeAlias == alias) return creator(content); + throw new InvalidOperationException("The content type cannot be cast to " + typeof(T).FullName + " since it is type: " + content.DocumentTypeAlias); + } + + public static HomeContentItem AsHome(this IPublishedContent content) + { + return content.AsDocumentType("Home", x => new HomeContentItem(x)); + } + + public static IEnumerable Homes(this IPublishedContent content, TraversalType traversalType = TraversalType.Children) + { + return content.GetEnumerable("Home", traversalType).Select(x => new HomeContentItem(x)); + } + + public static NewsArticleContentItem AsNewsArticle(this IPublishedContent content) + { + return content.AsDocumentType("NewsArticle", x => new NewsArticleContentItem(x)); + } + + public static IEnumerable NewsArticles(this IPublishedContent content, TraversalType traversalType = TraversalType.Children) + { + return content.GetEnumerable("NewsArticle", traversalType).Select(x => new NewsArticleContentItem(x)); + } + + public static NewsLandingPageContentItem AsNewsLandingPage(this IPublishedContent content) + { + return content.AsDocumentType("NewsLandingPage", x => new NewsLandingPageContentItem(x)); + } + + public static IEnumerable NewsLandingPages(this IPublishedContent content, TraversalType traversalType = TraversalType.Children) + { + return content.GetEnumerable("NewsLandingPage", traversalType).Select(x => new NewsLandingPageContentItem(x)); + } + + public static ContentPageContentItem AsContentPage(this IPublishedContent content) + { + return content.AsDocumentType("ContentPage", x => new ContentPageContentItem(x)); + } + + public static IEnumerable ContentPages(this IPublishedContent content, TraversalType traversalType = TraversalType.Children) + { + return content.GetEnumerable("ContentPage", traversalType).Select(x => new ContentPageContentItem(x)); + } + } + + public class PublishedContentWrapper : IPublishedContent + { + protected IPublishedContent WrappedContent { get; private set; } + + public PublishedContentWrapper(IPublishedContent content) + { + WrappedContent = content; + } + + public IPublishedContent Parent + { + get { return WrappedContent.Parent; } + } + + public int Id + { + get { return WrappedContent.Id; } + } + public int TemplateId + { + get { return WrappedContent.TemplateId; } + } + public int SortOrder + { + get { return WrappedContent.SortOrder; } + } + public string Name + { + get { return WrappedContent.Name; } + } + public string UrlName + { + get { return WrappedContent.UrlName; } + } + public string DocumentTypeAlias + { + get { return WrappedContent.DocumentTypeAlias; } + } + public int DocumentTypeId + { + get { return WrappedContent.DocumentTypeId; } + } + public string WriterName + { + get { return WrappedContent.WriterName; } + } + public string CreatorName + { + get { return WrappedContent.CreatorName; } + } + public int WriterId + { + get { return WrappedContent.WriterId; } + } + public int CreatorId + { + get { return WrappedContent.CreatorId; } + } + public string Path + { + get { return WrappedContent.Path; } + } + public DateTime CreateDate + { + get { return WrappedContent.CreateDate; } + } + public DateTime UpdateDate + { + get { return WrappedContent.UpdateDate; } + } + public Guid Version + { + get { return WrappedContent.Version; } + } + public int Level + { + get { return WrappedContent.Level; } + } + public Collection Properties + { + get { return WrappedContent.Properties; } + } + public IEnumerable Children + { + get { return WrappedContent.Children; } + } + public IPublishedContentProperty GetProperty(string alias) + { + return WrappedContent.GetProperty(alias); + } + } + + public partial class HomeContentItem : ContentPageContentItem + { + public HomeContentItem(IPublishedContent content) : base(content) + { + } + + public string SiteName + { + get { return WrappedContent.GetPropertyValue("siteName"); } + } + public string SiteDescription + { + get { return WrappedContent.GetPropertyValue("siteDescription"); } + } + } + + public partial class NewsLandingPageContentItem : ContentPageContentItem + { + public NewsLandingPageContentItem(IPublishedContent content) + : base(content) + { + } + + public string PageTitle + { + get { return WrappedContent.GetPropertyValue("pageTitle"); } + } + } + + public partial class NewsArticleContentItem : PublishedContentWrapper + { + public NewsArticleContentItem(IPublishedContent content) + : base(content) + { + } + + public string ArticleContent + { + get { return WrappedContent.GetPropertyValue("articleContent"); } + } + public DateTime ArticleDate + { + get { return WrappedContent.GetPropertyValue("articleDate"); } + } + public string ArticleAuthor + { + get { return WrappedContent.GetPropertyValue("articleAuthor"); } + } + } + + public partial class ContentPageContentItem : PublishedContentWrapper + { + public ContentPageContentItem(IPublishedContent content) + : base(content) + { + } + + public string BodyContent + { + get { return WrappedContent.GetPropertyValue("bodyContent"); } + } + } + + #endregion +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index b389798cf8..0f24401bad 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -57,6 +57,7 @@ + diff --git a/src/Umbraco.Web/IPublishedStore.cs b/src/Umbraco.Web/IPublishedStore.cs index acc41a9d0a..8fe73e5be4 100644 --- a/src/Umbraco.Web/IPublishedStore.cs +++ b/src/Umbraco.Web/IPublishedStore.cs @@ -10,5 +10,13 @@ namespace Umbraco.Web { IPublishedContent GetDocumentById(UmbracoContext umbracoContext, int nodeId); IEnumerable GetRootDocuments(UmbracoContext umbracoContext); + + //TODO: SD: We should make this happen! This will allow us to natively do a GetByDocumentType query + // on the UmbracoHelper (or an internal DataContext that it uses, etc...) + // One issue is that we need to make media work as fast as we can and need to create a ConvertFromMediaObject + // method in the DefaultPublishedMediaStore, there's already a TODO noting this but in order to do that we'll + // have to also use Examine as much as we can so we don't have to make db calls for looking up things like the + // node type alias, etc... in order to populate the created IPublishedContent object. + //IEnumerable GetDocumentsByType(string docTypeAlias); } } \ No newline at end of file From 292ded852ede6278e3d606217c636c6e4193a8dc Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Mon, 5 Nov 2012 06:04:40 +0600 Subject: [PATCH 05/14] Changed IPropertyEditorValueConverter to public #U4-1141 Changed the /umbraco folder in the UI project to be properly cased according to VS (this is initial, we need to do this for everything but need to write a script, see https://groups.google.com/forum/?pli=1#!topic/umbraco-dev/_KDTHpPPFM8 ) --- .../IPropertyEditorValueConverter.cs | 5 +- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 1352 ++++++++--------- 2 files changed, 677 insertions(+), 680 deletions(-) diff --git a/src/Umbraco.Core/PropertyEditors/IPropertyEditorValueConverter.cs b/src/Umbraco.Core/PropertyEditors/IPropertyEditorValueConverter.cs index 04b1f1a587..386a350e29 100644 --- a/src/Umbraco.Core/PropertyEditors/IPropertyEditorValueConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/IPropertyEditorValueConverter.cs @@ -3,11 +3,8 @@ using Umbraco.Core.Dynamics; namespace Umbraco.Core.PropertyEditors { - internal interface IPropertyEditorValueConverter + public interface IPropertyEditorValueConverter { - //TODO: SD: I thinnk this should only support propertyEditorId since I see no reason why we would want - // type converters specifically for docTypeAlias of property Alias! - // need to ask Gareth about his original intention. /// /// Returns true if this converter can perform the value conversion for the specified property editor id diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index b3424a86ad..90a03c9214 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -276,56 +276,56 @@ loadStarterKits.ascx - + ASPXCodeBehind - + editMacro.aspx - + StarterKits.aspx ASPXCodeBehind - + StarterKits.aspx - + ASPXCodeBehind - + umbracoDialog.Master - + ASPXCodeBehind - + umbracoPage.Master - + ASPXCodeBehind - + editTemplate.aspx - + EditView.aspx ASPXCodeBehind - + EditView.aspx - + treeInit.aspx ASPXCodeBehind - + treeInit.aspx - + umbraco.aspx ASPXCodeBehind - + Umbraco.aspx @@ -392,65 +392,65 @@ Dashboard.config - + UI.xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1219,18 +1219,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + @@ -1343,52 +1343,52 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1418,7 +1418,7 @@ - + @@ -1440,8 +1440,8 @@ - - + + @@ -1450,49 +1450,49 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - + + - - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + @@ -1516,25 +1516,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -1562,27 +1562,27 @@ - - - - - - - - - - + + + + + + + + + + - + - - - - - - - - + + + + + + + + @@ -1590,126 +1590,126 @@ - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UserControl @@ -1722,38 +1722,38 @@ UserControl - - - + + + Designer - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer @@ -1786,350 +1786,350 @@ Web.Template.config Designer - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + UserControl - - - + + + UserControl - - + + UserControl - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + Form - - + + Form - - + + Form - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + Form - - - - - - + + + + + + Form - - + + Form - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -2195,11 +2195,11 @@ - - - - - + + + + + Designer From 329431e6df73c3d9a6bc3d1654454c181c8ee449 Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Mon, 5 Nov 2012 06:14:44 +0600 Subject: [PATCH 06/14] Fixes: #U4-1141 - IPropertyEditorValueConverter is not a plugin type and is searched for on app startup. --- src/Umbraco.Core/CoreBootManager.cs | 11 +++++------ src/Umbraco.Core/PluginManager.cs | 10 ++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Core/CoreBootManager.cs b/src/Umbraco.Core/CoreBootManager.cs index d7d5b49838..98531f74ea 100644 --- a/src/Umbraco.Core/CoreBootManager.cs +++ b/src/Umbraco.Core/CoreBootManager.cs @@ -109,12 +109,11 @@ namespace Umbraco.Core PluginManager.Current.ResolveActions()); PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver( - new [] - { - typeof(DatePickerPropertyEditorValueConverter), - typeof(TinyMcePropertyEditorValueConverter), - typeof(YesNoPropertyEditorValueConverter) - }); + PluginManager.Current.ResolvePropertyEditorValueConverters()); + //add the internal ones, these are not public currently so need to add them manually + PropertyEditorValueConvertersResolver.Current.AddType(); + PropertyEditorValueConvertersResolver.Current.AddType(); + PropertyEditorValueConvertersResolver.Current.AddType(); } } } diff --git a/src/Umbraco.Core/PluginManager.cs b/src/Umbraco.Core/PluginManager.cs index 5523ecefc6..b01e7c0683 100644 --- a/src/Umbraco.Core/PluginManager.cs +++ b/src/Umbraco.Core/PluginManager.cs @@ -6,6 +6,7 @@ using System.Reflection; using System.Text; using System.Threading; using Umbraco.Core.Logging; +using Umbraco.Core.PropertyEditors; using umbraco.interfaces; namespace Umbraco.Core @@ -67,6 +68,15 @@ namespace Umbraco.Core return ResolveTypes(); } + /// + /// Returns all available IPropertyEditorValueConverter + /// + /// + internal IEnumerable ResolvePropertyEditorValueConverters() + { + return ResolveTypes(); + } + /// /// Returns all available IDataType in application /// From 7df992144121b0538b959b1ca3c2c105d209064a Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Mon, 5 Nov 2012 11:27:28 +0600 Subject: [PATCH 07/14] Fixes: #U4-1142, Changed ctor for RenderModel so people can actually create one to pass in to their views if they want. Changed the way that UmbracoTemplatePage works in that if you pass in an IPublishedContent model instead of a RenderModel, it will be generated for you without a YSOD. Changed the UmbracoHelper ctor so that it can be passed a custom IPublishedContent model so that it's context is of that model and not the one routed to. Added Umbraco.Web.Mvc to the imported namespaces for Views. --- src/Umbraco.Web.UI/Views/Web.config | 3 +- src/Umbraco.Web/Models/RenderModel.cs | 35 ++++++++++++++++++++-- src/Umbraco.Web/Mvc/RenderRouteHandler.cs | 6 +--- src/Umbraco.Web/Mvc/UmbracoTemplatePage.cs | 29 +++++++++++++++++- src/Umbraco.Web/Mvc/UmbracoViewPage.cs | 30 +++++++++++-------- src/Umbraco.Web/Mvc/web.config.template | 1 + src/Umbraco.Web/UmbracoHelper.cs | 18 ++++++++++- 7 files changed, 98 insertions(+), 24 deletions(-) diff --git a/src/Umbraco.Web.UI/Views/Web.config b/src/Umbraco.Web.UI/Views/Web.config index 4c69ffe7f4..5b163e5df2 100644 --- a/src/Umbraco.Web.UI/Views/Web.config +++ b/src/Umbraco.Web.UI/Views/Web.config @@ -19,7 +19,8 @@ - + + diff --git a/src/Umbraco.Web/Models/RenderModel.cs b/src/Umbraco.Web/Models/RenderModel.cs index aa06c747f3..f88bcf1ad5 100644 --- a/src/Umbraco.Web/Models/RenderModel.cs +++ b/src/Umbraco.Web/Models/RenderModel.cs @@ -1,3 +1,4 @@ +using System; using System.Globalization; using Umbraco.Core.Models; @@ -7,15 +8,43 @@ namespace Umbraco.Web.Models /// Represents the model for the current rendering page in Umbraco /// public class RenderModel - { + { + /// + /// Constructor specifying both the IPublishedContent and the CultureInfo + /// + /// + /// + public RenderModel(IPublishedContent content, CultureInfo culture) + { + if (content == null) throw new ArgumentNullException("content"); + if (culture == null) throw new ArgumentNullException("culture"); + Content = content; + CurrentCulture = culture; + } + + /// + /// Constructor to set the IPublishedContent and the CurrentCulture is set by the UmbracoContext + /// + /// + public RenderModel(IPublishedContent content) + { + if (content == null) throw new ArgumentNullException("content"); + if (UmbracoContext.Current == null) + { + throw new InvalidOperationException("Cannot construct a RenderModel without specifying a CultureInfo when no UmbracoContext has been initialized"); + } + Content = content; + CurrentCulture = UmbracoContext.Current.PublishedContentRequest.Culture; + } + /// /// Returns the current IPublishedContent object /// - public IPublishedContent Content { get; internal set; } + public IPublishedContent Content { get; private set; } /// /// Returns the current Culture assigned to the page being rendered /// - public CultureInfo CurrentCulture { get; internal set; } + public CultureInfo CurrentCulture { get; private set; } } } \ No newline at end of file diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs index e09de33820..30483cd022 100644 --- a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs @@ -66,11 +66,7 @@ namespace Umbraco.Web.Mvc throw new NullReferenceException("There is not current PublishedContentRequest, it must be initialized before the RenderRouteHandler executes"); } - var renderModel = new RenderModel() - { - Content = docRequest.PublishedContent, - CurrentCulture = docRequest.Culture - }; + var renderModel = new RenderModel(docRequest.PublishedContent, docRequest.Culture); //put essential data into the data tokens, the 'umbraco' key is required to be there for the view engine requestContext.RouteData.DataTokens.Add("umbraco", renderModel); //required for the RenderModelBinder diff --git a/src/Umbraco.Web/Mvc/UmbracoTemplatePage.cs b/src/Umbraco.Web/Mvc/UmbracoTemplatePage.cs index 1b390ca1e3..962fba50be 100644 --- a/src/Umbraco.Web/Mvc/UmbracoTemplatePage.cs +++ b/src/Umbraco.Web/Mvc/UmbracoTemplatePage.cs @@ -28,10 +28,37 @@ namespace Umbraco.Web.Mvc } } + protected override void SetViewData(System.Web.Mvc.ViewDataDictionary viewData) + { + //Here we're going to check if the viewData's model is of IPublishedContent, this is basically just a helper for + //syntax on the front-end so we can just pass in an IPublishedContent object to partial views that inherit from + //UmbracoTemplatePage. Then we're going to manually contruct a RenderViewModel to pass back in to SetViewData + if (viewData.Model is IPublishedContent) + { + //change the model to a RenderModel and auto set the culture + viewData.Model = new RenderModel((IPublishedContent)viewData.Model, UmbracoContext.PublishedContentRequest.Culture); + } + + base.SetViewData(viewData); + } + /// /// Returns the a DynamicPublishedContent object /// - public dynamic CurrentPage { get; private set; } + public dynamic CurrentPage { get; private set; } + + private UmbracoHelper _helper; + + /// + /// Gets an UmbracoHelper + /// + /// + /// This ensures that the UmbracoHelper is constructed with the content model of this view + /// + public override UmbracoHelper Umbraco + { + get { return _helper ?? (_helper = new UmbracoHelper(UmbracoContext, Model.Content)); } + } } } \ No newline at end of file diff --git a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs index 0f707b9051..ed3c18e181 100644 --- a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs +++ b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs @@ -13,36 +13,40 @@ namespace Umbraco.Web.Mvc { } - - protected override void InitializePage() - { - base.InitializePage(); - PublishedContentRequest = (PublishedContentRequest)ViewContext.RouteData.DataTokens.GetRequiredObject("umbraco-doc-request"); - UmbracoContext = (UmbracoContext)ViewContext.RouteData.DataTokens.GetRequiredObject("umbraco-context"); - ApplicationContext = UmbracoContext.Application; - } - + /// /// Returns the current UmbracoContext /// - public UmbracoContext UmbracoContext { get; private set; } + public UmbracoContext UmbracoContext + { + get { return (UmbracoContext) ViewContext.RouteData.DataTokens.GetRequiredObject("umbraco-context"); } + } /// /// Returns the current ApplicationContext /// - public ApplicationContext ApplicationContext { get; private set; } + public ApplicationContext ApplicationContext + { + get { return UmbracoContext.Application; } + } /// /// Returns the current PublishedContentRequest /// - internal PublishedContentRequest PublishedContentRequest { get; private set; } + internal PublishedContentRequest PublishedContentRequest + { + get { return (PublishedContentRequest)ViewContext.RouteData.DataTokens.GetRequiredObject("umbraco-doc-request"); } + } private UmbracoHelper _helper; /// /// Gets an UmbracoHelper /// - public UmbracoHelper Umbraco + /// + /// This constructs the UmbracoHelper with the content model of the page routed to + /// + public virtual UmbracoHelper Umbraco { get { return _helper ?? (_helper = new UmbracoHelper(UmbracoContext)); } } diff --git a/src/Umbraco.Web/Mvc/web.config.template b/src/Umbraco.Web/Mvc/web.config.template index 4c69ffe7f4..92e6cf94c1 100644 --- a/src/Umbraco.Web/Mvc/web.config.template +++ b/src/Umbraco.Web/Mvc/web.config.template @@ -19,6 +19,7 @@ + diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index 3033983783..2c96664a45 100644 --- a/src/Umbraco.Web/UmbracoHelper.cs +++ b/src/Umbraco.Web/UmbracoHelper.cs @@ -36,6 +36,22 @@ namespace Umbraco.Web private readonly UmbracoContext _umbracoContext; private readonly IPublishedContent _currentPage; + /// + /// Custom constructor setting the current page to the parameter passed in + /// + /// + /// + public UmbracoHelper(UmbracoContext umbracoContext, IPublishedContent content) + : this(umbracoContext) + { + if (content == null) throw new ArgumentNullException("content"); + _currentPage = content; + } + + /// + /// Standard constructor setting the current page to the page that has been routed to + /// + /// public UmbracoHelper(UmbracoContext umbracoContext) { if (umbracoContext == null) throw new ArgumentNullException("umbracoContext"); @@ -43,7 +59,7 @@ namespace Umbraco.Web _umbracoContext = umbracoContext; if (_umbracoContext.IsFrontEndUmbracoRequest) { - _currentPage = _umbracoContext.PublishedContentRequest.PublishedContent; + _currentPage = _umbracoContext.PublishedContentRequest.PublishedContent; } } From ff5c5c8a035755c5ed33468b973182a1b3b32e8d Mon Sep 17 00:00:00 2001 From: pgregorynz Date: Sun, 4 Nov 2012 21:24:04 -1000 Subject: [PATCH 08/14] Relates to bud U4-1142 Umbraco helper in wrong context with used in a Partial. Fix to context of Umbraco helper when used in partials. --- src/Umbraco.Web/UmbracoHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index 2c96664a45..8b928454a4 100644 --- a/src/Umbraco.Web/UmbracoHelper.cs +++ b/src/Umbraco.Web/UmbracoHelper.cs @@ -251,6 +251,7 @@ namespace Umbraco.Web var item = new Item() { + NodeId = currentPage.Id.ToString(), Field = fieldAlias, TextIfEmpty = altText, LegacyAttributes = attributesForItem From f8732cd70b7f4799fe8b51c817012d455d7dfc8f Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 5 Nov 2012 09:19:20 -0100 Subject: [PATCH 09/14] Removed the ExportCode dialog as it's not needed any more now that L2U is gone. --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 1 - .../umbraco/dialogs/ExportCode.aspx | 52 ------------------- 2 files changed, 53 deletions(-) delete mode 100644 src/Umbraco.Web.UI/umbraco/dialogs/ExportCode.aspx diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 90a03c9214..ca6128a99b 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -1531,7 +1531,6 @@ - diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/ExportCode.aspx b/src/Umbraco.Web.UI/umbraco/dialogs/ExportCode.aspx deleted file mode 100644 index 381a181c04..0000000000 --- a/src/Umbraco.Web.UI/umbraco/dialogs/ExportCode.aspx +++ /dev/null @@ -1,52 +0,0 @@ -<%@ Page Language="C#" MasterPageFile="../masterpages/umbracoDialog.Master" AutoEventWireup="true" - CodeBehind="ExportCode.aspx.cs" Inherits="umbraco.presentation.umbraco.dialogs.ExportCode" %> - -<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %> - - - - -

    - <%= - umbraco.ui.GetText("exportDocumentTypeAsCode-Full") - %> -

    - - Generation Mode: - - - - - - -
    - DataContext Name: - -
    -
    - Namespace: - -
    -
    - - - or - <%=umbraco.ui.Text("cancel")%> - - -

    - Don't forget to change the extensions to .cs! -

    - -
    - -
    -
    From 55ac779bf26b9c279954b9f10a20917a413aa709 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 5 Nov 2012 10:07:51 -0100 Subject: [PATCH 10/14] Changed the Chines language files to have a zh prefix in the key instead of en. Now the chinese translation files actually work. Fixed #U4-1126 --- .../umbraco_client/tinymce3/plugins/umbracocss/langs/zh.js | 2 +- .../umbraco_client/tinymce3/plugins/umbracocss/langs/zh_dlg.js | 2 +- .../umbraco_client/tinymce3/plugins/umbracoembed/langs/zh.js | 2 +- .../tinymce3/plugins/umbracoembed/langs/zh_dlg.js | 2 +- .../umbraco_client/tinymce3/plugins/umbracoimg/langs/zh_dlg.js | 2 +- .../umbraco_client/tinymce3/plugins/umbracolink/langs/zh_dlg.js | 2 +- .../umbraco_client/tinymce3/plugins/umbracomacro/langs/zh.js | 2 +- .../tinymce3/plugins/umbracomacro/langs/zh_dlg.js | 2 +- .../umbraco_client/tinymce3/themes/umbraco/langs/zh.js | 2 +- .../umbraco_client/tinymce3/themes/umbraco/langs/zh_dlg.js | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracocss/langs/zh.js b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracocss/langs/zh.js index 5e861809b0..cd9c36ea9b 100644 --- a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracocss/langs/zh.js +++ b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracocss/langs/zh.js @@ -1,3 +1,3 @@ -tinyMCE.addI18n('en.example',{ +tinyMCE.addI18n('zh.example',{ desc : '这是示例按钮' }); diff --git a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracocss/langs/zh_dlg.js b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracocss/langs/zh_dlg.js index 9f0c192848..db7ad925a0 100644 --- a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracocss/langs/zh_dlg.js +++ b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracocss/langs/zh_dlg.js @@ -1,3 +1,3 @@ -tinyMCE.addI18n('en.example_dlg',{ +tinyMCE.addI18n('zh.example_dlg',{ title : '这是示例标题' }); diff --git a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracoembed/langs/zh.js b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracoembed/langs/zh.js index 9c60a75052..ee41077410 100644 --- a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracoembed/langs/zh.js +++ b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracoembed/langs/zh.js @@ -1,4 +1,4 @@ -tinyMCE.addI18n('en.embed_dlg', { +tinyMCE.addI18n('zh.embed_dlg', { title: '嵌入第三方媒体', general: '普通', url: '链接:', diff --git a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracoembed/langs/zh_dlg.js b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracoembed/langs/zh_dlg.js index b72f4c72fe..2e59f0be58 100644 --- a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracoembed/langs/zh_dlg.js +++ b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracoembed/langs/zh_dlg.js @@ -1,4 +1,4 @@ -tinyMCE.addI18n('en.embed_dlg', { +tinyMCE.addI18n('zh.embed_dlg', { title: '嵌入第三方媒体', general: '普通', url: '链接:', diff --git a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracoimg/langs/zh_dlg.js b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracoimg/langs/zh_dlg.js index df1beb23ff..449c6df44d 100644 --- a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracoimg/langs/zh_dlg.js +++ b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracoimg/langs/zh_dlg.js @@ -1,4 +1,4 @@ -tinyMCE.addI18n('en.umbimage_dlg', { +tinyMCE.addI18n('zh.umbimage_dlg', { tab_general: '普通', tab_appearance: '外观', tab_advanced: '高级', diff --git a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracolink/langs/zh_dlg.js b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracolink/langs/zh_dlg.js index 7d5931a368..bec669b5f2 100644 --- a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracolink/langs/zh_dlg.js +++ b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracolink/langs/zh_dlg.js @@ -1 +1 @@ -tinyMCE.addI18n('en.advlink_dlg', { "target_name": "目标名称", classes: "类", style: "样式", id: "ID", "popup_position": "位置 (X/Y)", langdir: "语言书写方向", "popup_size": "尺寸", "popup_dependent": "依赖 (仅限Mozilla/Firefox)", "popup_resizable": "窗口大小可调", "popup_location": "显示地址栏", "popup_menubar": "显示菜单栏", "popup_toolbar": "显示工具栏", "popup_statusbar": "显示状态栏", "popup_scrollbars": "显示滚动条", "popup_return": "插入 \'return false\'", "popup_name": "窗口名称", "popup_url": "URL", popup: "JavaScript 弹出窗口", "target_blank": "在新窗口中打开", "target_top": "在顶部位置打开(替换掉所有Frames)", "target_parent": "在父级窗口或位置中打开", "target_same": "在该窗口或位置打开", "anchor_names": "锚点", "popup_opts": "选项", "advanced_props": "高级属性", "event_props": "事件", "popup_props": "弹窗属性", "general_props": "普通属性", "advanced_tab": "高级", "events_tab": "事件", "popup_tab": "弹窗", "general_tab": "普通", list: "链接列表", "is_external": "您输入的好像是外部链接,您是否想在前面添加http://?", "is_email": "您输入的好像是邮箱地址,您是否想在前面添加mailto:?", titlefield: "标题", target: "目标", url: "链接URL", title: "插入/编辑链接", "link_list": "链接列表", rtl: "从右到左", ltr: "从左到右", accesskey: "访问键", tabindex: "Tab索引", rev: "目标至页面关系", rel: "页面至目标关系", mime: "目标MIME类型", encoding: "目标语言编码", langcode: "语言代码", "target_langcode": "目标语言", width: "宽", height: "高" }); \ No newline at end of file +tinyMCE.addI18n('zh.advlink_dlg', { "target_name": "目标名称", classes: "类", style: "样式", id: "ID", "popup_position": "位置 (X/Y)", langdir: "语言书写方向", "popup_size": "尺寸", "popup_dependent": "依赖 (仅限Mozilla/Firefox)", "popup_resizable": "窗口大小可调", "popup_location": "显示地址栏", "popup_menubar": "显示菜单栏", "popup_toolbar": "显示工具栏", "popup_statusbar": "显示状态栏", "popup_scrollbars": "显示滚动条", "popup_return": "插入 \'return false\'", "popup_name": "窗口名称", "popup_url": "URL", popup: "JavaScript 弹出窗口", "target_blank": "在新窗口中打开", "target_top": "在顶部位置打开(替换掉所有Frames)", "target_parent": "在父级窗口或位置中打开", "target_same": "在该窗口或位置打开", "anchor_names": "锚点", "popup_opts": "选项", "advanced_props": "高级属性", "event_props": "事件", "popup_props": "弹窗属性", "general_props": "普通属性", "advanced_tab": "高级", "events_tab": "事件", "popup_tab": "弹窗", "general_tab": "普通", list: "链接列表", "is_external": "您输入的好像是外部链接,您是否想在前面添加http://?", "is_email": "您输入的好像是邮箱地址,您是否想在前面添加mailto:?", titlefield: "标题", target: "目标", url: "链接URL", title: "插入/编辑链接", "link_list": "链接列表", rtl: "从右到左", ltr: "从左到右", accesskey: "访问键", tabindex: "Tab索引", rev: "目标至页面关系", rel: "页面至目标关系", mime: "目标MIME类型", encoding: "目标语言编码", langcode: "语言代码", "target_langcode": "目标语言", width: "宽", height: "高" }); \ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracomacro/langs/zh.js b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracomacro/langs/zh.js index d2cd1a9531..f2edf9598f 100644 --- a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracomacro/langs/zh.js +++ b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracomacro/langs/zh.js @@ -1,3 +1,3 @@ -tinyMCE.addI18n('en.umbracomacro',{ +tinyMCE.addI18n('zh.umbracomacro',{ desc : '插入宏' }); diff --git a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracomacro/langs/zh_dlg.js b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracomacro/langs/zh_dlg.js index 9f0c192848..db7ad925a0 100644 --- a/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracomacro/langs/zh_dlg.js +++ b/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracomacro/langs/zh_dlg.js @@ -1,3 +1,3 @@ -tinyMCE.addI18n('en.example_dlg',{ +tinyMCE.addI18n('zh.example_dlg',{ title : '这是示例标题' }); diff --git a/src/Umbraco.Web.UI/umbraco_client/tinymce3/themes/umbraco/langs/zh.js b/src/Umbraco.Web.UI/umbraco_client/tinymce3/themes/umbraco/langs/zh.js index c7a7f22e55..e144e9d901 100644 --- a/src/Umbraco.Web.UI/umbraco_client/tinymce3/themes/umbraco/langs/zh.js +++ b/src/Umbraco.Web.UI/umbraco_client/tinymce3/themes/umbraco/langs/zh.js @@ -1,4 +1,4 @@ -tinyMCE.addI18n('en.umbraco',{"underline_desc":"» (Ctrl+U)", +tinyMCE.addI18n('zh.umbraco',{"underline_desc":"» (Ctrl+U)", "italic_desc":"б (Ctrl+I)", "bold_desc":" (Ctrl+B)", dd:"", diff --git a/src/Umbraco.Web.UI/umbraco_client/tinymce3/themes/umbraco/langs/zh_dlg.js b/src/Umbraco.Web.UI/umbraco_client/tinymce3/themes/umbraco/langs/zh_dlg.js index b5a70adac7..aa2ba0738e 100644 --- a/src/Umbraco.Web.UI/umbraco_client/tinymce3/themes/umbraco/langs/zh_dlg.js +++ b/src/Umbraco.Web.UI/umbraco_client/tinymce3/themes/umbraco/langs/zh_dlg.js @@ -1,4 +1,4 @@ -tinyMCE.addI18n('en.umbraco_dlg', {"link_list":"б", +tinyMCE.addI18n('zh.umbraco_dlg', {"link_list":"б", "link_is_external":"ĺⲿӣǷҪǰ http://", "link_is_email":"ĺַǷҪǰmailto:", "link_titlefield":"", From f80fa2f373e305ad37d4f6290ce431903601b031 Mon Sep 17 00:00:00 2001 From: Matt Watson Date: Wed, 31 Oct 2012 21:51:17 +0000 Subject: [PATCH 11/14] Datatype Tags, multiple render when multiple instance on same doctype Fixed #U4-915 --- src/umbraco.editorControls/tags/DataEditor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/umbraco.editorControls/tags/DataEditor.cs b/src/umbraco.editorControls/tags/DataEditor.cs index a6bd91ceaf..ab80d352c4 100644 --- a/src/umbraco.editorControls/tags/DataEditor.cs +++ b/src/umbraco.editorControls/tags/DataEditor.cs @@ -126,7 +126,7 @@ namespace umbraco.editorControls.tags this.ContentTemplateContainer.Controls.Add(tagBox); string tagsAutoCompleteScript = - "jQuery('.umbTagBox').tagsInput({ width: '400px', defaultText: 'Add a tag', minChars: 2, autocomplete_url: '" + + "jQuery('#" + tagBox.ClientID + "').tagsInput({ width: '400px', defaultText: 'Add a tag', minChars: 2, autocomplete_url: '" + umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/webservices/TagsAutoCompleteHandler.ashx?group=" + _group + "&id=" + pageId + "&rnd=" + DateTime.Now.Ticks + "&format=json' });"; From fb0c9c3fbb6b0c50d47618af4be38c2ab90b8dca Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Tue, 6 Nov 2012 08:32:21 +0600 Subject: [PATCH 12/14] Changed DynamicXml to public (somehow this wasn't checked in before) #U4-U4-1146 Added unit tests for DynamicXml.Find methods which are passing. --- src/Umbraco.Core/Dynamics/DynamicXml.cs | 2 +- .../DynamicDocument/DynamicXmlTests.cs | 58 +++++++++++++++++++ src/Umbraco.Tests/Umbraco.Tests.csproj | 1 + 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 src/Umbraco.Tests/DynamicDocument/DynamicXmlTests.cs diff --git a/src/Umbraco.Core/Dynamics/DynamicXml.cs b/src/Umbraco.Core/Dynamics/DynamicXml.cs index 53db732bea..0cfc13e58c 100644 --- a/src/Umbraco.Core/Dynamics/DynamicXml.cs +++ b/src/Umbraco.Core/Dynamics/DynamicXml.cs @@ -10,7 +10,7 @@ using System.Web; namespace Umbraco.Core.Dynamics { - internal class DynamicXml : DynamicObject, IEnumerable + public class DynamicXml : DynamicObject, IEnumerable { public XElement BaseElement { get; set; } diff --git a/src/Umbraco.Tests/DynamicDocument/DynamicXmlTests.cs b/src/Umbraco.Tests/DynamicDocument/DynamicXmlTests.cs new file mode 100644 index 0000000000..b302f27979 --- /dev/null +++ b/src/Umbraco.Tests/DynamicDocument/DynamicXmlTests.cs @@ -0,0 +1,58 @@ +using System; +using System.Xml; +using System.Xml.Linq; +using Microsoft.CSharp.RuntimeBinder; +using NUnit.Framework; +using Umbraco.Core.Dynamics; + +namespace Umbraco.Tests.DynamicDocument +{ + [TestFixture] + public class DynamicXmlTests + { + + /// + /// Test the current Core class + /// + [Test] + public void Find_Test_Core_Class() + { + RunFindTest(x => new DynamicXml(x)); + } + + /// + /// Tests the macroEngines legacy class + /// + [Test] + public void Find_Test_Legacy_Class() + { + RunFindTest(x => new global::umbraco.MacroEngines.DynamicXml(x)); + } + + private void RunFindTest(Func getDynamicXml) + { + var xmlstring = @" + + + +"; + + dynamic dXml = getDynamicXml(xmlstring); + + var result1 = dXml.Find("@name", "test 1"); + var result2 = dXml.Find("@name", "test 2"); + var result3 = dXml.Find("@name", "test 3"); + var result4 = dXml.Find("@name", "dont find"); + + Assert.AreEqual("found 1", result1.value); + Assert.AreEqual("found 2", result2.value); + Assert.AreEqual("found 3", result3.value); + Assert.Throws(() => + { + //this will throw because result4 is not found + var temp = result4.value; + }); + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 0f24401bad..df5601255e 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -55,6 +55,7 @@ + From 315e8b27a0cd13a608b216869b9189e4e4fd7e46 Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Tue, 6 Nov 2012 09:14:39 +0600 Subject: [PATCH 13/14] Migrated loadStarterKitDesigns to use the new codebehind structure. --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 7 + .../steps/Skinning/loadStarterKitDesigns.ascx | 2 +- .../Skinning/loadStarterKitDesigns.ascx.cs | 12 + .../loadStarterKitDesigns.ascx.designer.cs | 15 + src/Umbraco.Web/Umbraco.Web.csproj | 11 +- .../steps/Skinning/loadStarterKitDesigns.ascx | 69 ----- .../Skinning/loadStarterKitDesigns.ascx.cs | 293 ++++++++++-------- .../loadStarterKitDesigns.ascx.designer.cs | 42 --- 8 files changed, 198 insertions(+), 253 deletions(-) create mode 100644 src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx.cs create mode 100644 src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx.designer.cs delete mode 100644 src/Umbraco.Web/umbraco.presentation/install/steps/Skinning/loadStarterKitDesigns.ascx delete mode 100644 src/Umbraco.Web/umbraco.presentation/install/steps/Skinning/loadStarterKitDesigns.ascx.designer.cs diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index ca6128a99b..aa0fcb0968 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -269,6 +269,13 @@ default.aspx + + loadStarterKitDesigns.ascx + ASPXCodeBehind + + + loadStarterKitDesigns.ascx + ASPXCodeBehind diff --git a/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx b/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx index c475c273e3..864aeb5082 100644 --- a/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx +++ b/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx @@ -1,4 +1,4 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="loadStarterKitDesigns.ascx.cs" Inherits="umbraco.presentation.install.steps.Skinning.loadStarterKitDesigns" %> +<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="LoadStarterKitDesigns.ascx.cs" Inherits="Umbraco.Web.UI.Install.Steps.Skinning.LoadStarterKitDesigns" %> <%@ Import Namespace="umbraco.cms.businesslogic.packager.repositories" %> diff --git a/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx.cs b/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx.cs new file mode 100644 index 0000000000..dc992a5393 --- /dev/null +++ b/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using umbraco.presentation.install.steps.Skinning; + +namespace Umbraco.Web.UI.Install.Steps.Skinning +{ + public partial class LoadStarterKitDesigns : loadStarterKitDesigns + { + } +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx.designer.cs b/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx.designer.cs new file mode 100644 index 0000000000..308600663c --- /dev/null +++ b/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx.designer.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Umbraco.Web.UI.Install.Steps.Skinning { + + + public partial class LoadStarterKitDesigns { + } +} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 02156551bc..0de8cb2b22 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -319,6 +319,9 @@ ASPXCodeBehind + + ASPXCodeBehind + ASPXCodeBehind @@ -430,13 +433,6 @@ skinning.ascx - - loadStarterKitDesigns.ascx - ASPXCodeBehind - - - loadStarterKitDesigns.ascx - @@ -1841,7 +1837,6 @@
    - ASPXCodeBehind diff --git a/src/Umbraco.Web/umbraco.presentation/install/steps/Skinning/loadStarterKitDesigns.ascx b/src/Umbraco.Web/umbraco.presentation/install/steps/Skinning/loadStarterKitDesigns.ascx deleted file mode 100644 index 10957ef2f7..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/install/steps/Skinning/loadStarterKitDesigns.ascx +++ /dev/null @@ -1,69 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="loadStarterKitDesigns.ascx.cs" Inherits="umbraco.presentation.install.steps.Skinning.loadStarterKitDesigns" %> -<%@ Import Namespace="umbraco.cms.businesslogic.packager.repositories" %> - - - -

    Starter kit and skin have been installed

    - -
    - -
    - - - - - - -
    - -
    \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/install/steps/Skinning/loadStarterKitDesigns.ascx.cs b/src/Umbraco.Web/umbraco.presentation/install/steps/Skinning/loadStarterKitDesigns.ascx.cs index ec3c221457..f927950843 100644 --- a/src/Umbraco.Web/umbraco.presentation/install/steps/Skinning/loadStarterKitDesigns.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/install/steps/Skinning/loadStarterKitDesigns.ascx.cs @@ -8,152 +8,179 @@ using umbraco.BusinessLogic; namespace umbraco.presentation.install.steps.Skinning { - public delegate void StarterKitDesignInstalledEventHandler(); + public delegate void StarterKitDesignInstalledEventHandler(); - public partial class loadStarterKitDesigns : System.Web.UI.UserControl - { + public partial class loadStarterKitDesigns : System.Web.UI.UserControl + { - public event StarterKitDesignInstalledEventHandler StarterKitDesignInstalled; + public event StarterKitDesignInstalledEventHandler StarterKitDesignInstalled; - protected virtual void OnStarterKitDesignInstalled() - { - if (StarterKitDesignInstalled != null) - StarterKitDesignInstalled(); - } + protected virtual void OnStarterKitDesignInstalled() + { + if (StarterKitDesignInstalled != null) + StarterKitDesignInstalled(); + } - public Guid StarterKitGuid { get; set; } + public Guid StarterKitGuid { get; set; } - private cms.businesslogic.packager.repositories.Repository repo; - private string repoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66"; + private cms.businesslogic.packager.repositories.Repository repo; + private string repoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66"; - public loadStarterKitDesigns() - { - repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid); - } + public loadStarterKitDesigns() + { + repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid); + } - protected void Page_Load(object sender, EventArgs e) - { + protected void Page_Load(object sender, EventArgs e) + { - } - - - - protected override void OnInit(EventArgs e) - { - base.OnInit(e); - - if (repo.HasConnection()) - { - try - { - //clear progress bar cache - Helper.clearProgress(); - - var skinsCollection = repo.Webservice.Skins(StarterKitGuid.ToString()); - - var numberOfSkins = skinsCollection.Length; - this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "skinCounter", "var numberOfSkins = " + numberOfSkins, true); - - rep_starterKitDesigns.DataSource = skinsCollection; - rep_starterKitDesigns.DataBind(); - } - catch (Exception ex) - { - Log.Add(LogTypes.Debug, -1, ex.ToString()); - - ShowConnectionError(); - } - } - else - { - ShowConnectionError(); - } - } - - private void ShowConnectionError() - { - - uicontrols.Feedback fb = new global::umbraco.uicontrols.Feedback(); - fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; - fb.Text = "No connection to repository. Starter Kits Designs could not be fetched from the repository as there was no connection to: '" + repo.RepositoryUrl + "'"; - - pl_loadStarterKitDesigns.Controls.Clear(); - pl_loadStarterKitDesigns.Controls.Add(fb); - } - - protected void SelectStarterKitDesign(object sender, EventArgs e) - { - Helper.clearProgress(); - - Guid kitGuid = new Guid(((LinkButton)sender).CommandArgument); - - if (!cms.businesslogic.skinning.Skinning.IsSkinInstalled(kitGuid)) - { - - Helper.setProgress(5, "Fetching starting kit from the repository", ""); - - cms.businesslogic.packager.Installer installer = new cms.businesslogic.packager.Installer(); - - if (repo.HasConnection()) - { - cms.businesslogic.packager.Installer p = new cms.businesslogic.packager.Installer(); - - Helper.setProgress(15, "Connected to repository", ""); - - string tempFile = p.Import(repo.fetch(kitGuid.ToString())); - p.LoadConfig(tempFile); - int pID = p.CreateManifest(tempFile, kitGuid.ToString(), repoGuid); - - Helper.setProgress(30, "Installing skin files", ""); - p.InstallFiles(pID, tempFile); - - Helper.setProgress(50, "Installing skin system objects", ""); - p.InstallBusinessLogic(pID, tempFile); - - Helper.setProgress(60, "Finishing skin installation", ""); - p.InstallCleanUp(pID, tempFile); - - library.RefreshContent(); - - Helper.setProgress(80, "Activating skin", ""); - if (cms.businesslogic.skinning.Skinning.GetAllSkins().Count > 0) - { - cms.businesslogic.skinning.Skinning.ActivateAsCurrentSkin(cms.businesslogic.skinning.Skinning.GetAllSkins()[0]); - } + } - Helper.setProgress(100, "Skin installation has been completed", ""); - try - { + protected override void OnInit(EventArgs e) + { + base.OnInit(e); + + if (repo.HasConnection()) + { + try + { + //clear progress bar cache + Helper.clearProgress(); + + var skinsCollection = repo.Webservice.Skins(StarterKitGuid.ToString()); + + var numberOfSkins = skinsCollection.Length; + this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "skinCounter", "var numberOfSkins = " + numberOfSkins, true); + + rep_starterKitDesigns.DataSource = skinsCollection; + rep_starterKitDesigns.DataBind(); + } + catch (Exception ex) + { + Log.Add(LogTypes.Debug, -1, ex.ToString()); + + ShowConnectionError(); + } + } + else + { + ShowConnectionError(); + } + } + + private void ShowConnectionError() + { + + uicontrols.Feedback fb = new global::umbraco.uicontrols.Feedback(); + fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; + fb.Text = "No connection to repository. Starter Kits Designs could not be fetched from the repository as there was no connection to: '" + repo.RepositoryUrl + "'"; + + pl_loadStarterKitDesigns.Controls.Clear(); + pl_loadStarterKitDesigns.Controls.Add(fb); + } + + protected void SelectStarterKitDesign(object sender, EventArgs e) + { + Helper.clearProgress(); + + Guid kitGuid = new Guid(((LinkButton)sender).CommandArgument); + + if (!cms.businesslogic.skinning.Skinning.IsSkinInstalled(kitGuid)) + { + + Helper.setProgress(5, "Fetching starting kit from the repository", ""); + + cms.businesslogic.packager.Installer installer = new cms.businesslogic.packager.Installer(); + + if (repo.HasConnection()) + { + cms.businesslogic.packager.Installer p = new cms.businesslogic.packager.Installer(); + + Helper.setProgress(15, "Connected to repository", ""); + + string tempFile = p.Import(repo.fetch(kitGuid.ToString())); + p.LoadConfig(tempFile); + int pID = p.CreateManifest(tempFile, kitGuid.ToString(), repoGuid); + + Helper.setProgress(30, "Installing skin files", ""); + p.InstallFiles(pID, tempFile); + + Helper.setProgress(50, "Installing skin system objects", ""); + p.InstallBusinessLogic(pID, tempFile); + + Helper.setProgress(60, "Finishing skin installation", ""); + p.InstallCleanUp(pID, tempFile); + + library.RefreshContent(); + + Helper.setProgress(80, "Activating skin", ""); + if (cms.businesslogic.skinning.Skinning.GetAllSkins().Count > 0) + { + cms.businesslogic.skinning.Skinning.ActivateAsCurrentSkin(cms.businesslogic.skinning.Skinning.GetAllSkins()[0]); + } - if (string.IsNullOrEmpty(GlobalSettings.ConfigurationStatus)) - { - GlobalSettings.ConfigurationStatus = GlobalSettings.CurrentVersion; - Application["umbracoNeedConfiguration"] = false; - } - } - catch - { - - } + Helper.setProgress(100, "Skin installation has been completed", ""); - try - { - Helper.RedirectToNextStep(Page); - } - catch - { - OnStarterKitDesignInstalled(); - } - } - else - { - ShowConnectionError(); - } + try + { - } - } - } + + if (string.IsNullOrEmpty(GlobalSettings.ConfigurationStatus)) + { + GlobalSettings.ConfigurationStatus = GlobalSettings.CurrentVersion; + Application["umbracoNeedConfiguration"] = false; + } + } + catch + { + + } + + try + { + Helper.RedirectToNextStep(Page); + } + catch + { + OnStarterKitDesignInstalled(); + } + } + else + { + ShowConnectionError(); + } + + } + } + + /// + /// pl_loadStarterKitDesigns control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder pl_loadStarterKitDesigns; + + /// + /// pl_CustomizeSkin control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel pl_CustomizeSkin; + + /// + /// rep_starterKitDesigns control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Repeater rep_starterKitDesigns; + } } \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/install/steps/Skinning/loadStarterKitDesigns.ascx.designer.cs b/src/Umbraco.Web/umbraco.presentation/install/steps/Skinning/loadStarterKitDesigns.ascx.designer.cs deleted file mode 100644 index 173e8b04f7..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/install/steps/Skinning/loadStarterKitDesigns.ascx.designer.cs +++ /dev/null @@ -1,42 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace umbraco.presentation.install.steps.Skinning { - - - public partial class loadStarterKitDesigns { - - /// - /// pl_loadStarterKitDesigns control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder pl_loadStarterKitDesigns; - - /// - /// pl_CustomizeSkin control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel pl_CustomizeSkin; - - /// - /// rep_starterKitDesigns control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Repeater rep_starterKitDesigns; - } -} From fee1a0dd9ed5afda084024f7ad4cefed126a0c8a Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 6 Nov 2012 07:09:54 -0100 Subject: [PATCH 14/14] fix broken CreateXPathQuery in legacy requestHandler --- .../umbraco.presentation/requestHandler.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/requestHandler.cs b/src/Umbraco.Web/umbraco.presentation/requestHandler.cs index b330f5d8ed..24be00bd6e 100644 --- a/src/Umbraco.Web/umbraco.presentation/requestHandler.cs +++ b/src/Umbraco.Web/umbraco.presentation/requestHandler.cs @@ -33,8 +33,8 @@ namespace umbraco { private static string pageXPathQueryStart = "/root"; - private static string _urlName = string.Empty; - private static bool _urlNameInitialized = false; + private static string _urlName = "@urlName"; + private static bool _urlNameInitialized = true; private static XmlDocument _customHandlers; private string _pageXPathQuery = string.Empty; @@ -76,6 +76,9 @@ namespace umbraco { // Init urlName to correspond to web.config entries (umbracoUrlForbittenCharacters and umbracoUrlSpaceCharacter). // Needed to compensate for known asp.net framework error KB826437: // http://support.microsoft.com/default.aspx?scid=kb;EN-US;826437 + // note: obsoleted, everything was commented out anyway since long, so it just + // initializes _urlName, which we can do in the variable definition. + [Obsolete("This method did nothing anyway...")] private static void InitializeUrlName() { /* string toReplace = string.Empty; string replaceWith = string.Empty; @@ -197,8 +200,9 @@ namespace umbraco { bool getByID = false; string currentDomain = HttpContext.Current.Request.ServerVariables["SERVER_NAME"]; - if (!_urlNameInitialized) - InitializeUrlName(); + // obsoleted + //if (!_urlNameInitialized) + // InitializeUrlName(); // The url exists in cache, and the domain doesn't exists (which makes it ok to do a cache look up on the url alone) // TODO: NH: Remove the flag for friendlyxmlschema when real schema is implemented