diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/media.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/media.resource.js index 9137017128..74c2718bad 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/media.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/media.resource.js @@ -46,7 +46,7 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) { * .then(function() { * $scope.complete = true; * }); - * + * * @param {Object} args arguments object * @param {Int} args.parentId the ID of the parent node * @param {Array} options.sortedIds array of node IDs as they should be sorted @@ -87,9 +87,9 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) { * .then(function() { * alert("node was moved"); * }, function(err){ - * alert("node didnt move:" + err.data.Message); + * alert("node didnt move:" + err.data.Message); * }); - * + * * @param {Object} args arguments object * @param {Int} args.idd the ID of the node to move * @param {Int} args.parentId the ID of the parent node to move to @@ -129,12 +129,12 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) { *
* mediaResource.getById(1234)
* .then(function(media) {
- * var myMedia = media;
+ * var myMedia = media;
* alert('its here!');
* });
- *
- *
- * @param {Int} id id of media item to return
+ *
+ *
+ * @param {Int} id id of media item to return
* @returns {Promise} resourcePromise object containing the media item.
*
*/
@@ -163,9 +163,9 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
* .then(function() {
* alert('its gone!');
* });
- *
- *
- * @param {Int} id id of media item to delete
+ *
+ *
+ * @param {Int} id id of media item to delete
* @returns {Promise} resourcePromise object.
*
*/
@@ -191,12 +191,12 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
*
* mediaResource.getByIds( [1234,2526,28262])
* .then(function(mediaArray) {
- * var myDoc = contentArray;
+ * var myDoc = contentArray;
* alert('they are here!');
* });
- *
- *
- * @param {Array} ids ids of media items to return as an array
+ *
+ *
+ * @param {Array} ids ids of media items to return as an array
* @returns {Promise} resourcePromise object containing the media items array.
*
*/
@@ -223,28 +223,28 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
*
* @description
* Returns a scaffold of an empty media item, given the id of the media item to place it underneath and the media type alias.
- *
+ *
* - Parent Id must be provided so umbraco knows where to store the media
- * - Media Type alias must be provided so umbraco knows which properties to put on the media scaffold
- *
+ * - Media Type alias must be provided so umbraco knows which properties to put on the media scaffold
+ *
* The scaffold is used to build editors for media that has not yet been populated with data.
- *
+ *
* ##usage
*
* mediaResource.getScaffold(1234, 'folder')
* .then(function(scaffold) {
* var myDoc = scaffold;
- * myDoc.name = "My new media item";
+ * myDoc.name = "My new media item";
*
* mediaResource.save(myDoc, true)
* .then(function(media){
* alert("Retrieved, updated and saved again");
* });
* });
- *
- *
+ *
+ *
* @param {Int} parentId id of media item to return
- * @param {String} alias mediatype alias to base the scaffold on
+ * @param {String} alias mediatype alias to base the scaffold on
* @returns {Promise} resourcePromise object containing the media scaffold.
*
*/
@@ -283,11 +283,11 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
*
* mediaResource.getChildren(1234, {pageSize: 10, pageNumber: 2})
* .then(function(contentArray) {
- * var children = contentArray;
+ * var children = contentArray;
* alert('they are here!');
* });
- *
- *
+ *
+ *
* @param {Int} parentid id of content item to return children of
* @param {Object} options optional options object
* @param {Int} options.pageSize if paging data, number of nodes per page, default = 0
@@ -361,9 +361,9 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
*
* @description
* Saves changes made to a media item, if the media item is new, the isNew paramater must be passed to force creation
- * if the media item needs to have files attached, they must be provided as the files param and passed separately
- *
- *
+ * if the media item needs to have files attached, they must be provided as the files param and passed separately
+ *
+ *
* ##usage
*
* mediaResource.getById(1234)
@@ -374,11 +374,11 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
* alert("Retrieved, updated and saved again");
* });
* });
- *
- *
+ *
+ *
* @param {Object} media The media item object with changes applied
- * @param {Bool} isNew set to true to create a new item or to update an existing
- * @param {Array} files collection of files for the media item
+ * @param {Bool} isNew set to true to create a new item or to update an existing
+ * @param {Array} files collection of files for the media item
* @returns {Promise} resourcePromise object containing the saved media item.
*
*/
@@ -400,10 +400,10 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
* .then(function(folder) {
* alert('New folder');
* });
- *
+ *
*
* @param {string} name Name of the folder to create
- * @param {int} parentId Id of the media item to create the folder underneath
+ * @param {int} parentId Id of the media item to create the folder underneath
* @returns {Promise} resourcePromise object.
*
*/
@@ -427,18 +427,19 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
* Retrieves all media children with types used as folders.
* Uses the convention of looking for media items with mediaTypes ending in
* *Folder so will match "Folder", "bannerFolder", "secureFolder" etc,
- *
- * NOTE: This will return a max of 500 folders, if more is required it needs to be paged
- *
+ *
+ * NOTE: This will return a page of max 500 folders, if more is required it needs to be paged
+ * and then folders are in the .items property of the returned promise data
+ *
* ##usage
*
* mediaResource.getChildFolders(1234)
- * .then(function(data) {
+ * .then(function(page) {
* alert('folders');
* });
- *
+ *
*
- * @param {int} parentId Id of the media item to query for child folders
+ * @param {int} parentId Id of the media item to query for child folders
* @returns {Promise} resourcePromise object.
*
*/
@@ -454,9 +455,11 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
"mediaApiBaseUrl",
"GetChildFolders",
{
- id: parentId
+ id: parentId,
+ pageNumber: 1,
+ pageSize: 500
})),
- 'Failed to retrieve child folders for media item ' + parentId);
+ 'Failed to retrieve child folders for media item ' + parentId);
},
/**
@@ -473,8 +476,8 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
* .then(function() {
* alert('its empty!');
* });
- *
- *
+ *
+ *
* @returns {Promise} resourcePromise object.
*
*/
@@ -501,8 +504,8 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
* .then(function(searchResult) {
* alert('it's here!');
* });
- *
- *
+ *
+ *
* @param {string} query The search query
* @param {int} pageNumber The page number
* @param {int} pageSize The number of media items on a page
@@ -513,7 +516,7 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
search: function (query, pageNumber, pageSize, searchFrom) {
var args = [
- { "query": query },
+ { "query": query },
{ "pageNumber": pageNumber },
{ "pageSize": pageSize },
{ "searchFrom": searchFrom }
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js
index 777110197d..70e37662ba 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js
@@ -52,7 +52,7 @@ function listViewController($rootScope, $scope, $routeParams, $injector, notific
$scope.isNew = false;
$scope.actionInProgress = false;
$scope.selection = [];
- $scope.folders = [];
+ $scope.folders = [];
$scope.page = {};
$scope.listViewResultSet = {
totalPages: 0,
@@ -72,7 +72,7 @@ function listViewController($rootScope, $scope, $routeParams, $injector, notific
"canCopy": _.contains(currentUserPermissions, 'O'), //Magic Char = O
"canCreate": _.contains(currentUserPermissions, 'C'), //Magic Char = C
"canDelete": _.contains(currentUserPermissions, 'D'), //Magic Char = D
- "canMove": _.contains(currentUserPermissions, 'M'), //Magic Char = M
+ "canMove": _.contains(currentUserPermissions, 'M'), //Magic Char = M
"canPublish": _.contains(currentUserPermissions, 'U'), //Magic Char = U
"canUnpublish": _.contains(currentUserPermissions, 'U'), //Magic Char = Z (however UI says it can't be set, so if we can publish 'U' we can unpublish)
};
@@ -82,7 +82,7 @@ function listViewController($rootScope, $scope, $routeParams, $injector, notific
$scope.buttonPermissions = null;
//When we are dealing with 'content', we need to deal with permissions on child nodes.
- // Currently there is no real good way to
+ // Currently there is no real good way to
if ($scope.entityType === "content") {
var idsWithPermissions = null;
@@ -271,8 +271,8 @@ function listViewController($rootScope, $scope, $routeParams, $injector, notific
if (reloadFolders && $scope.entityType === 'media') {
//The folders aren't loaded - we only need to do this once since we're never changing node ids
mediaResource.getChildFolders($scope.contentId)
- .then(function (folders) {
- $scope.folders = folders;
+ .then(function (page) {
+ $scope.folders = page.items;
$scope.viewLoaded = true;
});
@@ -454,7 +454,7 @@ function listViewController($rootScope, $scope, $routeParams, $injector, notific
function performMove(target) {
- //NOTE: With the way this applySelected/serial works, I'm not sure there's a better way currently to return
+ //NOTE: With the way this applySelected/serial works, I'm not sure there's a better way currently to return
// a specific value from one of the methods, so we'll have to try this way. Even though the first method
// will fire once per every node moved, the destination path will be the same and we need to use that to sync.
var newPath = null;
@@ -604,7 +604,7 @@ function listViewController($rootScope, $scope, $routeParams, $injector, notific
getContentTypesCallback(id).then(function (items) {
$scope.listViewAllowedTypes = items;
});
-
+
$scope.contentId = id;
$scope.isTrashed = id === "-20" || id === "-21";