Merge branch 'temp8' of https://github.com/umbraco/Umbraco-CMS into temp8
This commit is contained in:
@@ -293,7 +293,6 @@ namespace Umbraco.Core.Configuration
|
||||
case LocalTempStorage.AspNetTemp:
|
||||
return System.IO.Path.Combine(HttpRuntime.CodegenDir, "UmbracoData");
|
||||
case LocalTempStorage.EnvironmentTemp:
|
||||
// TODO: why has this to be repeated everywhere?!
|
||||
// include the appdomain hash is just a safety check, for example if a website is moved from worker A to worker B and then back
|
||||
// to worker A again, in theory the %temp% folder should already be empty but we really want to make sure that its not
|
||||
// utilizing an old path - assuming we cannot have SHA1 collisions on AppDomainAppId
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace Umbraco.Core
|
||||
},
|
||||
{
|
||||
FailedPasswordAttempts,
|
||||
new PropertyType(PropertyEditors.Aliases.NoEdit, ValueStorageType.Integer, true, FailedPasswordAttempts)
|
||||
new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Integer, true, FailedPasswordAttempts)
|
||||
{
|
||||
Name = FailedPasswordAttemptsLabel
|
||||
}
|
||||
@@ -240,35 +240,35 @@ namespace Umbraco.Core
|
||||
},
|
||||
{
|
||||
LastLockoutDate,
|
||||
new PropertyType(PropertyEditors.Aliases.NoEdit, ValueStorageType.Date, true, LastLockoutDate)
|
||||
new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Date, true, LastLockoutDate)
|
||||
{
|
||||
Name = LastLockoutDateLabel
|
||||
}
|
||||
},
|
||||
{
|
||||
LastLoginDate,
|
||||
new PropertyType(PropertyEditors.Aliases.NoEdit, ValueStorageType.Date, true, LastLoginDate)
|
||||
new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Date, true, LastLoginDate)
|
||||
{
|
||||
Name = LastLoginDateLabel
|
||||
}
|
||||
},
|
||||
{
|
||||
LastPasswordChangeDate,
|
||||
new PropertyType(PropertyEditors.Aliases.NoEdit, ValueStorageType.Date, true, LastPasswordChangeDate)
|
||||
new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Date, true, LastPasswordChangeDate)
|
||||
{
|
||||
Name = LastPasswordChangeDateLabel
|
||||
}
|
||||
},
|
||||
{
|
||||
PasswordAnswer,
|
||||
new PropertyType(PropertyEditors.Aliases.NoEdit, ValueStorageType.Nvarchar, true, PasswordAnswer)
|
||||
new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Nvarchar, true, PasswordAnswer)
|
||||
{
|
||||
Name = PasswordAnswerLabel
|
||||
}
|
||||
},
|
||||
{
|
||||
PasswordQuestion,
|
||||
new PropertyType(PropertyEditors.Aliases.NoEdit, ValueStorageType.Nvarchar, true, PasswordQuestion)
|
||||
new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Nvarchar, true, PasswordQuestion)
|
||||
{
|
||||
Name = PasswordQuestionLabel
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Umbraco.Core
|
||||
/// DropDown List.
|
||||
/// </summary>
|
||||
public const string DropDownListFlexible = "Umbraco.DropDown.Flexible";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Grid.
|
||||
/// </summary>
|
||||
@@ -105,9 +105,9 @@ namespace Umbraco.Core
|
||||
public const string MultipleTextstring = "Umbraco.MultipleTextstring";
|
||||
|
||||
/// <summary>
|
||||
/// NoEdit.
|
||||
/// Label.
|
||||
/// </summary>
|
||||
public const string NoEdit = "Umbraco.NoEdit";
|
||||
public const string Label = "Umbraco.Label";
|
||||
|
||||
/// <summary>
|
||||
/// Picker Relations.
|
||||
@@ -118,7 +118,7 @@ namespace Umbraco.Core
|
||||
/// RadioButton list.
|
||||
/// </summary>
|
||||
public const string RadioButtonList = "Umbraco.RadioButtonList";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Slider.
|
||||
/// </summary>
|
||||
@@ -142,7 +142,7 @@ namespace Umbraco.Core
|
||||
/// <summary>
|
||||
/// TinyMCE
|
||||
/// </summary>
|
||||
public const string TinyMce = "Umbraco.TinyMCEv3";
|
||||
public const string TinyMce = "Umbraco.TinyMCE";
|
||||
|
||||
/// <summary>
|
||||
/// Boolean.
|
||||
@@ -163,7 +163,7 @@ namespace Umbraco.Core
|
||||
/// Upload Field.
|
||||
/// </summary>
|
||||
public const string UploadField = "Umbraco.UploadField";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Email Address.
|
||||
/// </summary>
|
||||
|
||||
@@ -271,12 +271,12 @@ namespace Umbraco.Core.Migrations.Install
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -88, EditorAlias = Constants.PropertyEditors.Aliases.TextBox, DbType = "Nvarchar" });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -89, EditorAlias = Constants.PropertyEditors.Aliases.TextArea, DbType = "Ntext" });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -90, EditorAlias = Constants.PropertyEditors.Aliases.UploadField, DbType = "Nvarchar" });
|
||||
InsertDataTypeDto(Constants.DataTypes.LabelString, Constants.PropertyEditors.Aliases.NoEdit, "Nvarchar", "{\"umbracoDataValueType\":\"STRING\"}");
|
||||
InsertDataTypeDto(Constants.DataTypes.LabelInt, Constants.PropertyEditors.Aliases.NoEdit, "Integer", "{\"umbracoDataValueType\":\"INT\"}");
|
||||
InsertDataTypeDto(Constants.DataTypes.LabelBigint, Constants.PropertyEditors.Aliases.NoEdit, "Nvarchar", "{\"umbracoDataValueType\":\"BIGINT\"}");
|
||||
InsertDataTypeDto(Constants.DataTypes.LabelDateTime, Constants.PropertyEditors.Aliases.NoEdit, "Date", "{\"umbracoDataValueType\":\"DATETIME\"}");
|
||||
InsertDataTypeDto(Constants.DataTypes.LabelDecimal, Constants.PropertyEditors.Aliases.NoEdit, "Decimal", "{\"umbracoDataValueType\":\"DECIMAL\"}");
|
||||
InsertDataTypeDto(Constants.DataTypes.LabelTime, Constants.PropertyEditors.Aliases.NoEdit, "Date", "{\"umbracoDataValueType\":\"TIME\"}");
|
||||
InsertDataTypeDto(Constants.DataTypes.LabelString, Constants.PropertyEditors.Aliases.Label, "Nvarchar", "{\"umbracoDataValueType\":\"STRING\"}");
|
||||
InsertDataTypeDto(Constants.DataTypes.LabelInt, Constants.PropertyEditors.Aliases.Label, "Integer", "{\"umbracoDataValueType\":\"INT\"}");
|
||||
InsertDataTypeDto(Constants.DataTypes.LabelBigint, Constants.PropertyEditors.Aliases.Label, "Nvarchar", "{\"umbracoDataValueType\":\"BIGINT\"}");
|
||||
InsertDataTypeDto(Constants.DataTypes.LabelDateTime, Constants.PropertyEditors.Aliases.Label, "Date", "{\"umbracoDataValueType\":\"DATETIME\"}");
|
||||
InsertDataTypeDto(Constants.DataTypes.LabelDecimal, Constants.PropertyEditors.Aliases.Label, "Decimal", "{\"umbracoDataValueType\":\"DECIMAL\"}");
|
||||
InsertDataTypeDto(Constants.DataTypes.LabelTime, Constants.PropertyEditors.Aliases.Label, "Date", "{\"umbracoDataValueType\":\"TIME\"}");
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -36, EditorAlias = Constants.PropertyEditors.Aliases.DateTime, DbType = "Date" });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -37, EditorAlias = Constants.PropertyEditors.Aliases.ColorPicker, DbType = "Nvarchar" });
|
||||
InsertDataTypeDto(Constants.DataTypes.DropDownSingle, Constants.PropertyEditors.Aliases.DropDownListFlexible, "Nvarchar", "{\"multiple\":false}");
|
||||
|
||||
@@ -135,6 +135,8 @@ namespace Umbraco.Core.Migrations.Upgrade
|
||||
.To<RadioAndCheckboxAndDropdownPropertyEditorsMigration>("{940FD19A-00A8-4D5C-B8FF-939143585726}")
|
||||
.As("{0576E786-5C30-4000-B969-302B61E90CA3}");
|
||||
|
||||
To<RenameLabelAndRichTextPropertyEditorAliases>("{E0CBE54D-A84F-4A8F-9B13-900945FD7ED9}");
|
||||
|
||||
//FINAL
|
||||
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
|
||||
var dataTypeDto = new DataTypeDto
|
||||
{
|
||||
NodeId = id,
|
||||
EditorAlias = Constants.PropertyEditors.Aliases.NoEdit,
|
||||
EditorAlias = Constants.PropertyEditors.Aliases.Label,
|
||||
DbType = dbType
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.Dtos;
|
||||
|
||||
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
|
||||
{
|
||||
public class RenameLabelAndRichTextPropertyEditorAliases : MigrationBase
|
||||
{
|
||||
public RenameLabelAndRichTextPropertyEditorAliases(IMigrationContext context)
|
||||
: base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Migrate()
|
||||
{
|
||||
MigratePropertyEditorAlias("Umbraco.TinyMCEv3", Constants.PropertyEditors.Aliases.TinyMce);
|
||||
MigratePropertyEditorAlias("Umbraco.NoEdit", Constants.PropertyEditors.Aliases.Label);
|
||||
}
|
||||
|
||||
private void MigratePropertyEditorAlias(string oldAlias, string newAlias)
|
||||
{
|
||||
var dataTypes = GetDataTypes(oldAlias);
|
||||
|
||||
foreach (var dataType in dataTypes)
|
||||
{
|
||||
dataType.EditorAlias = newAlias;
|
||||
Database.Update(dataType);
|
||||
}
|
||||
}
|
||||
|
||||
private List<DataTypeDto> GetDataTypes(string editorAlias)
|
||||
{
|
||||
var dataTypes = Database.Fetch<DataTypeDto>(Sql()
|
||||
.Select<DataTypeDto>()
|
||||
.From<DataTypeDto>()
|
||||
.Where<DataTypeDto>(x => x.EditorAlias == editorAlias));
|
||||
return dataTypes;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -735,7 +735,7 @@ namespace Umbraco.Core.Packaging
|
||||
property.Element("Name").Value, dataTypeDefinitionId, property.Element("Type").Value.Trim());
|
||||
|
||||
//convert to a label!
|
||||
dataTypeDefinition = _dataTypeService.GetByEditorAlias(Constants.PropertyEditors.Aliases.NoEdit).FirstOrDefault();
|
||||
dataTypeDefinition = _dataTypeService.GetByEditorAlias(Constants.PropertyEditors.Aliases.Label).FirstOrDefault();
|
||||
//if for some odd reason this isn't there then ignore
|
||||
if (dataTypeDefinition == null) continue;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Umbraco.Core.PropertyEditors
|
||||
/// <summary>
|
||||
/// Represents a property editor for label properties.
|
||||
/// </summary>
|
||||
[DataEditor(Constants.PropertyEditors.Aliases.NoEdit, "Label", "readonlyvalue", Icon = "icon-readonly")]
|
||||
[DataEditor(Constants.PropertyEditors.Aliases.Label, "Label", "readonlyvalue", Icon = "icon-readonly")]
|
||||
public class LabelPropertyEditor : DataEditor
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
|
||||
public class LabelValueConverter : PropertyValueConverterBase
|
||||
{
|
||||
public override bool IsConverter(PublishedPropertyType propertyType)
|
||||
=> Constants.PropertyEditors.Aliases.NoEdit.Equals(propertyType.EditorAlias);
|
||||
=> Constants.PropertyEditors.Aliases.Label.Equals(propertyType.EditorAlias);
|
||||
|
||||
public override Type GetPropertyValueType(PublishedPropertyType propertyType)
|
||||
{
|
||||
|
||||
@@ -1212,21 +1212,21 @@ namespace Umbraco.Core.Services.Implement
|
||||
Id = --identity,
|
||||
Key = identity.ToGuid()
|
||||
});
|
||||
propGroup.PropertyTypes.Add(new PropertyType(Constants.PropertyEditors.Aliases.NoEdit, ValueStorageType.Date, Constants.Conventions.Member.LastLockoutDate)
|
||||
propGroup.PropertyTypes.Add(new PropertyType(Constants.PropertyEditors.Aliases.Label, ValueStorageType.Date, Constants.Conventions.Member.LastLockoutDate)
|
||||
{
|
||||
Name = Constants.Conventions.Member.LastLockoutDateLabel,
|
||||
SortOrder = 5,
|
||||
Id = --identity,
|
||||
Key = identity.ToGuid()
|
||||
});
|
||||
propGroup.PropertyTypes.Add(new PropertyType(Constants.PropertyEditors.Aliases.NoEdit, ValueStorageType.Date, Constants.Conventions.Member.LastLoginDate)
|
||||
propGroup.PropertyTypes.Add(new PropertyType(Constants.PropertyEditors.Aliases.Label, ValueStorageType.Date, Constants.Conventions.Member.LastLoginDate)
|
||||
{
|
||||
Name = Constants.Conventions.Member.LastLoginDateLabel,
|
||||
SortOrder = 6,
|
||||
Id = --identity,
|
||||
Key = identity.ToGuid()
|
||||
});
|
||||
propGroup.PropertyTypes.Add(new PropertyType(Constants.PropertyEditors.Aliases.NoEdit, ValueStorageType.Date, Constants.Conventions.Member.LastPasswordChangeDate)
|
||||
propGroup.PropertyTypes.Add(new PropertyType(Constants.PropertyEditors.Aliases.Label, ValueStorageType.Date, Constants.Conventions.Member.LastPasswordChangeDate)
|
||||
{
|
||||
Name = Constants.Conventions.Member.LastPasswordChangeDateLabel,
|
||||
SortOrder = 7,
|
||||
|
||||
@@ -205,6 +205,7 @@
|
||||
<Compile Include="Composing\TypeFinder.cs" />
|
||||
<Compile Include="Composing\TypeHelper.cs" />
|
||||
<Compile Include="Composing\TypeLoader.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_8_0_0\RenameLabelAndRichTextPropertyEditorAliases.cs" />
|
||||
<Compile Include="TypeLoaderExtensions.cs" />
|
||||
<Compile Include="Composing\WeightAttribute.cs" />
|
||||
<Compile Include="Composing\WeightedCollectionBuilderBase.cs" />
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
/// <param name="appCache"></param>
|
||||
/// <param name="contentTypeCache"></param>
|
||||
/// <param name="entitySerializer"></param>
|
||||
internal PublishedMediaCache(IMediaService mediaService, IUserService userService, ISearcher searchProvider, IAppCache appCache, PublishedContentTypeCache contentTypeCache, IEntityXmlSerializer entitySerializer)
|
||||
internal PublishedMediaCache(IMediaService mediaService, IUserService userService, ISearcher searchProvider, IAppCache appCache, PublishedContentTypeCache contentTypeCache, IEntityXmlSerializer entitySerializer, IUmbracoContextAccessor umbracoContextAccessor)
|
||||
: base(false)
|
||||
{
|
||||
_mediaService = mediaService ?? throw new ArgumentNullException(nameof(mediaService));
|
||||
@@ -79,6 +79,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
_appCache = appCache;
|
||||
_contentTypeCache = contentTypeCache;
|
||||
_entitySerializer = entitySerializer;
|
||||
_umbracoContextAccessor = umbracoContextAccessor;
|
||||
}
|
||||
|
||||
static PublishedMediaCache()
|
||||
|
||||
@@ -344,7 +344,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
// Assert
|
||||
Assert.That(definitionUpdated, Is.Not.Null);
|
||||
Assert.That(definitionUpdated.Name, Is.EqualTo("AgeDataType Updated"));
|
||||
Assert.That(definitionUpdated.EditorAlias, Is.EqualTo(Constants.PropertyEditors.Aliases.NoEdit));
|
||||
Assert.That(definitionUpdated.EditorAlias, Is.EqualTo(Constants.PropertyEditors.Aliases.Label));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.LegacyXmlPublishedCache;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
@@ -44,6 +45,8 @@ namespace Umbraco.Tests.PublishedContent
|
||||
Composition.WithCollectionBuilder<UrlSegmentProviderCollectionBuilder>()
|
||||
.Clear()
|
||||
.Append<DefaultUrlSegmentProvider>();
|
||||
|
||||
Composition.RegisterUnique<IUmbracoContextAccessor, TestUmbracoContextAccessor>();
|
||||
}
|
||||
|
||||
private IMediaType MakeNewMediaType(IUser user, string text, int parentId = -1)
|
||||
@@ -126,7 +129,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var searcher = indexer.GetSearcher();
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>());
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(1111);
|
||||
@@ -156,7 +159,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var searcher = indexer.GetSearcher();
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>());
|
||||
|
||||
//ensure it is found
|
||||
var publishedMedia = cache.GetById(3113);
|
||||
@@ -203,7 +206,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var searcher = indexer.GetSearcher();
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>());
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(1111);
|
||||
@@ -231,7 +234,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var searcher = indexer.GetSearcher();
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>());
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(1111);
|
||||
@@ -259,7 +262,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var searcher = indexer.GetSearcher();
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>());
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(1111);
|
||||
@@ -288,7 +291,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var searcher = indexer.GetSearcher();
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>());
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(3113);
|
||||
@@ -314,7 +317,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var searcher = indexer.GetSearcher();
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>());
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(3113);
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<GenericProperty>
|
||||
<Name>Content</Name>
|
||||
<Alias>content</Alias>
|
||||
<Type>Umbraco.TinyMCEv3</Type>
|
||||
<Type>Umbraco.TinyMCE</Type>
|
||||
<Definition>ca90c950-0aff-4e72-b976-a30b1ac57dad</Definition>
|
||||
<Tab>Content</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
@@ -172,4 +172,4 @@
|
||||
<DictionaryItems />
|
||||
<Languages />
|
||||
<DataTypes />
|
||||
</umbPackage>
|
||||
</umbPackage>
|
||||
|
||||
@@ -324,7 +324,7 @@
|
||||
<GenericProperty>
|
||||
<Name>AboutText</Name>
|
||||
<Alias>aboutText</Alias>
|
||||
<Type>Umbraco.TinyMCEv3</Type>
|
||||
<Type>Umbraco.TinyMCE</Type>
|
||||
<Definition>ca90c950-0aff-4e72-b976-a30b1ac57dad</Definition>
|
||||
<Tab>About</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
@@ -472,7 +472,7 @@
|
||||
<GenericProperty>
|
||||
<Name>Content</Name>
|
||||
<Alias>bodyText</Alias>
|
||||
<Type>Umbraco.TinyMCEv3</Type>
|
||||
<Type>Umbraco.TinyMCE</Type>
|
||||
<Definition>ca90c950-0aff-4e72-b976-a30b1ac57dad</Definition>
|
||||
<Tab>Content</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
@@ -593,7 +593,7 @@
|
||||
<GenericProperty>
|
||||
<Name>Content</Name>
|
||||
<Alias>bodyText</Alias>
|
||||
<Type>Umbraco.TinyMCEv3</Type>
|
||||
<Type>Umbraco.TinyMCE</Type>
|
||||
<Definition>ca90c950-0aff-4e72-b976-a30b1ac57dad</Definition>
|
||||
<Tab>Content</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
@@ -721,8 +721,8 @@
|
||||
<![CDATA[@inherits UmbracoTemplatePage
|
||||
@{
|
||||
Layout = "umbLayout.cshtml";
|
||||
|
||||
// If the editor has not explicitly provided the "Page title" property page
|
||||
|
||||
// If the editor has not explicitly provided the "Page title" property page
|
||||
// then just show the name of the page otherwise show the provided title
|
||||
var pageTitle = string.IsNullOrWhiteSpace(CurrentPage.Title)
|
||||
? CurrentPage.Name
|
||||
@@ -745,7 +745,7 @@
|
||||
}
|
||||
|
||||
@CurrentPage.BodyText
|
||||
</section>
|
||||
</section>
|
||||
</article>
|
||||
<!-- /Content -->
|
||||
</div>
|
||||
@@ -777,7 +777,7 @@
|
||||
@{
|
||||
Layout = "umbLayout.cshtml";
|
||||
|
||||
// If the editor has not explicitly provided the "Page title" property page
|
||||
// If the editor has not explicitly provided the "Page title" property page
|
||||
// then just show the name of the page otherwise show the provided title
|
||||
var pageTitle = string.IsNullOrWhiteSpace(CurrentPage.Title)
|
||||
? CurrentPage.Name
|
||||
@@ -787,8 +787,8 @@
|
||||
// AncestorsOrSelf is all of the ancestors this page has in the tree
|
||||
// (1) means: go up to level 1 and stop looking for more ancestors when you get there
|
||||
// First() gets the first ancestor found (the home page, on level 1)
|
||||
var homePage = CurrentPage.AncestorsOrSelf(1).First();
|
||||
|
||||
var homePage = CurrentPage.AncestorsOrSelf(1).First();
|
||||
|
||||
// Find all pages with document type alias umbNewsOverview
|
||||
// We do that using the plural, umbNewsOverviews (note the extra "s" in the end)
|
||||
// Then take the first one, as we know there will only be on news overview page
|
||||
@@ -815,18 +815,18 @@
|
||||
@foreach (var item in newsItems)
|
||||
{
|
||||
|
||||
// If the editor has not explicitly provided the "Page title" property page
|
||||
// If the editor has not explicitly provided the "Page title" property page
|
||||
// then just show the name of the page otherwise show the provided title
|
||||
var title = string.IsNullOrWhiteSpace(item.Title)
|
||||
? item.Name
|
||||
var title = string.IsNullOrWhiteSpace(item.Title)
|
||||
? item.Name
|
||||
: item.Title;
|
||||
|
||||
|
||||
// If the editor has not explicitly set the publishDate property then show the create date
|
||||
var dateTime = item.PublishDate == default(DateTime)
|
||||
? item.CreateDate
|
||||
var dateTime = item.PublishDate == default(DateTime)
|
||||
? item.CreateDate
|
||||
: item.PublishDate;
|
||||
|
||||
|
||||
<section>
|
||||
<h3><a href="@item.Url">@title</a></h3>
|
||||
<span class="byline">@item.SubHeader</span>
|
||||
@@ -869,11 +869,11 @@
|
||||
@{
|
||||
Layout = "umbLayout.cshtml";
|
||||
|
||||
// If the editor has not explicitly provided the "Page title" property page
|
||||
// If the editor has not explicitly provided the "Page title" property page
|
||||
// then just show the name of the page otherwise show the provided title
|
||||
var pageTitle = string.IsNullOrWhiteSpace(CurrentPage.Title)
|
||||
? CurrentPage.Name
|
||||
: CurrentPage.Title;
|
||||
: CurrentPage.Title;
|
||||
}
|
||||
<div id="main-wrapper">
|
||||
<div id="main" class="container">
|
||||
@@ -892,7 +892,7 @@
|
||||
}
|
||||
|
||||
@CurrentPage.BodyText
|
||||
</section>
|
||||
</section>
|
||||
</article>
|
||||
<!-- /Content -->
|
||||
</div>
|
||||
@@ -921,4 +921,4 @@
|
||||
<DictionaryItems />
|
||||
<Languages />
|
||||
<DataTypes />
|
||||
</umbPackage>
|
||||
</umbPackage>
|
||||
|
||||
@@ -359,7 +359,7 @@ namespace Umbraco.Tests.TestHelpers.Entities
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Nvarchar) { Alias = "singleLineText", Name = "Text String", Mandatory = false, SortOrder = 4, DataTypeId = -88 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.TextArea, ValueStorageType.Ntext) { Alias = "multilineText", Name = "Multiple Text Strings", Mandatory = false, SortOrder = 5, DataTypeId = -89 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.UploadField, ValueStorageType.Nvarchar) { Alias = "upload", Name = "Upload Field", Mandatory = false, SortOrder = 6, DataTypeId = -90 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.NoEdit, ValueStorageType.Nvarchar) { Alias = "label", Name = "Label", Mandatory = false, SortOrder = 7, DataTypeId = -92 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.Label, ValueStorageType.Nvarchar) { Alias = "label", Name = "Label", Mandatory = false, SortOrder = 7, DataTypeId = -92 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.DateTime, ValueStorageType.Date) { Alias = "dateTime", Name = "Date Time", Mandatory = false, SortOrder = 8, DataTypeId = -36 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.ColorPicker, ValueStorageType.Nvarchar) { Alias = "colorPicker", Name = "Color Picker", Mandatory = false, SortOrder = 9, DataTypeId = -37 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.DropDownListFlexible, ValueStorageType.Nvarchar) { Alias = "ddlMultiple", Name = "Dropdown List Multiple", Mandatory = false, SortOrder = 11, DataTypeId = -39 });
|
||||
@@ -420,10 +420,10 @@ namespace Umbraco.Tests.TestHelpers.Entities
|
||||
|
||||
var contentCollection = new PropertyTypeCollection(false);
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.UploadField, ValueStorageType.Nvarchar) { Alias = Constants.Conventions.Media.File, Name = "File", Description = "", Mandatory = false, SortOrder = 1, DataTypeId = -90 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.NoEdit, ValueStorageType.Integer) { Alias = Constants.Conventions.Media.Width, Name = "Width", Description = "", Mandatory = false, SortOrder = 2, DataTypeId = -90 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.NoEdit, ValueStorageType.Integer) { Alias = Constants.Conventions.Media.Height, Name = "Height", Description = "", Mandatory = false, SortOrder = 2, DataTypeId = -90 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.NoEdit, ValueStorageType.Integer) { Alias = Constants.Conventions.Media.Bytes, Name = "Bytes", Description = "", Mandatory = false, SortOrder = 2, DataTypeId = -90 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.NoEdit, ValueStorageType.Nvarchar) { Alias = Constants.Conventions.Media.Extension, Name = "File Extension", Description = "", Mandatory = false, SortOrder = 2, DataTypeId = -90 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.Label, ValueStorageType.Integer) { Alias = Constants.Conventions.Media.Width, Name = "Width", Description = "", Mandatory = false, SortOrder = 2, DataTypeId = -90 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.Label, ValueStorageType.Integer) { Alias = Constants.Conventions.Media.Height, Name = "Height", Description = "", Mandatory = false, SortOrder = 2, DataTypeId = -90 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.Label, ValueStorageType.Integer) { Alias = Constants.Conventions.Media.Bytes, Name = "Bytes", Description = "", Mandatory = false, SortOrder = 2, DataTypeId = -90 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.Label, ValueStorageType.Nvarchar) { Alias = Constants.Conventions.Media.Extension, Name = "File Extension", Description = "", Mandatory = false, SortOrder = 2, DataTypeId = -90 });
|
||||
|
||||
mediaType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Media", SortOrder = 1 });
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
settings.TimeOutInMinutes == 20 &&
|
||||
settings.DefaultUILanguage == "en" &&
|
||||
settings.LocalTempStorageLocation == LocalTempStorage.Default &&
|
||||
settings.LocalTempPath == IOHelper.MapPath("~/App_Data/TEMP") &&
|
||||
settings.ReservedPaths == (GlobalSettings.StaticReservedPaths + "~/umbraco") &&
|
||||
settings.ReservedUrls == GlobalSettings.StaticReservedUrls);
|
||||
return config;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
function ContentEditController($rootScope, $scope, $routeParams, $q, $window,
|
||||
appState, contentResource, entityResource, navigationService, notificationsService,
|
||||
serverValidationManager, contentEditingHelper, treeService, formHelper, umbRequestHelper,
|
||||
editorState, $http, eventsService, relationResource, overlayService) {
|
||||
editorState, $http, eventsService, relationResource, overlayService, $location) {
|
||||
|
||||
var evts = [];
|
||||
var infiniteMode = $scope.infiniteModel && $scope.infiniteModel.infiniteMode;
|
||||
@@ -22,7 +22,7 @@
|
||||
$scope.page.isNew = $scope.isNew ? true : false;
|
||||
$scope.page.buttonGroupState = "init";
|
||||
$scope.page.hideActionsMenu = infiniteMode ? true : false;
|
||||
$scope.page.hideChangeVariant = infiniteMode ? true : false;
|
||||
$scope.page.hideChangeVariant = false;
|
||||
$scope.allowOpen = true;
|
||||
$scope.app = null;
|
||||
|
||||
@@ -213,24 +213,7 @@
|
||||
$scope.page.showPreviewButton = true;
|
||||
|
||||
}
|
||||
|
||||
// create infinite editing buttons
|
||||
function createInfiniteModeButtons(content) {
|
||||
|
||||
$scope.page.allowInfinitePublishAndClose = false;
|
||||
$scope.page.allowInfiniteSaveAndClose = false;
|
||||
|
||||
// check for publish rights
|
||||
if (_.contains(content.allowedActions, "U")) {
|
||||
$scope.page.allowInfinitePublishAndClose = true;
|
||||
|
||||
// check for save rights
|
||||
} else if (_.contains(content.allowedActions, "A")) {
|
||||
$scope.page.allowInfiniteSaveAndClose = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** Syncs the content item to it's tree node - this occurs on first load and after saving */
|
||||
function syncTreeNode(content, path, initialLoad) {
|
||||
|
||||
@@ -874,11 +857,8 @@
|
||||
|
||||
$scope.$broadcast("editors.apps.appChanged", { app: app });
|
||||
|
||||
if (infiniteMode) {
|
||||
createInfiniteModeButtons($scope.content);
|
||||
} else {
|
||||
createButtons($scope.content);
|
||||
}
|
||||
createButtons($scope.content);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -896,6 +876,18 @@
|
||||
$scope.infiniteModel.close($scope.infiniteModel);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Call back when user click the back-icon
|
||||
*/
|
||||
$scope.onBack = function() {
|
||||
if ($scope.infiniteModel && $scope.infiniteModel.close) {
|
||||
$scope.infiniteModel.close($scope.infiniteModel);
|
||||
} else {
|
||||
// navigate backwards if content has a parent.
|
||||
$location.path('/' + $routeParams.section + '/' + $routeParams.tree + '/' + $routeParams.method + '/' + $scope.content.parentId);
|
||||
}
|
||||
};
|
||||
|
||||
//ensure to unregister from all events!
|
||||
$scope.$on('$destroy', function () {
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
onSelectVariant: "&",
|
||||
onOpenSplitView: "&",
|
||||
onSelectApp: "&",
|
||||
onSelectAppAnchor: "&"
|
||||
onSelectAppAnchor: "&",
|
||||
onBack: "&?",
|
||||
showBack: "<?"
|
||||
},
|
||||
controllerAs: 'vm',
|
||||
controller: umbVariantContentController
|
||||
@@ -37,6 +39,7 @@
|
||||
vm.openSplitView = openSplitView;
|
||||
vm.selectApp = selectApp;
|
||||
vm.selectAppAnchor = selectAppAnchor;
|
||||
vm.showBackButton = showBackButton;
|
||||
|
||||
function onInit() {
|
||||
// disable the name field if the active content app is not "Content"
|
||||
@@ -48,6 +51,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
function showBackButton() {
|
||||
return vm.page.listViewPath !== null && vm.showBack;
|
||||
}
|
||||
|
||||
/** Called when the component has linked all elements, this is when the form controller is available */
|
||||
function postLink() {
|
||||
//set the content to dirty if the header changes
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
content: "<", // TODO: Not sure if this should be = since we are changing the 'active' property of a variant
|
||||
culture: "<",
|
||||
onSelectApp: "&?",
|
||||
onSelectAppAnchor: "&?"
|
||||
onSelectAppAnchor: "&?",
|
||||
onBack: "&?",
|
||||
showBack: "<?"
|
||||
},
|
||||
controllerAs: 'vm',
|
||||
controller: umbVariantContentEditorsController
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function EditorContentHeader($location, $routeParams) {
|
||||
function EditorContentHeader() {
|
||||
|
||||
function link(scope, el, attr, ctrl) {
|
||||
|
||||
@@ -37,7 +37,9 @@
|
||||
}
|
||||
|
||||
scope.goBack = function () {
|
||||
$location.path('/' + $routeParams.section + '/' + $routeParams.tree + '/' + $routeParams.method + '/' + scope.menu.currentNode.parentId);
|
||||
if (scope.onBack) {
|
||||
scope.onBack();
|
||||
}
|
||||
};
|
||||
|
||||
scope.selectVariant = function (event, variant) {
|
||||
@@ -113,13 +115,14 @@
|
||||
name: "=",
|
||||
nameDisabled: "<?",
|
||||
menu: "=",
|
||||
hideMenu: "<?",
|
||||
hideActionsMenu: "<?",
|
||||
content: "=",
|
||||
openVariants: "<",
|
||||
hideChangeVariant: "<?",
|
||||
onSelectNavigationItem: "&?",
|
||||
onSelectAnchorItem: "&?",
|
||||
showBackButton: "<?",
|
||||
onBack: "&?",
|
||||
splitViewOpen: "=?",
|
||||
onOpenInSplitView: "&?",
|
||||
onCloseSplitView: "&?",
|
||||
|
||||
@@ -258,7 +258,7 @@ Use this directive to construct a header inside the main editor window.
|
||||
name: "=",
|
||||
nameLocked: "=",
|
||||
menu: "=",
|
||||
hideMenu: "<?",
|
||||
hideActionsMenu: "<?",
|
||||
icon: "=",
|
||||
hideIcon: "@",
|
||||
alias: "=",
|
||||
|
||||
@@ -46,18 +46,15 @@
|
||||
};
|
||||
|
||||
function onInit() {
|
||||
|
||||
// hide navigation if there is only 1 item
|
||||
if (scope.navigation.length <= 1) {
|
||||
scope.showNavigation = false;
|
||||
}
|
||||
|
||||
$timeout(function(){
|
||||
if($window && $window.innerWidth) {
|
||||
calculateVisibleItems($window.innerWidth);
|
||||
}
|
||||
});
|
||||
|
||||
var firstRun = true;
|
||||
scope.$watch("navigation.length",
|
||||
(newVal, oldVal) => {
|
||||
if (firstRun || newVal !== undefined && newVal !== oldVal) {
|
||||
firstRun = false;
|
||||
scope.showNavigation = newVal > 1;
|
||||
calculateVisibleItems($window.innerWidth);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function calculateVisibleItems(windowWidth) {
|
||||
|
||||
@@ -157,6 +157,7 @@ app.config(function ($routeProvider) {
|
||||
return;
|
||||
}
|
||||
|
||||
//TODO: Fix this special case by using components, the packager should be a component and then we just have a view for each route like normal rendering the component with the correct parameters
|
||||
//special case for the package section
|
||||
var packagePages = ["edit", "options"];
|
||||
if ($routeParams.section.toLowerCase() === "packages" && $routeParams.tree.toLowerCase() === "packages" && packagePages.indexOf($routeParams.method.toLowerCase()) === -1) {
|
||||
@@ -164,6 +165,7 @@ app.config(function ($routeProvider) {
|
||||
return;
|
||||
}
|
||||
|
||||
//TODO: Fix this special case by using components, the users section should be a component and then we just have a view for each route like normal rendering the component with the correct parameters
|
||||
//special case for the users section
|
||||
var usersPages = ["user", "group"];
|
||||
if ($routeParams.section.toLowerCase() === "users" && $routeParams.tree.toLowerCase() === "users" && usersPages.indexOf($routeParams.method.toLowerCase()) === -1) {
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
content="content"
|
||||
culture="culture"
|
||||
on-select-app="appChanged(app)"
|
||||
on-select-app-anchor="appAnchorChanged(app, anchor)">
|
||||
on-select-app-anchor="appAnchorChanged(app, anchor)"
|
||||
on-back="onBack()"
|
||||
show-back="!(infiniteModel && infiniteModel.infiniteMode)"
|
||||
>
|
||||
</umb-variant-content-editors>
|
||||
|
||||
<umb-editor-footer>
|
||||
@@ -59,7 +62,7 @@
|
||||
</umb-button>
|
||||
|
||||
<umb-button-group
|
||||
ng-if="defaultButton && !content.trashed && !content.isElement && !infiniteModel.infiniteMode"
|
||||
ng-if="defaultButton && !content.trashed && !content.isElement"
|
||||
button-style="success"
|
||||
default-button="defaultButton"
|
||||
sub-buttons="subButtons"
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
on-close-split-view="vm.closeSplitView($index)"
|
||||
on-select-variant="vm.selectVariant(variant, $index)"
|
||||
on-select-app="vm.selectApp(app)"
|
||||
on-select-app-anchor="vm.selectAppAnchor(app, anchor)">
|
||||
on-select-app-anchor="vm.selectAppAnchor(app, anchor)"
|
||||
on-back="vm.onBack()"
|
||||
show-back="vm.showBack">
|
||||
</umb-variant-content>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
on-select-anchor-item="vm.selectAppAnchor(item, anchor)"
|
||||
open-variants="vm.openVariants"
|
||||
hide-change-variant="vm.page.hideChangeVariant"
|
||||
show-back-button="vm.page.listViewPath !== null"
|
||||
show-back-button="vm.showBackButton()"
|
||||
on-back="vm.onBack()"
|
||||
split-view-open="vm.editorCount > 1"
|
||||
on-open-in-split-view="vm.openSplitView(variant)"
|
||||
on-close-split-view="vm.onCloseSplitView()"
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
</umb-editor-navigation>
|
||||
</div>
|
||||
|
||||
<div ng-if="menu.currentNode && splitViewOpen !== true && hideMenu !== true">
|
||||
<div ng-if="menu.currentNode && splitViewOpen !== true && hideActionsMenu !== true">
|
||||
<umb-editor-menu
|
||||
data-element="editor-actions"
|
||||
current-node="menu.currentNode"
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
</umb-editor-navigation>
|
||||
</div>
|
||||
|
||||
<div ng-if="menu.currentNode && splitViewOpen !== true && hideMenu !== true">
|
||||
<div ng-if="menu.currentNode && splitViewOpen !== true && hideActionsMenu !== true">
|
||||
<umb-editor-menu
|
||||
data-element="editor-actions"
|
||||
current-node="menu.currentNode"
|
||||
|
||||
@@ -66,13 +66,13 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.CheckboxListContro
|
||||
function changed(item) {
|
||||
var index = _.findIndex($scope.model.value,
|
||||
function (v) {
|
||||
return v === item.value;
|
||||
return v === item.val;
|
||||
});
|
||||
|
||||
if (item.checked) {
|
||||
//if it doesn't exist in the model, then add it
|
||||
if (index < 0) {
|
||||
$scope.model.value.push(item.value);
|
||||
$scope.model.value.push(item.val);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function ListViewGridLayoutController($scope, $routeParams, mediaHelper, mediaResource, $location, listViewHelper, mediaTypeHelper) {
|
||||
function ListViewGridLayoutController($scope, $routeParams, mediaHelper, mediaResource,
|
||||
listViewHelper, mediaTypeHelper, editorService) {
|
||||
|
||||
var vm = this;
|
||||
var umbracoSettings = Umbraco.Sys.ServerVariables.umbracoSettings;
|
||||
@@ -116,8 +117,29 @@
|
||||
listViewHelper.selectHandler(folder, $index, $scope.folders, $scope.selection, $event);
|
||||
}
|
||||
|
||||
function goToItem(item, $event, $index) {
|
||||
$location.path($scope.entityType + '/' + $scope.entityType + '/edit/' + item.id);
|
||||
function goToItem(node, $event, $index) {
|
||||
$event.stopPropagation();
|
||||
|
||||
var contentEditor = {
|
||||
id: node.id,
|
||||
submit: function (model) {
|
||||
// update the node
|
||||
node.name = model.contentNode.name;
|
||||
// TODO: node.description = model.contentNode.description;
|
||||
node.published = model.contentNode.hasPublishedVersion;
|
||||
if (entityType !== "Member") {
|
||||
entityResource.getUrl(model.contentNode.id, entityType).then(function (data) {
|
||||
node.url = data;
|
||||
});
|
||||
}
|
||||
editorService.close();
|
||||
},
|
||||
close: function () {
|
||||
editorService.close();
|
||||
}
|
||||
};
|
||||
editorService.contentEditor(contentEditor);
|
||||
|
||||
}
|
||||
|
||||
activate();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function ListViewListLayoutController($scope, listViewHelper, $location, mediaHelper, mediaTypeHelper) {
|
||||
function ListViewListLayoutController($scope, listViewHelper, mediaHelper, mediaTypeHelper, editorService) {
|
||||
|
||||
var vm = this;
|
||||
var umbracoSettings = Umbraco.Sys.ServerVariables.umbracoSettings;
|
||||
@@ -52,11 +52,31 @@
|
||||
listViewHelper.selectHandler(selectedItem, $index, $scope.items, $scope.selection, $event);
|
||||
}
|
||||
|
||||
function clickItem(item) {
|
||||
// if item.id is 2147483647 (int.MaxValue) use item.key
|
||||
$location.path($scope.entityType + '/' + $scope.entityType + '/edit/' + (item.id === 2147483647 ? item.key : item.id));
|
||||
function clickItem(node) {
|
||||
|
||||
var contentEditor = {
|
||||
id: node.id,
|
||||
submit: function (model) {
|
||||
// update the node
|
||||
node.name = model.contentNode.name;
|
||||
// TODO: node.description = model.contentNode.description;
|
||||
node.published = model.contentNode.hasPublishedVersion;
|
||||
if (entityType !== "Member") {
|
||||
entityResource.getUrl(model.contentNode.id, entityType).then(function (data) {
|
||||
node.url = data;
|
||||
});
|
||||
}
|
||||
editorService.close();
|
||||
},
|
||||
close: function () {
|
||||
editorService.close();
|
||||
}
|
||||
};
|
||||
editorService.contentEditor(contentEditor);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function isSortDirection(col, direction) {
|
||||
return listViewHelper.setSortingDirection(col, direction, $scope.options);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Umbraco.Web.Editors
|
||||
public DataTypeDisplay GetEmpty(int parentId)
|
||||
{
|
||||
// cannot create an "empty" data type, so use something by default.
|
||||
var editor = _propertyEditors[Constants.PropertyEditors.Aliases.NoEdit];
|
||||
var editor = _propertyEditors[Constants.PropertyEditors.Aliases.Label];
|
||||
var dt = new DataType(editor, parentId);
|
||||
return Mapper.Map<IDataType, DataTypeDisplay>(dt);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
"No property editor '{PropertyEditorAlias}' found, converting to a Label",
|
||||
property.PropertyType.PropertyEditorAlias);
|
||||
|
||||
editor = _propertyEditors[Constants.PropertyEditors.Aliases.NoEdit];
|
||||
editor = _propertyEditors[Constants.PropertyEditors.Aliases.Label];
|
||||
}
|
||||
|
||||
var result = new TDestination
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}doctype",
|
||||
Label = _localizedTextService.Localize("content/membertype"),
|
||||
Value = _localizedTextService.UmbracoDictionaryTranslate(member.ContentType.Name),
|
||||
View = Current.PropertyEditors[Constants.PropertyEditors.Aliases.NoEdit].GetValueEditor().View
|
||||
View = Current.PropertyEditors[Constants.PropertyEditors.Aliases.Label].GetValueEditor().View
|
||||
},
|
||||
GetLoginProperty(_memberService, member, _localizedTextService),
|
||||
new ContentPropertyDisplay
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
_logger.Error(GetType(),
|
||||
"No property editor could be resolved with the alias: {PropertyEditorAlias}, defaulting to label", p.PropertyEditorAlias);
|
||||
propertyEditorAlias = Constants.PropertyEditors.Aliases.NoEdit;
|
||||
propertyEditorAlias = Constants.PropertyEditors.Aliases.Label;
|
||||
propertyEditor = _propertyEditors[propertyEditorAlias];
|
||||
}
|
||||
|
||||
|
||||
@@ -15,13 +15,13 @@ namespace Umbraco.Web.Models
|
||||
[DebuggerDisplay("Content Id: {Id}, Name: {Name}")]
|
||||
public abstract class PublishedContentBase : IPublishedContent
|
||||
{
|
||||
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
|
||||
|
||||
protected PublishedContentBase(IUmbracoContextAccessor umbracoContextAccessor)
|
||||
{
|
||||
_umbracoContextAccessor = umbracoContextAccessor;
|
||||
UmbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor));
|
||||
}
|
||||
|
||||
protected IUmbracoContextAccessor UmbracoContextAccessor { get; }
|
||||
|
||||
#region ContentType
|
||||
|
||||
public abstract PublishedContentType ContentType { get; }
|
||||
@@ -86,50 +86,52 @@ namespace Umbraco.Web.Models
|
||||
/// </remarks>
|
||||
public virtual string GetUrl(string culture = null) // TODO: consider .GetCulture("fr-FR").Url
|
||||
{
|
||||
var umbracoContext = _umbracoContextAccessor.UmbracoContext;
|
||||
switch (ItemType)
|
||||
{
|
||||
case PublishedItemType.Content:
|
||||
if (umbracoContext == null)
|
||||
throw new InvalidOperationException("Cannot compute Url for a content item when UmbracoContext is null.");
|
||||
if (umbracoContext.UrlProvider == null)
|
||||
throw new InvalidOperationException("Cannot compute Url for a content item when UmbracoContext.UrlProvider is null.");
|
||||
return umbracoContext.UrlProvider.GetUrl(this, culture);
|
||||
switch (ItemType)
|
||||
{
|
||||
case PublishedItemType.Content:
|
||||
var umbracoContext = UmbracoContextAccessor.UmbracoContext;
|
||||
|
||||
case PublishedItemType.Media:
|
||||
var prop = GetProperty(Constants.Conventions.Media.File);
|
||||
if (prop?.GetValue() == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
if (umbracoContext == null)
|
||||
throw new InvalidOperationException("Cannot compute Url for a content item when UmbracoContext is null.");
|
||||
if (umbracoContext.UrlProvider == null)
|
||||
throw new InvalidOperationException("Cannot compute Url for a content item when UmbracoContext.UrlProvider is null.");
|
||||
|
||||
var propType = ContentType.GetPropertyType(Constants.Conventions.Media.File);
|
||||
|
||||
// TODO: consider implementing media url providers
|
||||
// note: that one does not support variations
|
||||
//This is a hack - since we now have 2 properties that support a URL: upload and cropper, we need to detect this since we always
|
||||
// want to return the normal URL and the cropper stores data as json
|
||||
switch (propType.EditorAlias)
|
||||
{
|
||||
case Constants.PropertyEditors.Aliases.UploadField:
|
||||
return prop.GetValue().ToString();
|
||||
break;
|
||||
case Constants.PropertyEditors.Aliases.ImageCropper:
|
||||
//get the url from the json format
|
||||
|
||||
var stronglyTyped = prop.GetValue() as ImageCropperValue;
|
||||
if (stronglyTyped != null)
|
||||
{
|
||||
return stronglyTyped.Src;
|
||||
}
|
||||
return prop.GetValue()?.ToString();
|
||||
}
|
||||
return umbracoContext.UrlProvider.GetUrl(this, culture);
|
||||
|
||||
case PublishedItemType.Media:
|
||||
var prop = GetProperty(Constants.Conventions.Media.File);
|
||||
if (prop?.GetValue() == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
var propType = ContentType.GetPropertyType(Constants.Conventions.Media.File);
|
||||
|
||||
// TODO: consider implementing media url providers
|
||||
// note: that one does not support variations
|
||||
//This is a hack - since we now have 2 properties that support a URL: upload and cropper, we need to detect this since we always
|
||||
// want to return the normal URL and the cropper stores data as json
|
||||
switch (propType.EditorAlias)
|
||||
{
|
||||
case Constants.PropertyEditors.Aliases.UploadField:
|
||||
|
||||
return prop.GetValue().ToString();
|
||||
case Constants.PropertyEditors.Aliases.ImageCropper:
|
||||
//get the url from the json format
|
||||
|
||||
var stronglyTyped = prop.GetValue() as ImageCropperValue;
|
||||
if (stronglyTyped != null)
|
||||
{
|
||||
return stronglyTyped.Src;
|
||||
}
|
||||
return prop.GetValue()?.ToString();
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
|
||||
default:
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Web.PublishedCache
|
||||
{
|
||||
@@ -8,17 +9,20 @@ namespace Umbraco.Web.PublishedCache
|
||||
public class DefaultCultureAccessor : IDefaultCultureAccessor
|
||||
{
|
||||
private readonly ILocalizationService _localizationService;
|
||||
private readonly RuntimeLevel _runtimeLevel;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DefaultCultureAccessor"/> class.
|
||||
/// </summary>
|
||||
/// <param name="localizationService"></param>
|
||||
public DefaultCultureAccessor(ILocalizationService localizationService)
|
||||
public DefaultCultureAccessor(ILocalizationService localizationService, IRuntimeState runtimeState)
|
||||
{
|
||||
_localizationService = localizationService;
|
||||
_runtimeLevel = runtimeState.Level;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string DefaultCulture => _localizationService.GetDefaultLanguageIsoCode() ?? ""; // fast
|
||||
public string DefaultCulture => _runtimeLevel == RuntimeLevel.Run
|
||||
? _localizationService.GetDefaultLanguageIsoCode() ?? "" // fast
|
||||
: "en-US"; // default for install and upgrade, when the service is n/a
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
internal class PublishedContent : PublishedContentBase
|
||||
{
|
||||
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
|
||||
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
|
||||
private readonly ContentNode _contentNode;
|
||||
private readonly string _urlSegment;
|
||||
|
||||
@@ -24,13 +23,13 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
ContentData contentData,
|
||||
IPublishedSnapshotAccessor publishedSnapshotAccessor,
|
||||
IVariationContextAccessor variationContextAccessor,
|
||||
IUmbracoContextAccessor umbracoContextAccessor) :base(umbracoContextAccessor)
|
||||
IUmbracoContextAccessor umbracoContextAccessor)
|
||||
: base(umbracoContextAccessor)
|
||||
{
|
||||
_contentNode = contentNode;
|
||||
ContentData = contentData;
|
||||
_publishedSnapshotAccessor = publishedSnapshotAccessor;
|
||||
_umbracoContextAccessor = umbracoContextAccessor;
|
||||
VariationContextAccessor = variationContextAccessor;
|
||||
_contentNode = contentNode ?? throw new ArgumentNullException(nameof(contentNode));
|
||||
ContentData = contentData ?? throw new ArgumentNullException(nameof(contentData));
|
||||
_publishedSnapshotAccessor = publishedSnapshotAccessor ?? throw new ArgumentNullException(nameof(publishedSnapshotAccessor));
|
||||
VariationContextAccessor = variationContextAccessor ?? throw new ArgumentNullException(nameof(variationContextAccessor));
|
||||
|
||||
_urlSegment = ContentData.Name.ToUrlSegment();
|
||||
IsPreviewing = ContentData.Published == false;
|
||||
@@ -72,7 +71,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
public PublishedContent(
|
||||
ContentNode contentNode,
|
||||
PublishedContent origin,
|
||||
IUmbracoContextAccessor umbracoContextAccessor) :base(umbracoContextAccessor)
|
||||
IUmbracoContextAccessor umbracoContextAccessor)
|
||||
: base(umbracoContextAccessor)
|
||||
{
|
||||
_contentNode = contentNode;
|
||||
_publishedSnapshotAccessor = origin._publishedSnapshotAccessor;
|
||||
@@ -91,7 +91,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
// clone for previewing as draft a published content that is published and has no draft
|
||||
private PublishedContent(
|
||||
PublishedContent origin,
|
||||
IUmbracoContextAccessor umbracoContextAccessor) :base(umbracoContextAccessor)
|
||||
IUmbracoContextAccessor umbracoContextAccessor)
|
||||
: base(umbracoContextAccessor)
|
||||
{
|
||||
_publishedSnapshotAccessor = origin._publishedSnapshotAccessor;
|
||||
VariationContextAccessor = origin.VariationContextAccessor;
|
||||
@@ -468,8 +469,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
return this;
|
||||
|
||||
var cache = GetAppropriateCache();
|
||||
if (cache == null) return new PublishedContent(this, _umbracoContextAccessor).CreateModel();
|
||||
return (IPublishedContent)cache.Get(AsPreviewingCacheKey, () => new PublishedContent(this, _umbracoContextAccessor).CreateModel());
|
||||
if (cache == null) return new PublishedContent(this, UmbracoContextAccessor).CreateModel();
|
||||
return (IPublishedContent)cache.Get(AsPreviewingCacheKey, () => new PublishedContent(this, UmbracoContextAccessor).CreateModel());
|
||||
}
|
||||
|
||||
// used by Navigable.Source,...
|
||||
|
||||
@@ -95,6 +95,7 @@ namespace Umbraco.Web
|
||||
|
||||
// ok, process
|
||||
|
||||
// TODO: should we move this to after we've ensured we are processing a routable page?
|
||||
// ensure there's an UmbracoContext registered for the current request
|
||||
// registers the context reference so its disposed at end of request
|
||||
var umbracoContextReference = _umbracoContextFactory.EnsureUmbracoContext(httpContext);
|
||||
|
||||
Reference in New Issue
Block a user