Merge remote-tracking branch 'origin/v8/dev' into v9/feature/merge-v8-05072021
# Conflicts: # build/NuSpecs/UmbracoCms.Web.nuspec # src/SolutionInfo.cs # src/Umbraco.Core/Compose/RelateOnTrashComponent.cs # src/Umbraco.Core/Composing/Current.cs # src/Umbraco.Core/Constants-AppSettings.cs # src/Umbraco.Core/Constants-SqlTemplates.cs # src/Umbraco.Core/Dashboards/ContentDashboardSettings.cs # src/Umbraco.Core/Dashboards/IContentDashboardSettings.cs # src/Umbraco.Core/Extensions/PublishedPropertyExtension.cs # src/Umbraco.Core/HealthChecks/Checks/Services/SmtpCheck.cs # src/Umbraco.Core/Models/IReadOnlyContentBase.cs # src/Umbraco.Core/Models/Mapping/MemberTabsAndPropertiesMapper.cs # src/Umbraco.Core/Models/Mapping/UserMapDefinition.cs # src/Umbraco.Core/Models/ReadOnlyContentBaseAdapter.cs # src/Umbraco.Core/Persistence/NPocoDatabaseExtensions-Bulk.cs # src/Umbraco.Core/PropertyEditors/IPropertyCacheCompression.cs # src/Umbraco.Core/PropertyEditors/IPropertyCacheCompressionOptions.cs # src/Umbraco.Core/PropertyEditors/MediaPicker3Configuration.cs # src/Umbraco.Core/PropertyEditors/NoopPropertyCacheCompressionOptions.cs # src/Umbraco.Core/PropertyEditors/PropertyCacheCompression.cs # src/Umbraco.Core/Routing/UrlProviderExtensions.cs # src/Umbraco.Core/Runtime/CoreRuntime.cs # src/Umbraco.Core/Services/ILocalizedTextService.cs # src/Umbraco.Core/Services/LocalizedTextServiceExtensions.cs # src/Umbraco.Examine.Lucene/BackOfficeExamineSearcher.cs # src/Umbraco.Examine/UmbracoContentIndex.cs # src/Umbraco.Infrastructure/Examine/GenericIndexDiagnostics.cs # src/Umbraco.Infrastructure/IPublishedContentQuery.cs # src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs # src/Umbraco.Infrastructure/Models/MediaWithCrops.cs # src/Umbraco.Infrastructure/Persistence/NPocoDatabaseExtensions.cs # src/Umbraco.Infrastructure/Persistence/UmbracoDatabase.cs # src/Umbraco.Infrastructure/PropertyEditors/ImageCropperConfiguration.cs # src/Umbraco.Infrastructure/PropertyEditors/MediaPicker3PropertyEditor.cs # src/Umbraco.Infrastructure/PropertyEditors/NestedContentPropertyEditor.cs # src/Umbraco.Infrastructure/PropertyEditors/UploadFileTypeValidator.cs # src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/ImageCropperValue.cs # src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/MediaPickerWithCropsValueConverter.cs # src/Umbraco.Infrastructure/PublishedContentQuery.cs # src/Umbraco.Infrastructure/Search/UmbracoTreeSearcherFields.cs # src/Umbraco.Infrastructure/Services/Implement/LocalizedTextService.cs # src/Umbraco.Persistence.SqlCe/SqlCeSyntaxProvider.cs # src/Umbraco.PublishedCache.NuCache/DataSource/BTree.DictionaryOfPropertyDataSerializer.cs # src/Umbraco.PublishedCache.NuCache/DataSource/BTree.cs # src/Umbraco.PublishedCache.NuCache/DataSource/ContentData.cs # src/Umbraco.PublishedCache.NuCache/DataSource/ContentSourceDto.cs # src/Umbraco.PublishedCache.NuCache/DataSource/PropertyData.cs # src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentTypeServiceVariantsTests.cs # src/Umbraco.Tests.UnitTests/Umbraco.Web.Common/ImageCropperTest.cs # src/Umbraco.Tests/App.config # src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs # src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs # src/Umbraco.Tests/PublishedContent/NuCacheTests.cs # src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs # src/Umbraco.Web.BackOffice/Controllers/CodeFileController.cs # src/Umbraco.Web.BackOffice/Controllers/ContentController.cs # src/Umbraco.Web.BackOffice/Controllers/ContentTypeControllerBase.cs # src/Umbraco.Web.BackOffice/Controllers/DashboardController.cs # src/Umbraco.Web.BackOffice/Controllers/DataTypeController.cs # src/Umbraco.Web.BackOffice/Controllers/MediaController.cs # src/Umbraco.Web.BackOffice/Controllers/PackageInstallController.cs # src/Umbraco.Web.BackOffice/Controllers/TemplateQueryController.cs # src/Umbraco.Web.BackOffice/Mapping/ContentMapDefinition.cs # src/Umbraco.Web.BackOffice/Trees/ContentTreeControllerBase.cs # src/Umbraco.Web.BackOffice/Trees/DataTypeTreeController.cs # src/Umbraco.Web.BackOffice/Trees/MediaTypeTreeController.cs # src/Umbraco.Web.Common/Extensions/FriendlyImageCropperTemplateExtensions.cs # src/Umbraco.Web.Common/Extensions/ImageCropperTemplateCoreExtensions.cs # src/Umbraco.Web.Common/Macros/MacroRenderer.cs # src/Umbraco.Web.UI.NetCore/umbraco/config/lang/da.xml # src/Umbraco.Web.UI/Umbraco/config/lang/it.xml # src/Umbraco.Web.UI/web.Template.Debug.config # src/Umbraco.Web.UI/web.Template.config # src/Umbraco.Web/Compose/NotificationsComponent.cs # src/Umbraco.Web/Composing/ModuleInjector.cs # src/Umbraco.Web/Editors/AuthenticationController.cs # src/Umbraco.Web/Editors/BackOfficeController.cs # src/Umbraco.Web/Editors/ContentTypeController.cs # src/Umbraco.Web/Editors/CurrentUserController.cs # src/Umbraco.Web/Editors/DictionaryController.cs # src/Umbraco.Web/Editors/MediaTypeController.cs # src/Umbraco.Web/Editors/MemberController.cs # src/Umbraco.Web/Editors/MemberGroupController.cs # src/Umbraco.Web/Editors/MemberTypeController.cs # src/Umbraco.Web/Editors/NuCacheStatusController.cs # src/Umbraco.Web/Editors/UserGroupsController.cs # src/Umbraco.Web/Editors/UsersController.cs # src/Umbraco.Web/HealthCheck/Checks/Config/AbstractConfigCheck.cs # src/Umbraco.Web/HealthCheck/Checks/Config/CompilationDebugCheck.cs # src/Umbraco.Web/HealthCheck/Checks/Config/ConfigurationService.cs # src/Umbraco.Web/HealthCheck/Checks/Config/CustomErrorsCheck.cs # src/Umbraco.Web/HealthCheck/Checks/Config/MacroErrorsCheck.cs # src/Umbraco.Web/HealthCheck/Checks/Config/NotificationEmailCheck.cs # src/Umbraco.Web/HealthCheck/Checks/Config/TraceCheck.cs # src/Umbraco.Web/HealthCheck/Checks/Config/TrySkipIisCustomErrorsCheck.cs # src/Umbraco.Web/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs # src/Umbraco.Web/HealthCheck/Checks/Security/BaseHttpHeaderCheck.cs # src/Umbraco.Web/HealthCheck/Checks/Security/ExcessiveHeadersCheck.cs # src/Umbraco.Web/HealthCheck/Checks/Security/HttpsCheck.cs # src/Umbraco.Web/HealthCheck/NotificationMethods/EmailNotificationMethod.cs # src/Umbraco.Web/Models/Trees/MenuItemList.cs # src/Umbraco.Web/PublishedCache/NuCache/DataSource/ContentCacheDataModel.cs # src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs # src/Umbraco.Web/PublishedCache/NuCache/DataSource/SerializerBase.cs # src/Umbraco.Web/PublishedCache/NuCache/NuCacheComposer.cs # src/Umbraco.Web/Runtime/WebRuntime.cs # src/Umbraco.Web/Search/ExamineComponent.cs # src/Umbraco.Web/Trees/ApplicationTreeController.cs # src/Umbraco.Web/Trees/MemberTreeController.cs # src/Umbraco.Web/UrlHelperRenderExtensions.cs
This commit is contained in:
@@ -383,12 +383,12 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
var code = await _userManager.GeneratePasswordResetTokenAsync(identityUser);
|
||||
var callbackUrl = ConstructCallbackUrl(identityUser.Id, code);
|
||||
|
||||
var message = _textService.Localize("login/resetPasswordEmailCopyFormat",
|
||||
var message = _textService.Localize("login","resetPasswordEmailCopyFormat",
|
||||
// Ensure the culture of the found user is used for the email!
|
||||
UmbracoUserExtensions.GetUserCulture(identityUser.Culture, _textService, _globalSettings),
|
||||
new[] { identityUser.UserName, callbackUrl });
|
||||
|
||||
var subject = _textService.Localize("login/resetPasswordEmailCopySubject",
|
||||
var subject = _textService.Localize("login","resetPasswordEmailCopySubject",
|
||||
// Ensure the culture of the found user is used for the email!
|
||||
UmbracoUserExtensions.GetUserCulture(identityUser.Culture, _textService, _globalSettings));
|
||||
|
||||
@@ -445,11 +445,11 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
return BadRequest("Invalid code");
|
||||
}
|
||||
|
||||
var subject = _textService.Localize("login/mfaSecurityCodeSubject",
|
||||
var subject = _textService.Localize("login","mfaSecurityCodeSubject",
|
||||
// Ensure the culture of the found user is used for the email!
|
||||
UmbracoUserExtensions.GetUserCulture(user.Culture, _textService, _globalSettings));
|
||||
|
||||
var message = _textService.Localize("login/mfaSecurityCodeMessage",
|
||||
var message = _textService.Localize("login","mfaSecurityCodeMessage",
|
||||
// Ensure the culture of the found user is used for the email!
|
||||
UmbracoUserExtensions.GetUserCulture(user.Culture, _textService, _globalSettings),
|
||||
new[] { code });
|
||||
|
||||
@@ -335,7 +335,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
}
|
||||
|
||||
//Add error and redirect for it to be displayed
|
||||
TempData[ViewDataExtensions.TokenPasswordResetCode] = new[] { _textService.Localize("login/resetCodeExpired") };
|
||||
TempData[ViewDataExtensions.TokenPasswordResetCode] = new[] { _textService.Localize("login","resetCodeExpired") };
|
||||
return RedirectToLocal(Url.Action(nameof(Default), this.GetControllerName()));
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
|
||||
// Sign in the user with this external login provider (which auto links, etc...)
|
||||
var result = await _signInManager.ExternalLoginSignInAsync(loginInfo, isPersistent: false);
|
||||
|
||||
|
||||
var errors = new List<string>();
|
||||
|
||||
if (result == Microsoft.AspNetCore.Identity.SignInResult.Success)
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (string.IsNullOrWhiteSpace(parentId)) throw new ArgumentException("Value cannot be null or whitespace.", "parentId");
|
||||
if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", "name");
|
||||
if (name.ContainsAny(Path.GetInvalidPathChars())) {
|
||||
return ValidationProblem(_localizedTextService.Localize("codefile/createFolderIllegalChars"));
|
||||
return ValidationProblem(_localizedTextService.Localize("codefile", "createFolderIllegalChars"));
|
||||
}
|
||||
|
||||
// if the parentId is root (-1) then we just need an empty string as we are
|
||||
@@ -422,8 +422,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
}
|
||||
|
||||
display.AddErrorNotification(
|
||||
_localizedTextService.Localize("speechBubbles/partialViewErrorHeader"),
|
||||
_localizedTextService.Localize("speechBubbles/partialViewErrorText"));
|
||||
_localizedTextService.Localize("speechBubbles", "partialViewErrorHeader"),
|
||||
_localizedTextService.Localize("speechBubbles", "partialViewErrorText"));
|
||||
break;
|
||||
|
||||
case Constants.Trees.PartialViewMacros:
|
||||
@@ -437,8 +437,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
}
|
||||
|
||||
display.AddErrorNotification(
|
||||
_localizedTextService.Localize("speechBubbles/partialViewErrorHeader"),
|
||||
_localizedTextService.Localize("speechBubbles/partialViewErrorText"));
|
||||
_localizedTextService.Localize("speechBubbles", "partialViewErrorHeader"),
|
||||
_localizedTextService.Localize("speechBubbles", "partialViewErrorText"));
|
||||
break;
|
||||
|
||||
case Constants.Trees.Scripts:
|
||||
|
||||
@@ -275,7 +275,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
new ContentVariantDisplay
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
Name = _localizedTextService.Localize("general/recycleBin")
|
||||
Name = _localizedTextService.Localize("general","recycleBin")
|
||||
}
|
||||
},
|
||||
ContentApps = apps
|
||||
@@ -417,16 +417,65 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
var emptyContent = _contentService.Create("", parentId, contentType.Alias, _backofficeSecurityAccessor.BackOfficeSecurity.GetUserId().ResultOr(0));
|
||||
var mapped = MapToDisplay(emptyContent);
|
||||
|
||||
return CleanContentItemDisplay(mapped);
|
||||
}
|
||||
|
||||
private ContentItemDisplay CleanContentItemDisplay(ContentItemDisplay display)
|
||||
{
|
||||
// translate the content type name if applicable
|
||||
mapped.ContentTypeName = _localizedTextService.UmbracoDictionaryTranslate(CultureDictionary, mapped.ContentTypeName);
|
||||
display.ContentTypeName = _localizedTextService.UmbracoDictionaryTranslate(CultureDictionary, display.ContentTypeName);
|
||||
// if your user type doesn't have access to the Settings section it would not get this property mapped
|
||||
if (mapped.DocumentType != null)
|
||||
mapped.DocumentType.Name = _localizedTextService.UmbracoDictionaryTranslate(CultureDictionary, mapped.DocumentType.Name);
|
||||
if (display.DocumentType != null)
|
||||
display.DocumentType.Name = _localizedTextService.UmbracoDictionaryTranslate(CultureDictionary, display.DocumentType.Name);
|
||||
|
||||
//remove the listview app if it exists
|
||||
mapped.ContentApps = mapped.ContentApps.Where(x => x.Alias != "umbListView").ToList();
|
||||
display.ContentApps = display.ContentApps.Where(x => x.Alias != "umbListView").ToList();
|
||||
|
||||
return mapped;
|
||||
return display;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an empty <see cref="ContentItemDisplay"/> for each content type in the IEnumerable, all with the same parent ID
|
||||
/// </summary>
|
||||
/// <remarks>Will attempt to re-use the same permissions for every content as long as the path and user are the same</remarks>
|
||||
/// <param name="contentTypes"></param>
|
||||
/// <param name="parentId"></param>
|
||||
/// <returns></returns>
|
||||
private IEnumerable<ContentItemDisplay> GetEmpties(IEnumerable<IContentType> contentTypes, int parentId)
|
||||
{
|
||||
var result = new List<ContentItemDisplay>();
|
||||
var backOfficeSecurity = _backofficeSecurityAccessor.BackOfficeSecurity;
|
||||
|
||||
var userId = backOfficeSecurity.GetUserId().ResultOr(0);
|
||||
var currentUser = backOfficeSecurity.CurrentUser;
|
||||
// We know that if the ID is less than 0 the parent is null.
|
||||
// Since this is called with parent ID it's safe to assume that the parent is the same for all the content types.
|
||||
var parent = parentId > 0 ? _contentService.GetById(parentId) : null;
|
||||
// Since the parent is the same and the path used to get permissions is based on the parent we only have to do it once
|
||||
var path = parent == null ? "-1" : parent.Path;
|
||||
var permissions = new Dictionary<string, EntityPermissionSet>
|
||||
{
|
||||
[path] = _userService.GetPermissionsForPath(currentUser, path)
|
||||
};
|
||||
|
||||
foreach (var contentType in contentTypes)
|
||||
{
|
||||
var emptyContent = _contentService.Create("", parentId, contentType, userId);
|
||||
|
||||
var mapped = MapToDisplay(emptyContent, context =>
|
||||
{
|
||||
// Since the permissions depend on current user and path, we add both of these to context as well,
|
||||
// that way we can compare the path and current user when mapping, if they're the same just take permissions
|
||||
// and skip getting them again, in theory they should always be the same, but better safe than sorry.,
|
||||
context.Items["Parent"] = parent;
|
||||
context.Items["CurrentUser"] = currentUser;
|
||||
context.Items["Permissions"] = permissions;
|
||||
});
|
||||
result.Add(CleanContentItemDisplay(mapped));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -437,22 +486,9 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
[OutgoingEditorModelEvent]
|
||||
public ActionResult<IDictionary<Guid, ContentItemDisplay>> GetEmptyByKeys([FromQuery] Guid[] contentTypeKeys, [FromQuery] int parentId)
|
||||
{
|
||||
var result = new Dictionary<Guid, ContentItemDisplay>();
|
||||
|
||||
using var scope = _scopeProvider.CreateScope(autoComplete: true);
|
||||
var contentTypes = _contentTypeService.GetAll(contentTypeKeys).ToList();
|
||||
|
||||
foreach (var contentType in contentTypes)
|
||||
{
|
||||
if (contentType is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
result.Add(contentType.Key, GetEmptyInner(contentType, parentId));
|
||||
}
|
||||
|
||||
return result;
|
||||
return GetEmpties(contentTypes, parentId).ToDictionary(x => x.ContentTypeKey);
|
||||
}
|
||||
|
||||
[OutgoingEditorModelEvent]
|
||||
@@ -616,8 +652,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
|
||||
var notificationModel = new SimpleNotificationModel();
|
||||
notificationModel.AddSuccessNotification(
|
||||
_localizedTextService.Localize("blueprints/createdBlueprintHeading"),
|
||||
_localizedTextService.Localize("blueprints/createdBlueprintMessage", new[] { content.Name })
|
||||
_localizedTextService.Localize("blueprints", "createdBlueprintHeading"),
|
||||
_localizedTextService.Localize("blueprints", "createdBlueprintMessage", new[] { content.Name })
|
||||
);
|
||||
|
||||
return notificationModel;
|
||||
@@ -628,7 +664,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
var existing = _contentService.GetBlueprintsForContentTypes(content.ContentTypeId);
|
||||
if (existing.Any(x => x.Name == name && x.Id != content.Id))
|
||||
{
|
||||
ModelState.AddModelError(modelName, _localizedTextService.Localize("blueprints/duplicateBlueprintMessage"));
|
||||
ModelState.AddModelError(modelName, _localizedTextService.Localize("blueprints", "duplicateBlueprintMessage"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -794,15 +830,15 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
var variantName = GetVariantName(culture, segment);
|
||||
|
||||
AddSuccessNotification(notifications, culture, segment,
|
||||
_localizedTextService.Localize("speechBubbles/editContentSendToPublish"),
|
||||
_localizedTextService.Localize("speechBubbles/editVariantSendToPublishText", new[] { variantName }));
|
||||
_localizedTextService.Localize("speechBubbles", "editContentSendToPublish"),
|
||||
_localizedTextService.Localize("speechBubbles", "editVariantSendToPublishText", new[] { variantName }));
|
||||
}
|
||||
}
|
||||
else if (ModelState.IsValid)
|
||||
{
|
||||
globalNotifications.AddSuccessNotification(
|
||||
_localizedTextService.Localize("speechBubbles/editContentSendToPublish"),
|
||||
_localizedTextService.Localize("speechBubbles/editContentSendToPublishText"));
|
||||
_localizedTextService.Localize("speechBubbles", "editContentSendToPublish"),
|
||||
_localizedTextService.Localize("speechBubbles", "editContentSendToPublishText"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -819,8 +855,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (!await ValidatePublishBranchPermissionsAsync(contentItem))
|
||||
{
|
||||
globalNotifications.AddErrorNotification(
|
||||
_localizedTextService.Localize("publish"),
|
||||
_localizedTextService.Localize("publish/invalidPublishBranchPermissions"));
|
||||
_localizedTextService.Localize(null,"publish"),
|
||||
_localizedTextService.Localize("publish", "invalidPublishBranchPermissions"));
|
||||
wasCancelled = false;
|
||||
break;
|
||||
}
|
||||
@@ -835,8 +871,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (!await ValidatePublishBranchPermissionsAsync(contentItem))
|
||||
{
|
||||
globalNotifications.AddErrorNotification(
|
||||
_localizedTextService.Localize("publish"),
|
||||
_localizedTextService.Localize("publish/invalidPublishBranchPermissions"));
|
||||
_localizedTextService.Localize(null,"publish"),
|
||||
_localizedTextService.Localize("publish", "invalidPublishBranchPermissions"));
|
||||
wasCancelled = false;
|
||||
break;
|
||||
}
|
||||
@@ -931,7 +967,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
//if there's more than 1 variant, then we need to add the culture specific error
|
||||
//messages based on the variants in error so that the messages show in the publish/save dialog
|
||||
if (variants.Count > 1)
|
||||
AddVariantValidationError(variant.Culture, variant.Segment, "publish/contentPublishedFailedByMissingName");
|
||||
AddVariantValidationError(variant.Culture, variant.Segment, "publish","contentPublishedFailedByMissingName");
|
||||
else
|
||||
return false; //It's invariant and is missing critical data, it cannot be saved
|
||||
}
|
||||
@@ -968,15 +1004,15 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
/// <param name="variantCount"></param>
|
||||
/// <param name="notifications"></param>
|
||||
/// <param name="globalNotifications"></param>
|
||||
/// <param name="invariantSavedLocalizationKey"></param>
|
||||
/// <param name="variantSavedLocalizationKey"></param>
|
||||
/// <param name="invariantSavedLocalizationAlias"></param>
|
||||
/// <param name="variantSavedLocalizationAlias"></param>
|
||||
/// <param name="wasCancelled"></param>
|
||||
/// <remarks>
|
||||
/// Method is used for normal Saving and Scheduled Publishing
|
||||
/// </remarks>
|
||||
private void SaveAndNotify(ContentItemSave contentItem, Func<IContent, OperationResult> saveMethod, int variantCount,
|
||||
Dictionary<string, SimpleNotificationModel> notifications, SimpleNotificationModel globalNotifications,
|
||||
string invariantSavedLocalizationKey, string variantSavedLocalizationKey, string cultureForInvariantErrors,
|
||||
string invariantSavedLocalizationAlias, string variantSavedLocalizationAlias, string cultureForInvariantErrors,
|
||||
out bool wasCancelled)
|
||||
{
|
||||
var saveResult = saveMethod(contentItem.PersistedContent);
|
||||
@@ -996,15 +1032,15 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
var variantName = GetVariantName(culture, segment);
|
||||
|
||||
AddSuccessNotification(notifications, culture, segment,
|
||||
_localizedTextService.Localize("speechBubbles/editContentSavedHeader"),
|
||||
_localizedTextService.Localize(variantSavedLocalizationKey, new[] { variantName }));
|
||||
_localizedTextService.Localize("speechBubbles", "editContentSavedHeader"),
|
||||
_localizedTextService.Localize(null,variantSavedLocalizationAlias, new[] { variantName }));
|
||||
}
|
||||
}
|
||||
else if (ModelState.IsValid)
|
||||
{
|
||||
globalNotifications.AddSuccessNotification(
|
||||
_localizedTextService.Localize("speechBubbles/editContentSavedHeader"),
|
||||
_localizedTextService.Localize(invariantSavedLocalizationKey));
|
||||
_localizedTextService.Localize("speechBubbles", "editContentSavedHeader"),
|
||||
_localizedTextService.Localize("speechBubbles",invariantSavedLocalizationAlias));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1131,7 +1167,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
//can't continue, a mandatory variant is not published and not scheduled for publishing
|
||||
// TODO: Add segment
|
||||
AddVariantValidationError(culture, null, "speechBubbles/scheduleErrReleaseDate2");
|
||||
AddVariantValidationError(culture, null, "speechBubbles", "scheduleErrReleaseDate2");
|
||||
isValid = false;
|
||||
continue;
|
||||
}
|
||||
@@ -1139,7 +1175,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
//can't continue, a mandatory variant is not published and it's scheduled for publishing after a non-mandatory
|
||||
// TODO: Add segment
|
||||
AddVariantValidationError(culture, null, "speechBubbles/scheduleErrReleaseDate3");
|
||||
AddVariantValidationError(culture, null, "speechBubbles", "scheduleErrReleaseDate3");
|
||||
isValid = false;
|
||||
continue;
|
||||
}
|
||||
@@ -1153,7 +1189,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
//1) release date cannot be less than now
|
||||
if (variant.ReleaseDate.HasValue && variant.ReleaseDate < DateTime.Now)
|
||||
{
|
||||
AddVariantValidationError(variant.Culture, variant.Segment, "speechBubbles/scheduleErrReleaseDate1");
|
||||
AddVariantValidationError(variant.Culture, variant.Segment, "speechBubbles", "scheduleErrReleaseDate1");
|
||||
isValid = false;
|
||||
continue;
|
||||
}
|
||||
@@ -1161,7 +1197,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
//2) expire date cannot be less than now
|
||||
if (variant.ExpireDate.HasValue && variant.ExpireDate < DateTime.Now)
|
||||
{
|
||||
AddVariantValidationError(variant.Culture, variant.Segment, "speechBubbles/scheduleErrExpireDate1");
|
||||
AddVariantValidationError(variant.Culture, variant.Segment, "speechBubbles", "scheduleErrExpireDate1");
|
||||
isValid = false;
|
||||
continue;
|
||||
}
|
||||
@@ -1169,7 +1205,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
//3) expire date cannot be less than release date
|
||||
if (variant.ExpireDate.HasValue && variant.ReleaseDate.HasValue && variant.ExpireDate <= variant.ReleaseDate)
|
||||
{
|
||||
AddVariantValidationError(variant.Culture, variant.Segment, "speechBubbles/scheduleErrExpireDate2");
|
||||
AddVariantValidationError(variant.Culture, variant.Segment, "speechBubbles", "scheduleErrExpireDate2");
|
||||
isValid = false;
|
||||
continue;
|
||||
}
|
||||
@@ -1397,19 +1433,19 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (r.publishing && !r.isValid)
|
||||
{
|
||||
//flagged for publishing but the mandatory culture is invalid
|
||||
AddVariantValidationError(r.model.Culture, r.model.Segment, "publish/contentPublishedFailedReqCultureValidationError");
|
||||
AddVariantValidationError(r.model.Culture, r.model.Segment, "publish", "contentPublishedFailedReqCultureValidationError");
|
||||
canPublish = false;
|
||||
}
|
||||
else if (r.publishing && r.isValid && firstInvalidMandatoryCulture != null)
|
||||
{
|
||||
//in this case this culture also cannot be published because another mandatory culture is invalid
|
||||
AddVariantValidationError(r.model.Culture, r.model.Segment, "publish/contentPublishedFailedReqCultureValidationError", firstInvalidMandatoryCulture);
|
||||
AddVariantValidationError(r.model.Culture, r.model.Segment, "publish", "contentPublishedFailedReqCultureValidationError", firstInvalidMandatoryCulture);
|
||||
canPublish = false;
|
||||
}
|
||||
else if (!r.publishing)
|
||||
{
|
||||
//cannot continue publishing since a required culture that is not currently being published isn't published
|
||||
AddVariantValidationError(r.model.Culture, r.model.Segment, "speechBubbles/contentReqCulturePublishError");
|
||||
AddVariantValidationError(r.model.Culture, r.model.Segment, "speechBubbles", "contentReqCulturePublishError");
|
||||
canPublish = false;
|
||||
}
|
||||
}
|
||||
@@ -1434,7 +1470,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
var valid = persistentContent.PublishCulture(CultureImpact.Explicit(variant.Culture, defaultCulture.InvariantEquals(variant.Culture)));
|
||||
if (!valid)
|
||||
{
|
||||
AddVariantValidationError(variant.Culture, variant.Segment, "speechBubbles/contentCultureValidationError");
|
||||
AddVariantValidationError(variant.Culture, variant.Segment, "speechBubbles", "contentCultureValidationError");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1451,12 +1487,12 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
/// <param name="cultureToken">
|
||||
/// The culture used in the localization message, null by default which means <see cref="culture"/> will be used.
|
||||
/// </param>
|
||||
private void AddVariantValidationError(string culture, string segment, string localizationKey, string cultureToken = null)
|
||||
private void AddVariantValidationError(string culture, string segment, string localizationArea,string localizationAlias, string cultureToken = null)
|
||||
{
|
||||
var cultureToUse = cultureToken ?? culture;
|
||||
var variantName = GetVariantName(cultureToUse, segment);
|
||||
|
||||
var errMsg = _localizedTextService.Localize(localizationKey, new[] { variantName });
|
||||
var errMsg = _localizedTextService.Localize(localizationArea, localizationAlias, new[] { variantName });
|
||||
|
||||
ModelState.AddVariantValidationError(culture, segment, errMsg);
|
||||
}
|
||||
@@ -1585,7 +1621,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
_contentService.EmptyRecycleBin(_backofficeSecurityAccessor.BackOfficeSecurity.GetUserId().ResultOr(Constants.Security.SuperUserId));
|
||||
|
||||
return Ok(_localizedTextService.Localize("defaultdialogs/recycleBinIsEmpty"));
|
||||
return Ok(_localizedTextService.Localize("defaultdialogs", "recycleBinIsEmpty"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1726,8 +1762,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
else
|
||||
{
|
||||
content.AddSuccessNotification(
|
||||
_localizedTextService.Localize("content/unpublish"),
|
||||
_localizedTextService.Localize("speechBubbles/contentUnpublished"));
|
||||
_localizedTextService.Localize("content", "unpublish"),
|
||||
_localizedTextService.Localize("speechBubbles", "contentUnpublished"));
|
||||
return content;
|
||||
}
|
||||
}
|
||||
@@ -1752,8 +1788,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (results.Any(x => x.Value.Result == PublishResultType.SuccessUnpublishMandatoryCulture))
|
||||
{
|
||||
content.AddSuccessNotification(
|
||||
_localizedTextService.Localize("content/unpublish"),
|
||||
_localizedTextService.Localize("speechBubbles/contentMandatoryCultureUnpublished"));
|
||||
_localizedTextService.Localize("content", "unpublish"),
|
||||
_localizedTextService.Localize("speechBubbles", "contentMandatoryCultureUnpublished"));
|
||||
return content;
|
||||
}
|
||||
|
||||
@@ -1761,8 +1797,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
foreach (var r in results)
|
||||
{
|
||||
content.AddSuccessNotification(
|
||||
_localizedTextService.Localize("content/unpublish"),
|
||||
_localizedTextService.Localize("speechBubbles/contentCultureUnpublished", new[] { _allLangs.Value[r.Key].CultureName }));
|
||||
_localizedTextService.Localize("conten", "unpublish"),
|
||||
_localizedTextService.Localize("speechBubbles", "contentCultureUnpublished", new[] { _allLangs.Value[r.Key].CultureName }));
|
||||
}
|
||||
return content;
|
||||
|
||||
@@ -1793,7 +1829,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
}
|
||||
catch (UriFormatException)
|
||||
{
|
||||
return ValidationProblem(_localizedTextService.Localize("assignDomain/invalidDomain"));
|
||||
return ValidationProblem(_localizedTextService.Localize("assignDomain", "invalidDomain"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1943,7 +1979,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
|
||||
foreach (var (culture, segment) in variantErrors)
|
||||
{
|
||||
AddVariantValidationError(culture, segment, "speechBubbles/contentCultureValidationError");
|
||||
AddVariantValidationError(culture, segment, "speechBubbles", "contentCultureValidationError");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2064,7 +2100,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (toMove.ContentType.AllowedAsRoot == false)
|
||||
{
|
||||
return ValidationProblem(
|
||||
_localizedTextService.Localize("moveOrCopy/notAllowedAtRoot"));
|
||||
_localizedTextService.Localize("moveOrCopy", "notAllowedAtRoot"));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2081,14 +2117,14 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
.Any(x => x.Value == toMove.ContentType.Id) == false)
|
||||
{
|
||||
return ValidationProblem(
|
||||
_localizedTextService.Localize("moveOrCopy/notAllowedByContentType"));
|
||||
_localizedTextService.Localize("moveOrCopy", "notAllowedByContentType"));
|
||||
}
|
||||
|
||||
// Check on paths
|
||||
if ($",{parent.Path},".IndexOf($",{toMove.Id},", StringComparison.Ordinal) > -1)
|
||||
{
|
||||
return ValidationProblem(
|
||||
_localizedTextService.Localize("moveOrCopy/notAllowedByPath"));
|
||||
_localizedTextService.Localize("moveOrCopy", "notAllowedByPath"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2157,16 +2193,16 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
//either invariant single publish, or bulk publish where all statuses are already published
|
||||
display.AddSuccessNotification(
|
||||
_localizedTextService.Localize("speechBubbles/editContentPublishedHeader"),
|
||||
_localizedTextService.Localize("speechBubbles/editContentPublishedText"));
|
||||
_localizedTextService.Localize("speechBubbles", "editContentPublishedHeader"),
|
||||
_localizedTextService.Localize("speechBubbles", "editContentPublishedText"));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var c in successfulCultures)
|
||||
{
|
||||
display.AddSuccessNotification(
|
||||
_localizedTextService.Localize("speechBubbles/editContentPublishedHeader"),
|
||||
_localizedTextService.Localize("speechBubbles/editVariantPublishedText", new[] { _allLangs.Value[c].CultureName }));
|
||||
_localizedTextService.Localize("speechBubbles", "editContentPublishedHeader"),
|
||||
_localizedTextService.Localize("speechBubbles", "editVariantPublishedText", new[] { _allLangs.Value[c].CultureName }));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2182,20 +2218,20 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (successfulCultures == null)
|
||||
{
|
||||
display.AddSuccessNotification(
|
||||
_localizedTextService.Localize("speechBubbles/editContentPublishedHeader"),
|
||||
_localizedTextService.Localize("speechBubbles", "editContentPublishedHeader"),
|
||||
totalStatusCount > 1
|
||||
? _localizedTextService.Localize("speechBubbles/editMultiContentPublishedText", new[] { itemCount.ToInvariantString() })
|
||||
: _localizedTextService.Localize("speechBubbles/editContentPublishedText"));
|
||||
? _localizedTextService.Localize("speechBubbles", "editMultiContentPublishedText", new[] { itemCount.ToInvariantString() })
|
||||
: _localizedTextService.Localize("speechBubbles", "editContentPublishedText"));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var c in successfulCultures)
|
||||
{
|
||||
display.AddSuccessNotification(
|
||||
_localizedTextService.Localize("speechBubbles/editContentPublishedHeader"),
|
||||
_localizedTextService.Localize("speechBubbles", "editContentPublishedHeader"),
|
||||
totalStatusCount > 1
|
||||
? _localizedTextService.Localize("speechBubbles/editMultiVariantPublishedText", new[] { itemCount.ToInvariantString(), _allLangs.Value[c].CultureName })
|
||||
: _localizedTextService.Localize("speechBubbles/editVariantPublishedText", new[] { _allLangs.Value[c].CultureName }));
|
||||
? _localizedTextService.Localize("speechBubbles", "editMultiVariantPublishedText", new[] { itemCount.ToInvariantString(), _allLangs.Value[c].CultureName })
|
||||
: _localizedTextService.Localize("speechBubbles", "editVariantPublishedText", new[] { _allLangs.Value[c].CultureName }));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2205,8 +2241,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
//TODO: This doesn't take into account variations with the successfulCultures param
|
||||
var names = string.Join(", ", status.Select(x => $"'{x.Content.Name}'"));
|
||||
display.AddWarningNotification(
|
||||
_localizedTextService.Localize("publish"),
|
||||
_localizedTextService.Localize("publish/contentPublishedFailedByParent",
|
||||
_localizedTextService.Localize(null,"publish"),
|
||||
_localizedTextService.Localize("publish", "contentPublishedFailedByParent",
|
||||
new[] { names }).Trim());
|
||||
}
|
||||
break;
|
||||
@@ -2214,7 +2250,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
//TODO: This doesn't take into account variations with the successfulCultures param
|
||||
var names = string.Join(", ", status.Select(x => $"'{x.Content.Name}'"));
|
||||
AddCancelMessage(display, message: "publish/contentPublishedFailedByEvent", messageParams: new[] { names });
|
||||
AddCancelMessage(display, "publish","contentPublishedFailedByEvent", messageParams: new[] { names });
|
||||
}
|
||||
break;
|
||||
case PublishResultType.FailedPublishAwaitingRelease:
|
||||
@@ -2222,8 +2258,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
//TODO: This doesn't take into account variations with the successfulCultures param
|
||||
var names = string.Join(", ", status.Select(x => $"'{x.Content.Name}'"));
|
||||
display.AddWarningNotification(
|
||||
_localizedTextService.Localize("publish"),
|
||||
_localizedTextService.Localize("publish/contentPublishedFailedAwaitingRelease",
|
||||
_localizedTextService.Localize(null,"publish"),
|
||||
_localizedTextService.Localize("publish", "contentPublishedFailedAwaitingRelease",
|
||||
new[] { names }).Trim());
|
||||
}
|
||||
break;
|
||||
@@ -2232,8 +2268,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
//TODO: This doesn't take into account variations with the successfulCultures param
|
||||
var names = string.Join(", ", status.Select(x => $"'{x.Content.Name}'"));
|
||||
display.AddWarningNotification(
|
||||
_localizedTextService.Localize("publish"),
|
||||
_localizedTextService.Localize("publish/contentPublishedFailedExpired",
|
||||
_localizedTextService.Localize(null,"publish"),
|
||||
_localizedTextService.Localize("publish", "contentPublishedFailedExpired",
|
||||
new[] { names }).Trim());
|
||||
}
|
||||
break;
|
||||
@@ -2242,8 +2278,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
//TODO: This doesn't take into account variations with the successfulCultures param
|
||||
var names = string.Join(", ", status.Select(x => $"'{x.Content.Name}'"));
|
||||
display.AddWarningNotification(
|
||||
_localizedTextService.Localize("publish"),
|
||||
_localizedTextService.Localize("publish/contentPublishedFailedIsTrashed",
|
||||
_localizedTextService.Localize(null,"publish"),
|
||||
_localizedTextService.Localize("publish", "contentPublishedFailedIsTrashed",
|
||||
new[] { names }).Trim());
|
||||
}
|
||||
break;
|
||||
@@ -2253,8 +2289,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
var names = string.Join(", ", status.Select(x => $"'{x.Content.Name}'"));
|
||||
display.AddWarningNotification(
|
||||
_localizedTextService.Localize("publish"),
|
||||
_localizedTextService.Localize("publish/contentPublishedFailedInvalid",
|
||||
_localizedTextService.Localize(null,"publish"),
|
||||
_localizedTextService.Localize("publish", "contentPublishedFailedInvalid",
|
||||
new[] { names }).Trim());
|
||||
}
|
||||
else
|
||||
@@ -2263,8 +2299,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
var names = string.Join(", ", status.Select(x => $"'{(x.Content.ContentType.VariesByCulture() ? x.Content.GetCultureName(c) : x.Content.Name)}'"));
|
||||
display.AddWarningNotification(
|
||||
_localizedTextService.Localize("publish"),
|
||||
_localizedTextService.Localize("publish/contentPublishedFailedInvalid",
|
||||
_localizedTextService.Localize(null,"publish"),
|
||||
_localizedTextService.Localize("publish", "contentPublishedFailedInvalid",
|
||||
new[] { names }).Trim());
|
||||
}
|
||||
}
|
||||
@@ -2272,7 +2308,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
break;
|
||||
case PublishResultType.FailedPublishMandatoryCultureMissing:
|
||||
display.AddWarningNotification(
|
||||
_localizedTextService.Localize("publish"),
|
||||
_localizedTextService.Localize(null,"publish"),
|
||||
"publish/contentPublishedFailedByCulture");
|
||||
break;
|
||||
default:
|
||||
@@ -2286,12 +2322,22 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <returns></returns>
|
||||
private ContentItemDisplay MapToDisplay(IContent content)
|
||||
{
|
||||
var display = _umbracoMapper.Map<ContentItemDisplay>(content, context =>
|
||||
private ContentItemDisplay MapToDisplay(IContent content) =>
|
||||
MapToDisplay(content, context =>
|
||||
{
|
||||
context.Items["CurrentUser"] = _backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser;
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Used to map an <see cref="IContent"/> instance to a <see cref="ContentItemDisplay"/> and ensuring AllowPreview is set correctly.
|
||||
/// Also allows you to pass in an action for the mapper context where you can pass additional information on to the mapper.
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="contextOptions"></param>
|
||||
/// <returns></returns>
|
||||
private ContentItemDisplay MapToDisplay(IContent content, Action<MapperContext> contextOptions)
|
||||
{
|
||||
var display = _umbracoMapper.Map<ContentItemDisplay>(content, contextOptions);
|
||||
display.AllowPreview = display.AllowPreview && content.Trashed == false && content.ContentType.IsElement == false;
|
||||
return display;
|
||||
}
|
||||
@@ -2404,11 +2450,11 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
case OperationResultType.FailedExceptionThrown:
|
||||
case OperationResultType.NoOperation:
|
||||
default:
|
||||
return ValidationProblem(_localizedTextService.Localize("speechBubbles/operationFailedHeader"));
|
||||
return ValidationProblem(_localizedTextService.Localize("speechBubbles", "operationFailedHeader"));
|
||||
case OperationResultType.FailedCancelledByEvent:
|
||||
return ValidationProblem(
|
||||
_localizedTextService.Localize("speechBubbles/operationCancelledHeader"),
|
||||
_localizedTextService.Localize("speechBubbles/operationCancelledText"));
|
||||
_localizedTextService.Localize("speechBubbles", "operationCancelledHeader"),
|
||||
_localizedTextService.Localize("speechBubbles", "operationCancelledText"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,15 +190,13 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
/// Adds a cancelled message to the display
|
||||
/// </summary>
|
||||
/// <param name="display"></param>
|
||||
/// <param name="header"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="localizeHeader"></param>
|
||||
/// <param name="localizeMessage"></param>
|
||||
/// <param name="headerParams"></param>
|
||||
/// <param name="messageArea"></param>
|
||||
/// <param name="messageAlias"></param>
|
||||
/// <param name="messageParams"></param>
|
||||
protected void AddCancelMessage(INotificationModel display, string header = "speechBubbles/operationCancelledHeader", string message = "speechBubbles/operationCancelledText", bool localizeHeader = true,
|
||||
bool localizeMessage = true,
|
||||
string[] headerParams = null,
|
||||
protected void AddCancelMessage(
|
||||
INotificationModel display,
|
||||
string messageArea = "speechBubbles",
|
||||
string messageAlias ="operationCancelledText",
|
||||
string[] messageParams = null)
|
||||
{
|
||||
// if there's already a default event message, don't add our default one
|
||||
@@ -209,8 +207,29 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
}
|
||||
|
||||
display.AddWarningNotification(
|
||||
localizeHeader ? LocalizedTextService.Localize(header, headerParams) : header,
|
||||
localizeMessage ? LocalizedTextService.Localize(message, messageParams) : message);
|
||||
LocalizedTextService.Localize("speechBubbles", "operationCancelledHeader"),
|
||||
LocalizedTextService.Localize(messageArea, messageAlias, messageParams));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a cancelled message to the display
|
||||
/// </summary>
|
||||
/// <param name="display"></param>
|
||||
/// <param name="header"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="headerArea"></param>
|
||||
/// <param name="headerAlias"></param>
|
||||
/// <param name="headerParams"></param>
|
||||
protected void AddCancelMessage(INotificationModel display, string message)
|
||||
{
|
||||
// if there's already a default event message, don't add our default one
|
||||
IEventMessagesFactory messages = EventMessages;
|
||||
if (messages != null && messages.GetOrDefault().GetAll().Any(x => x.IsDefaultEventMessage))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
display.AddWarningNotification(LocalizedTextService.Localize("speechBubbles", "operationCancelledHeader"), message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
|
||||
|
||||
display.AddSuccessNotification(
|
||||
_localizedTextService.Localize("speechBubbles/contentTypeSavedHeader"),
|
||||
_localizedTextService.Localize("speechBubbles","contentTypeSavedHeader"),
|
||||
string.Empty);
|
||||
|
||||
return display;
|
||||
@@ -612,8 +612,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
else
|
||||
{
|
||||
model.Notifications.Add(new BackOfficeNotification(
|
||||
_localizedTextService.Localize("speechBubbles/operationFailedHeader"),
|
||||
_localizedTextService.Localize("media/disallowedFileType"),
|
||||
_localizedTextService.Localize("speechBubbles","operationFailedHeader"),
|
||||
_localizedTextService.Localize("media","disallowedFileType"),
|
||||
NotificationStyle.Warning));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
var exists = allAliases.InvariantContains(contentTypeSave.Alias);
|
||||
if (exists && (ctId == 0 || !ct.Alias.InvariantEquals(contentTypeSave.Alias)))
|
||||
{
|
||||
ModelState.AddModelError("Alias", LocalizedTextService.Localize("editcontenttype/aliasAlreadyExists"));
|
||||
ModelState.AddModelError("Alias", LocalizedTextService.Localize("editcontenttype", "aliasAlreadyExists"));
|
||||
}
|
||||
|
||||
// execute the external validators
|
||||
@@ -417,7 +417,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
case MoveOperationStatusType.FailedCancelledByEvent:
|
||||
return ValidationProblem();
|
||||
case MoveOperationStatusType.FailedNotAllowedByPath:
|
||||
return ValidationProblem(LocalizedTextService.Localize("moveOrCopy/notAllowedByPath"));
|
||||
return ValidationProblem(LocalizedTextService.Localize("moveOrCopy", "notAllowedByPath"));
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
@@ -453,8 +453,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
return NotFound();
|
||||
case MoveOperationStatusType.FailedCancelledByEvent:
|
||||
return ValidationProblem();
|
||||
case MoveOperationStatusType.FailedNotAllowedByPath:
|
||||
return ValidationProblem(LocalizedTextService.Localize("moveOrCopy/notAllowedByPath"));
|
||||
case MoveOperationStatusType.FailedNotAllowedByPath:
|
||||
return ValidationProblem(LocalizedTextService.Localize("moveOrCopy", "notAllowedByPath"));
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
// even if we weren't resetting this, it is the correct value (null), otherwise if we were resetting then it will contain the new pword
|
||||
var result = new ModelWithNotifications<string>(passwordChangeResult.Result.ResetPassword);
|
||||
result.AddSuccessNotification(_localizedTextService.Localize("user/password"), _localizedTextService.Localize("user/passwordChanged"));
|
||||
result.AddSuccessNotification(_localizedTextService.Localize("user","password"), _localizedTextService.Localize("user","passwordChanged"));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Umbraco.Cms.Core.Cache;
|
||||
using Umbraco.Cms.Core.Configuration;
|
||||
@@ -20,6 +21,7 @@ using Umbraco.Cms.Web.Common.Attributes;
|
||||
using Umbraco.Cms.Web.Common.Authorization;
|
||||
using Umbraco.Cms.Web.Common.Controllers;
|
||||
using Umbraco.Cms.Web.Common.Filters;
|
||||
using Umbraco.Core.Dashboards;
|
||||
using Umbraco.Extensions;
|
||||
using Constants = Umbraco.Cms.Core.Constants;
|
||||
|
||||
@@ -39,7 +41,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
private readonly IDashboardService _dashboardService;
|
||||
private readonly IUmbracoVersion _umbracoVersion;
|
||||
private readonly IShortStringHelper _shortStringHelper;
|
||||
|
||||
private readonly IOptions<ContentDashboardSettings> _dashboardSettings;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DashboardController"/> with all its dependencies.
|
||||
/// </summary>
|
||||
@@ -49,7 +51,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
ILogger<DashboardController> logger,
|
||||
IDashboardService dashboardService,
|
||||
IUmbracoVersion umbracoVersion,
|
||||
IShortStringHelper shortStringHelper)
|
||||
IShortStringHelper shortStringHelper,
|
||||
IOptions<ContentDashboardSettings> dashboardSettings)
|
||||
|
||||
{
|
||||
_backOfficeSecurityAccessor = backOfficeSecurityAccessor;
|
||||
@@ -58,6 +61,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
_dashboardService = dashboardService;
|
||||
_umbracoVersion = umbracoVersion;
|
||||
_shortStringHelper = shortStringHelper;
|
||||
_dashboardSettings = dashboardSettings;
|
||||
}
|
||||
|
||||
//we have just one instance of HttpClient shared for the entire application
|
||||
@@ -65,7 +69,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
|
||||
//we have baseurl as a param to make previewing easier, so we can test with a dev domain from client side
|
||||
[ValidateAngularAntiForgeryToken]
|
||||
public async Task<JObject> GetRemoteDashboardContent(string section, string baseUrl = "https://dashboard.umbraco.org/")
|
||||
public async Task<JObject> GetRemoteDashboardContent(string section, string baseUrl = "https://dashboard.umbraco.com/")
|
||||
{
|
||||
var user = _backOfficeSecurityAccessor.BackOfficeSecurity.CurrentUser;
|
||||
var allowedSections = string.Join(",", user.AllowedSections);
|
||||
@@ -73,7 +77,14 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
var version = _umbracoVersion.SemanticVersion.ToSemanticStringWithoutBuild();
|
||||
var isAdmin = user.IsAdmin();
|
||||
|
||||
var url = string.Format(baseUrl + "{0}?section={0}&allowed={1}&lang={2}&version={3}&admin={4}", section, allowedSections, language, version, isAdmin);
|
||||
var url = string.Format("{0}{1}?section={2}&allowed={3}&lang={4}&version={5}&admin={6}",
|
||||
baseUrl,
|
||||
_dashboardSettings.Value.ContentDashboardPath,
|
||||
section,
|
||||
allowedSections,
|
||||
language,
|
||||
version,
|
||||
isAdmin);
|
||||
var key = "umbraco-dynamic-dashboard-" + language + allowedSections.Replace(",", "-") + section;
|
||||
|
||||
var content = _appCaches.RuntimeCache.GetCacheItem<JObject>(key);
|
||||
|
||||
@@ -305,7 +305,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
|
||||
// map back to display model, and return
|
||||
var display = _umbracoMapper.Map<IDataType, DataTypeDisplay>(dataType.PersistedDataType);
|
||||
display.AddSuccessNotification(_localizedTextService.Localize("speechBubbles/dataTypeSaved"), "");
|
||||
display.AddSuccessNotification(_localizedTextService.Localize("speechBubbles", "dataTypeSaved"), "");
|
||||
return display;
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
return ValidationProblem();
|
||||
case MoveOperationStatusType.FailedNotAllowedByPath:
|
||||
var notificationModel = new SimpleNotificationModel();
|
||||
notificationModel.AddErrorNotification(_localizedTextService.Localize("moveOrCopy/notAllowedByPath"), "");
|
||||
notificationModel.AddErrorNotification(_localizedTextService.Localize("moveOrCopy", "notAllowedByPath"), "");
|
||||
return ValidationProblem(notificationModel);
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (_localizationService.DictionaryItemExists(key))
|
||||
{
|
||||
var message = _localizedTextService.Localize(
|
||||
"dictionaryItem/changeKeyError",
|
||||
"dictionaryItem","changeKeyError",
|
||||
_backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser.GetUserCulture(_localizedTextService, _globalSettings),
|
||||
new Dictionary<string, string> { { "0", key } });
|
||||
return ValidationProblem(message);
|
||||
@@ -218,7 +218,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
|
||||
var message = _localizedTextService.Localize(
|
||||
"dictionaryItem/changeKeyError",
|
||||
"dictionaryItem","changeKeyError",
|
||||
userCulture,
|
||||
new Dictionary<string, string> { { "0", dictionary.Name } });
|
||||
ModelState.AddModelError("Name", message);
|
||||
@@ -241,7 +241,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
var model = _umbracoMapper.Map<IDictionaryItem, DictionaryDisplay>(dictionaryItem);
|
||||
|
||||
model.Notifications.Add(new BackOfficeNotification(
|
||||
_localizedTextService.Localize("speechBubbles/dictionaryItemSaved", userCulture), string.Empty,
|
||||
_localizedTextService.Localize("speechBubbles","dictionaryItemSaved", userCulture), string.Empty,
|
||||
NotificationStyle.Success));
|
||||
|
||||
return model;
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
Id = Constants.System.RecycleBinMedia,
|
||||
Alias = "recycleBin",
|
||||
ParentId = -1,
|
||||
Name = _localizedTextService.Localize("general/recycleBin"),
|
||||
Name = _localizedTextService.Localize("general", "recycleBin"),
|
||||
ContentTypeAlias = "recycleBin",
|
||||
CreateDate = DateTime.Now,
|
||||
IsContainer = true,
|
||||
@@ -496,7 +496,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
|
||||
if (sourceParentID == destinationParentID)
|
||||
{
|
||||
return ValidationProblem(new SimpleNotificationModel(new BackOfficeNotification("",_localizedTextService.Localize("media/moveToSameFolderFailed"),NotificationStyle.Error)));
|
||||
return ValidationProblem(new SimpleNotificationModel(new BackOfficeNotification("",_localizedTextService.Localize("media", "moveToSameFolderFailed"),NotificationStyle.Error)));
|
||||
}
|
||||
if (moveResult == false)
|
||||
{
|
||||
@@ -584,8 +584,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (saveStatus.Success)
|
||||
{
|
||||
display.AddSuccessNotification(
|
||||
_localizedTextService.Localize("speechBubbles/editMediaSaved"),
|
||||
_localizedTextService.Localize("speechBubbles/editMediaSavedText"));
|
||||
_localizedTextService.Localize("speechBubbles", "editMediaSaved"),
|
||||
_localizedTextService.Localize("speechBubbles", "editMediaSavedText"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -616,7 +616,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
_mediaService.EmptyRecycleBin(_backofficeSecurityAccessor.BackOfficeSecurity.GetUserId().ResultOr(Constants.Security.SuperUserId));
|
||||
|
||||
return Ok(_localizedTextService.Localize("defaultdialogs/recycleBinIsEmpty"));
|
||||
return Ok(_localizedTextService.Localize("defaultdialogs", "recycleBinIsEmpty"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -831,15 +831,14 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
var saveResult = _mediaService.Save(f, _backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser.Id);
|
||||
if (saveResult == false)
|
||||
{
|
||||
AddCancelMessage(tempFiles,
|
||||
message: _localizedTextService.Localize("speechBubbles/operationCancelledText") + " -- " + mediaItemName);
|
||||
AddCancelMessage(tempFiles, _localizedTextService.Localize("speechBubbles", "operationCancelledText") + " -- " + mediaItemName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tempFiles.Notifications.Add(new BackOfficeNotification(
|
||||
_localizedTextService.Localize("speechBubbles/operationFailedHeader"),
|
||||
_localizedTextService.Localize("media/disallowedFileType"),
|
||||
_localizedTextService.Localize("speechBubbles", "operationFailedHeader"),
|
||||
_localizedTextService.Localize("media", "disallowedFileType"),
|
||||
NotificationStyle.Warning));
|
||||
}
|
||||
}
|
||||
@@ -927,8 +926,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
return ValidationProblem(
|
||||
new SimpleNotificationModel(new BackOfficeNotification(
|
||||
_localizedTextService.Localize("speechBubbles/operationFailedHeader"),
|
||||
_localizedTextService.Localize("speechBubbles/invalidUserPermissionsText"),
|
||||
_localizedTextService.Localize("speechBubbles", "operationFailedHeader"),
|
||||
_localizedTextService.Localize("speechBubbles", "invalidUserPermissionsText"),
|
||||
NotificationStyle.Warning)),
|
||||
StatusCodes.Status403Forbidden);
|
||||
}
|
||||
@@ -963,7 +962,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (toMove.ContentType.AllowedAsRoot == false && mediaTypeService.GetAll().Any(ct => ct.AllowedAsRoot))
|
||||
{
|
||||
var notificationModel = new SimpleNotificationModel();
|
||||
notificationModel.AddErrorNotification(_localizedTextService.Localize("moveOrCopy/notAllowedAtRoot"), "");
|
||||
notificationModel.AddErrorNotification(_localizedTextService.Localize("moveOrCopy", "notAllowedAtRoot"), "");
|
||||
return ValidationProblem(notificationModel);
|
||||
}
|
||||
}
|
||||
@@ -981,7 +980,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
.Any(x => x.Value == toMove.ContentType.Id) == false)
|
||||
{
|
||||
var notificationModel = new SimpleNotificationModel();
|
||||
notificationModel.AddErrorNotification(_localizedTextService.Localize("moveOrCopy/notAllowedByContentType"), "");
|
||||
notificationModel.AddErrorNotification(_localizedTextService.Localize("moveOrCopy", "notAllowedByContentType"), "");
|
||||
return ValidationProblem(notificationModel);
|
||||
}
|
||||
|
||||
@@ -989,7 +988,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if ((string.Format(",{0},", parent.Path)).IndexOf(string.Format(",{0},", toMove.Id), StringComparison.Ordinal) > -1)
|
||||
{
|
||||
var notificationModel = new SimpleNotificationModel();
|
||||
notificationModel.AddErrorNotification(_localizedTextService.Localize("moveOrCopy/notAllowedByPath"), "");
|
||||
notificationModel.AddErrorNotification(_localizedTextService.Localize("moveOrCopy", "notAllowedByPath"), "");
|
||||
return ValidationProblem(notificationModel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
|
||||
|
||||
display.AddSuccessNotification(
|
||||
_localizedTextService.Localize("speechBubbles/mediaTypeSavedHeader"),
|
||||
_localizedTextService.Localize("speechBubbles","mediaTypeSavedHeader"),
|
||||
string.Empty);
|
||||
|
||||
return display;
|
||||
|
||||
@@ -305,8 +305,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
case ContentSaveAction.Save:
|
||||
case ContentSaveAction.SaveNew:
|
||||
display.AddSuccessNotification(
|
||||
_localizedTextService.Localize("speechBubbles/editMemberSaved"),
|
||||
_localizedTextService.Localize("speechBubbles/editMemberSaved"));
|
||||
_localizedTextService.Localize("speechBubbles","editMemberSaved"),
|
||||
_localizedTextService.Localize("speechBubbles","editMemberSaved"));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
MemberGroupDisplay display = _umbracoMapper.Map<IMemberGroup, MemberGroupDisplay>(memberGroup);
|
||||
|
||||
display.AddSuccessNotification(
|
||||
_localizedTextService.Localize("speechBubbles/memberGroupSavedHeader"),
|
||||
_localizedTextService.Localize("speechBubbles","memberGroupSavedHeader"),
|
||||
string.Empty);
|
||||
|
||||
return display;
|
||||
|
||||
@@ -246,7 +246,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
var display =_umbracoMapper.Map<MemberTypeDisplay>(savedCt.Value);
|
||||
|
||||
display.AddSuccessNotification(
|
||||
_localizedTextService.Localize("speechBubbles/memberTypeSavedHeader"),
|
||||
_localizedTextService.Localize("speechBubbles","memberTypeSavedHeader"),
|
||||
string.Empty);
|
||||
|
||||
return display;
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
//this package is already installed
|
||||
return ValidationProblem(
|
||||
_localizedTextService.Localize("packager/packageAlreadyInstalled"));
|
||||
_localizedTextService.Localize("packager", "packageAlreadyInstalled"));
|
||||
}
|
||||
|
||||
model.OriginalVersion = installType == PackageInstallType.Upgrade ? alreadyInstalled.Version : null;
|
||||
@@ -197,8 +197,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
else
|
||||
{
|
||||
model.Notifications.Add(new BackOfficeNotification(
|
||||
_localizedTextService.Localize("speechBubbles/operationFailedHeader"),
|
||||
_localizedTextService.Localize("media/disallowedFileType"),
|
||||
_localizedTextService.Localize("speechBubbles", "operationFailedHeader"),
|
||||
_localizedTextService.Localize("media", "disallowedFileType"),
|
||||
NotificationStyle.Warning));
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (installType == PackageInstallType.AlreadyInstalled)
|
||||
{
|
||||
return ValidationProblem(
|
||||
_localizedTextService.Localize("packager/packageAlreadyInstalled"));
|
||||
_localizedTextService.Localize("packager", "packageAlreadyInstalled"));
|
||||
}
|
||||
|
||||
model.OriginalVersion = installType == PackageInstallType.Upgrade ? alreadyInstalled.Version : null;
|
||||
@@ -268,7 +268,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
var packageMinVersion = packageInfo.UmbracoVersion;
|
||||
if (_umbracoVersion.Version < packageMinVersion)
|
||||
return ValidationProblem(
|
||||
_localizedTextService.Localize("packager/targetVersionMismatch", new[] {packageMinVersion.ToString()}));
|
||||
_localizedTextService.Localize("packager", "targetVersionMismatch", new[] {packageMinVersion.ToString()}));
|
||||
}
|
||||
|
||||
var installType = _packagingService.GetPackageInstallType(packageInfo.Name, SemVersion.Parse(packageInfo.Version), out var alreadyInstalled);
|
||||
|
||||
@@ -47,28 +47,28 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
|
||||
private IEnumerable<OperatorTerm> Terms => new List<OperatorTerm>
|
||||
{
|
||||
new OperatorTerm(_localizedTextService.Localize("template/is"), Operator.Equals, new [] {"string"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template/isNot"), Operator.NotEquals, new [] {"string"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template/before"), Operator.LessThan, new [] {"datetime"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template/beforeIncDate"), Operator.LessThanEqualTo, new [] {"datetime"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template/after"), Operator.GreaterThan, new [] {"datetime"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template/afterIncDate"), Operator.GreaterThanEqualTo, new [] {"datetime"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template/equals"), Operator.Equals, new [] {"int"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template/doesNotEqual"), Operator.NotEquals, new [] {"int"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template/contains"), Operator.Contains, new [] {"string"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template/doesNotContain"), Operator.NotContains, new [] {"string"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template/greaterThan"), Operator.GreaterThan, new [] {"int"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template/greaterThanEqual"), Operator.GreaterThanEqualTo, new [] {"int"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template/lessThan"), Operator.LessThan, new [] {"int"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template/lessThanEqual"), Operator.LessThanEqualTo, new [] {"int"})
|
||||
new OperatorTerm(_localizedTextService.Localize("template","is"), Operator.Equals, new [] {"string"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template","isNot"), Operator.NotEquals, new [] {"string"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template","before"), Operator.LessThan, new [] {"datetime"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template","beforeIncDate"), Operator.LessThanEqualTo, new [] {"datetime"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template","after"), Operator.GreaterThan, new [] {"datetime"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template","afterIncDate"), Operator.GreaterThanEqualTo, new [] {"datetime"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template","equals"), Operator.Equals, new [] {"int"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template","doesNotEqual"), Operator.NotEquals, new [] {"int"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template","contains"), Operator.Contains, new [] {"string"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template","doesNotContain"), Operator.NotContains, new [] {"string"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template","greaterThan"), Operator.GreaterThan, new [] {"int"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template","greaterThanEqual"), Operator.GreaterThanEqualTo, new [] {"int"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template","lessThan"), Operator.LessThan, new [] {"int"}),
|
||||
new OperatorTerm(_localizedTextService.Localize("template","lessThanEqual"), Operator.LessThanEqualTo, new [] {"int"})
|
||||
};
|
||||
|
||||
private IEnumerable<PropertyModel> Properties => new List<PropertyModel>
|
||||
{
|
||||
new PropertyModel { Name = _localizedTextService.Localize("template/id"), Alias = "Id", Type = "int" },
|
||||
new PropertyModel { Name = _localizedTextService.Localize("template/name"), Alias = "Name", Type = "string" },
|
||||
new PropertyModel { Name = _localizedTextService.Localize("template/createdDate"), Alias = "CreateDate", Type = "datetime" },
|
||||
new PropertyModel { Name = _localizedTextService.Localize("template/lastUpdatedDate"), Alias = "UpdateDate", Type = "datetime" }
|
||||
new PropertyModel { Name = _localizedTextService.Localize("template","id"), Alias = "Id", Type = "int" },
|
||||
new PropertyModel { Name = _localizedTextService.Localize("template","name"), Alias = "Name", Type = "string" },
|
||||
new PropertyModel { Name = _localizedTextService.Localize("template","createdDate"), Alias = "CreateDate", Type = "datetime" },
|
||||
new PropertyModel { Name = _localizedTextService.Localize("template","lastUpdatedDate"), Alias = "UpdateDate", Type = "datetime" }
|
||||
};
|
||||
|
||||
public QueryResultModel PostTemplateQuery(QueryModel model)
|
||||
@@ -232,10 +232,10 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
public IEnumerable<ContentTypeModel> GetContentTypes()
|
||||
{
|
||||
var contentTypes = _contentTypeService.GetAll()
|
||||
.Select(x => new ContentTypeModel { Alias = x.Alias, Name = _localizedTextService.Localize("template/contentOfType", tokens: new string[] { x.Name }) })
|
||||
.Select(x => new ContentTypeModel { Alias = x.Alias, Name = _localizedTextService.Localize("template", "contentOfType", tokens: new string[] { x.Name }) })
|
||||
.OrderBy(x => x.Name).ToList();
|
||||
|
||||
contentTypes.Insert(0, new ContentTypeModel { Alias = string.Empty, Name = _localizedTextService.Localize("template/allContent") });
|
||||
contentTypes.Insert(0, new ContentTypeModel { Alias = string.Empty, Name = _localizedTextService.Localize("template", "allContent") });
|
||||
|
||||
return contentTypes;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
|
||||
var display = _umbracoMapper.Map<UserGroupDisplay>(userGroupSave.PersistedUserGroup);
|
||||
|
||||
display.AddSuccessNotification(_localizedTextService.Localize("speechBubbles/operationSavedHeader"), _localizedTextService.Localize("speechBubbles/editUserGroupSaved"));
|
||||
display.AddSuccessNotification(_localizedTextService.Localize("speechBubbles","operationSavedHeader"), _localizedTextService.Localize("speechBubbles","editUserGroupSaved"));
|
||||
return display;
|
||||
}
|
||||
|
||||
@@ -202,10 +202,10 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
}
|
||||
if (userGroups.Length > 1)
|
||||
{
|
||||
return Ok(_localizedTextService.Localize("speechBubbles/deleteUserGroupsSuccess", new[] {userGroups.Length.ToString()}));
|
||||
return Ok(_localizedTextService.Localize("speechBubbles","deleteUserGroupsSuccess", new[] {userGroups.Length.ToString()}));
|
||||
}
|
||||
|
||||
return Ok(_localizedTextService.Localize("speechBubbles/deleteUserGroupSuccess", new[] {userGroups[0].Name}));
|
||||
return Ok(_localizedTextService.Localize("speechBubbles","deleteUserGroupSuccess", new[] {userGroups[0].Name}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,7 +491,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
//send the email
|
||||
await SendUserInviteEmailAsync(display, _backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser.Name, _backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser.Email, user, userSave.Message);
|
||||
|
||||
display.AddSuccessNotification(_localizedTextService.Localize("speechBubbles/resendInviteHeader"), _localizedTextService.Localize("speechBubbles/resendInviteSuccess", new[] { user.Name }));
|
||||
display.AddSuccessNotification(_localizedTextService.Localize("speechBubbles","resendInviteHeader"), _localizedTextService.Localize("speechBubbles","resendInviteSuccess", new[] { user.Name }));
|
||||
return display;
|
||||
}
|
||||
|
||||
@@ -543,10 +543,10 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
var applicationUri = _hostingEnvironment.ApplicationMainUrl;
|
||||
var inviteUri = new Uri(applicationUri, action);
|
||||
|
||||
var emailSubject = _localizedTextService.Localize("user/inviteEmailCopySubject",
|
||||
var emailSubject = _localizedTextService.Localize("user","inviteEmailCopySubject",
|
||||
//Ensure the culture of the found user is used for the email!
|
||||
UmbracoUserExtensions.GetUserCulture(to.Language, _localizedTextService, _globalSettings));
|
||||
var emailBody = _localizedTextService.Localize("user/inviteEmailCopyFormat",
|
||||
var emailBody = _localizedTextService.Localize("user","inviteEmailCopyFormat",
|
||||
//Ensure the culture of the found user is used for the email!
|
||||
UmbracoUserExtensions.GetUserCulture(to.Language, _localizedTextService, _globalSettings),
|
||||
new[] { userDisplay.Name, from, message, inviteUri.ToString(), fromEmail });
|
||||
@@ -645,11 +645,11 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
var userHasChangedOwnLanguage =
|
||||
user.Id == currentUser.Id && currentUser.Language != user.Language;
|
||||
|
||||
var textToLocalise = userHasChangedOwnLanguage ? "speechBubbles/operationSavedHeaderReloadUser" : "speechBubbles/operationSavedHeader";
|
||||
var textToLocalise = userHasChangedOwnLanguage ? "operationSavedHeaderReloadUser" : "operationSavedHeader";
|
||||
var culture = userHasChangedOwnLanguage
|
||||
? CultureInfo.GetCultureInfo(user.Language)
|
||||
: Thread.CurrentThread.CurrentUICulture;
|
||||
display.AddSuccessNotification(_localizedTextService.Localize(textToLocalise, culture), _localizedTextService.Localize("speechBubbles/editUserSaved", culture));
|
||||
display.AddSuccessNotification(_localizedTextService.Localize("speechBubbles", textToLocalise, culture), _localizedTextService.Localize("speechBubbles","editUserSaved", culture));
|
||||
return display;
|
||||
}
|
||||
|
||||
@@ -697,7 +697,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (passwordChangeResult.Success)
|
||||
{
|
||||
var result = new ModelWithNotifications<string>(passwordChangeResult.Result.ResetPassword);
|
||||
result.AddSuccessNotification(_localizedTextService.Localize("general/success"), _localizedTextService.Localize("user/passwordChangedGeneric"));
|
||||
result.AddSuccessNotification(_localizedTextService.Localize("general","success"), _localizedTextService.Localize("user","passwordChangedGeneric"));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -733,10 +733,10 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
|
||||
if (users.Length > 1)
|
||||
{
|
||||
return Ok(_localizedTextService.Localize("speechBubbles/disableUsersSuccess", new[] {userIds.Length.ToString()}));
|
||||
return Ok(_localizedTextService.Localize("speechBubbles","disableUsersSuccess", new[] {userIds.Length.ToString()}));
|
||||
}
|
||||
|
||||
return Ok(_localizedTextService.Localize("speechBubbles/disableUserSuccess", new[] { users[0].Name }));
|
||||
return Ok(_localizedTextService.Localize("speechBubbles","disableUserSuccess", new[] { users[0].Name }));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -756,11 +756,11 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (users.Length > 1)
|
||||
{
|
||||
return Ok(
|
||||
_localizedTextService.Localize("speechBubbles/enableUsersSuccess", new[] { userIds.Length.ToString() }));
|
||||
_localizedTextService.Localize("speechBubbles","enableUsersSuccess", new[] { userIds.Length.ToString() }));
|
||||
}
|
||||
|
||||
return Ok(
|
||||
_localizedTextService.Localize("speechBubbles/enableUserSuccess", new[] { users[0].Name }));
|
||||
_localizedTextService.Localize("speechBubbles","enableUserSuccess", new[] { users[0].Name }));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -792,12 +792,12 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (userIds.Length == 1)
|
||||
{
|
||||
return Ok(
|
||||
_localizedTextService.Localize("speechBubbles/unlockUserSuccess", new[] {user.Name}));
|
||||
_localizedTextService.Localize("speechBubbles","unlockUserSuccess", new[] {user.Name}));
|
||||
}
|
||||
}
|
||||
|
||||
return Ok(
|
||||
_localizedTextService.Localize("speechBubbles/unlockUsersSuccess", new[] {(userIds.Length - notFound.Count).ToString()}));
|
||||
_localizedTextService.Localize("speechBubbles","unlockUsersSuccess", new[] {(userIds.Length - notFound.Count).ToString()}));
|
||||
}
|
||||
|
||||
[Authorize(Policy = AuthorizationPolicies.AdminUserEditsRequireAdmin)]
|
||||
@@ -815,7 +815,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
}
|
||||
_userService.Save(users);
|
||||
return Ok(
|
||||
_localizedTextService.Localize("speechBubbles/setUserGroupOnUsersSuccess"));
|
||||
_localizedTextService.Localize("speechBubbles","setUserGroupOnUsersSuccess"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -846,7 +846,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
_userService.Delete(user, true);
|
||||
|
||||
return Ok(
|
||||
_localizedTextService.Localize("speechBubbles/deleteUserSuccess", new[] { userName }));
|
||||
_localizedTextService.Localize("speechBubbles","deleteUserSuccess", new[] { userName }));
|
||||
}
|
||||
|
||||
public class PagedUserResult : PagedResult<UserBasic>
|
||||
|
||||
Reference in New Issue
Block a user