diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
index e34c65aead..4b03a9439b 100644
--- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
+++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
@@ -292,7 +292,6 @@
-
default.aspx
ASPXCodeBehind
@@ -564,8 +563,6 @@
-
-
diff --git a/src/Umbraco.Web.UI/umbraco/Views/common/dialogs/mediapicker.html b/src/Umbraco.Web.UI/umbraco/Views/common/dialogs/mediapicker.html
index 8ecb90c060..3524f1371f 100644
--- a/src/Umbraco.Web.UI/umbraco/Views/common/dialogs/mediapicker.html
+++ b/src/Umbraco.Web.UI/umbraco/Views/common/dialogs/mediapicker.html
@@ -31,8 +31,13 @@
diff --git a/src/Umbraco.Web.UI/umbraco/js/umbraco.controllers.js b/src/Umbraco.Web.UI/umbraco/js/umbraco.controllers.js
index 707549ae74..4aba440002 100644
--- a/src/Umbraco.Web.UI/umbraco/js/umbraco.controllers.js
+++ b/src/Umbraco.Web.UI/umbraco/js/umbraco.controllers.js
@@ -152,7 +152,20 @@ angular.module("umbraco").controller("Umbraco.Dialogs.MediaPickerController", fu
mediaResource.rootMedia()
.then(function (data) {
$scope.images = data;
- });
+ });
+
+ $scope.selectMediaItem = function (image) {
+ if (image.contentTypeAlias.toLowerCase() == 'folder') {
+ mediaResource.getChildren(image.id)
+ .then(function (data) {
+ $scope.images = data;
+ });
+ }
+ else if (image.contentTypeAlias.toLowerCase() == 'image') {
+ $scope.select(image);
+ }
+
+ }
});
angular.module("umbraco").controller("Umbraco.Common.LegacyController",
function($scope, $routeParams){
@@ -475,8 +488,13 @@ angular.module("umbraco")
//really simple example on how to intergrate a service with tinyMCE
$(data.selection).each(function(i,img){
+
+ var imageProperty = _.find(img.properties, function (item) {
+ return item.alias == 'umbracoFile';
+ });
+
var data = {
- src: img.thumbnail,
+ src: imageProperty != null ? imageProperty.value : "nothing.jpg",
style: 'width: 100px; height: 100px',
id : '__mcenew'
};
diff --git a/src/Umbraco.Web.UI/umbraco/js/umbraco.resources.js b/src/Umbraco.Web.UI/umbraco/js/umbraco.resources.js
index f4bd8e77b0..2dcf9ca881 100644
--- a/src/Umbraco.Web.UI/umbraco/js/umbraco.resources.js
+++ b/src/Umbraco.Web.UI/umbraco/js/umbraco.resources.js
@@ -14,10 +14,15 @@ define(['app', 'angular'], function (app, angular) {
function mediaResource($q, $http) {
/** internal method to get the api url */
- function getRootMediaUrl(section) {
+ function getRootMediaUrl() {
return Umbraco.Sys.ServerVariables.mediaApiBaseUrl + "GetRootMedia";
}
+ /** internal method to get the api url */
+ function getChildrenMediaUrl(parentId) {
+ return Umbraco.Sys.ServerVariables.mediaApiBaseUrl + "GetChildren?parentId=" + parentId
+ }
+
return {
rootMedia: function () {
@@ -33,12 +38,22 @@ define(['app', 'angular'], function (app, angular) {
});
return deferred.promise;
+ },
- return [
- { id: 1234, src: "/Media/boston.jpg", thumbnail: "/Media/boston.jpg" },
- { src: "/Media/bird.jpg", thumbnail: "/Media/bird.jpg" },
- { src: "/Media/frog.jpg", thumbnail: "/Media/frog.jpg" }
- ];
+ getChildren: function (parentId) {
+
+ var deferred = $q.defer();
+
+ //go and get the tree data
+ $http.get(getChildrenMediaUrl(parentId)).
+ success(function (data, status, headers, config) {
+ deferred.resolve(data);
+ }).
+ error(function (data, status, headers, config) {
+ deferred.reject('Failed to retreive data for application tree ' + section);
+ });
+
+ return deferred.promise;
}
};
}
diff --git a/src/Umbraco.Web/Editors/MediaController.cs b/src/Umbraco.Web/Editors/MediaController.cs
index 62d8eefa96..a830583d27 100644
--- a/src/Umbraco.Web/Editors/MediaController.cs
+++ b/src/Umbraco.Web/Editors/MediaController.cs
@@ -51,5 +51,14 @@ namespace Umbraco.Web.Editors
return Services.MediaService.GetRootMedia()
.Select(x => _mediaModelMapper.ToMediaItemSimple(x));
}
+
+ ///
+ /// Returns the child media objects
+ ///
+ public IEnumerable> GetChildren(int parentId)
+ {
+ return Services.MediaService.GetChildren(parentId)
+ .Select(x => _mediaModelMapper.ToMediaItemSimple(x));
+ }
}
}
diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentItemBasic.cs b/src/Umbraco.Web/Models/ContentEditing/ContentItemBasic.cs
index eed05955d0..2b9bc11d6e 100644
--- a/src/Umbraco.Web/Models/ContentEditing/ContentItemBasic.cs
+++ b/src/Umbraco.Web/Models/ContentEditing/ContentItemBasic.cs
@@ -22,6 +22,9 @@ namespace Umbraco.Web.Models.ContentEditing
private IEnumerable _properties;
+ [DataMember(Name = "icon")]
+ public string Icon { get; set; }
+
[DataMember(Name = "id", IsRequired = true)]
[Required]
public int Id { get; set; }
diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs b/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs
index 11abf5730c..6bcd7f0cc3 100644
--- a/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs
+++ b/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs
@@ -18,9 +18,7 @@ namespace Umbraco.Web.Models.ContentEditing
{
Tabs = new List>();
}
-
- [DataMember(Name = "icon")]
- public string Icon { get; set; }
+
[DataMember(Name = "publishDate")]
public DateTime? PublishDate { get; set; }
diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentPropertyBasic.cs b/src/Umbraco.Web/Models/ContentEditing/ContentPropertyBasic.cs
index 8604bf05b2..f439eadf79 100644
--- a/src/Umbraco.Web/Models/ContentEditing/ContentPropertyBasic.cs
+++ b/src/Umbraco.Web/Models/ContentEditing/ContentPropertyBasic.cs
@@ -16,6 +16,10 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "value")]
public string Value { get; set; }
+ [DataMember(Name = "alias", IsRequired = true)]
+ [Required(AllowEmptyStrings = false)]
+ public string Alias { get; set; }
+
protected bool Equals(ContentPropertyBasic other)
{
return Id == other.Id;
diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentPropertyDisplay.cs b/src/Umbraco.Web/Models/ContentEditing/ContentPropertyDisplay.cs
index f3d4a765ee..9123432993 100644
--- a/src/Umbraco.Web/Models/ContentEditing/ContentPropertyDisplay.cs
+++ b/src/Umbraco.Web/Models/ContentEditing/ContentPropertyDisplay.cs
@@ -13,10 +13,6 @@ namespace Umbraco.Web.Models.ContentEditing
[Required]
public string Label { get; set; }
- [DataMember(Name = "alias", IsRequired = true)]
- [Required(AllowEmptyStrings = false)]
- public string Alias { get; set; }
-
[DataMember(Name = "description")]
public string Description { get; set; }
diff --git a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs
index 02833804cd..f2340b5b55 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs
@@ -72,8 +72,7 @@ namespace Umbraco.Web.Models.Mapping
{
//set display props after the normal properties are alraedy mapped
display.Name = originalContent.Name;
- display.Tabs = tabs;
- display.Icon = originalContent.ContentType.Icon;
+ display.Tabs = tabs;
//look up the published version of this item if it is not published
if (content.Published)
{
@@ -136,7 +135,9 @@ namespace Umbraco.Web.Models.Mapping
ParentId = content.ParentId,
UpdateDate = content.UpdateDate,
CreateDate = content.CreateDate,
- ContentTypeAlias = content.ContentType.Alias
+ ContentTypeAlias = content.ContentType.Alias,
+ Icon = content.ContentType.Icon,
+ Name = content.Name
};
if (createProperties)
result.Properties = content.Properties.Select(p => CreateProperty(p, propertyCreatedCallback)).ToArray();
@@ -170,7 +171,8 @@ namespace Umbraco.Web.Models.Mapping
var legacyResult = new TContentProperty
{
Id = property.Id,
- Value = property.Value.ToString()
+ Value = property.Value.ToString(),
+ Alias = property.Alias
};
if (callback != null) callback(legacyResult, property, null);
return legacyResult;
@@ -178,7 +180,8 @@ namespace Umbraco.Web.Models.Mapping
var result = new TContentProperty
{
Id = property.Id,
- Value = editor.ValueEditor.SerializeValue(property.Value)
+ Value = editor.ValueEditor.SerializeValue(property.Value),
+ Alias = property.Alias
};
if (callback != null) callback(result, property, editor);
return result;
diff --git a/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs b/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs
index 0e52d87551..2cedd33ad6 100644
--- a/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs
+++ b/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs
@@ -51,7 +51,9 @@ namespace Umbraco.Web.Models.Mapping
ParentId = media.ParentId,
UpdateDate = media.UpdateDate,
CreateDate = media.CreateDate,
- ContentTypeAlias = media.ContentType.Alias
+ ContentTypeAlias = media.ContentType.Alias,
+ Icon = media.ContentType.Icon,
+ Name = media.Name
};
if (createProperties)
result.Properties = media.Properties.Select(p => CreateProperty(p, propertyCreatedCallback)).ToArray();
@@ -85,7 +87,8 @@ namespace Umbraco.Web.Models.Mapping
var legacyResult = new TContentProperty
{
Id = property.Id,
- Value = property.Value.ToString()
+ Value = property.Value.ToString(),
+ Alias = property.Alias
};
if (callback != null) callback(legacyResult, property, null);
return legacyResult;
@@ -94,7 +97,8 @@ namespace Umbraco.Web.Models.Mapping
var result = new TContentProperty
{
Id = property.Id,
- Value = editor.ValueEditor.SerializeValue(property.Value)
+ Value = editor.ValueEditor.SerializeValue(property.Value),
+ Alias = property.Alias
};
if (callback != null) callback(result, property, editor);
return result;