Fixes: U4-2770 Legacy content dialogs doesnt render and removes a file that shouldn't have been committed.
This commit is contained in:
@@ -1,92 +0,0 @@
|
||||
<form ng-controller="Umbraco.Dialogs.MediaPickerController" id="fileupload" method="POST" enctype="multipart/form-data"
|
||||
data-file-upload="options" data-file-upload-progress="" data-ng-class="{'fileupload-processing': processing() || loadingFiles}">
|
||||
|
||||
<div class="umb-panel">
|
||||
<div class="umb-panel-header">
|
||||
|
||||
<div class="umb-el-wrap umb-panel-buttons">
|
||||
<div class="span5">
|
||||
<div class="form-search">
|
||||
<i class="icon-search"></i>
|
||||
<input type="text"
|
||||
ng-model="searchTerm"
|
||||
class="umb-search-field search-query"
|
||||
placeholder="Filter..."
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pull-right umb-btn-toolbar">
|
||||
<span class="btn fileinput-button" ng-class="{disabled: disabled}">
|
||||
<i class="icon-add"></i>Add
|
||||
<input type="file" name="files[]" multiple ng-disabled="disabled">
|
||||
</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="umb-panel-body umb-scrollable" auto-scale="70">
|
||||
|
||||
<div class="control-group umb-control-group">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href ng-click="gotoFolder(-1)" prevent-default>Media</a> /</li>
|
||||
|
||||
<li ng-repeat="item in path">
|
||||
<a href ng-click="gotoFolder(item.id)" prevent-default>{{item.name}}</a>/
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<a href ng-hide="showFolderInput" ng-click="showFolderInput = true">
|
||||
<i class="icon icon-add"></i>
|
||||
</a>
|
||||
|
||||
<input type="text"
|
||||
class="input-foldername input-mini inline"
|
||||
ng-show="showFolderInput"
|
||||
ng-model="newFolderName"
|
||||
ng-keyup="submitFolder($event)"
|
||||
ng-blur="showFolderInput = false"
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div style="height: 10px; margin: 10px 0px 10px 0px" class="umb-loader" ng-hide="active() == 0"></div>
|
||||
|
||||
<ul class="thumbnails">
|
||||
<li class="span2 folder" ng-repeat="image in images | orderBy:'contentTypeAlias' | filter:searchTerm">
|
||||
<a href="#" class="thumbnail" ng-class="{selected: dialogData.selection.indexOf(image) > -1}"
|
||||
ng-click="selectMediaItem(image)"
|
||||
prevent-default>
|
||||
|
||||
|
||||
<img ng-src="{{image.thumbnail}}" ng-switch-when="Image" alt="{{image.name}}"/>
|
||||
|
||||
|
||||
<div ng-switch on="!!image.thumbnail" >
|
||||
<img ng-src="{{image.thumbnail}}" class="image" ng-switch-when="true" alt="{{image.name}}"/>
|
||||
|
||||
<div ng-switch-default>
|
||||
<i class="{{image.icon}}"></i>
|
||||
{{image.name}}
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="umb-panel-footer">
|
||||
<div class="umb-el-wrap umb-panel-buttons">
|
||||
<div class="pull-right umb-btn-toolbar">
|
||||
<button ng-show="dialogData.selection.length > 0" type="button" ng-click="submit(dialogData)" class="btn btn-primary">Select ({{dialogData.selection.length}})</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
@@ -119,7 +119,7 @@ namespace Umbraco.Web.Trees
|
||||
int iid;
|
||||
if (int.TryParse(id, out iid) == false)
|
||||
{
|
||||
throw new InvalidOperationException("The Id for a content item must be an integer");
|
||||
throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
}
|
||||
var item = Services.EntityService.Get(iid, UmbracoObjectTypes.Document);
|
||||
if (item == null)
|
||||
@@ -128,7 +128,7 @@ namespace Umbraco.Web.Trees
|
||||
}
|
||||
|
||||
return GetUserAllowedMenuItems(
|
||||
CreateAllowedActions(),
|
||||
CreateAllowedActions(item),
|
||||
GetUserMenuItemsForNode(item));
|
||||
}
|
||||
|
||||
@@ -137,23 +137,27 @@ namespace Umbraco.Web.Trees
|
||||
get { return UmbracoObjectTypes.Document; }
|
||||
}
|
||||
|
||||
protected IEnumerable<MenuItem> CreateAllowedActions()
|
||||
protected IEnumerable<MenuItem> CreateAllowedActions(IUmbracoEntity item)
|
||||
{
|
||||
var menu = new MenuItemCollection();
|
||||
menu.AddMenuItem<ActionNew>();
|
||||
menu.AddMenuItem<ActionDelete>(true);
|
||||
menu.AddMenuItem<ActionMove>(true);
|
||||
menu.AddMenuItem<ActionCopy>();
|
||||
|
||||
//need to ensure some of these are converted to the legacy system - until we upgrade them all to be angularized.
|
||||
menu.AddMenuItem<ActionMove>(true).ConvertLegacyMenuItem(item, "content", "content");
|
||||
menu.AddMenuItem<ActionCopy>().ConvertLegacyMenuItem(item, "content", "content");
|
||||
|
||||
menu.AddMenuItem<ActionSort>(true);
|
||||
menu.AddMenuItem<ActionRollback>();
|
||||
menu.AddMenuItem<ActionPublish>(true);
|
||||
menu.AddMenuItem<ActionToPublish>();
|
||||
menu.AddMenuItem<ActionAssignDomain>();
|
||||
menu.AddMenuItem<ActionRights>();
|
||||
menu.AddMenuItem<ActionProtect>(true);
|
||||
menu.AddMenuItem<ActionUnPublish>(true);
|
||||
menu.AddMenuItem<ActionNotify>(true);
|
||||
menu.AddMenuItem<ActionSendToTranslate>();
|
||||
|
||||
menu.AddMenuItem<ActionRollback>().ConvertLegacyMenuItem(item, "content", "content");
|
||||
menu.AddMenuItem<ActionPublish>(true).ConvertLegacyMenuItem(item, "content", "content");
|
||||
menu.AddMenuItem<ActionToPublish>().ConvertLegacyMenuItem(item, "content", "content");
|
||||
menu.AddMenuItem<ActionAssignDomain>().ConvertLegacyMenuItem(item, "content", "content");
|
||||
menu.AddMenuItem<ActionRights>().ConvertLegacyMenuItem(item, "content", "content");
|
||||
menu.AddMenuItem<ActionProtect>(true).ConvertLegacyMenuItem(item, "content", "content");
|
||||
menu.AddMenuItem<ActionUnPublish>(true).ConvertLegacyMenuItem(item, "content", "content");
|
||||
menu.AddMenuItem<ActionNotify>(true).ConvertLegacyMenuItem(item, "content", "content");
|
||||
menu.AddMenuItem<ActionSendToTranslate>().ConvertLegacyMenuItem(item, "content", "content");
|
||||
|
||||
menu.AddMenuItem<RefreshNode, ActionRefresh>(true);
|
||||
|
||||
|
||||
@@ -67,9 +67,9 @@ namespace Umbraco.Web.Trees
|
||||
//First try to get a URL/title from the legacy action,
|
||||
// if that doesn't work, try to get the legacy confirm view
|
||||
Attempt<LegacyUrlAction>
|
||||
.Try(GetUrlAndTitleFromLegacyAction(currentAction, xmlTreeNode, currentSection),
|
||||
.Try(GetUrlAndTitleFromLegacyAction(currentAction, xmlTreeNode.NodeID, xmlTreeNode.NodeType, xmlTreeNode.Text, currentSection),
|
||||
action => menuItem.LaunchDialogUrl(action.Url, action.DialogTitle))
|
||||
.IfFailed(() => GetLegacyConfirmView(currentAction, xmlTreeNode, currentSection),
|
||||
.IfFailed(() => GetLegacyConfirmView(currentAction, currentSection),
|
||||
view => menuItem.LaunchDialogView(
|
||||
view,
|
||||
ui.GetText("defaultdialogs", "confirmdelete") + " '" + xmlTreeNode.Text + "' ?"));
|
||||
@@ -89,14 +89,15 @@ namespace Umbraco.Web.Trees
|
||||
return collection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <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>
|
||||
/// <param name="actionNode"></param>
|
||||
/// <param name="currentSection"></param>
|
||||
/// <returns></returns>
|
||||
internal static Attempt<string> GetLegacyConfirmView(IAction action, XmlTreeNode actionNode, string currentSection)
|
||||
internal static Attempt<string> GetLegacyConfirmView(IAction action, string currentSection)
|
||||
{
|
||||
if (action.JsFunctionName.IsNullOrWhiteSpace())
|
||||
{
|
||||
@@ -118,9 +119,11 @@ namespace Umbraco.Web.Trees
|
||||
/// This will look at a legacy IAction's JsFunctionName and convert it to a URL if possible.
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="actionNode"></param>
|
||||
/// <param name="nodeName"></param>
|
||||
/// <param name="currentSection"></param>
|
||||
internal static Attempt<LegacyUrlAction> GetUrlAndTitleFromLegacyAction(IAction action, XmlTreeNode actionNode, string currentSection)
|
||||
/// <param name="nodeId"></param>
|
||||
/// <param name="nodeType"></param>
|
||||
internal static Attempt<LegacyUrlAction> GetUrlAndTitleFromLegacyAction(IAction action, string nodeId, string nodeType, string nodeName, string currentSection)
|
||||
{
|
||||
if (action.JsFunctionName.IsNullOrWhiteSpace())
|
||||
{
|
||||
@@ -133,80 +136,80 @@ namespace Umbraco.Web.Trees
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"create.aspx?nodeId=" + actionNode.NodeID + "&nodeType=" + actionNode.NodeType + "&nodeName=" + actionNode.Text + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"create.aspx?nodeId=" + nodeId + "&nodeType=" + nodeType + "&nodeName=" + nodeName + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
ui.GetText("actions", "create")));
|
||||
case "UmbClientMgr.appActions().actionNewFolder()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"createFolder.aspx?nodeId=" + actionNode.NodeID + "&nodeType=" + actionNode.NodeType + "&nodeName=" + actionNode.Text + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"createFolder.aspx?nodeId=" + nodeId + "&nodeType=" + nodeType + "&nodeName=" + nodeName + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
ui.GetText("actions", "create")));
|
||||
case "UmbClientMgr.appActions().actionSort()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"dialogs/sort.aspx?id=" + actionNode.NodeID + "&nodeType=" + actionNode.NodeType + "&app=" + currentSection + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"dialogs/sort.aspx?id=" + nodeId + "&nodeType=" + nodeType + "&app=" + currentSection + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
ui.GetText("actions", "sort")));
|
||||
case "UmbClientMgr.appActions().actionRights()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"dialogs/cruds.aspx?id=" + actionNode.NodeID + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"dialogs/cruds.aspx?id=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
ui.GetText("actions", "rights")));
|
||||
case "UmbClientMgr.appActions().actionProtect()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"dialogs/protectPage.aspx?mode=cut&nodeId=" + actionNode.NodeID + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"dialogs/protectPage.aspx?mode=cut&nodeId=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
ui.GetText("actions", "protect")));
|
||||
case "UmbClientMgr.appActions().actionRollback()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"dialogs/rollback.aspx?nodeId=" + actionNode.NodeID + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"dialogs/rollback.aspx?nodeId=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
ui.GetText("actions", "rollback")));
|
||||
case "UmbClientMgr.appActions().actionNotify()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"dialogs/notifications.aspx?id=" + actionNode.NodeID + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"dialogs/notifications.aspx?id=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
ui.GetText("actions", "notify")));
|
||||
case "UmbClientMgr.appActions().actionPublish()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"dialogs/publish.aspx?id=" + actionNode.NodeID + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"dialogs/publish.aspx?id=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
ui.GetText("actions", "publish")));
|
||||
case "UmbClientMgr.appActions().actionToPublish()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"dialogs/SendPublish.aspx?id=" + actionNode.NodeID + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"dialogs/SendPublish.aspx?id=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
ui.GetText("actions", "sendtopublish")));
|
||||
case "UmbClientMgr.appActions().actionRePublish()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"dialogs/republish.aspx?rnd=" + actionNode.NodeID + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"dialogs/republish.aspx?rnd=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"Republishing entire site"));
|
||||
case "UmbClientMgr.appActions().actionAssignDomain()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"dialogs/assignDomain2.aspx?id=" + actionNode.NodeID + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"dialogs/assignDomain2.aspx?id=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
ui.GetText("actions", "assignDomain")));
|
||||
case "UmbClientMgr.appActions().actionLiveEdit()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"canvas.aspx?redir=/" + actionNode.NodeID + ".aspx",
|
||||
"canvas.aspx?redir=/" + nodeId + ".aspx",
|
||||
"",
|
||||
ActionUrlMethod.BlankWindow));
|
||||
case "UmbClientMgr.appActions().actionSendToTranslate()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"dialogs/sendToTranslation.aspx?id=" + actionNode.NodeID + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"dialogs/sendToTranslation.aspx?id=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
ui.GetText("actions", "sendToTranslate")));
|
||||
case "UmbClientMgr.appActions().actionEmptyTranscan()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
@@ -224,25 +227,25 @@ namespace Umbraco.Web.Trees
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"dialogs/exportDocumentType.aspx?nodeId=" + actionNode.NodeID + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"dialogs/exportDocumentType.aspx?nodeId=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
""));
|
||||
case "UmbClientMgr.appActions().actionAudit()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"dialogs/viewAuditTrail.aspx?nodeId=" + actionNode.NodeID + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"dialogs/viewAuditTrail.aspx?nodeId=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
ui.GetText("actions", "auditTrail")));
|
||||
case "UmbClientMgr.appActions().actionMove()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"dialogs/moveOrCopy.aspx?app=" + currentSection + "&mode=cut&id=" + actionNode.NodeID + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"dialogs/moveOrCopy.aspx?app=" + currentSection + "&mode=cut&id=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
ui.GetText("actions", "move")));
|
||||
case "UmbClientMgr.appActions().actionCopy()":
|
||||
return new Attempt<LegacyUrlAction>(
|
||||
true,
|
||||
new LegacyUrlAction(
|
||||
"dialogs/moveOrCopy.aspx?app=" + currentSection + "&mode=copy&id=" + actionNode.NodeID + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
"dialogs/moveOrCopy.aspx?app=" + currentSection + "&mode=copy&id=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
ui.GetText("actions", "copy")));
|
||||
}
|
||||
return Attempt<LegacyUrlAction>.False;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http.Formatting;
|
||||
using System.Web.Http;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Services;
|
||||
@@ -51,9 +54,19 @@ namespace Umbraco.Web.Trees
|
||||
return menu;
|
||||
}
|
||||
|
||||
int iid;
|
||||
if (int.TryParse(id, out iid) == false)
|
||||
{
|
||||
throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
}
|
||||
var item = Services.EntityService.Get(iid, UmbracoObjectTypes.Media);
|
||||
if (item == null)
|
||||
{
|
||||
throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
}
|
||||
//return a normal node menu:
|
||||
menu.AddMenuItem<ActionNew>();
|
||||
menu.AddMenuItem<ActionMove>();
|
||||
menu.AddMenuItem<ActionMove>().ConvertLegacyMenuItem(item, "media", "media");
|
||||
menu.AddMenuItem<ActionDelete>();
|
||||
menu.AddMenuItem<ActionSort>();
|
||||
menu.AddMenuItem<ActionRefresh>(true);
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
namespace Umbraco.Web.Trees.Menu
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
using umbraco;
|
||||
|
||||
namespace Umbraco.Web.Trees.Menu
|
||||
{
|
||||
public static class MenuItemExtensions
|
||||
{
|
||||
@@ -56,5 +60,18 @@
|
||||
menuItem.AdditionalData[ActionUrlKey] = url;
|
||||
menuItem.AdditionalData[ActionUrlMethodKey] = url;
|
||||
}
|
||||
|
||||
internal static void ConvertLegacyMenuItem(this MenuItem menuItem, IUmbracoEntity item, string nodeType, string currentSection)
|
||||
{
|
||||
//First try to get a URL/title from the legacy action,
|
||||
// if that doesn't work, try to get the legacy confirm view
|
||||
Attempt<LegacyTreeDataConverter.LegacyUrlAction>
|
||||
.Try(LegacyTreeDataConverter.GetUrlAndTitleFromLegacyAction(menuItem.Action, item.Id.ToInvariantString(), nodeType, item.Name, currentSection),
|
||||
action => menuItem.LaunchDialogUrl(action.Url, action.DialogTitle))
|
||||
.IfFailed(() => LegacyTreeDataConverter.GetLegacyConfirmView(menuItem.Action, currentSection),
|
||||
view => menuItem.LaunchDialogView(
|
||||
view,
|
||||
ui.GetText("defaultdialogs", "confirmdelete") + " '" + item.Name + "' ?"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user