Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7

This commit is contained in:
Shannon
2016-08-11 14:06:49 +02:00
7 changed files with 102 additions and 34 deletions

View File

@@ -291,7 +291,19 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
true);
}
}
[ConfigurationProperty("EnableInheritedMediaTypes")]
internal InnerTextConfigurationElement<bool> EnableInheritedMediaTypes
{
get
{
return new OptionalInnerTextConfigurationElement<bool>(
(InnerTextConfigurationElement<bool>)this["EnableInheritedMediaTypes"],
//set the default
true);
}
}
string IContentSection.NotificationEmailAddress
{
get { return Notifications.NotificationEmailAddress; }
@@ -431,5 +443,10 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{
get { return EnableInheritedDocumentTypes; }
}
bool IContentSection.EnableInheritedMediaTypes
{
get { return EnableInheritedMediaTypes; }
}
}
}

View File

@@ -61,5 +61,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
string DefaultDocumentTypeProperty { get; }
bool EnableInheritedDocumentTypes { get; }
bool EnableInheritedMediaTypes { get; }
}
}

View File

@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Web;
namespace Umbraco.Tests.FrontEnd
@@ -48,5 +45,38 @@ namespace Umbraco.Tests.FrontEnd
Assert.AreEqual("Hello world, this is some text <a href='blah'>with&hellip;</a>", result);
}
[Test]
public void Create_Encrypted_RouteString_From_Anonymous_Object()
{
var additionalRouteValues = new
{
key1 = "value1",
key2 = "value2",
Key3 = "Value3",
keY4 = "valuE4"
};
var encryptedRouteString = UmbracoHelper.CreateEncryptedRouteString("FormController", "FormAction", "", additionalRouteValues);
var result = encryptedRouteString.DecryptWithMachineKey();
var expectedResult = "c=FormController&a=FormAction&ar=&key1=value1&key2=value2&Key3=Value3&keY4=valuE4";
Assert.AreEqual(expectedResult, result);
}
[Test]
public void Create_Encrypted_RouteString_From_Dictionary()
{
var additionalRouteValues = new Dictionary<string, object>()
{
{"key1", "value1"},
{"key2", "value2"},
{"Key3", "Value3"},
{"keY4", "valuE4"}
};
var encryptedRouteString = UmbracoHelper.CreateEncryptedRouteString("FormController", "FormAction", "", additionalRouteValues);
var result = encryptedRouteString.DecryptWithMachineKey();
var expectedResult = "c=FormController&a=FormAction&ar=&key1=value1&key2=value2&Key3=Value3&keY4=valuE4";
Assert.AreEqual(expectedResult, result);
}
}
}

View File

@@ -17,7 +17,7 @@ angular.module("umbraco.install").factory('installerService', function($rootScop
//add to umbraco installer facts here
var facts = ['Umbraco helped millions of people watch a man jump from the edge of space',
'Over 300 000 websites are currently powered by Umbraco',
'Over 370 000 websites are currently powered by Umbraco',
"At least 2 people have named their cat 'Umbraco'",
'On an average day, more than 1000 people download Umbraco',
'<a target="_blank" href="http://umbraco.tv">umbraco.tv</a> is the premier source of Umbraco video tutorials to get you started',
@@ -56,7 +56,7 @@ angular.module("umbraco.install").factory('installerService', function($rootScop
return (found) ? found.description : null;
}
//calculates the offset of the progressbar on the installaer
//calculates the offset of the progressbar on the installer
function calculateProgress(steps, next) {
var sorted = _.sortBy(steps, "serverOrder");

View File

@@ -1,24 +1,16 @@
using System.Collections.Generic;
using System.Linq;
using System.Web.Security;
using AutoMapper;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Security;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi.Filters;
using Constants = Umbraco.Core.Constants;
using System.Web.Http;
using System.Net;
using Umbraco.Core.PropertyEditors;
using System;
using System.Net.Http;
using System.Text;
using Umbraco.Web.WebApi;
using ContentType = System.Net.Mime.ContentType;
using Umbraco.Core.Services;
using Umbraco.Web.Models;
namespace Umbraco.Web.Editors
{
@@ -92,16 +84,18 @@ namespace Umbraco.Web.Editors
/// Returns the avilable compositions for this content type
/// This has been wrapped in a dto instead of simple parameters to support having multiple parameters in post request body
/// </summary>
/// <param name="contentTypeId"></param>
/// <param name="filterContentTypes">
/// <param name="filter.contentTypeId"></param>
/// <param name="filter.ContentTypes">
/// This is normally an empty list but if additional content type aliases are passed in, any content types containing those aliases will be filtered out
/// along with any content types that have matching property types that are included in the filtered content types
/// </param>
/// <param name="filterPropertyTypes">
/// <param name="filter.PropertyTypes">
/// This is normally an empty list but if additional property type aliases are passed in, any content types that have these aliases will be filtered out.
/// This is required because in the case of creating/modifying a content type because new property types being added to it are not yet persisted so cannot
/// be looked up via the db, they need to be passed in.
/// </param>
/// <param name="filter">
/// Filter applied when resolving compositions</param>
/// <returns></returns>
[HttpPost]
public HttpResponseMessage GetAvailableCompositeMediaTypes(GetAvailableCompositionsFilter filter)
@@ -117,8 +111,7 @@ namespace Umbraco.Web.Editors
public MediaTypeDisplay GetEmpty(int parentId)
{
var ct = new MediaType(parentId);
ct.Icon = "icon-picture";
var ct = new MediaType(parentId) {Icon = "icon-picture"};
var dto = Mapper.Map<IMediaType, MediaTypeDisplay>(ct);
return dto;

View File

@@ -47,9 +47,9 @@ namespace Umbraco.Web.Trees
.OrderBy(entity => entity.Name)
.Select(dt =>
{
var node = CreateTreeNode(dt.Id.ToString(), id, queryStrings, dt.Name, "icon-item-arrangement",
//NOTE: This is legacy now but we need to support upgrades. From 7.4+ we don't allow 'child' creations since
// this is an organiational thing and we do that with folders now.
var node = CreateTreeNode(dt.Id.ToString(), id, queryStrings, dt.Name, "icon-item-arrangement",
//NOTE: Since 7.4+ child type creation is enabled by a config option. It defaults to on, but can be disabled if we decide to.
//We need this check to keep supporting sites where childs have already been created.
dt.HasChildren());
node.Path = dt.Path;
@@ -101,8 +101,7 @@ namespace Umbraco.Web.Trees
else
{
var ct = Services.ContentTypeService.GetContentType(int.Parse(id));
IContentType parent = null;
parent = ct == null ? null : Services.ContentTypeService.GetContentType(ct.ParentId);
var parent = ct == null ? null : Services.ContentTypeService.GetContentType(ct.ParentId);
if (enableInheritedDocumentTypes)
{

View File

@@ -1,14 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Formatting;
using System.Text;
using System.Threading.Tasks;
using umbraco;
using umbraco.BusinessLogic.Actions;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Models;
using Umbraco.Core.Models.EntityBase;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.WebApi.Filters;
using Umbraco.Core.Services;
@@ -50,7 +47,11 @@ namespace Umbraco.Web.Trees
.OrderBy(entity => entity.Name)
.Select(dt =>
{
var node = CreateTreeNode(dt.Id.ToString(), id, queryStrings, dt.Name, "icon-item-arrangement", false);
var node = CreateTreeNode(dt.Id.ToString(), id, queryStrings, dt.Name, "icon-item-arrangement",
//NOTE: Since 7.4+ child type creation is enabled by a config option. It defaults to on, but can be disabled if we decide to.
//We need this check to keep supporting sites where childs have already been created.
dt.HasChildren());
node.Path = dt.Path;
return node;
}));
@@ -62,6 +63,8 @@ namespace Umbraco.Web.Trees
{
var menu = new MenuItemCollection();
var enableInheritedMediaTypes = UmbracoConfig.For.UmbracoSettings().Content.EnableInheritedMediaTypes;
if (id == Constants.System.Root.ToInvariantString())
{
//set the default to create
@@ -89,10 +92,34 @@ namespace Umbraco.Web.Trees
menu.Items.Add<RefreshNode, ActionRefresh>(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), hasSeparator: true);
}
else
{
menu.Items.Add<ActionDelete>(Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias)));
menu.Items.Add<ActionMove>(Services.TextService.Localize(string.Format("actions/{0}", ActionMove.Instance.Alias)), hasSeparator: true);
{
var ct = Services.ContentTypeService.GetMediaType(int.Parse(id));
var parent = ct == null ? null : Services.ContentTypeService.GetMediaType(ct.ParentId);
if (enableInheritedMediaTypes)
{
menu.Items.Add<ActionNew>(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias)));
//no move action if this is a child doc type
if (parent == null)
{
menu.Items.Add<ActionMove>(Services.TextService.Localize(string.Format("actions/{0}", ActionMove.Instance.Alias)), true);
}
}
else
{
menu.Items.Add<ActionMove>(Services.TextService.Localize(string.Format("actions/{0}", ActionMove.Instance.Alias)));
//no move action if this is a child doc type
if (parent == null)
{
menu.Items.Add<ActionMove>(Services.TextService.Localize(string.Format("actions/{0}", ActionMove.Instance.Alias)), true);
}
}
menu.Items.Add<ActionCopy>(Services.TextService.Localize(string.Format("actions/{0}", ActionCopy.Instance.Alias)));
menu.Items.Add<ActionDelete>(Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias)));
if (enableInheritedMediaTypes)
menu.Items.Add<RefreshNode, ActionRefresh>(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true);
}
return menu;