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.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index a044d1d210..83e6774b0d 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; } } diff --git a/src/Umbraco.Core/CoreBootManager.cs b/src/Umbraco.Core/CoreBootManager.cs index 7175052105..b4122cbd8e 100644 --- a/src/Umbraco.Core/CoreBootManager.cs +++ b/src/Umbraco.Core/CoreBootManager.cs @@ -115,12 +115,11 @@ namespace Umbraco.Core PluginManager.Current.ResolveMacroPropertyTypes()); 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/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.Core/PluginManager.cs b/src/Umbraco.Core/PluginManager.cs index 02e51a0e84..0d86f41725 100644 --- a/src/Umbraco.Core/PluginManager.cs +++ b/src/Umbraco.Core/PluginManager.cs @@ -7,6 +7,7 @@ using System.Text; using System.Threading; using Umbraco.Core.Logging; using Umbraco.Core.Models; +using Umbraco.Core.PropertyEditors; using umbraco.interfaces; namespace Umbraco.Core @@ -68,6 +69,15 @@ namespace Umbraco.Core return ResolveTypes(); } + /// + /// Returns all available IPropertyEditorValueConverter + /// + /// + internal IEnumerable ResolvePropertyEditorValueConverters() + { + return ResolveTypes(); + } + /// /// Returns all available IDataType in application /// 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.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/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 f0ae5b58a0..aee1088fbd 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -87,8 +87,10 @@ + + diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 9ec23cae0a..e4f3ab5c8f 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -271,6 +271,13 @@ default.aspx + + loadStarterKitDesigns.ascx + ASPXCodeBehind + + + loadStarterKitDesigns.ascx + ASPXCodeBehind @@ -278,49 +285,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 @@ -387,65 +401,65 @@ Dashboard.config - + UI.xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1214,18 +1228,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + @@ -1338,52 +1352,52 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1413,7 +1427,7 @@ - + @@ -1435,8 +1449,8 @@ - - + + @@ -1445,49 +1459,49 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - + + - - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + @@ -1511,25 +1525,24 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -1557,27 +1570,27 @@ - - - - - - - - - - + + + + + + + + + + - + - - - - - - - - + + + + + + + + @@ -1585,126 +1598,126 @@ - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UserControl @@ -1717,38 +1730,38 @@ UserControl - - - + + + Designer - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer @@ -1781,350 +1794,350 @@ Web.Template.config Designer - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + UserControl - - - + + + UserControl - - + + UserControl - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + Form - - + + Form - - + + Form - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + Form - - - - - - + + + + + + Form - - + + Form - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -2190,11 +2203,11 @@ - - - - - + + + + + Designer 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.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..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" %> @@ -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/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.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) { %> - - -

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

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

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

    - -
    - -
    -
    diff --git a/src/Umbraco.Web.UI/umbraco_client/Installer/css/all.css b/src/Umbraco.Web.UI/umbraco_client/Installer/css/all.css index 9d7f82b00a..46ffeb7e01 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Installer/css/all.css +++ b/src/Umbraco.Web.UI/umbraco_client/Installer/css/all.css @@ -89,7 +89,7 @@ figure{display: block;} .bg-main .color3 .bg-c { background:url(../images/bg-blog.jpg) no-repeat 50% 0;} /* Color 4 */ -.bg-main .color4 { background:#201c01 url(../images/bg-bhuiness-repeat.jpg) repeat-x;} +.bg-main .color4 { background:#201c01 url(../images/bg-normal-repeat.jpg) repeat-x;} .bg-main .color4 .bg-c { background:url(../images/bg-bhuiness.jpg) no-repeat 50% 0;} /* Color 5 */ diff --git a/src/Umbraco.Web.UI/umbraco_client/Installer/js/jquery.main.js b/src/Umbraco.Web.UI/umbraco_client/Installer/js/jquery.main.js index 1a0330e4c9..a51b5f623f 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Installer/js/jquery.main.js +++ b/src/Umbraco.Web.UI/umbraco_client/Installer/js/jquery.main.js @@ -30,7 +30,10 @@ function updateProgressBar(percent) { } function updateStatusMessage(message, error) { - jQuery(".loader > strong").text(message); + if (message != null && message != undefined) { + jQuery(".loader > strong").text(message); + } + if (error != undefined) { jQuery(".loader").append("

    " + error + "

    "); } 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":"", diff --git a/src/Umbraco.Web/IPublishedStore.cs b/src/Umbraco.Web/IPublishedStore.cs index 0eae294911..8fe73e5be4 100644 --- a/src/Umbraco.Web/IPublishedStore.cs +++ b/src/Umbraco.Web/IPublishedStore.cs @@ -6,9 +6,17 @@ 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); + + //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 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/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 563de6f82f..604d0388e9 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -341,6 +341,9 @@ ASPXCodeBehind + + ASPXCodeBehind + ASPXCodeBehind @@ -348,6 +351,9 @@ ASPXCodeBehind + + ASPXCodeBehind + ASPXCodeBehind @@ -449,13 +455,6 @@ skinning.ascx - - loadStarterKitDesigns.ascx - ASPXCodeBehind - - - loadStarterKitDesigns.ascx - @@ -814,13 +813,6 @@ StartupDashboardVideos.ascx - - StarterKits.aspx - ASPXCodeBehind - - - StarterKits.aspx - EditRelationType.aspx ASPXCodeBehind @@ -1867,7 +1859,6 @@ - ASPXCodeBehind @@ -1886,7 +1877,6 @@ - diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index 3033983783..8b928454a4 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; } } @@ -235,6 +251,7 @@ namespace Umbraco.Web var item = new Item() { + NodeId = currentPage.Id.ToString(), Field = fieldAlias, TextIfEmpty = altText, LegacyAttributes = attributesForItem 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; - } -} 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 diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/StarterKits.aspx b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/StarterKits.aspx deleted file mode 100644 index 17483f8591..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/StarterKits.aspx +++ /dev/null @@ -1,69 +0,0 @@ -<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="../../masterpages/umbracoPage.Master" Title="Install starter kit" CodeBehind="StarterKits.aspx.cs" Inherits="umbraco.presentation.umbraco.developer.Packages.StarterKits" %> -<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %> -<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> - - - - - - - - - - - - - - -

    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; - } -} 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' });";