Merge pull request #1113 from umbraco/temp-U4-7936
U4-7936 Clicking the Recycle Bin shows "Session expired" login screen
This commit is contained in:
@@ -42,6 +42,15 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
|
||||
return {
|
||||
|
||||
getRecycleBin: function() {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"contentApiBaseUrl",
|
||||
"GetRecycleBin")),
|
||||
'Failed to retrieve data for content recycle bin');
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.contentResource#sort
|
||||
|
||||
@@ -22,6 +22,15 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
|
||||
return {
|
||||
|
||||
getRecycleBin: function () {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetRecycleBin")),
|
||||
'Failed to retrieve data for media recycle bin');
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#sort
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function ContentRecycleBinController($scope, $routeParams, dataTypeResource, navigationService, localizationService) {
|
||||
function ContentRecycleBinController($scope, $routeParams, contentResource, navigationService, localizationService) {
|
||||
|
||||
//ensures the list view doesn't actually load until we query for the list view config
|
||||
// for the section
|
||||
@@ -16,17 +16,23 @@ function ContentRecycleBinController($scope, $routeParams, dataTypeResource, nav
|
||||
$scope.page.name = "Recycle Bin";
|
||||
$scope.page.nameLocked = true;
|
||||
|
||||
//ensures the list view doesn't actually load until we query for the list view config
|
||||
// for the section
|
||||
$scope.listViewPath = null;
|
||||
|
||||
$routeParams.id = "-20";
|
||||
dataTypeResource.getById(-95).then(function (result) {
|
||||
_.each(result.preValues, function (i) {
|
||||
$scope.model.config[i.key] = i.value;
|
||||
contentResource.getRecycleBin().then(function (result) {
|
||||
//we'll get the 'content item' for the recycle bin, we know that it will contain a single tab and a
|
||||
// single property, so we'll extract that property (list view) and use it's data.
|
||||
var listproperty = result.tabs[0].properties[0];
|
||||
|
||||
_.each(listproperty.config, function (val, key) {
|
||||
$scope.model.config[key] = val;
|
||||
});
|
||||
$scope.listViewPath = 'views/propertyeditors/listview/listview.html';
|
||||
});
|
||||
|
||||
$scope.model = { config: { entityType: $routeParams.section } };
|
||||
$scope.model = { config: { entityType: $routeParams.section, layouts: [] } };
|
||||
|
||||
// sync tree node
|
||||
navigationService.syncTree({ tree: "content", path: ["-1", $routeParams.id], forceReload: false });
|
||||
@@ -37,7 +43,7 @@ function ContentRecycleBinController($scope, $routeParams, dataTypeResource, nav
|
||||
|
||||
var pageName = "general_recycleBin";
|
||||
|
||||
localizationService.localize(pageName).then(function(value) {
|
||||
localizationService.localize(pageName).then(function (value) {
|
||||
$scope.page.name = value;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<umb-editor-view ng-controller="Umbraco.Editors.Content.RecycleBinController">
|
||||
|
||||
<umb-editor-header
|
||||
name="page.name"
|
||||
<form>
|
||||
<umb-editor-header name="page.name"
|
||||
name-locked="page.nameLocked"
|
||||
hide-icon="true"
|
||||
hide-description="true"
|
||||
hide-alias="true" >
|
||||
hide-alias="true">
|
||||
</umb-editor-header>
|
||||
|
||||
<umb-editor-container>
|
||||
@@ -13,5 +12,5 @@
|
||||
<div ng-include="listViewPath"></div>
|
||||
|
||||
</umb-editor-container>
|
||||
|
||||
</form>
|
||||
</umb-editor-view>
|
||||
@@ -8,8 +8,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function MediaRecycleBinController($scope, $routeParams, dataTypeResource, navigationService, localizationService) {
|
||||
function MediaRecycleBinController($scope, $routeParams, mediaResource, navigationService, localizationService) {
|
||||
|
||||
//ensures the list view doesn't actually load until we query for the list view config
|
||||
// for the section
|
||||
$scope.page = {};
|
||||
$scope.page.name = "Recycle Bin";
|
||||
$scope.page.nameLocked = true;
|
||||
@@ -19,14 +21,18 @@ function MediaRecycleBinController($scope, $routeParams, dataTypeResource, navig
|
||||
$scope.listViewPath = null;
|
||||
|
||||
$routeParams.id = "-21";
|
||||
dataTypeResource.getById(-96).then(function (result) {
|
||||
_.each(result.preValues, function (i) {
|
||||
$scope.model.config[i.key] = i.value;
|
||||
mediaResource.getRecycleBin().then(function (result) {
|
||||
//we'll get the 'content item' for the recycle bin, we know that it will contain a single tab and a
|
||||
// single property, so we'll extract that property (list view) and use it's data.
|
||||
var listproperty = result.tabs[0].properties[0];
|
||||
|
||||
_.each(listproperty.config, function (val, key) {
|
||||
$scope.model.config[key] = val;
|
||||
});
|
||||
$scope.listViewPath = 'views/propertyeditors/listview/listview.html';
|
||||
});
|
||||
|
||||
$scope.model = { config: { entityType: $routeParams.section } };
|
||||
$scope.model = { config: { entityType: $routeParams.section, layouts: [] } };
|
||||
|
||||
// sync tree node
|
||||
navigationService.syncTree({ tree: "media", path: ["-1", $routeParams.id], forceReload: false });
|
||||
@@ -37,12 +43,11 @@ function MediaRecycleBinController($scope, $routeParams, dataTypeResource, navig
|
||||
|
||||
var pageName = "general_recycleBin";
|
||||
|
||||
localizationService.localize(pageName).then(function(value) {
|
||||
localizationService.localize(pageName).then(function (value) {
|
||||
$scope.page.name = value;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
angular.module('umbraco').controller("Umbraco.Editors.Media.RecycleBinController", MediaRecycleBinController);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<umb-editor-view ng-controller="Umbraco.Editors.Media.RecycleBinController">
|
||||
|
||||
<umb-editor-header
|
||||
name="page.name"
|
||||
<form>
|
||||
<umb-editor-header name="page.name"
|
||||
name-locked="page.nameLocked"
|
||||
hide-icon="true"
|
||||
hide-description="true"
|
||||
@@ -13,5 +12,5 @@
|
||||
<div ng-include="listViewPath"></div>
|
||||
|
||||
</umb-editor-container>
|
||||
|
||||
</form>
|
||||
</umb-editor-view>
|
||||
|
||||
@@ -30,6 +30,7 @@ using Umbraco.Core.Dynamics;
|
||||
using umbraco.BusinessLogic.Actions;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.presentation.preview;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Web.UI;
|
||||
using Constants = Umbraco.Core.Constants;
|
||||
using Notification = Umbraco.Web.Models.ContentEditing.Notification;
|
||||
@@ -76,6 +77,29 @@ namespace Umbraco.Web.Editors
|
||||
return foundContent.Select(Mapper.Map<IContent, ContentItemDisplay>);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an item to be used to display the recycle bin for content
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ContentItemDisplay GetRecycleBin()
|
||||
{
|
||||
var display = new ContentItemDisplay
|
||||
{
|
||||
Id = Constants.System.RecycleBinContent,
|
||||
Alias = "recycleBin",
|
||||
ParentId = -1,
|
||||
Name = Services.TextService.Localize("general/recycleBin"),
|
||||
ContentTypeAlias = "recycleBin",
|
||||
CreateDate = DateTime.Now,
|
||||
IsContainer = true,
|
||||
Path = "-1," + Constants.System.RecycleBinContent
|
||||
};
|
||||
|
||||
TabsAndPropertiesResolver.AddListView(display, "content", Services.DataTypeService, Services.TextService);
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content json for the content id
|
||||
/// </summary>
|
||||
|
||||
@@ -88,6 +88,29 @@ namespace Umbraco.Web.Editors
|
||||
return mapped;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an item to be used to display the recycle bin for media
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ContentItemDisplay GetRecycleBin()
|
||||
{
|
||||
var display = new ContentItemDisplay
|
||||
{
|
||||
Id = Constants.System.RecycleBinMedia,
|
||||
Alias = "recycleBin",
|
||||
ParentId = -1,
|
||||
Name = Services.TextService.Localize("general/recycleBin"),
|
||||
ContentTypeAlias = "recycleBin",
|
||||
CreateDate = DateTime.Now,
|
||||
IsContainer = true,
|
||||
Path = "-1," + Constants.System.RecycleBinMedia
|
||||
};
|
||||
|
||||
TabsAndPropertiesResolver.AddListView(display, "media", Services.DataTypeService, Services.TextService);
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content json for the content id
|
||||
/// </summary>
|
||||
@@ -123,7 +146,7 @@ namespace Umbraco.Web.Editors
|
||||
/// <summary>
|
||||
/// Returns media items known to be a container of other media items
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[FilterAllowedOutgoingMedia(typeof(IEnumerable<ContentItemBasic<ContentPropertyBasic, IMedia>>))]
|
||||
public IEnumerable<ContentItemBasic<ContentPropertyBasic, IMedia>> GetChildFolders(int id = -1)
|
||||
|
||||
@@ -126,6 +126,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
/// <param name="display"></param>
|
||||
/// <param name="entityType">This must be either 'content' or 'media'</param>
|
||||
/// <param name="dataTypeService"></param>
|
||||
/// <param name="localizedTextService"></param>
|
||||
internal static void AddListView<TPersisted>(TabbedContentItem<ContentPropertyDisplay, TPersisted> display, string entityType, IDataTypeService dataTypeService, ILocalizedTextService localizedTextService)
|
||||
where TPersisted : IContentBase
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user