Merge branch 'temp8' of https://github.com/umbraco/Umbraco-CMS into temp8
This commit is contained in:
@@ -69,7 +69,7 @@ Use this directive to render a tooltip.
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
function TooltipDirective($timeout) {
|
||||
function TooltipDirective() {
|
||||
|
||||
function link(scope, el, attr, ctrl) {
|
||||
|
||||
@@ -77,14 +77,6 @@ Use this directive to render a tooltip.
|
||||
scope.tooltipStyles.left = 0;
|
||||
scope.tooltipStyles.top = 0;
|
||||
|
||||
function activate() {
|
||||
|
||||
$timeout(function() {
|
||||
setTooltipPosition(scope.event);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function setTooltipPosition(event) {
|
||||
|
||||
var container = $("#contentwrapper");
|
||||
@@ -141,7 +133,7 @@ Use this directive to render a tooltip.
|
||||
|
||||
}
|
||||
|
||||
activate();
|
||||
setTooltipPosition(scope.event);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -166,6 +166,7 @@
|
||||
<Content Include="Umbraco\Config\Lang\cs.xml" />
|
||||
<Content Include="Umbraco\Config\Lang\tr.xml" />
|
||||
<Content Include="Umbraco\Config\Lang\zh_tw.xml" />
|
||||
<Content Include="Config\Splashes\noNodes.aspx" />
|
||||
<Content Include="Umbraco\Install\Views\Web.config" />
|
||||
<Content Include="App_Plugins\ModelsBuilder\package.manifest" />
|
||||
<None Include="Config\ClientDependency.Release.config">
|
||||
|
||||
@@ -3,11 +3,8 @@ using System.Runtime.Serialization;
|
||||
using Umbraco.Web.Trees;
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Actions;
|
||||
using Umbraco.Web.Composing;
|
||||
|
||||
|
||||
namespace Umbraco.Web.Models.Trees
|
||||
{
|
||||
@@ -157,7 +154,7 @@ namespace Umbraco.Web.Models.Trees
|
||||
public void LaunchDialogView(string view, string dialogTitle)
|
||||
{
|
||||
SetDialogTitle(dialogTitle);
|
||||
AdditionalData[ActionViewKey] = view;
|
||||
SetActionView(view);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -186,6 +183,15 @@ namespace Umbraco.Web.Models.Trees
|
||||
AdditionalData[DialogTitleKey] = dialogTitle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the menu item to launch a specific view
|
||||
/// </summary>
|
||||
/// <param name="view"></param>
|
||||
private void SetActionView(string view)
|
||||
{
|
||||
AdditionalData[ActionViewKey] = view;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the menu item to launch a URL with the specified action (dialog or new window)
|
||||
/// </summary>
|
||||
@@ -197,33 +203,6 @@ namespace Umbraco.Web.Models.Trees
|
||||
AdditionalData[ActionUrlMethodKey] = method;
|
||||
}
|
||||
|
||||
internal void ConvertLegacyMenuItem(IUmbracoEntity item, string nodeType, string currentSection)
|
||||
{
|
||||
// try to get a URL/title from the legacy action,
|
||||
// in some edge cases, item can be null so we'll just convert those to "-1" and "" for id and name since these edge cases don't need that.
|
||||
var attempt = LegacyTreeDataConverter.GetUrlAndTitleFromLegacyAction(Action,
|
||||
item == null ? "-1" : item.Id.ToInvariantString(),
|
||||
nodeType,
|
||||
item == null ? "" : item.Name, currentSection);
|
||||
if (attempt)
|
||||
{
|
||||
var action = attempt.Result;
|
||||
LaunchDialogUrl(action.Url, action.DialogTitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if that doesn't work, try to get the legacy confirm view
|
||||
var attempt2 = LegacyTreeDataConverter.GetLegacyConfirmView(Action);
|
||||
if (attempt2)
|
||||
{
|
||||
var view = attempt2.Result;
|
||||
var textService = Current.Services.TextService;
|
||||
LaunchDialogView(view, textService.Localize("defaultdialogs/confirmdelete") + " '" + (item == null ? "" : item.Name) + "' ?");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +214,9 @@ namespace Umbraco.Web.Trees
|
||||
|
||||
// set names according to variations
|
||||
foreach (var entity in result)
|
||||
{
|
||||
EnsureName(entity, cultureVal);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -235,7 +237,8 @@ namespace Umbraco.Web.Trees
|
||||
AddActionNode<ActionSort>(item, menu, true);
|
||||
AddActionNode<ActionAssignDomain>(item, menu, opensDialog: true);
|
||||
AddActionNode<ActionRights>(item, menu, opensDialog: true);
|
||||
AddActionNode<ActionProtect>(item, menu, true, convert: true, opensDialog: true);
|
||||
AddActionNode<ActionProtect>(item, menu, true, opensDialog: true);
|
||||
|
||||
if (EmailSender.CanSendRequiredEmail)
|
||||
{
|
||||
menu.Items.Add(new MenuItem("notify", Services.TextService)
|
||||
@@ -267,7 +270,6 @@ namespace Umbraco.Web.Trees
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// set name according to variations
|
||||
@@ -279,12 +281,17 @@ namespace Umbraco.Web.Trees
|
||||
if (culture == null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(entity.Name))
|
||||
{
|
||||
entity.Name = "[[" + entity.Id + "]]";
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(entity is IDocumentEntitySlim docEntity))
|
||||
{
|
||||
throw new InvalidOperationException($"Cannot render a tree node for a culture when the entity isn't {typeof(IDocumentEntitySlim)}, instead it is {entity.GetType()}");
|
||||
}
|
||||
|
||||
// we are getting the tree for a given culture,
|
||||
// for those items that DO support cultures, we need to get the proper name, IF it exists
|
||||
@@ -304,16 +311,15 @@ namespace Umbraco.Web.Trees
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(entity.Name))
|
||||
{
|
||||
entity.Name = "[[" + entity.Id + "]]";
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Remove the need for converting to legacy
|
||||
private void AddActionNode<TAction>(IUmbracoEntity item, MenuItemCollection menu, bool hasSeparator = false, bool convert = false, bool opensDialog = false)
|
||||
private void AddActionNode<TAction>(IUmbracoEntity item, MenuItemCollection menu, bool hasSeparator = false, bool opensDialog = false)
|
||||
where TAction : IAction
|
||||
{
|
||||
var menuItem = menu.Items.Add<TAction>(Services.TextService.Localize("actions", _actions.GetAction<TAction>().Alias), hasSeparator);
|
||||
if (convert) menuItem.ConvertLegacyMenuItem(item, "content", "content");
|
||||
menuItem.OpensDialog = opensDialog;
|
||||
var menuItem = menu.Items.Add<TAction>(Services.TextService.Localize("actions", _actions.GetAction<TAction>().Alias), hasSeparator, opensDialog);
|
||||
}
|
||||
|
||||
public IEnumerable<SearchResultEntity> Search(string query, int pageSize, long pageIndex, out long totalFound, string searchFrom = null)
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
using System;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Actions;
|
||||
|
||||
using Umbraco.Web.Composing;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts the legacy tree data to the new format
|
||||
/// </summary>
|
||||
internal class LegacyTreeDataConverter
|
||||
{
|
||||
// TODO: remove this whole class when everything is angularized
|
||||
|
||||
/// <summary>
|
||||
/// This will look at the legacy IAction's JsFunctionName and convert it to a confirmation dialog view if possible
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <returns></returns>
|
||||
internal static Attempt<string> GetLegacyConfirmView(IAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case ActionDelete actionDelete:
|
||||
return Attempt.Succeed(
|
||||
Current.Configs.Global().Path.EnsureEndsWith('/') + "views/common/dialogs/legacydelete.html");
|
||||
}
|
||||
|
||||
return Attempt<string>.Fail();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will look at a legacy IAction's JsFunctionName and convert it to a URL if possible.
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="nodeName"></param>
|
||||
/// <param name="currentSection"></param>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <param name="nodeType"></param>
|
||||
internal static Attempt<LegacyUrlAction> GetUrlAndTitleFromLegacyAction(IAction action, string nodeId, string nodeType, string nodeName, string currentSection)
|
||||
{
|
||||
switch (action)
|
||||
|
||||
{
|
||||
case ActionNew actionNew:
|
||||
return Attempt.Succeed(
|
||||
new LegacyUrlAction(
|
||||
"create.aspx?nodeId=" + nodeId + "&nodeType=" + nodeType + "&nodeName=" + nodeName + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
Current.Services.TextService.Localize("actions/create")));
|
||||
}
|
||||
return Attempt<LegacyUrlAction>.Fail();
|
||||
}
|
||||
|
||||
internal class LegacyUrlAction
|
||||
{
|
||||
public LegacyUrlAction(string url, string dialogTitle)
|
||||
: this(url, dialogTitle, ActionUrlMethod.Dialog)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public LegacyUrlAction(string url, string dialogTitle, ActionUrlMethod actionMethod)
|
||||
{
|
||||
Url = url;
|
||||
ActionMethod = actionMethod;
|
||||
DialogTitle = dialogTitle;
|
||||
}
|
||||
|
||||
public string Url { get; private set; }
|
||||
public ActionUrlMethod ActionMethod { get; private set; }
|
||||
public string DialogTitle { get; private set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,6 @@
|
||||
<Compile Include="Security\BackOfficeUserManager.cs" />
|
||||
<Compile Include="Security\SessionIdValidator.cs" />
|
||||
<Compile Include="SignalR\PreviewHubComposer.cs" />
|
||||
<Compile Include="Trees\LegacyTreeDataConverter.cs" />
|
||||
<Compile Include="Trees\FilesTreeController.cs" />
|
||||
<Compile Include="Trees\TreeCollection.cs" />
|
||||
<Compile Include="JavaScript\ClientDependencyConfiguration.cs" />
|
||||
|
||||
Reference in New Issue
Block a user