2013-06-10 17:01:50 -02:00
|
|
|
|
using System.Text;
|
2013-05-27 01:23:49 -10:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using Umbraco.Core;
|
|
|
|
|
|
using Umbraco.Core.Models;
|
|
|
|
|
|
using Umbraco.Core.PropertyEditors;
|
|
|
|
|
|
using Umbraco.Web.Models.ContentEditing;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.Models.Mapping
|
|
|
|
|
|
{
|
2013-06-10 17:01:50 -02:00
|
|
|
|
internal class ContentModelMapper : BaseContentModelMapper
|
2013-05-27 01:23:49 -10:00
|
|
|
|
{
|
2013-06-10 17:01:50 -02:00
|
|
|
|
|
2013-06-17 01:06:31 +02:00
|
|
|
|
public ContentModelMapper(ApplicationContext applicationContext, UserModelMapper userMapper)
|
|
|
|
|
|
: base(applicationContext, userMapper)
|
2013-06-03 23:50:20 -10:00
|
|
|
|
{
|
2013-05-27 01:23:49 -10:00
|
|
|
|
}
|
|
|
|
|
|
|
2013-06-10 16:43:42 -02:00
|
|
|
|
|
2013-07-25 15:31:26 +10:00
|
|
|
|
//public ContentItemBasic<ContentPropertyBasic, IContent> ToContentItemSimple(IContent content)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// var result = base.ToContentItemSimpleBase<IContent>(content);
|
|
|
|
|
|
// result.ContentTypeAlias = content.ContentType.Alias;
|
|
|
|
|
|
// result.Icon = content.ContentType.Icon;
|
|
|
|
|
|
// result.Updator = UserMapper.ToUserBasic(content.GetWriterProfile());
|
|
|
|
|
|
// return result;
|
|
|
|
|
|
//}
|
2013-06-10 16:43:42 -02:00
|
|
|
|
|
2013-07-25 15:31:26 +10:00
|
|
|
|
//public ContentItemDisplay ToContentItemDisplay(IContent content)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// //create the list of tabs for properties assigned to tabs.
|
|
|
|
|
|
// var tabs = GetTabs(content);
|
2013-06-10 16:43:42 -02:00
|
|
|
|
|
2013-07-25 15:31:26 +10:00
|
|
|
|
// var result = CreateContent<ContentItemDisplay, ContentPropertyDisplay, IContent>(content, (display, originalContent) =>
|
|
|
|
|
|
// {
|
|
|
|
|
|
// //fill in the rest
|
|
|
|
|
|
// display.Updator = UserMapper.ToUserBasic(content.GetWriterProfile());
|
|
|
|
|
|
// display.ContentTypeAlias = content.ContentType.Alias;
|
|
|
|
|
|
// display.Icon = content.ContentType.Icon;
|
2013-06-10 16:43:42 -02:00
|
|
|
|
|
2013-07-25 15:31:26 +10:00
|
|
|
|
// //set display props after the normal properties are alraedy mapped
|
|
|
|
|
|
// display.Name = originalContent.Name;
|
|
|
|
|
|
// display.Tabs = tabs;
|
|
|
|
|
|
// //look up the published version of this item if it is not published
|
|
|
|
|
|
// if (content.Published)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// display.PublishDate = content.UpdateDate;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else if (content.HasPublishedVersion())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var published = ApplicationContext.Services.ContentService.GetPublishedVersion(content.Id);
|
|
|
|
|
|
// display.PublishDate = published.UpdateDate;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// display.PublishDate = null;
|
|
|
|
|
|
// }
|
2013-06-10 16:43:42 -02:00
|
|
|
|
|
2013-07-25 15:31:26 +10:00
|
|
|
|
// }, null, false);
|
2013-06-10 16:43:42 -02:00
|
|
|
|
|
2013-07-25 15:31:26 +10:00
|
|
|
|
// return result;
|
|
|
|
|
|
//}
|
2013-06-10 16:43:42 -02:00
|
|
|
|
|
|
|
|
|
|
}
|
2013-05-27 01:23:49 -10:00
|
|
|
|
}
|