From 9ddee615cc8ba9be3de7333f2d7211e906821304 Mon Sep 17 00:00:00 2001 From: Floris Robbemont Date: Tue, 1 Oct 2013 14:09:38 +0200 Subject: [PATCH 01/17] U4-3007 RouteDefinition should not store instance of controller --- src/Umbraco.Web/Mvc/RouteDefinition.cs | 7 +--- src/Umbraco.Web/Mvc/UmbracoMvcHandler.cs | 35 +---------------- src/Umbraco.Web/Mvc/UmbracoPageResult.cs | 49 +++++++++++++++--------- 3 files changed, 33 insertions(+), 58 deletions(-) diff --git a/src/Umbraco.Web/Mvc/RouteDefinition.cs b/src/Umbraco.Web/Mvc/RouteDefinition.cs index 49ba64fac5..f0334202dd 100644 --- a/src/Umbraco.Web/Mvc/RouteDefinition.cs +++ b/src/Umbraco.Web/Mvc/RouteDefinition.cs @@ -11,12 +11,7 @@ namespace Umbraco.Web.Mvc { public string ControllerName { get; set; } public string ActionName { get; set; } - - /// - /// The Controller instance found for routing to - /// - public ControllerBase Controller { get; set; } - + /// /// The Controller type found for routing to /// diff --git a/src/Umbraco.Web/Mvc/UmbracoMvcHandler.cs b/src/Umbraco.Web/Mvc/UmbracoMvcHandler.cs index 649ac54f27..88cc42a8f1 100644 --- a/src/Umbraco.Web/Mvc/UmbracoMvcHandler.cs +++ b/src/Umbraco.Web/Mvc/UmbracoMvcHandler.cs @@ -25,46 +25,13 @@ namespace Umbraco.Web.Mvc : base(requestContext) { } - - private void StoreControllerInRouteDefinition() - { - var routeDef = (RouteDefinition)RequestContext.RouteData.DataTokens["umbraco-route-def"]; - - if (routeDef == null) return; - - // Get the factory and controller and create a new instance of the controller - var factory = ControllerBuilder.Current.GetControllerFactory(); - var controller = factory.CreateController(RequestContext, routeDef.ControllerName) as ControllerBase; - - // Store the controller - routeDef.Controller = controller; - } - + /// /// This is used internally purely to render an Umbraco MVC template to string and shouldn't be used for anything else. /// internal void ExecuteUmbracoRequest() { - StoreControllerInRouteDefinition(); base.ProcessRequest(RequestContext.HttpContext); } - - protected override void ProcessRequest(HttpContextBase httpContext) - { - StoreControllerInRouteDefinition(); - - // Let MVC do its magic and continue the request - base.ProcessRequest(httpContext); - } - - protected override IAsyncResult BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, - object state) - { - StoreControllerInRouteDefinition(); - - return base.BeginProcessRequest(httpContext, callback, state); - } } - - } \ No newline at end of file diff --git a/src/Umbraco.Web/Mvc/UmbracoPageResult.cs b/src/Umbraco.Web/Mvc/UmbracoPageResult.cs index db0f352645..2ae32e6ad5 100644 --- a/src/Umbraco.Web/Mvc/UmbracoPageResult.cs +++ b/src/Umbraco.Web/Mvc/UmbracoPageResult.cs @@ -11,8 +11,7 @@ namespace Umbraco.Web.Mvc { public override void ExecuteResult(ControllerContext context) { - - //since we could be returning the current page from a surface controller posted values in which the routing values are changed, we + //since we could be returning the current page from a surface controller posted values in which the routing values are changed, we //need to revert these values back to nothing in order for the normal page to render again. context.RouteData.DataTokens["area"] = null; context.RouteData.DataTokens["Namespaces"] = null; @@ -24,30 +23,44 @@ namespace Umbraco.Web.Mvc } var routeDef = (RouteDefinition)context.RouteData.DataTokens["umbraco-route-def"]; + var factory = ControllerBuilder.Current.GetControllerFactory(); //ensure the original template is reset context.RouteData.Values["action"] = routeDef.ActionName; //ensure ModelState is copied across - routeDef.Controller.ViewData.ModelState.Merge(context.Controller.ViewData.ModelState); + ControllerBase controller = null; - //ensure TempData and ViewData is copied across - foreach (var d in context.Controller.ViewData) - routeDef.Controller.ViewData[d.Key] = d.Value; - routeDef.Controller.TempData = context.Controller.TempData; + try + { + controller = factory.CreateController(context.RequestContext, routeDef.ControllerName) as ControllerBase; - using (DisposableTimer.TraceDuration("Executing Umbraco RouteDefinition controller", "Finished")) - { - try - { - ((IController)routeDef.Controller).Execute(context.RequestContext); - } - finally - { - routeDef.Controller.DisposeIfDisposable(); - } - } + if (controller == null) + { + throw new InvalidOperationException("Could not create controller with name " + routeDef.ControllerName + " in the context of an Http POST when using a SurfaceController form"); + } + controller.ViewData.ModelState.Merge(context.Controller.ViewData.ModelState); + + //ensure TempData and ViewData is copied across + foreach (var d in context.Controller.ViewData) + controller.ViewData[d.Key] = d.Value; + + controller.TempData = context.Controller.TempData; + + using (DisposableTimer.TraceDuration("Executing Umbraco RouteDefinition controller", "Finished")) + { + ((IController)controller).Execute(context.RequestContext); + } + } + finally + { + if (controller != null) + factory.ReleaseController(controller); + + if (controller != null) + controller.DisposeIfDisposable(); + } } } } \ No newline at end of file From 20ab14beb4c6d36bb77f2786f87682f11a5f4d56 Mon Sep 17 00:00:00 2001 From: bjawnie Date: Thu, 3 Oct 2013 20:43:42 +0200 Subject: [PATCH 02/17] Made two minor corrections to the texts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "Content>alias" changed to "Alternativ link" from "Alias", so it makes more sense. "defaultdialogs>treepicker" changed to "Vælg" from "Vælg punkt", so it fits in the button. --- src/Umbraco.Web.UI/umbraco/config/lang/da.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml index 7951e3995d..46aab50c9e 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml @@ -77,13 +77,13 @@ Om siden - Alternativ link + Alias (hvordan ville du f.eks. beskrive billedet via telefonen?) Alternative links Klik på musen for at redigere dette punkt Oprettet af Oprettet den - Dokumenttype + Dokumenttype Redigerer Nedtagningsdato Dette punkt er ændret siden udgivelsen @@ -168,7 +168,7 @@ Vælg et placeholder id Ved at sætte et id på en placeholder kan du indskyde indhold fra undertemplates ved at referere til dette ID vha. et <asp:content /> element.]]> Vælg et placeholder id fra listen herunder. Du kan kun vælge id'er fra den nuværende masterskabelon.]]> Klik på billedet for at se den fulde størrelse - Vælg punkt + Vælg Se Cache Item @@ -752,4 +752,4 @@ Mange hilsner fra umbraco robotten Bruger typer Forfatter - \ No newline at end of file + From c2e7fc2f10f4e479b7108dacfaac89d0e42a5d46 Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 4 Oct 2013 20:14:38 +0200 Subject: [PATCH 03/17] PropertyValueConverter - add converters for built-in data types --- .../ValueConverters/IntegerValueConverter.cs | 32 ++++++++++ .../MultipleTextStringValueConverter.cs | 64 +++++++++++++++++++ .../SimpleEditorValueConverter.cs | 36 +++++++++++ .../TextStringValueConverter.cs | 38 +++++++++++ src/Umbraco.Core/Umbraco.Core.csproj | 4 ++ .../SimpleEditorValueConverter.cs | 43 +++++++++++++ .../TextStringValueConverter.cs | 42 ++++++++++++ src/Umbraco.Web/Umbraco.Web.csproj | 2 + src/Umbraco.Web/WebBootManager.cs | 5 +- 9 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 src/Umbraco.Core/PropertyEditors/ValueConverters/IntegerValueConverter.cs create mode 100644 src/Umbraco.Core/PropertyEditors/ValueConverters/MultipleTextStringValueConverter.cs create mode 100644 src/Umbraco.Core/PropertyEditors/ValueConverters/SimpleEditorValueConverter.cs create mode 100644 src/Umbraco.Core/PropertyEditors/ValueConverters/TextStringValueConverter.cs create mode 100644 src/Umbraco.Web/PropertyEditors/ValueConverters/SimpleEditorValueConverter.cs create mode 100644 src/Umbraco.Web/PropertyEditors/ValueConverters/TextStringValueConverter.cs diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/IntegerValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/IntegerValueConverter.cs new file mode 100644 index 0000000000..b917244790 --- /dev/null +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/IntegerValueConverter.cs @@ -0,0 +1,32 @@ +using System; +using Umbraco.Core.Models.PublishedContent; + +namespace Umbraco.Core.PropertyEditors.ValueConverters +{ + [PropertyValueType(typeof(int))] + [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)] + public class IntegerValueConverter : PropertyValueConverterBase + { + public override bool IsConverter(PublishedPropertyType propertyType) + { + return Guid.Parse(Constants.PropertyEditors.Integer).Equals(propertyType.PropertyEditorGuid); + } + + public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview) + { + if (source == null) return 0; + + // in XML an integer is a string + var sourceString = source as string; + if (sourceString != null) + { + int i; + return (int.TryParse(sourceString, out i)) ? i : 0; + } + + // in the database an integer is an integer + // default value is zero + return (source is int) ? source : 0; + } + } +} diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/MultipleTextStringValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/MultipleTextStringValueConverter.cs new file mode 100644 index 0000000000..0b7ae5c68a --- /dev/null +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/MultipleTextStringValueConverter.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml; +using System.Xml.Linq; +using Umbraco.Core.Models.PublishedContent; + +namespace Umbraco.Core.PropertyEditors.ValueConverters +{ + [PropertyValueType(typeof(IEnumerable))] + [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)] + public class MultipleTextStringValueConverter : PropertyValueConverterBase + { + public override bool IsConverter(PublishedPropertyType propertyType) + { + return Guid.Parse(Constants.PropertyEditors.MultipleTextstring).Equals(propertyType.PropertyEditorGuid); + } + + public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview) + { + // data is (both in database and xml): + // + // + // Strong + // Flexible + // Efficient + // + // + + var sourceString = source.ToString(); + if (string.IsNullOrWhiteSpace(sourceString)) return Enumerable.Empty(); + + var values = new List(); + var pos = sourceString.IndexOf("", StringComparison.Ordinal); + while (pos >= 0) + { + pos += "".Length; + var npos = sourceString.IndexOf("<", pos, StringComparison.Ordinal); + var value = sourceString.Substring(pos, npos - pos); + values.Add(value); + pos = sourceString.IndexOf("", pos, StringComparison.Ordinal); + } + return values.ToArray(); + } + + public override object ConvertSourceToXPath(PublishedPropertyType propertyType, object source, bool preview) + { + var d = new XmlDocument(); + var e = d.CreateElement("values"); + d.AppendChild(e); + + var values = (IEnumerable) source; + foreach (var value in values) + { + var ee = d.CreateElement("value"); + ee.InnerText = value; + e.AppendChild(ee); + } + + return d.CreateNavigator(); + } + } +} diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/SimpleEditorValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/SimpleEditorValueConverter.cs new file mode 100644 index 0000000000..b237fb7278 --- /dev/null +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/SimpleEditorValueConverter.cs @@ -0,0 +1,36 @@ +using System; +using System.Web; +using Umbraco.Core.Models.PublishedContent; + +namespace Umbraco.Core.PropertyEditors.ValueConverters +{ + [PropertyValueType(typeof(IHtmlString))] + [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)] + public class SimpleEditorValueConverter : PropertyValueConverterBase + { + public override bool IsConverter(PublishedPropertyType propertyType) + { + return Guid.Parse(Constants.PropertyEditors.UltraSimpleEditor).Equals(propertyType.PropertyEditorGuid); + } + + public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview) + { + // in xml a string is: string + // in the database a string is: string + // default value is: null + return source; + } + + public override object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview) + { + // source should come from ConvertSource and be a string (or null) already + return new HtmlString(source == null ? string.Empty : (string)source); + } + + public override object ConvertSourceToXPath(PublishedPropertyType propertyType, object source, bool preview) + { + // source should come from ConvertSource and be a string (or null) already + return source; + } + } +} diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/TextStringValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/TextStringValueConverter.cs new file mode 100644 index 0000000000..e01d9386bb --- /dev/null +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/TextStringValueConverter.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Umbraco.Core.Models.PublishedContent; + +namespace Umbraco.Core.PropertyEditors.ValueConverters +{ + [PropertyValueType(typeof(string))] + [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)] + public class TextStringValueConverter : PropertyValueConverterBase + { + public override bool IsConverter(PublishedPropertyType propertyType) + { + return Guid.Parse(Constants.PropertyEditors.Textbox).Equals(propertyType.PropertyEditorGuid); + } + + public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview) + { + // in xml a string is: string + // in the database a string is: string + // default value is: null + return source; + } + + public override object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview) + { + // source should come from ConvertSource and be a string (or null) already + return source ?? string.Empty; + } + + public override object ConvertSourceToXPath(PublishedPropertyType propertyType, object source, bool preview) + { + // source should come from ConvertSource and be a string (or null) already + return source; + } + } +} diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 0671b9a5b5..80b700209b 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -194,6 +194,10 @@ + + + + diff --git a/src/Umbraco.Web/PropertyEditors/ValueConverters/SimpleEditorValueConverter.cs b/src/Umbraco.Web/PropertyEditors/ValueConverters/SimpleEditorValueConverter.cs new file mode 100644 index 0000000000..ceae50e93b --- /dev/null +++ b/src/Umbraco.Web/PropertyEditors/ValueConverters/SimpleEditorValueConverter.cs @@ -0,0 +1,43 @@ +using System; +using System.Web; +using Umbraco.Core; +using Umbraco.Core.Models.PublishedContent; +using Umbraco.Core.PropertyEditors; +using Umbraco.Web.Templates; + +namespace Umbraco.Web.PropertyEditors.ValueConverters +{ + [PropertyValueType(typeof(IHtmlString))] + [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Request)] + public class SimpleEditorValueConverter : PropertyValueConverterBase + { + public override bool IsConverter(PublishedPropertyType propertyType) + { + return Guid.Parse(Constants.PropertyEditors.UltraSimpleEditor).Equals(propertyType.PropertyEditorGuid); + } + + public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview) + { + if (source == null) return null; + var sourceString = source.ToString(); + + // ensures string is parsed for {localLink} and urls are resolved correctly + sourceString = TemplateUtilities.ParseInternalLinks(sourceString, preview); + sourceString = TemplateUtilities.ResolveUrlsFromTextString(sourceString); + + return sourceString; + } + + public override object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview) + { + // source should come from ConvertSource and be a string (or null) already + return new HtmlString(source == null ? string.Empty : (string)source); + } + + public override object ConvertSourceToXPath(PublishedPropertyType propertyType, object source, bool preview) + { + // source should come from ConvertSource and be a string (or null) already + return source; + } + } +} diff --git a/src/Umbraco.Web/PropertyEditors/ValueConverters/TextStringValueConverter.cs b/src/Umbraco.Web/PropertyEditors/ValueConverters/TextStringValueConverter.cs new file mode 100644 index 0000000000..e090abd4b9 --- /dev/null +++ b/src/Umbraco.Web/PropertyEditors/ValueConverters/TextStringValueConverter.cs @@ -0,0 +1,42 @@ +using System; +using Umbraco.Core; +using Umbraco.Core.Models.PublishedContent; +using Umbraco.Core.PropertyEditors; +using Umbraco.Web.Templates; + +namespace Umbraco.Web.PropertyEditors.ValueConverters +{ + [PropertyValueType(typeof(string))] + [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Request)] + public class TextStringValueConverter : PropertyValueConverterBase + { + public override bool IsConverter(PublishedPropertyType propertyType) + { + return Guid.Parse(Constants.PropertyEditors.Textbox).Equals(propertyType.PropertyEditorGuid); + } + + public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview) + { + if (source == null) return null; + var sourceString = source.ToString(); + + // ensures string is parsed for {localLink} and urls are resolved correctly + sourceString = TemplateUtilities.ParseInternalLinks(sourceString, preview); + sourceString = TemplateUtilities.ResolveUrlsFromTextString(sourceString); + + return sourceString; + } + + public override object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview) + { + // source should come from ConvertSource and be a string (or null) already + return source ?? string.Empty; + } + + public override object ConvertSourceToXPath(PublishedPropertyType propertyType, object source, bool preview) + { + // source should come from ConvertSource and be a string (or null) already + return source; + } + } +} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index c508c3fc92..3129231960 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -298,6 +298,8 @@ + + diff --git a/src/Umbraco.Web/WebBootManager.cs b/src/Umbraco.Web/WebBootManager.cs index 3092fd71ff..31d3ce42ed 100644 --- a/src/Umbraco.Web/WebBootManager.cs +++ b/src/Umbraco.Web/WebBootManager.cs @@ -293,8 +293,11 @@ namespace Umbraco.Web // discovered when CoreBootManager configures the converters. We HAVE to remove one of them // here because there cannot be two converters for one property editor - and we want the full // RteMacroRenderingValueConverter that converts macros, etc. So remove TinyMceValueConverter. - // (why it exists in in the first place, I'm not sure to understand) + // (the limited one, defined in Core, is there for tests) PropertyValueConvertersResolver.Current.RemoveType(); + // same for other converters + PropertyValueConvertersResolver.Current.RemoveType(); + PropertyValueConvertersResolver.Current.RemoveType(); PublishedCachesResolver.Current = new PublishedCachesResolver(new PublishedCaches( new PublishedCache.XmlPublishedCache.PublishedContentCache(), From fe18722e1fda5f740e66b69f819e585de9d5c8af Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sat, 5 Oct 2013 10:04:08 -0700 Subject: [PATCH 04/17] Merge pull request #147 from AndyButland/u4-2958 Fix for issue U4-2958 Member can edit & Show on profile do not persist on Member Type editor --- .../umbraco.presentation/umbraco/members/EditMemberType.aspx.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberType.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberType.aspx.cs index fe3fb9b0f7..94413d2fd2 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberType.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberType.aspx.cs @@ -64,7 +64,7 @@ namespace umbraco.cms.presentation.members } handled = true; } - setupExtraEditorControls(); + return handled; } private void setupExtraEditorControls(){ From 2d83ba06a576a38fd3f560c44fe5100aadcfa9c8 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sat, 5 Oct 2013 19:18:11 +0200 Subject: [PATCH 05/17] Fix small styling issues in installer --- src/Umbraco.Web.UI/install/default.aspx | 4 +--- src/Umbraco.Web.UI/install/steps/database.ascx | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI/install/default.aspx b/src/Umbraco.Web.UI/install/default.aspx index 03ff1c0b30..f44b0430c1 100644 --- a/src/Umbraco.Web.UI/install/default.aspx +++ b/src/Umbraco.Web.UI/install/default.aspx @@ -2,9 +2,7 @@ <%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> -<%@ Register Src="~/install/Title.ascx" TagPrefix="umb1" TagName="PageTitle" %> - - +<%@ Register Src="~/install/Title.ascx" TagPrefix="umb1" TagName="PageTitle" %> diff --git a/src/Umbraco.Web.UI/install/steps/database.ascx b/src/Umbraco.Web.UI/install/steps/database.ascx index 834ed80b55..6b6f1c4496 100644 --- a/src/Umbraco.Web.UI/install/steps/database.ascx +++ b/src/Umbraco.Web.UI/install/steps/database.ascx @@ -201,7 +201,7 @@

- 2. Connection details: Please fill out the connection information for your database. + 2. Connection details: Please fill out the connection information for your database.

From 2ab2a5a9f3d309c7fd8bcf2ebff534c0c420f52a Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sat, 5 Oct 2013 19:23:57 +0200 Subject: [PATCH 06/17] Fix bug where Right ALT+S would save in Firefox instead of inserting the correct character --- .../umbraco/js/umbracoCheckKeys.js | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco/js/umbracoCheckKeys.js b/src/Umbraco.Web.UI/umbraco/js/umbracoCheckKeys.js index ba1cda9a3a..0b3a8e8387 100644 --- a/src/Umbraco.Web.UI/umbraco/js/umbracoCheckKeys.js +++ b/src/Umbraco.Web.UI/umbraco/js/umbracoCheckKeys.js @@ -32,7 +32,7 @@ function umbracoCheckKeys(e) { } function shortcutCheckKeysPressFirefox(e) { - if (ctrlDown && keycode == 83 && !e.altKey) + if (ctrlDown && keycode == 83) e.preventDefault(); } @@ -71,22 +71,20 @@ function runShortCuts() { } } if (ctrlDown) { - try { - if (keycode == 83) - doSubmit(); - else if (keycode == 85) - document.getElementById('TabView1_tab01layer_publish').click(); - else if (!shiftDown && keycode == 9) { - functionsFrame.tabSwitch(1); - return false; - } - else - if (shiftDown && keycode == 9) { - functionsFrame.tabSwitch(-1); - return false; - } - } catch(e) { - } + if (keycode == 83) + doSubmit(); + else if (keycode == 85) + document.getElementById('TabView1_tab01layer_publish').click(); + else if (!shiftDown && keycode == 9) { + functionsFrame.tabSwitch(1); + return false; + } + else + if (shiftDown && keycode == 9) { + functionsFrame.tabSwitch(-1); + return false; + } + } } From 9f3784aaed46b2621740794868fb072fffe8ad3d Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sat, 5 Oct 2013 19:26:01 +0200 Subject: [PATCH 07/17] U4-1242 Template editor sometimes stops editing. --- src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js b/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js index 9c9d508bbb..8f0faf2a28 100644 --- a/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js +++ b/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js @@ -36,7 +36,9 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls.CodeEditor"); } else { //this is a wrapper for CodeMirror + this._editor.focus(); this._editor.setValue(code); + this._editor.focus(); } }, GetSelection: function(code) { @@ -150,4 +152,3 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls.CodeEditor"); return obj; }; })(jQuery); - From b02657f32c3aede1e2118810f79c96bcde43a723 Mon Sep 17 00:00:00 2001 From: Floris Robbemont Date: Sat, 5 Oct 2013 23:22:17 +0200 Subject: [PATCH 08/17] Cleaning up commit for issue U4-3007 Changed documentation on UmbracoMvcHandler --- src/Umbraco.Web/Mvc/UmbracoMvcHandler.cs | 19 ++-- src/Umbraco.Web/Mvc/UmbracoPageResult.cs | 111 ++++++++++++++++------- 2 files changed, 85 insertions(+), 45 deletions(-) diff --git a/src/Umbraco.Web/Mvc/UmbracoMvcHandler.cs b/src/Umbraco.Web/Mvc/UmbracoMvcHandler.cs index 88cc42a8f1..6e7a92ea10 100644 --- a/src/Umbraco.Web/Mvc/UmbracoMvcHandler.cs +++ b/src/Umbraco.Web/Mvc/UmbracoMvcHandler.cs @@ -1,23 +1,18 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Web; -using System.Web.Mvc; +using System.Web.Mvc; using System.Web.Routing; namespace Umbraco.Web.Mvc { /// - /// Mvc handler class to intercept creation of controller and store it for later use. - /// This means we create two instances of the same controller to support some features later on. + /// MVC handler to facilitate the TemplateRenderer. This handler can execute an MVC request and return it as a string. /// - /// The alternate option for this is to completely rewrite all MvcHandler methods. + /// Original: /// - /// This is currently needed for the 'return CurrentUmbracoPage()' surface controller functionality + /// This handler also used to intercept creation of controllers and store it for later use. + /// This was needed for the 'return CurrentUmbracoPage()' surface controller functionality /// because it needs to send data back to the page controller. + /// + /// The creation of this controller has been moved to the UmbracoPageResult class which will create a controller when needed. /// internal class UmbracoMvcHandler : MvcHandler { diff --git a/src/Umbraco.Web/Mvc/UmbracoPageResult.cs b/src/Umbraco.Web/Mvc/UmbracoPageResult.cs index 2ae32e6ad5..6b44959c8c 100644 --- a/src/Umbraco.Web/Mvc/UmbracoPageResult.cs +++ b/src/Umbraco.Web/Mvc/UmbracoPageResult.cs @@ -1,5 +1,6 @@ using System; using System.Web.Mvc; +using System.Web.Routing; using Umbraco.Core; namespace Umbraco.Web.Mvc @@ -11,56 +12,100 @@ namespace Umbraco.Web.Mvc { public override void ExecuteResult(ControllerContext context) { - //since we could be returning the current page from a surface controller posted values in which the routing values are changed, we - //need to revert these values back to nothing in order for the normal page to render again. - context.RouteData.DataTokens["area"] = null; - context.RouteData.DataTokens["Namespaces"] = null; + ResetRouteData(context.RouteData); - //validate that the current page execution is not being handled by the normal umbraco routing system - if (!context.RouteData.DataTokens.ContainsKey("umbraco-route-def")) - { - throw new InvalidOperationException("Can only use " + typeof(UmbracoPageResult).Name + " in the context of an Http POST when using a SurfaceController form"); - } + ValidateRouteData(context.RouteData); var routeDef = (RouteDefinition)context.RouteData.DataTokens["umbraco-route-def"]; var factory = ControllerBuilder.Current.GetControllerFactory(); - //ensure the original template is reset context.RouteData.Values["action"] = routeDef.ActionName; - //ensure ModelState is copied across ControllerBase controller = null; try { - controller = factory.CreateController(context.RequestContext, routeDef.ControllerName) as ControllerBase; - - if (controller == null) - { - throw new InvalidOperationException("Could not create controller with name " + routeDef.ControllerName + " in the context of an Http POST when using a SurfaceController form"); - } - + controller = CreateController(context, factory, routeDef); + controller.ViewData.ModelState.Merge(context.Controller.ViewData.ModelState); - //ensure TempData and ViewData is copied across - foreach (var d in context.Controller.ViewData) - controller.ViewData[d.Key] = d.Value; + CopyControllerData(context, controller); - controller.TempData = context.Controller.TempData; - - using (DisposableTimer.TraceDuration("Executing Umbraco RouteDefinition controller", "Finished")) - { - ((IController)controller).Execute(context.RequestContext); - } + ExecuteControllerAction(context, controller); } - finally + finally { - if (controller != null) - factory.ReleaseController(controller); - - if (controller != null) - controller.DisposeIfDisposable(); + CleanupController(controller, factory); } } + + /// + /// Executes the controller action + /// + private static void ExecuteControllerAction(ControllerContext context, IController controller) + { + using (DisposableTimer.TraceDuration("Executing Umbraco RouteDefinition controller", "Finished")) + { + controller.Execute(context.RequestContext); + } + } + + /// + /// Since we could be returning the current page from a surface controller posted values in which the routing values are changed, we + /// need to revert these values back to nothing in order for the normal page to render again. + /// + private static void ResetRouteData(RouteData routeData) + { + routeData.DataTokens["area"] = null; + routeData.DataTokens["Namespaces"] = null; + } + + /// + /// Validate that the current page execution is not being handled by the normal umbraco routing system + /// + private static void ValidateRouteData(RouteData routeData) + { + if (!routeData.DataTokens.ContainsKey("umbraco-route-def")) + { + throw new InvalidOperationException("Can only use " + typeof(UmbracoPageResult).Name + + " in the context of an Http POST when using a SurfaceController form"); + } + } + + /// + /// Ensure TempData and ViewData is copied across + /// + private static void CopyControllerData(ControllerContext context, ControllerBase controller) + { + foreach (var d in context.Controller.ViewData) + controller.ViewData[d.Key] = d.Value; + + controller.TempData = context.Controller.TempData; + } + + /// + /// Creates a controller using the controller factory + /// + private static ControllerBase CreateController(ControllerContext context, IControllerFactory factory, RouteDefinition routeDef) + { + var controller = factory.CreateController(context.RequestContext, routeDef.ControllerName) as ControllerBase; + + if (controller == null) + throw new InvalidOperationException("Could not create controller with name " + routeDef.ControllerName + "."); + + return controller; + } + + /// + /// Cleans up the controller by releasing it using the controller factory, and by disposing it. + /// + private static void CleanupController(IController controller, IControllerFactory factory) + { + if (controller != null) + factory.ReleaseController(controller); + + if (controller != null) + controller.DisposeIfDisposable(); + } } } \ No newline at end of file From 45ad51b8df4babce50734db27321e78afa263e96 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sun, 6 Oct 2013 16:45:21 +0200 Subject: [PATCH 09/17] U4-2737 Snippets that are available when creating new MacroScripts should also be available for Partial Views --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 36 ++- .../Templates/Breadcrumb.cshtml | 22 ++ ...ptyTemplate (ForUseWithCustomViews).cshtml | 1 + .../Templates/Gallery.cshtml | 31 +++ .../ListAncestorsFromCurrentPage.cshtml | 16 ++ .../ListChildPagesFromChangeableSource.cshtml | 21 ++ .../ListChildPagesFromCurrentPage.cshtml | 15 ++ .../ListChildPagesOrderedByDate.cshtml | 10 + .../ListChildPagesOrderedByName.cshtml | 8 + .../ListChildPagesOrderedByProperty.cshtml | 21 ++ .../ListChildPagesWithDoctype.cshtml | 32 +++ .../ListDescendantsFromCurrentPage.cshtml | 54 +++++ .../ListImagesFromMediaFolder.cshtml | 23 ++ .../Templates/MultinodeTree-picker.cshtml | 20 ++ .../Templates/Navigation.cshtml | 22 ++ .../Templates/SiteMap.cshtml | 32 +++ .../PartialViews/Templates/Breadcrumb.cshtml | 22 ++ .../PartialViews/Templates/EditProfile.cshtml | 54 +++++ .../Templates/EmptyTemplate.cshtml | 1 - .../ListAncestorsFromCurrentPage.cshtml | 16 ++ .../ListChildPagesFromCurrentPage.cshtml | 15 ++ .../ListChildPagesOrderedByDate.cshtml | 10 + .../ListChildPagesOrderedByName.cshtml | 8 + .../ListChildPagesWithDoctype.cshtml | 32 +++ .../ListDescendantsFromCurrentPage.cshtml | 54 +++++ .../PartialViews/Templates/Login.cshtml | 40 ++++ .../PartialViews/Templates/LoginStatus.cshtml | 31 +++ .../Templates/MultinodeTree-picker.cshtml | 20 ++ .../PartialViews/Templates/Navigation.cshtml | 22 ++ .../Templates/RegisterMember.cshtml | 90 ++++++++ .../PartialViews/Templates/SiteMap.cshtml | 32 +++ .../Umbraco/create/PartialView.ascx | 6 +- .../Umbraco/create/PartialView.ascx.cs | 12 +- .../create/PartialView.ascx.designer.cs | 9 - src/Umbraco.Web.UI/packages.config | 2 +- .../umbraco/config/create/UI.xml | 9 +- .../umbraco/create/DLRScripting.ascx | 2 +- .../umbraco/create/PartialViewMacro.ascx.cs | 13 +- src/Umbraco.Web.UI/umbraco/create/xslt.ascx | 2 +- .../templates/cshtml/TwitterFeed.cshtml | 217 ------------------ src/Umbraco.Web/Umbraco.Web.csproj | 18 +- .../umbraco/create/DLRScripting.ascx | 2 +- .../umbraco/create/MacroPartialViewTasks.cs | 22 -- .../umbraco/create/PartialViewMacrosTasks.cs | 123 ++++++++++ .../umbraco/create/PartialViewTasks.cs | 9 +- .../umbraco/create/xslt.ascx | 2 +- src/umbraco.sln | 38 +-- 47 files changed, 978 insertions(+), 319 deletions(-) create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Breadcrumb.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EmptyTemplate (ForUseWithCustomViews).cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Gallery.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListAncestorsFromCurrentPage.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesFromChangeableSource.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesFromCurrentPage.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesOrderedByDate.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesOrderedByName.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesOrderedByProperty.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesWithDoctype.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListDescendantsFromCurrentPage.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListImagesFromMediaFolder.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/MultinodeTree-picker.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Navigation.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/SiteMap.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Breadcrumb.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/EditProfile.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListAncestorsFromCurrentPage.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesFromCurrentPage.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesOrderedByDate.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesOrderedByName.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesWithDoctype.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListDescendantsFromCurrentPage.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Login.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/LoginStatus.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/MultinodeTree-picker.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Navigation.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/RegisterMember.cshtml create mode 100644 src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/SiteMap.cshtml delete mode 100644 src/Umbraco.Web.UI/umbraco/scripting/templates/cshtml/TwitterFeed.cshtml delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/create/MacroPartialViewTasks.cs create mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 02ddb3454b..41b0fe0ae1 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -46,6 +46,7 @@ ..\ true + true bin\ @@ -649,6 +650,7 @@ Dashboard.config + UI.xml @@ -2141,16 +2143,46 @@ Code - - + Code + + + + + + Code + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Breadcrumb.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Breadcrumb.cshtml new file mode 100644 index 0000000000..29dab7ad82 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Breadcrumb.cshtml @@ -0,0 +1,22 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage +@* + This snippet makes a breadcrumb of parents using an unordred html list. + + How it works: + - It uses the Ancestors() method to get all parents and then generates links so the visitor get go back + - Finally it outputs the name of the current page (without a link) +*@ + +@if (CurrentPage.Ancestors().Any()) +{ + +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EmptyTemplate (ForUseWithCustomViews).cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EmptyTemplate (ForUseWithCustomViews).cshtml new file mode 100644 index 0000000000..8d10a3a9c7 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EmptyTemplate (ForUseWithCustomViews).cshtml @@ -0,0 +1 @@ +@inherits Umbraco.Web.Mvc.UmbracoViewPage \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Gallery.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Gallery.cshtml new file mode 100644 index 0000000000..e0d53980ac --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Gallery.cshtml @@ -0,0 +1,31 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage + +@* +Macro to display a gallery from a media folder. Add the below parameter to the macro +and use it to point the macro at a specific media folder to display it's content as +a simple list. + +Macro Parameters To Create, for this macro to work: +Show:True Alias:mediaId Name:Media Folder ID Type:MediaCurrent +*@ + +@if (Model.MacroParameters["mediaId"] != null) +{ + @* Get the media folder as a dynamic node *@ + var mediaFolder = Umbraco.Media(Model.MacroParameters["mediaId"]); + + if (mediaFolder.Children.Any()) + { +
    + @* for each item in children of the selected media folder *@ + @foreach (var mediaItem in mediaFolder.Children) + { +
  • + + @mediaItem.Name + +
  • + } +
+ } +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListAncestorsFromCurrentPage.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListAncestorsFromCurrentPage.cshtml new file mode 100644 index 0000000000..e5b63c939d --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListAncestorsFromCurrentPage.cshtml @@ -0,0 +1,16 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage + +@* Check the current page has ancestors *@ +@if (CurrentPage.Ancestors().Any()) +{ +
    + @* For each page in the ancestors collection which have been ordered by Level (so we start with the highest top node first) *@ + @foreach (var page in CurrentPage.Ancestors().OrderBy("Level")) + { +
  • @page.Name »
  • + } + + @* Display the current page as the last item in the list *@ +
  • @CurrentPage.Name
  • +
+} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesFromChangeableSource.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesFromChangeableSource.cshtml new file mode 100644 index 0000000000..f06cbb7987 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesFromChangeableSource.cshtml @@ -0,0 +1,21 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage +@* + === Macro Parameters To Create === + Show:True Alias:nodeId Name:Node ID Type:Content Picker +*@ + +@if (Model.MacroParameters["startNodeID"] != null) +{ + @* Get the start node as a dynamic node *@ + var startNode = Umbraco.Content(Model.MacroParameters["startNodeID"]); + + if (startNode.Children.Where("Visible").Any()) + { +
    + @foreach (var page in startNode.Children.Where("Visible")) + { +
  • @page.Name
  • + } +
+ } +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesFromCurrentPage.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesFromCurrentPage.cshtml new file mode 100644 index 0000000000..7918e56386 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesFromCurrentPage.cshtml @@ -0,0 +1,15 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage + +@* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@ +@if (CurrentPage.Children.Where("Visible").Any()) +{ +
    + @* For each child page under the root node, where the property umbracoNaviHide is not True *@ + @foreach (var childPage in CurrentPage.Children.Where("Visible")) + { +
  • + @childPage.Name +
  • + } +
+} diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesOrderedByDate.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesOrderedByDate.cshtml new file mode 100644 index 0000000000..136578c16c --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesOrderedByDate.cshtml @@ -0,0 +1,10 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage + +
    + @*OrderBy() takes the property to sort by and optionally order desc/asc *@ + + @foreach (var page in CurrentPage.Children.Where("Visible").OrderBy("CreateDate desc")) + { +
  • @page.Name
  • + } +
diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesOrderedByName.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesOrderedByName.cshtml new file mode 100644 index 0000000000..0a1ded1cd3 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesOrderedByName.cshtml @@ -0,0 +1,8 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage +
    + @*OrderBy() takes the property to sort by*@ + @foreach (var page in CurrentPage.Children.Where("Visible").OrderBy("Name")) + { +
  • @page.Name
  • + } +
diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesOrderedByProperty.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesOrderedByProperty.cshtml new file mode 100644 index 0000000000..dc37b363c4 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesOrderedByProperty.cshtml @@ -0,0 +1,21 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage +@* + Macro parameter to be set on the macro + Show:True Alias:propertyAlias Name:Property Alias Type:Textstring +*@ + + +@{ + + @* Get the property alias we want to filter on from the macro parameter *@ + var propertyAlias = Model.MacroParameters["propertyAlias"]; + var selection = CurrentPage.Children.Where("Visible").OrderBy(propertyAlias); +} + + +
    + @foreach (var page in selection) + { +
  • @page.Name
  • + } +
diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesWithDoctype.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesWithDoctype.cshtml new file mode 100644 index 0000000000..12077f82b6 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListChildPagesWithDoctype.cshtml @@ -0,0 +1,32 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage + +@* + This snippet shows how simple it is to fetch only children of a certain Document Type using Razor. Instead of + calling .Children, simply call .AliasOfDocumentType in plural. + For instance .Textpages or .NewsArticles (you can find the alias of your Document Type by editing it in the + Settings section). +*@ + + +@{ + @*Build a query and return the visible items *@ + var selection= CurrentPage.Textpages.Where("Visible"); + + @* + Example of more querying, if you have a true/false property with the alias of shouldBeFeatured: + var selection= Model.Textpages.Where("shouldBeFeatured == true").Where("Visible"); + *@ +} + + +@*Determine if there are any nodes in the selection, then render list *@ +@if(selection.Any()){ + +
    + @foreach(var page in selection){ +
  • @page.Name
  • + } +
+ +} + diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListDescendantsFromCurrentPage.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListDescendantsFromCurrentPage.cshtml new file mode 100644 index 0000000000..0cf32ad868 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListDescendantsFromCurrentPage.cshtml @@ -0,0 +1,54 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage + +@* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@ +@if (CurrentPage.Children.Where("Visible").Any()) +{ + @* Get the first page in the children, where the property umbracoNaviHide is not True *@ + var naviLevel = CurrentPage.Children.Where("Visible").First().Level; + + @* Add in level for a CSS hook *@ +
    + @* For each child page under the root node, where the property umbracoNaviHide is not True *@ + @foreach (var childPage in CurrentPage.Children.Where("Visible")) + { +
  • + @childPage.Name + + @* if the current page has any children, where the property umbracoNaviHide is not True *@ + @if (childPage.Children.Where("Visible").Any()) + { + @* Call our helper to display the children *@ + @childPages(childPage.Children) + } +
  • + } +
+} + + +@helper childPages(dynamic pages) + { + @* Ensure that we have a collection of pages *@ + if (pages.Any()) + { + @* Get the first page in pages and get the level *@ + var naviLevel = pages.First().Level; + + @* Add in level for a CSS hook *@ +
    + @foreach (var page in pages.Where("Visible")) + { +
  • + @page.Name + + @* if the current page has any children, where the property umbracoNaviHide is not True *@ + @if (page.Children.Where("Visible").Any()) + { + @* Call our helper to display the children *@ + @childPages(page.Children) + } +
  • + } +
+ } +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListImagesFromMediaFolder.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListImagesFromMediaFolder.cshtml new file mode 100644 index 0000000000..dc63da00f8 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/ListImagesFromMediaFolder.cshtml @@ -0,0 +1,23 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage + +@* +Macro Parameters To Create, for this macro to work: +Show:True Alias:mediaId Name:Media Folder ID Type:MediaCurrent +*@ + +@if (Model.MacroParameters["mediaId"] != null) +{ + @* Get the media folder as a dynamic node *@ + var mediaFolder = Umbraco.Media(Model.MacroParameters["mediaId"]); + + if (mediaFolder.Children.Any()) + { +
    + @* for each item in children of the selected media folder *@ + @foreach (var mediaItem in mediaFolder.Children) + { +
  • @mediaItem.Name
  • + } +
+ } +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/MultinodeTree-picker.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/MultinodeTree-picker.cshtml new file mode 100644 index 0000000000..46dfe4a7b5 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/MultinodeTree-picker.cshtml @@ -0,0 +1,20 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage + +@* + Macro to list nodes from a Multinode tree picker, using the pickers default settings. + Content Values stored as xml. + + To get it working with any site's data structure, simply set the selection equal to the property which has the + multinode treepicker (so: replace "PropertyWithPicker" with the alias of your property). +*@ + +@* Lists each selected value from the picker as a link *@ +
    + @foreach(var id in CurrentPage.PropertyWithPicker){ + + @*For each link, get the node, and display its name and url*@ + var content = Umbraco.Content(id.InnerText); + +
  • @content.Name
  • + } +
\ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Navigation.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Navigation.cshtml new file mode 100644 index 0000000000..9b066b9706 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Navigation.cshtml @@ -0,0 +1,22 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage + +@* + Macro to display child pages below the root page of a standard website. + Also highlights the current active page/section in the navigation with + the css class "current". +*@ + + +@{ + @*Get the root of the website *@ + var root = CurrentPage.AncestorOrSelf(1); +} + +
    + @foreach (var page in root.Children.Where("Visible")) + { +
  • + @page.Name +
  • + } +
diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/SiteMap.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/SiteMap.cshtml new file mode 100644 index 0000000000..94aab238f8 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/SiteMap.cshtml @@ -0,0 +1,32 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage + +@*Render the sitemap by passing the root node to the traverse helper*@ +
+ @Traverse(CurrentPage.AncestorOrSelf()) +
+ +@*Helper method to travers through all descendants*@ +@helper Traverse(dynamic node) +{ + @* Update the level to reflect how deep you want the sitemap to go *@ + var maxLevelForSitemap = 4; + + @*Select visible children *@ + var items = node.Children.Where("Visible").Where("Level <= " + maxLevelForSitemap); + + @*If any items are returned, render a list *@ + if (items.Any()) + { +
    + @foreach (var item in items) + { +
  • + @item.Name + + @*Run the traverse helper again *@ + @Traverse(item) +
  • + } +
+ } +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Breadcrumb.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Breadcrumb.cshtml new file mode 100644 index 0000000000..3f3dcfd3b6 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Breadcrumb.cshtml @@ -0,0 +1,22 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage +@* + This snippet makes a breadcrumb of parents using an unordred html list. + + How it works: + - It uses the Ancestors() method to get all parents and then generates links so the visitor get go back + - Finally it outputs the name of the current page (without a link) +*@ + +@if (CurrentPage.Ancestors().Any()) +{ + +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/EditProfile.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/EditProfile.cshtml new file mode 100644 index 0000000000..80fdff9e68 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/EditProfile.cshtml @@ -0,0 +1,54 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage + +@using System.Web.Mvc.Html +@using ClientDependency.Core.Mvc +@using umbraco.cms.businesslogic.member +@using Umbraco.Web +@using Umbraco.Web.Models +@using Umbraco.Web.Controllers + +@{ + var profileModel = new ProfileModel(); + + Html.EnableClientValidation(); + Html.EnableUnobtrusiveJavaScript(); + Html.RequiresJs("/umbraco_client/ui/jquery.js"); + Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.min.js"); + Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.unobtrusive.min.js"); +} + +@if (Member.IsLoggedOn()) +{ + @Html.RenderJsHere() + + using (Html.BeginUmbracoForm("HandleUpdateProfile")) + { +
+ Edit profile + + @Html.ValidationSummary(true) + + @Html.LabelFor(m => profileModel.Name) + @Html.TextBoxFor(m => profileModel.Name) + @Html.ValidationMessageFor(m => profileModel.Name) +
+ + @Html.LabelFor(m => profileModel.Email) + @Html.TextBoxFor(m => profileModel.Email) + @Html.ValidationMessageFor(m => profileModel.Email) +
+ + @for (var i = 0; i < profileModel.MemberProperties.Count; i++) + { + @Html.LabelFor(m => profileModel.MemberProperties[i].Value, profileModel.MemberProperties[i].Name) + @Html.EditorFor(m => profileModel.MemberProperties[i].Value) + @Html.HiddenFor(m => profileModel.MemberProperties[i].Alias) +
+ } + + @Html.HiddenFor(m => profileModel.MemberTypeAlias) + + +
+ } +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/EmptyTemplate.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/EmptyTemplate.cshtml index 2363dcc14c..e69de29bb2 100644 --- a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/EmptyTemplate.cshtml +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/EmptyTemplate.cshtml @@ -1 +0,0 @@ -@inherits Umbraco.Web.Mvc.UmbracoTemplatePage \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListAncestorsFromCurrentPage.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListAncestorsFromCurrentPage.cshtml new file mode 100644 index 0000000000..7ce864c204 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListAncestorsFromCurrentPage.cshtml @@ -0,0 +1,16 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage + +@* Check the current page has ancestors *@ +@if (CurrentPage.Ancestors().Any()) +{ +
    + @* For each page in the ancestors collection which have been ordered by Level (so we start with the highest top node first) *@ + @foreach (var page in CurrentPage.Ancestors().OrderBy("Level")) + { +
  • @page.Name »
  • + } + + @* Display the current page as the last item in the list *@ +
  • @CurrentPage.Name
  • +
+} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesFromCurrentPage.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesFromCurrentPage.cshtml new file mode 100644 index 0000000000..d53af0560b --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesFromCurrentPage.cshtml @@ -0,0 +1,15 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage + +@* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@ +@if (CurrentPage.Children.Where("Visible").Any()) +{ +
    + @* For each child page under the root node, where the property umbracoNaviHide is not True *@ + @foreach (var childPage in CurrentPage.Children.Where("Visible")) + { +
  • + @childPage.Name +
  • + } +
+} diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesOrderedByDate.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesOrderedByDate.cshtml new file mode 100644 index 0000000000..e504430b9a --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesOrderedByDate.cshtml @@ -0,0 +1,10 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage + +
    + @*OrderBy() takes the property to sort by and optionally order desc/asc *@ + + @foreach (var page in CurrentPage.Children.Where("Visible").OrderBy("CreateDate desc")) + { +
  • @page.Name
  • + } +
diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesOrderedByName.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesOrderedByName.cshtml new file mode 100644 index 0000000000..92324b627d --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesOrderedByName.cshtml @@ -0,0 +1,8 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage +
    + @*OrderBy() takes the property to sort by*@ + @foreach (var page in CurrentPage.Children.Where("Visible").OrderBy("Name")) + { +
  • @page.Name
  • + } +
diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesWithDoctype.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesWithDoctype.cshtml new file mode 100644 index 0000000000..322058b881 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesWithDoctype.cshtml @@ -0,0 +1,32 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage + +@* + This snippet shows how simple it is to fetch only children of a certain Document Type using Razor. Instead of + calling .Children, simply call .AliasOfDocumentType in plural. + For instance .Textpages or .NewsArticles (you can find the alias of your Document Type by editing it in the + Settings section). +*@ + + +@{ + @*Build a query and return the visible items *@ + var selection= CurrentPage.Textpages.Where("Visible"); + + @* + Example of more querying, if you have a true/false property with the alias of shouldBeFeatured: + var selection= Model.Textpages.Where("shouldBeFeatured == true").Where("Visible"); + *@ +} + + +@*Determine if there are any nodes in the selection, then render list *@ +@if(selection.Any()){ + +
    + @foreach(var page in selection){ +
  • @page.Name
  • + } +
+ +} + diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListDescendantsFromCurrentPage.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListDescendantsFromCurrentPage.cshtml new file mode 100644 index 0000000000..76642a68f6 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListDescendantsFromCurrentPage.cshtml @@ -0,0 +1,54 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage + +@* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@ +@if (CurrentPage.Children.Where("Visible").Any()) +{ + @* Get the first page in the children, where the property umbracoNaviHide is not True *@ + var naviLevel = CurrentPage.Children.Where("Visible").First().Level; + + @* Add in level for a CSS hook *@ +
    + @* For each child page under the root node, where the property umbracoNaviHide is not True *@ + @foreach (var childPage in CurrentPage.Children.Where("Visible")) + { +
  • + @childPage.Name + + @* if the current page has any children, where the property umbracoNaviHide is not True *@ + @if (childPage.Children.Where("Visible").Any()) + { + @* Call our helper to display the children *@ + @childPages(childPage.Children) + } +
  • + } +
+} + + +@helper childPages(dynamic pages) + { + @* Ensure that we have a collection of pages *@ + if (pages.Any()) + { + @* Get the first page in pages and get the level *@ + var naviLevel = pages.First().Level; + + @* Add in level for a CSS hook *@ +
    + @foreach (var page in pages.Where("Visible")) + { +
  • + @page.Name + + @* if the current page has any children, where the property umbracoNaviHide is not True *@ + @if (page.Children.Where("Visible").Any()) + { + @* Call our helper to display the children *@ + @childPages(page.Children) + } +
  • + } +
+ } +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Login.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Login.cshtml new file mode 100644 index 0000000000..be4e04eeae --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Login.cshtml @@ -0,0 +1,40 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage + +@using System.Web.Mvc.Html +@using ClientDependency.Core.Mvc +@using Umbraco.Web +@using Umbraco.Web.Models +@using Umbraco.Web.Controllers + +@{ + var loginModel = new LoginModel(); + + Html.EnableClientValidation(); + Html.EnableUnobtrusiveJavaScript(); + Html.RequiresJs("/umbraco_client/ui/jquery.js"); + Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.min.js"); + Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.unobtrusive.min.js"); +} + +@Html.RenderJsHere() + +@using (Html.BeginUmbracoForm("HandleLogin")) +{ +
+ Login + + @Html.ValidationSummary(true) + + @Html.LabelFor(m => loginModel.Username) + @Html.TextBoxFor(m => loginModel.Username) + @Html.ValidationMessageFor(m => loginModel.Username) +
+ + @Html.LabelFor(m => loginModel.Password) + @Html.PasswordFor(m => loginModel.Password) + @Html.ValidationMessageFor(m => loginModel.Password) +
+ + +
+} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/LoginStatus.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/LoginStatus.cshtml new file mode 100644 index 0000000000..4f9b30d9c0 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/LoginStatus.cshtml @@ -0,0 +1,31 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage + +@using ClientDependency.Core.Mvc +@using Umbraco.Web +@using Umbraco.Web.Models +@using Umbraco.Web.Controllers + +@{ + var loginStatusModel = new LoginStatusModel(); + + Html.EnableClientValidation(); + Html.EnableUnobtrusiveJavaScript(); + Html.RequiresJs("/umbraco_client/ui/jquery.js"); + Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.min.js"); + Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.unobtrusive.min.js"); +} + +@Html.RenderJsHere() + +@if (loginStatusModel.IsLoggedIn) +{ +

You are currently logged in as @loginStatusModel.Name

+ + using (Html.BeginUmbracoForm("HandleLogout")) + { +
+ Logout + +
+ } +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/MultinodeTree-picker.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/MultinodeTree-picker.cshtml new file mode 100644 index 0000000000..2cefb8d8ba --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/MultinodeTree-picker.cshtml @@ -0,0 +1,20 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage + +@* + Macro to list nodes from a Multinode tree picker, using the pickers default settings. + Content Values stored as xml. + + To get it working with any site's data structure, simply set the selection equal to the property which has the + multinode treepicker (so: replace "PropertyWithPicker" with the alias of your property). +*@ + +@* Lists each selected value from the picker as a link *@ +
    + @foreach(var id in CurrentPage.PropertyWithPicker){ + + @*For each link, get the node, and display its name and url*@ + var content = Umbraco.Content(id.InnerText); + +
  • @content.Name
  • + } +
\ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Navigation.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Navigation.cshtml new file mode 100644 index 0000000000..cd9efe8b35 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Navigation.cshtml @@ -0,0 +1,22 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage + +@* + Macro to display child pages below the root page of a standard website. + Also highlights the current active page/section in the navigation with + the css class "current". +*@ + + +@{ + @*Get the root of the website *@ + var root = CurrentPage.AncestorOrSelf(1); +} + +
    + @foreach (var page in root.Children.Where("Visible")) + { +
  • + @page.Name +
  • + } +
diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/RegisterMember.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/RegisterMember.cshtml new file mode 100644 index 0000000000..b0a7cbcf7f --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/RegisterMember.cshtml @@ -0,0 +1,90 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage + +@using System.Web.Mvc.Html +@using ClientDependency.Core.Mvc +@using Umbraco.Web +@using Umbraco.Web.Models +@using Umbraco.Web.Controllers + +@{ + var registerModel = new RegisterModel(); + + @* + Configurable here: + + registerModel.MemberTypeAlias - the default is "Member" + + registerModel.RedirectOnSucces - the default is false + + registerModel.RedirectUrl - what page do we go to if the registration was successful? + the default is "/" unless RedirectOnSuccess is set to false + + registerModel.UsernameIsEmail - the default is true + if you want the username to be different from the email + address, set this to true and add a new Username field in + the form below + + @Html.LabelFor(m => registerModel.Username) + @Html.TextBoxFor(m => registerModel.Username) + @Html.ValidationMessageFor(m => registerModel.Username) + *@ + + Html.EnableClientValidation(); + Html.EnableUnobtrusiveJavaScript(); + Html.RequiresJs("/umbraco_client/ui/jquery.js"); + Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.min.js"); + Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.unobtrusive.min.js"); + + var success = TempData["FormSuccess"] != null; +} + +@if (success) +{ + // This message will show if RedirectOnSucces is set to false (default) +

Registration succeeeded.

+} +else +{ + using (Html.BeginUmbracoForm("HandleRegisterMember")) + { +
+ Register Member + + @Html.ValidationSummary(true) + + @Html.LabelFor(m => registerModel.Name) + @Html.TextBoxFor(m => registerModel.Name) + @Html.ValidationMessageFor(m => registerModel.Name) +
+ + @Html.LabelFor(m => registerModel.Email) + @Html.TextBoxFor(m => registerModel.Email) + @Html.ValidationMessageFor(m => registerModel.Email) +
+ + @Html.LabelFor(m => registerModel.Password) + @Html.PasswordFor(m => registerModel.Password) + @Html.ValidationMessageFor(m => registerModel.Password) +
+ + @if (registerModel.MemberProperties != null) { + for (var i = 0; i < registerModel.MemberProperties.Count; i++) + { + @Html.LabelFor(m => registerModel.MemberProperties[i].Value, registerModel.MemberProperties[i].Name) + @Html.EditorFor(m => registerModel.MemberProperties[i].Value) + @Html.HiddenFor(m => registerModel.MemberProperties[i].Alias) +
+ } + } + + @Html.HiddenFor(m => registerModel.MemberTypeAlias) + @Html.HiddenFor(m => registerModel.RedirectOnSucces) + @Html.HiddenFor(m => registerModel.RedirectUrl) + @Html.HiddenFor(m => registerModel.UsernameIsEmail) + + +
+ + @Html.RenderJsHere() + } +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/SiteMap.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/SiteMap.cshtml new file mode 100644 index 0000000000..6e08a509cd --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/SiteMap.cshtml @@ -0,0 +1,32 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage + +@*Render the sitemap by passing the root node to the traverse helper*@ +
+ @Traverse(CurrentPage.AncestorOrSelf()) +
+ +@*Helper method to travers through all descendants*@ +@helper Traverse(dynamic node) +{ + @* Update the level to reflect how deep you want the sitemap to go *@ + var maxLevelForSitemap = 4; + + @*Select visible children *@ + var items = node.Children.Where("Visible").Where("Level <= " + maxLevelForSitemap); + + @*If any items are returned, render a list *@ + if (items.Any()) + { +
    + @foreach (var item in items) + { +
  • + @item.Name + + @*Run the traverse helper again *@ + @Traverse(item) +
  • + } +
+ } +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/create/PartialView.ascx b/src/Umbraco.Web.UI/Umbraco/create/PartialView.ascx index d08c2ef062..e3b50216ab 100644 --- a/src/Umbraco.Web.UI/Umbraco/create/PartialView.ascx +++ b/src/Umbraco.Web.UI/Umbraco/create/PartialView.ascx @@ -12,14 +12,10 @@ Filename (without .cshtml):
- Choose a template:
+ Choose a snippet:
-
- -
- -
Choose a template:
+
Choose a snippet:
diff --git a/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx.cs b/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx.cs index 077d60c87f..8ed79da349 100644 --- a/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx.cs +++ b/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx.cs @@ -21,18 +21,19 @@ namespace Umbraco.Web.UI.Umbraco.Create private static void LoadTemplates(ListControl list) { - var path = IOHelper.MapPath(SystemDirectories.Umbraco + "/partialviewmacros/templates/"); + var path = IOHelper.MapPath(SystemDirectories.Umbraco + "/PartialViewMacros/Templates/"); list.Items.Clear(); - // always add the option of an empty one - list.Items.Add(new ListItem("Empty template", "EmptyTemplate.cshtml")); + // always add the options of empty templates + list.Items.Add(new ListItem("Empty Template", "EmptyTemplate.cshtml")); + list.Items.Add(new ListItem("Empty Template (For Use With Custom Views)", "EmptyTemplate (ForUseWithCustomViews).cshtml")); if (System.IO.Directory.Exists(path)) { const string extension = ".cshtml"; //Already adding Empty Template as the first item, so don't add it again - foreach (var fileInfo in new System.IO.DirectoryInfo(path).GetFiles("*" + extension).Where(f => f.Name != "EmptyTemplate.cshtml")) + foreach (var fileInfo in new System.IO.DirectoryInfo(path).GetFiles("*" + extension).Where(f => f.Name.StartsWith("EmptyTemplate") == false)) { var filename = System.IO.Path.GetFileName(fileInfo.FullName); @@ -52,8 +53,7 @@ namespace Umbraco.Web.UI.Umbraco.Create var createMacroVal = 0; if (CreateMacroCheckBox.Checked) createMacroVal = 1; - - + string returnUrl = dialogHandler_temp.Create(Request.GetItemAsString("nodeType"), createMacroVal, //apparently we need to pass this value to 'ParentID'... of course! :P then we'll extract it in PartialViewTasks to create it. PartialViewTemplate.SelectedValue + "|||" + FileName.Text); @@ -63,7 +63,6 @@ namespace Umbraco.Web.UI.Umbraco.Create .ChildNodeCreated() .CloseModalWindow(); } - } } } \ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco/create/xslt.ascx b/src/Umbraco.Web.UI/umbraco/create/xslt.ascx index ceed6abbb7..eb9c572e20 100644 --- a/src/Umbraco.Web.UI/umbraco/create/xslt.ascx +++ b/src/Umbraco.Web.UI/umbraco/create/xslt.ascx @@ -4,7 +4,7 @@ Filename (without .xslt): -
Choose a template:
+
Choose a snippet:
Clean diff --git a/src/Umbraco.Web.UI/umbraco/scripting/templates/cshtml/TwitterFeed.cshtml b/src/Umbraco.Web.UI/umbraco/scripting/templates/cshtml/TwitterFeed.cshtml deleted file mode 100644 index 86cbe66514..0000000000 --- a/src/Umbraco.Web.UI/umbraco/scripting/templates/cshtml/TwitterFeed.cshtml +++ /dev/null @@ -1,217 +0,0 @@ -@inherits umbraco.MacroEngines.DynamicNodeContext - - -@{ - @* - Macro Parameters To Create - Show:True Alias:twitterUsername Name:Twitter Username Type:Textstring Defaults to: umbraco - Show:True Alias:includeRTs Name:Include Retweets Type:Textstring Defaults to: false - Show:True Alias:excludeReplies Name:Exclude Replies Type:Textstring Defaults to: false - Show:True Alias:noTweets Name:Number of Tweets Type:Integer Defaults to: 1 - *@ - - var twitterUsername = String.IsNullOrEmpty(Parameter.twitterUsername) ? "umbraco" : Parameter.twitterUsername; - var includeRTs = String.IsNullOrEmpty(Parameter.includeRTs) ? false : Parameter.includeRTs; - var excludeReplies = String.IsNullOrEmpty(Parameter.excludeReplies) ? false : Parameter.excludeReplies; - var noTweets = String.IsNullOrEmpty(Parameter.noTweets) ? 1 : Parameter.noTweets; - - - @* Twitter JSON URL *@ - var twitterURL = string.Format( - "https://api.twitter.com/1/statuses/user_timeline.json?screen_name={0}&include_rts={1}&exclude_replies={2}&include_entities=1&count={3}", - twitterUsername, - includeRTs, - excludeReplies, - noTweets); -} - - -@* Fetch the JSON from Twitters API *@ -@using (var client = new System.Net.WebClient()) -{ - @* Fetch the JSON from Twitter *@ - var response = client.DownloadString(new Uri(twitterURL)); - - @* Decode the JSON so we can interate over it *@ - var tweets = Json.Decode(response); - -
    - @foreach (var tweet in tweets) - { -
  • - @* Tweet with formatted links *@ -

    @formatLinks(tweet.text, tweet.entities)

    - -

    - @* Format Tweet Date and ouput as 24/03/12 @14:05 *@ - @formatDate(tweet.created_at).ToString("dd/MM/yy @ HH:mm") -

    - -

    - @* Profile Image *@ - @tweet.user.Name - - @* Your real name (not profile name) *@ - @tweet.user.name -

    - - @* Google Map (if tweet has geo info) *@ - @if (tweet.geo != null) - { - @Html.Raw(displayMap(tweet.geo)); - } - - @* Dislay Image (if tweet has image attached *@ - @if (tweet.entities.media != null) - { - - - - } -
  • - } -
-} - -@functions -{ - DateTime formatDate(string twitterDate) - { - //Example tweet date - //Fri Mar 02 16:09:35 +0000 2012 - //ddd MMM dd HH:mm:ss zz00 yyyy - DateTime tweetDate = DateTime.ParseExact(twitterDate, "ddd MMM dd HH:mm:ss zz00 yyyy", null); - - return tweetDate; - } - - String displayMap(dynamic geo) - { - //Get the lat & long values - var tweetLat = geo.coordinates[0]; - var tweetLong = geo.coordinates[1]; - - //Format the string to return the image - var googleMap = string.Format("http://maps.googleapis.com/maps/api/staticmap?center={0},{1}&zoom=14&size=250x250&maptype=roadmap&sensor=false&markers={0}, {1}", tweetLat, tweetLong); - var mapImage = string.Format("map", googleMap); - - return mapImage; - } - - IHtmlString formatLinks(string tweet, dynamic entities) - { - //A List of tweet entities so we can sort all of them - IList tweetEntities = new List(); - - //Get URLs - var links = entities.urls; - - //Check we have links to loop over - if (links != null) - { - //For each link in the collection of links - foreach (var link in links) - { - var startPosition = link.indices[0]; - var endPosition = link.indices[1]; - var length = endPosition - startPosition; - - var url = link.url; //The short t.co link - var displayURL = link.display_url; //A friendly version of the full link (may be truncated) - - var newText = string.Format("{1}", url, displayURL); - var oldText = tweet.Substring(startPosition, length); - - - //Create a new entity - tweetEntity entity = new tweetEntity(); - entity.startPosition = startPosition; - entity.endPosition = endPosition; - entity.newText = newText; - entity.oldText = oldText; - - //Add it to the collection - tweetEntities.Add(entity); - } - } - - - //Get user mentions (@umbraco) - var mentions = entities.user_mentions; - - //Check we have mentions to loop over - if (mentions != null) - { - //For each mention in the collection of mentions - foreach (var mention in mentions) - { - var startPosition = mention.indices[0]; - var endPosition = mention.indices[1]; - var length = endPosition - startPosition; - - var username = mention.screen_name; - - var newText = string.Format("@{0}", username); - var oldText = tweet.Substring(startPosition, length); - - //Create a new entity - tweetEntity entity = new tweetEntity(); - entity.startPosition = startPosition; - entity.endPosition = endPosition; - entity.newText = newText; - entity.oldText = oldText; - - //Add to collection - tweetEntities.Add(entity); - } - } - - //Get hashtags - var hashtags = entities.hashtags; - - //Check we have hash to loop over - if (hashtags != null) - { - foreach (var hash in hashtags) - { - var startPosition = hash.indices[0]; - var endPosition = hash.indices[1]; - var length = endPosition - startPosition; - var hashtag = hash.text; - - var newText = string.Format("#{0}", hashtag); - var oldText = tweet.Substring(startPosition, length); - - //Create a new entity - tweetEntity entity = new tweetEntity(); - entity.startPosition = startPosition; - entity.endPosition = endPosition; - entity.newText = newText; - entity.oldText = oldText; - - //Add to collection - tweetEntities.Add(entity); - } - } - - //For each item in the tweet entities in reverse order - //If we update the string in reverse order the remaining start/end indexs will still be correct - foreach (var item in tweetEntities.OrderByDescending(x => x.startPosition)) - { - //Lets update the tweet text - tweet = tweet.Replace(item.oldText, item.newText); - } - - - //Return the new tweet with all the links added in - return Html.Raw(tweet); - } - - public class tweetEntity - { - public int startPosition { get; set; } - public int endPosition { get; set; } - public string oldText { get; set; } - public string newText { get; set; } - } -} \ No newline at end of file diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 6ad8ce6049..fea8dd65ec 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -582,7 +582,7 @@ ASPXCodeBehind - + ASPXCodeBehind @@ -1856,9 +1856,7 @@ - - ASPXCodeBehind - + @@ -1934,21 +1932,15 @@ - - ASPXCodeBehind - + UserControl - - ASPXCodeBehind - + - - ASPXCodeBehind - + ASPXCodeBehind diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/DLRScripting.ascx b/src/Umbraco.Web/umbraco.presentation/umbraco/create/DLRScripting.ascx index 9cbd9efb7a..8ee0c03943 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/DLRScripting.ascx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/DLRScripting.ascx @@ -10,7 +10,7 @@ Filename (without extension):
-
Choose a template:
+
Choose a snippet:
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MacroPartialViewTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MacroPartialViewTasks.cs deleted file mode 100644 index 515abb59d5..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MacroPartialViewTasks.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.IO; -using Umbraco.Core.CodeAnnotations; -using Umbraco.Web.Macros; - -namespace umbraco -{ - [UmbracoWillObsolete("http://issues.umbraco.org/issue/U4-1373", "This will one day be removed when we overhaul the create process")] - public class MacroPartialViewTasks : PartialViewTasks - { - protected override string ParentFolderName - { - get { return "MacroPartials"; } - } - - protected override void WriteTemplateHeader(StreamWriter sw) - { - //write out the template header - sw.Write("@inherits "); - sw.Write(typeof(PartialViewMacroPage).FullName); - } - } -} \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs new file mode 100644 index 0000000000..f939ba51a9 --- /dev/null +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs @@ -0,0 +1,123 @@ +using System.IO; +using System.Web; +using Umbraco.Core.CodeAnnotations; +using Umbraco.Core.IO; +using Umbraco.Core.Logging; +using Umbraco.Web.Mvc; +using umbraco.BasePages; +using Umbraco.Core; + +namespace umbraco +{ + /// + /// The UI 'tasks' for the create dialog and delete processes + /// + [UmbracoWillObsolete("http://issues.umbraco.org/issue/U4-1373", "This will one day be removed when we overhaul the create process")] + public class PartialViewMacroTasks : interfaces.ITaskReturnUrl + { + private string _alias; + private int _parentId; + private int _typeId; + private int _userId; + + protected virtual string EditViewFile + { + get { return "Settings/Views/EditView.aspx"; } + } + + protected string BasePath + { + get { return SystemDirectories.MvcViews + "/" + ParentFolderName.EnsureEndsWith('/'); } + } + + protected virtual string ParentFolderName + { + get { return "MacroPartials"; } + } + + public int UserId + { + set { _userId = value; } + } + public int TypeID + { + set { _typeId = value; } + get { return _typeId; } + } + + + public string Alias + { + set { _alias = value; } + get { return _alias; } + } + + public int ParentID + { + set { _parentId = value; } + get { return _parentId; } + } + + public bool Save() + { + var pipesIndex = _alias.IndexOf("|||", System.StringComparison.Ordinal); + var template = _alias.Substring(0, pipesIndex).Trim(); + var fileName = _alias.Substring(pipesIndex + 3, _alias.Length - pipesIndex - 3) + ".cshtml"; + + var fullFilePath = IOHelper.MapPath(BasePath + fileName); + + //return the link to edit the file if it already exists + if (File.Exists(fullFilePath)) + { + _returnUrl = string.Format(EditViewFile + "?file={0}", HttpUtility.UrlEncode(ParentFolderName.EnsureEndsWith('/') + fileName)); + return true; + } + + //create the file + using (var sw = File.CreateText(fullFilePath)) + { + using (var templateFile = File.OpenText(IOHelper.MapPath(SystemDirectories.Umbraco + "/PartialViewMacros/Templates/" + template))) + { + var templateContent = templateFile.ReadToEnd(); + sw.Write(templateContent); + } + } + + // Create macro? + if (ParentID == 1) + { + var name = fileName + .Substring(0, (fileName.LastIndexOf('.') + 1)).Trim('.') + .SplitPascalCasing().ToFirstUpperInvariant(); + var m = cms.businesslogic.macro.Macro.MakeNew(name); + m.ScriptingFile = BasePath + fileName; + } + + _returnUrl = string.Format(EditViewFile + "?file={0}", HttpUtility.UrlEncode(ParentFolderName.EnsureEndsWith('/') + fileName)); + return true; + } + + public bool Delete() + { + var path = IOHelper.MapPath(BasePath + _alias.TrimStart('/')); + + if (File.Exists(path)) + File.Delete(path); + else if (Directory.Exists(path)) + Directory.Delete(path, true); + + LogHelper.Info(string.Format("{0} Deleted by user {1}", _alias, UmbracoEnsuredPage.CurrentUser.Id)); + + return true; + } + + #region ITaskReturnUrl Members + private string _returnUrl = ""; + public string ReturnUrl + { + get { return _returnUrl; } + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs index 9d9e65f151..78550060a2 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs @@ -76,7 +76,7 @@ namespace umbraco //create the file using (var sw = File.CreateText(fullFilePath)) { - using (var templateFile = File.OpenText(IOHelper.MapPath(SystemDirectories.Umbraco + "/partialviews/templates/" + template))) + using (var templateFile = File.OpenText(IOHelper.MapPath(SystemDirectories.Umbraco + "/PartialViews/Templates/" + template))) { var templateContent = templateFile.ReadToEnd(); sw.Write(templateContent); @@ -97,13 +97,6 @@ namespace umbraco return true; } - protected virtual void WriteTemplateHeader(StreamWriter sw) - { - //write out the template header - sw.Write("@inherits "); - sw.Write(typeof(UmbracoTemplatePage).FullName.TrimEnd("`1")); - } - public bool Delete() { var path = IOHelper.MapPath(BasePath + _alias.TrimStart('/')); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/xslt.ascx b/src/Umbraco.Web/umbraco.presentation/umbraco/create/xslt.ascx index ceed6abbb7..eb9c572e20 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/xslt.ascx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/xslt.ascx @@ -4,7 +4,7 @@ Filename (without .xslt): -
Choose a template:
+
Choose a snippet:
Clean diff --git a/src/umbraco.sln b/src/umbraco.sln index fee2486039..2e6c017bee 100644 --- a/src/umbraco.sln +++ b/src/umbraco.sln @@ -1,5 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio 2013 +VisualStudioVersion = 12.0.20827.3 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{2849E9D4-3B4E-40A3-A309-F3CB4F0E125F}" ProjectSection(SolutionItems) = preProject ..\build\Build.bat = ..\build\Build.bat @@ -14,6 +16,23 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{FD962632-1 ..\docs\README.txt = ..\docs\README.txt EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{B5BD12C1-A454-435E-8A46-FF4A364C0382}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{66AB0414-D4F2-435C-9868-E25B6865D9A9}" + ProjectSection(SolutionItems) = preProject + .nuget\NuGet.Config = .nuget\NuGet.Config + .nuget\NuGet.exe = .nuget\NuGet.exe + .nuget\NuGet.targets = .nuget\NuGet.targets + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UmbracoExamine Libraries", "UmbracoExamine Libraries", "{DD32977B-EF54-475B-9A1B-B97A502C6E58}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuSpecs", "NuSpecs", "{227C3B55-80E5-4E7E-A802-BE16C5128B9D}" + ProjectSection(SolutionItems) = preProject + ..\build\NuSpecs\UmbracoCms.Core.nuspec = ..\build\NuSpecs\UmbracoCms.Core.nuspec + ..\build\NuSpecs\UmbracoCms.nuspec = ..\build\NuSpecs\UmbracoCms.nuspec + EndProjectSection +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Web.UI", "Umbraco.Web.UI\Umbraco.Web.UI.csproj", "{4C4C194C-B5E4-4991-8F87-4373E24CC19F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Web", "Umbraco.Web\Umbraco.Web.csproj", "{651E1350-91B6-44B7-BD60-7207006D7003}" @@ -38,35 +57,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlCE4Umbraco", "SQLCE4Umbr EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "umbraco.MacroEngines", "umbraco.MacroEngines\umbraco.MacroEngines.csproj", "{89C09045-1064-466B-B94A-DB3AFE2A5853}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{B5BD12C1-A454-435E-8A46-FF4A364C0382}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Core", "Umbraco.Core\Umbraco.Core.csproj", "{31785BC3-256C-4613-B2F5-A1B0BDDED8C1}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Tests", "Umbraco.Tests\Umbraco.Tests.csproj", "{5D3B8245-ADA6-453F-A008-50ED04BFE770}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{66AB0414-D4F2-435C-9868-E25B6865D9A9}" - ProjectSection(SolutionItems) = preProject - .nuget\NuGet.Config = .nuget\NuGet.Config - .nuget\NuGet.exe = .nuget\NuGet.exe - .nuget\NuGet.targets = .nuget\NuGet.targets - EndProjectSection -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UmbracoExamine", "UmbracoExamine\UmbracoExamine.csproj", "{07FBC26B-2927-4A22-8D96-D644C667FECC}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UmbracoExamine Libraries", "UmbracoExamine Libraries", "{DD32977B-EF54-475B-9A1B-B97A502C6E58}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UmbracoExamine.PDF", "UmbracoExamine.PDF\UmbracoExamine.PDF.csproj", "{F30DDDB8-3994-4673-82AE-057123C6E1A8}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UmbracoExamine.Azure", "UmbracoExamine.Azure\UmbracoExamine.Azure.csproj", "{73529637-28F5-419C-A6BB-D094E39DE614}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UmbracoExamine.PDF.Azure", "UmbracoExamine.PDF.Azure\UmbracoExamine.PDF.Azure.csproj", "{B555AAE6-0F56-442F-AC9F-EF497DB38DE7}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuSpecs", "NuSpecs", "{227C3B55-80E5-4E7E-A802-BE16C5128B9D}" - ProjectSection(SolutionItems) = preProject - ..\build\NuSpecs\UmbracoCms.Core.nuspec = ..\build\NuSpecs\UmbracoCms.Core.nuspec - ..\build\NuSpecs\UmbracoCms.nuspec = ..\build\NuSpecs\UmbracoCms.nuspec - EndProjectSection -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU From 3ff9d6adbc22eeaa9fc70153b8c5b9858e6cc338 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sun, 6 Oct 2013 16:55:54 +0200 Subject: [PATCH 10/17] U4-2509 Umbraco backend search not working correctly with spaces - Also updated search.aspx dialog --- .../umbraco/dialogs/search.aspx.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.cs index cba44bc41e..0b8137434e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.cs @@ -71,16 +71,19 @@ namespace umbraco.presentation.dialogs } else { - var operation = criteria.Field("__nodeName", txt.MultipleCharacterWildcard()); + var words = txt.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(w => w.ToLower().MultipleCharacterWildcard()).ToList(); + var operation = criteria.GroupedOr(new[] { "__nodeName" }, new[] { words[0] }); + words.RemoveAt(0); + foreach (var word in words) + operation = operation.And().GroupedOr(new[] { "__nodeName" }, new[] { word }); // ensure the user can only find nodes they are allowed to see - if (CurrentUser.StartNodeId > 0) + if (UmbracoContext.Current.UmbracoUser.StartNodeId > 0) { - operation = operation.And().Id(CurrentUser.StartNodeId); + operation = operation.And().Id(UmbracoContext.Current.UmbracoUser.StartNodeId); } results = internalSearcher.Search(operation.Compile()); - } nothingFound.Visible = !results.Any(); From 130f6d3a427d72e1c8a82a5e11f3bab80a11ddb8 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sun, 6 Oct 2013 17:52:46 +0200 Subject: [PATCH 11/17] Additions for U4-2776 Default Content For A Razor Layout Section --- src/Umbraco.Web/Mvc/UmbracoViewPage.cs | 6 ++++++ src/Umbraco.Web/WebViewPageExtensions.cs | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs index 39b9396e01..0f56fe6e55 100644 --- a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs +++ b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs @@ -1,5 +1,6 @@ using System; using System.Text; +using System.Web; using System.Web.Mvc; using System.Web.WebPages; using Umbraco.Core; @@ -178,5 +179,10 @@ namespace Umbraco.Web.Mvc { return WebViewPageExtensions.RenderSection(this, name, defaultContents); } + + public HelperResult RenderSection(string name, IHtmlString defaultContents) + { + return WebViewPageExtensions.RenderSection(this, name, defaultContents); + } } } \ No newline at end of file diff --git a/src/Umbraco.Web/WebViewPageExtensions.cs b/src/Umbraco.Web/WebViewPageExtensions.cs index 7d54a01b39..51f811061c 100644 --- a/src/Umbraco.Web/WebViewPageExtensions.cs +++ b/src/Umbraco.Web/WebViewPageExtensions.cs @@ -1,4 +1,6 @@ using System; +using System.Web; +using System.Web.Mvc; using System.Web.WebPages; namespace Umbraco.Web @@ -19,5 +21,10 @@ namespace Umbraco.Web { return webPage.IsSectionDefined(name) ? webPage.RenderSection(name) : new HelperResult(text => text.Write(defaultContents)); } + + public static HelperResult RenderSection(this WebPageBase webPage, string name, IHtmlString defaultContents) + { + return webPage.IsSectionDefined(name) ? webPage.RenderSection(name) : new HelperResult(text => text.Write(defaultContents)); + } } } From 34b7f86b8ba83663a8d8e7e610dbada263062fbb Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sun, 6 Oct 2013 18:24:46 +0200 Subject: [PATCH 12/17] U4-541 Wrong dictionary key when using in backend template names --- .../umbraco/Trees/loadNodeTypes.cs | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadNodeTypes.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadNodeTypes.cs index ae82b25b71..a5c7dbd7b8 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadNodeTypes.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadNodeTypes.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; +using umbraco.cms.businesslogic; +using umbraco.cms.businesslogic.language; using Umbraco.Core.Services; using umbraco.businesslogic; using umbraco.interfaces; @@ -21,8 +23,8 @@ namespace umbraco protected override void CreateRootNode(ref XmlTreeNode rootNode) { - rootNode.NodeType = "init" + TreeAlias; - rootNode.NodeID = "init"; + rootNode.NodeType = "init" + TreeAlias; + rootNode.NodeID = "init"; } protected override void CreateRootNodeActions(ref List actions) @@ -67,7 +69,7 @@ function openNodeType(id) { XmlTreeNode xNode = XmlTreeNode.Create(this); xNode.NodeID = docType.Id.ToString(CultureInfo.InvariantCulture); - xNode.Text = docType.Name; + xNode.Text = GetTranslatedNodeTypeName(docType.Name); xNode.Action = "javascript:openNodeType(" + docType.Id + ");"; xNode.Icon = "settingDataType.gif"; xNode.OpenIcon = "settingDataType.gif"; @@ -92,5 +94,23 @@ function openNodeType(id) { { get { return Services.ContentTypeService; } } + + private string GetTranslatedNodeTypeName(string originalName) + { + + if (originalName.StartsWith("#") == false) + return originalName; + + var lang = Language.GetByCultureCode(System.Threading.Thread.CurrentThread.CurrentCulture.Name); + + if (lang != null && Dictionary.DictionaryItem.hasKey(originalName.Substring(1, originalName.Length - 1))) + { + var dictionaryItem = new Dictionary.DictionaryItem(originalName.Substring(1, originalName.Length - 1)); + if (dictionaryItem != null) + return dictionaryItem.Value(lang.id); + } + + return "[" + originalName + "]"; + } } } From b2980cedc6e00a63a1eb84ae80dada2592c99f79 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sun, 6 Oct 2013 18:54:46 +0200 Subject: [PATCH 13/17] Also apply to media types - U4-541 Wrong dictionary key when using in backend template names --- src/Umbraco.Web/Umbraco.Web.csproj | 1 + .../umbraco/Trees/TranslateTreeNames.cs | 26 +++++++++++++++++++ .../umbraco/Trees/loadMediaTypes.cs | 3 ++- .../umbraco/Trees/loadNodeTypes.cs | 23 ++-------------- 4 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TranslateTreeNames.cs diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index fea8dd65ec..4ef3e0e0a0 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -404,6 +404,7 @@ ASPXCodeBehind + diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TranslateTreeNames.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TranslateTreeNames.cs new file mode 100644 index 0000000000..ff0a268a44 --- /dev/null +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TranslateTreeNames.cs @@ -0,0 +1,26 @@ +using System.Linq; +using umbraco.cms.businesslogic.language; + +namespace Umbraco.Web.umbraco.presentation.umbraco.Trees +{ + internal class TranslateTreeNames + { + public static string GetTranslatedName(string originalName) + { + + if (originalName.StartsWith("#") == false) + return originalName; + + var lang = Language.GetByCultureCode(System.Threading.Thread.CurrentThread.CurrentCulture.Name); + + if (lang != null && global::umbraco.cms.businesslogic.Dictionary.DictionaryItem.hasKey(originalName.Substring(1, originalName.Length - 1))) + { + var dictionaryItem = new global::umbraco.cms.businesslogic.Dictionary.DictionaryItem(originalName.Substring(1, originalName.Length - 1)); + if (dictionaryItem != null) + return dictionaryItem.Value(lang.id); + } + + return "[" + originalName + "]"; + } + } +} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMediaTypes.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMediaTypes.cs index 1f58cee995..835c46fdee 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMediaTypes.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMediaTypes.cs @@ -8,6 +8,7 @@ using umbraco.businesslogic; using umbraco.cms.presentation.Trees; using umbraco.interfaces; using Umbraco.Core; +using Umbraco.Web.umbraco.presentation.umbraco.Trees; namespace umbraco { @@ -50,7 +51,7 @@ function openMediaType(id) { XmlTreeNode xNode = XmlTreeNode.Create(this); xNode.NodeID = mediaType.Id.ToString(CultureInfo.InvariantCulture); - xNode.Text = mediaType.Name; + xNode.Text = TranslateTreeNames.GetTranslatedName(mediaType.Name); xNode.Action = string.Format("javascript:openMediaType({0});", mediaType.Id); xNode.Icon = "settingDataType.gif"; xNode.OpenIcon = "settingDataType.gif"; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadNodeTypes.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadNodeTypes.cs index a5c7dbd7b8..17a7482fcc 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadNodeTypes.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadNodeTypes.cs @@ -3,14 +3,13 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; -using umbraco.cms.businesslogic; -using umbraco.cms.businesslogic.language; using Umbraco.Core.Services; using umbraco.businesslogic; using umbraco.interfaces; using umbraco.BusinessLogic.Actions; using umbraco.cms.presentation.Trees; using Umbraco.Core; +using Umbraco.Web.umbraco.presentation.umbraco.Trees; namespace umbraco @@ -69,7 +68,7 @@ function openNodeType(id) { XmlTreeNode xNode = XmlTreeNode.Create(this); xNode.NodeID = docType.Id.ToString(CultureInfo.InvariantCulture); - xNode.Text = GetTranslatedNodeTypeName(docType.Name); + xNode.Text = TranslateTreeNames.GetTranslatedName(docType.Name); xNode.Action = "javascript:openNodeType(" + docType.Id + ");"; xNode.Icon = "settingDataType.gif"; xNode.OpenIcon = "settingDataType.gif"; @@ -94,23 +93,5 @@ function openNodeType(id) { { get { return Services.ContentTypeService; } } - - private string GetTranslatedNodeTypeName(string originalName) - { - - if (originalName.StartsWith("#") == false) - return originalName; - - var lang = Language.GetByCultureCode(System.Threading.Thread.CurrentThread.CurrentCulture.Name); - - if (lang != null && Dictionary.DictionaryItem.hasKey(originalName.Substring(1, originalName.Length - 1))) - { - var dictionaryItem = new Dictionary.DictionaryItem(originalName.Substring(1, originalName.Length - 1)); - if (dictionaryItem != null) - return dictionaryItem.Value(lang.id); - } - - return "[" + originalName + "]"; - } } } From 33b09c80aa4c20cb1a47432c8e78ce772309112a Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sun, 6 Oct 2013 18:55:52 +0200 Subject: [PATCH 14/17] Forgot to commit csproj file --- src/Umbraco.Web/Umbraco.Web.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 4ef3e0e0a0..6f2b84ff28 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -404,7 +404,7 @@ ASPXCodeBehind - + From a90f32035dad342e56b1109e31a7141987e4a6e8 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 7 Oct 2013 08:18:44 +0200 Subject: [PATCH 15/17] U4-2733 call to umbraco.library:Request broken? --- src/Umbraco.Web/UmbracoHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index c0b59819c4..bd5bc39c85 100644 --- a/src/Umbraco.Web/UmbracoHelper.cs +++ b/src/Umbraco.Web/UmbracoHelper.cs @@ -191,7 +191,7 @@ namespace Umbraco.Web var contentType = _umbracoContext.HttpContext.Response.ContentType; var traceIsEnabled = containerPage.Trace.IsEnabled; containerPage.Trace.IsEnabled = false; - _umbracoContext.HttpContext.Server.Execute(containerPage, output, false); + _umbracoContext.HttpContext.Server.Execute(containerPage, output, true); containerPage.Trace.IsEnabled = traceIsEnabled; //reset the content type _umbracoContext.HttpContext.Response.ContentType = contentType; From 12b7a9d8749b7234d000aa4f9f4b05befafcfbe6 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 7 Oct 2013 13:20:34 +0200 Subject: [PATCH 16/17] Argh, didn't save csproj file before committing. --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 41b0fe0ae1..d717813eb2 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -650,7 +650,6 @@ Dashboard.config - UI.xml From 16bce4248d9d37adc10b76ecfdeeda0eaafa02ee Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 8 Oct 2013 10:46:02 +1100 Subject: [PATCH 17/17] Fixes merge issues with 6.2 and copying across TempData properly. --- src/Umbraco.Web/Mvc/UmbracoPageResult.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/Mvc/UmbracoPageResult.cs b/src/Umbraco.Web/Mvc/UmbracoPageResult.cs index 6b44959c8c..f0904c64a4 100644 --- a/src/Umbraco.Web/Mvc/UmbracoPageResult.cs +++ b/src/Umbraco.Web/Mvc/UmbracoPageResult.cs @@ -27,8 +27,6 @@ namespace Umbraco.Web.Mvc { controller = CreateController(context, factory, routeDef); - controller.ViewData.ModelState.Merge(context.Controller.ViewData.ModelState); - CopyControllerData(context, controller); ExecuteControllerAction(context, controller); @@ -73,14 +71,29 @@ namespace Umbraco.Web.Mvc } /// - /// Ensure TempData and ViewData is copied across + /// Ensure ModelState, ViewData and TempData is copied across /// private static void CopyControllerData(ControllerContext context, ControllerBase controller) { + controller.ViewData.ModelState.Merge(context.Controller.ViewData.ModelState); + foreach (var d in context.Controller.ViewData) controller.ViewData[d.Key] = d.Value; - controller.TempData = context.Controller.TempData; + //We cannot simply merge the temp data because during controller execution it will attempt to 'load' temp data + // but since it has not been saved, there will be nothing to load and it will revert to nothing, so the trick is + // to Save the state of the temp data first then it will automatically be picked up. + // http://issues.umbraco.org/issue/U4-1339 + + var targetController = controller as Controller; + var sourceController = context.Controller as Controller; + if (targetController != null && sourceController != null) + { + targetController.TempDataProvider = sourceController.TempDataProvider; + targetController.TempData = sourceController.TempData; + targetController.TempData.Save(sourceController.ControllerContext, sourceController.TempDataProvider); + } + } ///