Compare commits

..

23 Commits

Author SHA1 Message Date
Morten Christensen 2a2e867784 Fxies U4-2257 2013-06-02 11:30:27 -02:00
Sebastiaan Janssen 79e0242468 Show containers in folderbrowser again 2013-06-02 05:03:51 -02:00
Morten Christensen 242443d861 Fixes the EntityRepository for Content and Media, so trees load correctly.
Fixes U4-2306
Fixes loading of MNTP.
FolderBrowser is now able to show multiple images on a single media item.
FolderBrowser only shows images and not containers.
2013-06-01 20:40:51 -02:00
Sebastiaan Janssen 7c066b9ded Merge with 6.0.7 2013-05-31 14:01:21 -02:00
Sebastiaan Janssen 159d605434 U4-2262 Release 6.1.0 Build 2 (Beta) has Razor Errors on scripting files 2013-05-31 13:59:35 -02:00
Sebastiaan Janssen 1971006a48 Merge with 6.0.7 2013-05-31 12:16:09 -02:00
Sebastiaan Janssen 5c0c33a46b Fixes U4-2304 Typo bug in umbraco.cms.businesslogic.packager 2013-05-31 12:14:03 -02:00
Sebastiaan Janssen 9bd255d9a5 Include ExamineManagementIco.png in project so it's included in the build 2013-05-31 11:35:21 -02:00
Sebastiaan Janssen cc7f41d9ee U4-2295 Templates tree doesn't refresh and Master template stays at "None" 2013-05-31 09:15:10 -02:00
Sebastiaan Janssen b4b0a37c2c Fixes U4-2302 Breaking change in 6.1? Macro parameter "contentPicker" no longer
passes an id, but a node
2013-05-31 09:13:25 -02:00
Sebastiaan Janssen 8c841f97cc Merge with 6.0.7 2013-05-31 05:57:18 -02:00
Sebastiaan Janssen a1ee352514 Additional fix for U4-335 Image cropper out of memory 2013-05-31 05:46:10 -02:00
Morten Christensen c25b06b15f Fixes #U4-2296 2013-05-30 14:28:34 -02:00
Sebastiaan Janssen 78bfb6a8cc Fix missing Examine dashboard 2013-05-30 10:26:54 -02:00
Sebastiaan Janssen d8a8bf5f74 Bump version number 2013-05-30 10:26:40 -02:00
Sebastiaan Janssen b70c98ea74 Merge with 6.0.7 2013-05-30 10:25:20 -02:00
Sebastiaan Janssen a8ad8c2a43 Bump version number 2013-05-30 10:23:35 -02:00
Sebastiaan Janssen 96f8cd3d60 Opening branch 6.1.1 2013-05-30 10:21:34 -02:00
Sebastiaan Janssen 91436ad247 Closing branch 6.1.0 2013-05-30 10:20:59 -02:00
Sebastiaan Janssen 678f911ff1 Added tag release-6.1.0 for changeset 8309c3bd6db5 2013-05-30 10:20:36 -02:00
Sebastiaan Janssen afbe3ca3b9 Creating branch 6.0.7 2013-05-30 09:57:33 -02:00
Sebastiaan Janssen 32d6f2e50c Closing branch 6.0.6 2013-05-30 09:57:03 -02:00
Sebastiaan Janssen 9909f5b6be Added tag release-6.0.6 for changeset 953c466faf8f 2013-05-30 09:56:32 -02:00
23 changed files with 256 additions and 185 deletions
+2
View File
@@ -33,3 +33,5 @@ aed55cba29009ad3db48880a7cfb66407ce9805f release-6.0.3
87cf618a39e38ec58df916d10e6a924de62ae37d release-6.1.0-beta
0dee9964687ea51ea797984cf7cce3655d6a6558 release-6.0.4
7670bb47a671a9ecc15118589d8048907ea76241 release-6.1.0-beta2
953c466faf8fcfd6e85e06ccd04c2346bbdb88a8 release-6.0.6
8309c3bd6db5885c9ef37e71db0672b8947fcb59 release-6.1.0
+1 -1
View File
@@ -1,5 +1,5 @@
@ECHO OFF
SET release=6.1.0
SET release=6.1.1
SET comment=
SET version=%release%
@@ -5,7 +5,7 @@ namespace Umbraco.Core.Configuration
{
public class UmbracoVersion
{
private static readonly Version Version = new Version("6.1.0");
private static readonly Version Version = new Version("6.1.1");
/// <summary>
/// Gets the current version of Umbraco.
+2 -8
View File
@@ -517,10 +517,7 @@ namespace Umbraco.Core.Models
x.Add(new XAttribute("writerName", content.GetWriterProfile().Name));
x.Add(new XAttribute("writerID", content.WriterId));
x.Add(new XAttribute("template", content.Template == null ? "0" : content.Template.Id.ToString()));
if (UmbracoSettings.UseLegacyXmlSchema)
{
x.Add(new XAttribute("nodeTypeAlias", content.ContentType.Alias));
}
x.Add(new XAttribute("nodeTypeAlias", content.ContentType.Alias));
return x;
}
@@ -541,10 +538,7 @@ namespace Umbraco.Core.Models
x.Add(new XAttribute("writerID", media.CreatorId));
x.Add(new XAttribute("version", media.Version));
x.Add(new XAttribute("template", 0));
if (UmbracoSettings.UseLegacyXmlSchema)
{
x.Add(new XAttribute("nodeTypeAlias", media.ContentType.Alias));
}
x.Add(new XAttribute("nodeTypeAlias", media.ContentType.Alias));
return x;
}
+9 -15
View File
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Umbraco.Core.Models.EntityBase;
@@ -21,7 +22,6 @@ namespace Umbraco.Core.Models
private bool _isDraft;
private bool _hasPendingChanges;
private string _contentTypeAlias;
private string _umbracoFile;
private Guid _nodeObjectTypeId;
private static readonly PropertyInfo CreatorIdSelector = ExpressionHelper.GetPropertyInfo<UmbracoEntity, int>(x => x.CreatorId);
@@ -38,7 +38,6 @@ namespace Umbraco.Core.Models
private static readonly PropertyInfo ContentTypeAliasSelector = ExpressionHelper.GetPropertyInfo<UmbracoEntity, string>(x => x.ContentTypeAlias);
private static readonly PropertyInfo ContentTypeIconSelector = ExpressionHelper.GetPropertyInfo<UmbracoEntity, string>(x => x.ContentTypeIcon);
private static readonly PropertyInfo ContentTypeThumbnailSelector = ExpressionHelper.GetPropertyInfo<UmbracoEntity, string>(x => x.ContentTypeThumbnail);
private static readonly PropertyInfo UmbracoFileSelector = ExpressionHelper.GetPropertyInfo<UmbracoEntity, string>(x => x.UmbracoFile);
private static readonly PropertyInfo NodeObjectTypeIdSelector = ExpressionHelper.GetPropertyInfo<UmbracoEntity, Guid>(x => x.NodeObjectTypeId);
private string _contentTypeIcon;
private string _contentTypeThumbnail;
@@ -234,19 +233,6 @@ namespace Umbraco.Core.Models
}
}
public string UmbracoFile
{
get { return _umbracoFile; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_umbracoFile = value;
return _umbracoFile;
}, _umbracoFile, UmbracoFileSelector);
}
}
public Guid NodeObjectTypeId
{
get { return _nodeObjectTypeId; }
@@ -259,5 +245,13 @@ namespace Umbraco.Core.Models
}, _nodeObjectTypeId, NodeObjectTypeIdSelector);
}
}
public IList<UmbracoProperty> UmbracoProperties { get; set; }
internal class UmbracoProperty
{
public Guid DataTypeControlId { get; set; }
public string Value { get; set; }
}
}
}
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence.Repositories;
@@ -25,13 +26,26 @@ namespace Umbraco.Core.Persistence.Factories
ContentTypeAlias = dto.Alias ?? string.Empty,
ContentTypeIcon = dto.Icon ?? string.Empty,
ContentTypeThumbnail = dto.Thumbnail ?? string.Empty,
UmbracoFile = dto.UmbracoFile ?? string.Empty
UmbracoProperties = new List<UmbracoEntity.UmbracoProperty>()
};
entity.IsPublished = dto.PublishedVersion != default(Guid) || (dto.NewestVersion != default(Guid) && dto.PublishedVersion == dto.NewestVersion);
entity.IsDraft = dto.NewestVersion != default(Guid) && (dto.PublishedVersion == default(Guid) || dto.PublishedVersion != dto.NewestVersion);
entity.HasPendingChanges = (dto.PublishedVersion != default(Guid) && dto.NewestVersion != default(Guid)) && dto.PublishedVersion != dto.NewestVersion;
if (dto.UmbracoPropertyDtos != null)
{
foreach (var propertyDto in dto.UmbracoPropertyDtos)
{
entity.UmbracoProperties.Add(new UmbracoEntity.UmbracoProperty
{
DataTypeControlId =
propertyDto.DataTypeControlId,
Value = propertyDto.UmbracoFile
});
}
}
return entity;
}
@@ -45,7 +45,7 @@ namespace Umbraco.Core.Persistence.Repositories
public virtual IUmbracoEntity Get(int id)
{
var sql = GetBaseWhere(GetBase, false, id);
var sql = GetBaseWhere(GetBase, false, false, id);
var nodeDto = _work.Database.FirstOrDefault<UmbracoEntityDto>(sql);
if (nodeDto == null)
return null;
@@ -58,8 +58,9 @@ namespace Umbraco.Core.Persistence.Repositories
public virtual IUmbracoEntity Get(int id, Guid objectTypeId)
{
bool isContentOrMedia = objectTypeId == new Guid(Constants.ObjectTypes.Document) || objectTypeId == new Guid(Constants.ObjectTypes.Media);
var sql = GetBaseWhere(GetBase, isContentOrMedia, objectTypeId, id).Append(GetGroupBy(isContentOrMedia));
bool isContent = objectTypeId == new Guid(Constants.ObjectTypes.Document);
bool isMedia = objectTypeId == new Guid(Constants.ObjectTypes.Media);
var sql = GetBaseWhere(GetBase, isContent, isMedia, objectTypeId, id).Append(GetGroupBy(isContent, isMedia));
var nodeDto = _work.Database.FirstOrDefault<UmbracoEntityDto>(sql);
if (nodeDto == null)
return null;
@@ -81,10 +82,13 @@ namespace Umbraco.Core.Persistence.Repositories
}
else
{
bool isContentOrMedia = objectTypeId == new Guid(Constants.ObjectTypes.Document) || objectTypeId == new Guid(Constants.ObjectTypes.Media);
var sql = GetBaseWhere(GetBase, isContentOrMedia, objectTypeId).Append(GetGroupBy(isContentOrMedia));
var dtos = _work.Database.Fetch<UmbracoEntityDto>(sql);
bool isContent = objectTypeId == new Guid(Constants.ObjectTypes.Document);
bool isMedia = objectTypeId == new Guid(Constants.ObjectTypes.Media);
var sql = GetBaseWhere(GetBase, isContent, isMedia, objectTypeId).Append(GetGroupBy(isContent, isMedia));
var dtos = isMedia
? _work.Database.Fetch<UmbracoEntityDto, UmbracoPropertyDto, UmbracoEntityDto>(
new UmbracoEntityRelator().Map, sql)
: _work.Database.Fetch<UmbracoEntityDto>(sql);
var factory = new UmbracoEntityFactory();
foreach (var dto in dtos)
@@ -97,9 +101,9 @@ namespace Umbraco.Core.Persistence.Repositories
public virtual IEnumerable<IUmbracoEntity> GetByQuery(IQuery<IUmbracoEntity> query)
{
var sqlClause = GetBase(false);
var sqlClause = GetBase(false, false);
var translator = new SqlTranslator<IUmbracoEntity>(sqlClause, query);
var sql = translator.Translate().Append(GetGroupBy(false));
var sql = translator.Translate().Append(GetGroupBy(false, false));
var dtos = _work.Database.Fetch<UmbracoEntityDto>(sql);
@@ -111,12 +115,16 @@ namespace Umbraco.Core.Persistence.Repositories
public virtual IEnumerable<IUmbracoEntity> GetByQuery(IQuery<IUmbracoEntity> query, Guid objectTypeId)
{
bool isContentOrMedia = objectTypeId == new Guid(Constants.ObjectTypes.Document) || objectTypeId == new Guid(Constants.ObjectTypes.Media);
var sqlClause = GetBaseWhere(GetBase, isContentOrMedia, objectTypeId);
bool isContent = objectTypeId == new Guid(Constants.ObjectTypes.Document);
bool isMedia = objectTypeId == new Guid(Constants.ObjectTypes.Media);
var sqlClause = GetBaseWhere(GetBase, isContent, isMedia, objectTypeId);
var translator = new SqlTranslator<IUmbracoEntity>(sqlClause, query);
var sql = translator.Translate().Append(GetGroupBy(isContentOrMedia));
var sql = translator.Translate().Append(GetGroupBy(isContent, isMedia));
var dtos = _work.Database.Fetch<UmbracoEntityDto>(sql);
var dtos = isMedia
? _work.Database.Fetch<UmbracoEntityDto, UmbracoPropertyDto, UmbracoEntityDto>(
new UmbracoEntityRelator().Map, sql)
: _work.Database.Fetch<UmbracoEntityDto>(sql);
var factory = new UmbracoEntityFactory();
var list = dtos.Select(factory.BuildEntity).Cast<IUmbracoEntity>().ToList();
@@ -128,7 +136,7 @@ namespace Umbraco.Core.Persistence.Repositories
#region Sql Statements
protected virtual Sql GetBase(bool isContentOrMedia)
protected virtual Sql GetBase(bool isContent, bool isMedia)
{
var columns = new List<object>
{
@@ -146,14 +154,19 @@ namespace Umbraco.Core.Persistence.Repositories
"COUNT(parent.parentID) as children"
};
if (isContentOrMedia)
if (isContent || isMedia)
{
columns.Add("published.versionId as publishedVerison");
columns.Add("latest.versionId as newestVersion");
columns.Add("contenttype.alias");
columns.Add("contenttype.icon");
columns.Add("contenttype.thumbnail");
}
if (isMedia)
{
columns.Add("property.dataNvarchar as umbracoFile");
columns.Add("property.controlId");
}
var sql = new Sql()
@@ -162,7 +175,7 @@ namespace Umbraco.Core.Persistence.Repositories
.LeftJoin("umbracoNode parent").On("parent.parentID = umbracoNode.id");
if (isContentOrMedia)
if (isContent || isMedia)
{
sql.InnerJoin("cmsContent content").On("content.nodeId = umbracoNode.id")
.LeftJoin("cmsContentType contenttype").On("contenttype.nodeId = content.contentType")
@@ -171,40 +184,51 @@ namespace Umbraco.Core.Persistence.Repositories
.On("umbracoNode.id = published.nodeId")
.LeftJoin(
"(SELECT nodeId, versionId FROM cmsDocument WHERE newest = 1 GROUP BY nodeId, versionId) as latest")
.On("umbracoNode.id = latest.nodeId")
.LeftJoin(
"(SELECT contentNodeId, dataNvarchar FROM cmsPropertyData INNER JOIN cmsPropertyType ON cmsPropertyType.id = cmsPropertyData.propertytypeid"+
" INNER JOIN cmsDataType ON cmsPropertyType.dataTypeId = cmsDataType.nodeId WHERE cmsDataType.controlId = '"+ Constants.PropertyEditors.UploadField +"') as property")
.On("umbracoNode.id = latest.nodeId");
}
/*if (isContent)
{
sql.LeftJoin(
"(SELECT contentNodeId, versionId, dataNvarchar, controlId FROM cmsPropertyData INNER JOIN cmsPropertyType ON cmsPropertyType.id = cmsPropertyData.propertytypeid" +
" INNER JOIN cmsDataType ON cmsPropertyType.dataTypeId = cmsDataType.nodeId) as property")
.On("umbracoNode.id = property.contentNodeId AND latest.versionId = property.versionId");
}*/
if (isMedia)
{
sql.LeftJoin(
"(SELECT contentNodeId, versionId, dataNvarchar, controlId FROM cmsPropertyData INNER JOIN cmsPropertyType ON cmsPropertyType.id = cmsPropertyData.propertytypeid" +
" INNER JOIN cmsDataType ON cmsPropertyType.dataTypeId = cmsDataType.nodeId) as property")
.On("umbracoNode.id = property.contentNodeId");
}
return sql;
}
protected virtual Sql GetBaseWhere(Func<bool, Sql> baseQuery, bool isContentOrMedia, Guid id)
protected virtual Sql GetBaseWhere(Func<bool, bool, Sql> baseQuery, bool isContent, bool isMedia, Guid id)
{
var sql = baseQuery(isContentOrMedia)
var sql = baseQuery(isContent, isMedia)
.Where("umbracoNode.nodeObjectType = @NodeObjectType", new { NodeObjectType = id });
return sql;
}
protected virtual Sql GetBaseWhere(Func<bool, Sql> baseQuery, bool isContentOrMedia, int id)
protected virtual Sql GetBaseWhere(Func<bool, bool, Sql> baseQuery, bool isContent, bool isMedia, int id)
{
var sql = baseQuery(isContentOrMedia)
var sql = baseQuery(isContent, isMedia)
.Where("umbracoNode.id = @Id", new { Id = id })
.Append(GetGroupBy(isContentOrMedia));
.Append(GetGroupBy(isContent, isMedia));
return sql;
}
protected virtual Sql GetBaseWhere(Func<bool, Sql> baseQuery, bool isContentOrMedia, Guid objectId, int id)
protected virtual Sql GetBaseWhere(Func<bool, bool, Sql> baseQuery, bool isContent, bool isMedia, Guid objectId, int id)
{
var sql = baseQuery(isContentOrMedia)
var sql = baseQuery(isContent, isMedia)
.Where("umbracoNode.id = @Id AND umbracoNode.nodeObjectType = @NodeObjectType",
new {Id = id, NodeObjectType = objectId});
return sql;
}
protected virtual Sql GetGroupBy(bool isContentOrMedia)
protected virtual Sql GetGroupBy(bool isContent, bool isMedia)
{
var columns = new List<object>
{
@@ -221,14 +245,19 @@ namespace Umbraco.Core.Persistence.Repositories
"umbracoNode.createDate"
};
if (isContentOrMedia)
if (isContent || isMedia)
{
columns.Add("published.versionId");
columns.Add("latest.versionId");
columns.Add("contenttype.alias");
columns.Add("contenttype.icon");
columns.Add("contenttype.thumbnail");
}
if (isMedia)
{
columns.Add("property.dataNvarchar");
columns.Add("property.controlId");
}
var sql = new Sql()
@@ -274,9 +303,57 @@ namespace Umbraco.Core.Persistence.Repositories
[Column("thumbnail")]
public string Thumbnail { get; set; }
[ResultColumn]
public List<UmbracoPropertyDto> UmbracoPropertyDtos { get; set; }
}
[ExplicitColumns]
internal class UmbracoPropertyDto
{
[Column("controlId")]
public Guid DataTypeControlId { get; set; }
[Column("umbracoFile")]
public string UmbracoFile { get; set; }
}
internal class UmbracoEntityRelator
{
internal UmbracoEntityDto Current;
internal UmbracoEntityDto Map(UmbracoEntityDto a, UmbracoPropertyDto p)
{
// Terminating call. Since we can return null from this function
// we need to be ready for PetaPoco to callback later with null
// parameters
if (a == null)
return Current;
// Is this the same UmbracoEntityDto as the current one we're processing
if (Current != null && Current.UniqueId == a.UniqueId)
{
// Yes, just add this UmbracoPropertyDto to the current UmbracoEntityDto's collection
Current.UmbracoPropertyDtos.Add(p);
// Return null to indicate we're not done with this UmbracoEntityDto yet
return null;
}
// This is a different UmbracoEntityDto to the current one, or this is the
// first time through and we don't have a Tab yet
// Save the current UmbracoEntityDto
var prev = Current;
// Setup the new current UmbracoEntityDto
Current = a;
Current.UmbracoPropertyDtos = new List<UmbracoPropertyDto>();
Current.UmbracoPropertyDtos.Add(p);
// Return the now populated previous UmbracoEntityDto (or null if first time through)
return prev;
}
}
#endregion
}
}
@@ -128,7 +128,12 @@ namespace Umbraco.Tests.Services
Assert.That(entities.Any(), Is.True);
Assert.That(entities.Count(), Is.EqualTo(3));
Assert.That(entities.Any(x => ((UmbracoEntity)x).UmbracoFile != string.Empty), Is.True);
//Assert.That(entities.Any(x => ((UmbracoEntity)x).UmbracoFile != string.Empty), Is.True);
Assert.That(
entities.Any(
x =>
((UmbracoEntity) x).UmbracoProperties.Any(
y => y.DataTypeControlId == new Guid(Constants.PropertyEditors.UploadField))), Is.True);
}
public override void CreateTestData()
+1
View File
@@ -837,6 +837,7 @@
<Content Include="Umbraco_Client\ContextMenu\Js\jquery.contextMenu.js" />
<Content Include="Umbraco_Client\Dashboards\ExamineManagement.css" />
<Content Include="Umbraco_Client\Dashboards\ExamineManagement.js" />
<Content Include="Umbraco_Client\Dashboards\ExamineManagementIco.png" />
<Content Include="Umbraco_Client\Dialogs\SortDialog.css" />
<Content Include="Umbraco_client\Dialogs\SortDialog.js" />
<Content Include="Umbraco_Client\Dialogs\AssignDomain2.js" />
@@ -101,5 +101,12 @@
<control>/umbraco/plugins/uGoLive/Dashboard.ascx</control>
</tab>
</section>
<section alias="ExamineManagement">
<areas>
<area>developer</area>
</areas>
<tab caption="Examine Management">
<control>/umbraco/dashboard/ExamineManagement.ascx</control>
</tab>
</section>
</dashBoard>
@@ -10,9 +10,15 @@
@{
@*Build a query and return the visible items *@
var selection= Model.Textpages.Where(query).Where("Visible");
var selection= Model.Textpages.Where("Visible");
@*
Example of more querying, if you have a true/false property with the alias of shouldBeFeatured:
var selection= Model.Textpages.Where("shouldBeFeatured == true").Where("Visible");
*@
}
@*Determine if there are any nodes in the selection, then render list *@
@if(selection.Any()){
@@ -1,25 +1,21 @@
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@inherits umbraco.MacroEngines.DynamicNodeContext
@* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@
@if (CurrentPage.Children.Where("umbracoNaviHide != @0", "True").Any())
@if (Model.Children.Where("Visible").Any())
{
@* Get the first page in the children, where the property umbracoNaviHide is not True *@
var naviLevel = CurrentPage.Children.Where("umbracoNaviHide != @0", "True").First().Level;
var naviLevel = Model.Children.Where("Visible").First().Level;
@* Add in level for a CSS hook *@
<ul class="level-@naviLevel">
@* For each child page under the root node, where the property umbracoNaviHide is not True *@
@foreach (var childPage in CurrentPage.Children.Where("umbracoNaviHide != @0", "True"))
@foreach (var childPage in Model.Children.Where("Visible"))
{
<li>
<a href="@childPage.Url">@childPage.Name</a>
@* if the current page has any children, where the property umbracoNaviHide is not True *@
@if (childPage.Children.Where("umbracoNaviHide != @0", "True").Any())
@if (childPage.Children.Where("Visible").Any())
{
@* Call our helper to display the children *@
@childPages(childPage.Children)
@@ -40,13 +36,13 @@
@* Add in level for a CSS hook *@
<ul class="level-@(naviLevel)">
@foreach (var page in pages.Where("umbracoNaviHide != @0", "True"))
@foreach (var page in pages.Where("Visible"))
{
<li>
<a href="@page.Url">@page.Name</a>
@* if the current page has any children, where the property umbracoNaviHide is not True *@
@if (page.Children.Where("umbracoNaviHide != @0", "True").Any())
@if (page.Children.Where("Visible").Any())
{
@* Call our helper to display the children *@
@childPages(page.Children)
@@ -24,6 +24,7 @@
useMasterPages: <%=umbraco.UmbracoSettings.UseAspNetMasterPages.ToString().ToLower()%>,
templateId: <%= Request.QueryString["templateID"] %>,
masterTemplateId: jQuery('#<%= MasterTemplate.ClientID %>').val(),
masterPageDropDown: $("#<%= MasterTemplate.ClientID %>"),
treeSyncPath: '<%=TemplateTreeSyncPath%>',
text: {
templateErrorHeader: "<%= umbraco.ui.Text("speechBubbles", "templateErrorHeader") %>",
@@ -102,7 +102,7 @@
var self = this;
umbraco.presentation.webservices.codeEditorSave.SaveTemplate(
templateName, templateAlias, codeVal, self._opts.templateId, self._opts.masterTemplateId,
templateName, templateAlias, codeVal, self._opts.templateId, this._opts.masterPageDropDown.val(),
function(t) { self.submitSucces(t); },
function(t) { self.submitFailure(t); });
@@ -29,10 +29,12 @@ namespace Umbraco.Web.WebServices
var service = ApplicationContext.Current.Services.EntityService;
var entities = service.GetChildren(parentId, UmbracoObjectTypes.Media);
//TODO: Only fetch files, not containers
foreach (UmbracoEntity entity in entities)
{
var thumbUrl = ThumbnailProvidersResolver.Current.GetThumbnailUrl(entity.UmbracoFile);
var uploadFieldProperty = entity.UmbracoProperties.FirstOrDefault(x => x.DataTypeControlId == new Guid(Constants.PropertyEditors.UploadField));
var thumbnailUrl = uploadFieldProperty == null ? "" : ThumbnailProvidersResolver.Current.GetThumbnailUrl(uploadFieldProperty.Value);
var item = new
{
Id = entity.Id,
@@ -41,13 +43,16 @@ namespace Umbraco.Web.WebServices
Tags = string.Join(",", Tag.GetTags(entity.Id).Select(x => x.TagCaption)),
MediaTypeAlias = entity.ContentTypeAlias,
EditUrl = string.Format("editMedia.aspx?id={0}", entity.Id),
FileUrl = entity.UmbracoFile,
ThumbnailUrl = string.IsNullOrEmpty(thumbUrl)
FileUrl = uploadFieldProperty == null
? ""
: uploadFieldProperty.Value,
ThumbnailUrl = string.IsNullOrEmpty(thumbnailUrl)
? IOHelper.ResolveUrl(string.Format("{0}/images/thumbnails/{1}", SystemDirectories.Umbraco, entity.ContentTypeThumbnail))
: thumbUrl
: thumbnailUrl
};
data.Add(item);
}
return new JavaScriptSerializer().Serialize(data);
@@ -1230,8 +1230,12 @@ namespace umbraco
{ }
break;
case "contentPicker":
var currentNode = macroXml.ImportNode(umbracoXml.GetElementById(contentId), true);
case "contentCurrent":
var importNode = macroPropertyValue == string.Empty
? umbracoXml.GetElementById(contentId)
: umbracoXml.GetElementById(macroPropertyValue);
var currentNode = macroXml.ImportNode(importNode, true);
// remove all sub content nodes
foreach (XmlNode n in currentNode.SelectNodes("node|*[@isDoc]"))
@@ -25,6 +25,15 @@ namespace umbraco.cms.presentation.Trees
private User _user;
/// <summary>
/// Determines whether the (legacy) Document object passed to the OnRenderNode-method
/// should be initialized with a full set of properties.
/// By default the Document will be initialized, so setting the boolean to True will
/// ensure that the Document object is loaded with a minimum set of properties to
/// improve performance.
/// </summary>
protected virtual bool LoadMinimalDocument { get; set; }
/// <summary>
/// Returns the current User. This ensures that we don't instantiate a new User object
/// each time.
@@ -108,7 +117,7 @@ function openContent(id) {
{
XmlTreeNode node = CreateNode(e, allowedUserOptions);
OnRenderNode(ref node, new Document(entity));
OnRenderNode(ref node, new Document(entity, LoadMinimalDocument));
OnBeforeNodeRender(ref Tree, ref node, EventArgs.Empty);
if (node != null)
@@ -61,7 +61,7 @@ function openMedia(id) {
//with the OnBeforeTreeRender/OnAfterTreeRender events, which sends an array for legacy Media items.
public override void Render(ref XmlTree tree)
{
_timer = DisposableTimer.Start(x => LogHelper.Debug<BaseMediaTree>("Media tree loaded" + " (took " + x + "ms)"));
//_timer = DisposableTimer.Start(x => LogHelper.Debug<BaseMediaTree>("Media tree loaded" + " (took " + x + "ms)"));
var entities = Services.EntityService.GetChildren(m_id, UmbracoObjectTypes.Media).ToArray();
@@ -79,20 +79,22 @@ function openMedia(id) {
xNode.Icon = entity.ContentTypeIcon;
xNode.OpenIcon = entity.ContentTypeIcon;
xNode.Menu = this.ShowContextMenu ? new List<IAction>(new IAction[] { ActionRefresh.Instance }) : null;
if (IsDialog == false)
{
if(this.ShowContextMenu == false)
xNode.Menu = null;
xNode.Action = "javascript:openMedia(" + entity.Id + ");";
}
else
{
xNode.Menu = this.ShowContextMenu ? new List<IAction>(new IAction[] { ActionRefresh.Instance }) : null;
if (this.DialogMode == TreeDialogModes.fulllink)
{
if (string.IsNullOrEmpty(entity.UmbracoFile) == false)
string nodeLink = GetLinkValue(entity);
if (string.IsNullOrEmpty(nodeLink) == false)
{
xNode.Action = "javascript:openMedia('" + entity.UmbracoFile + "');";
xNode.Action = "javascript:openMedia('" + nodeLink + "');";
}
else
{
@@ -122,88 +124,11 @@ function openMedia(id) {
}
//stop the timer and log the output
_timer.Dispose();
//_timer.Dispose();
OnAfterTreeRender(entities, args, false);
}
/*public override void Render(ref XmlTree tree)
{
//_timer = DisposableTimer.Start(x => LogHelper.Debug<BaseMediaTree>("Media tree loaded" + " (took " + x + "ms)"));
Media[] docs = new Media(m_id).Children;
var args = new TreeEventArgs(tree);
OnBeforeTreeRender(docs, args);
foreach (Media dd in docs)
{
XmlTreeNode xNode = XmlTreeNode.Create(this);
xNode.NodeID = dd.Id.ToString();
xNode.Text = dd.Text;
// Check for dialog behaviour
if (!this.IsDialog)
{
if (!this.ShowContextMenu)
xNode.Menu = null;
xNode.Action = "javascript:openMedia(" + dd.Id + ");";
}
else
{
if (this.ShowContextMenu)
xNode.Menu = new List<IAction>(new IAction[] { ActionRefresh.Instance });
else
xNode.Menu = null;
if (this.DialogMode == TreeDialogModes.fulllink)
{
string nodeLink = GetLinkValue(dd, dd.Id.ToString());
if (!String.IsNullOrEmpty(nodeLink))
{
xNode.Action = "javascript:openMedia('" + nodeLink + "');";
}
else
{
if (string.Equals(dd.ContentType.Alias, Constants.Conventions.MediaTypes.Folder, StringComparison.OrdinalIgnoreCase))
{
xNode.Action = "javascript:jQuery('.umbTree #" + dd.Id.ToString() + "').click();";
}
else
{
xNode.Action = null;
xNode.Style.DimNode();
}
}
}
else
{
xNode.Action = "javascript:openMedia('" + dd.Id.ToString() + "');";
}
}
xNode.HasChildren = dd.HasChildren;
if (this.IsDialog)
xNode.Source = GetTreeDialogUrl(dd.Id);
else
xNode.Source = GetTreeServiceUrl(dd.Id);
if (dd.ContentType != null)
{
xNode.Icon = dd.ContentType.IconUrl;
xNode.OpenIcon = dd.ContentType.IconUrl;
}
OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
if (xNode != null)
{
tree.Add(xNode);
OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
}
}
//_timer.Dispose();
OnAfterTreeRender(docs, args);
}*/
/// <summary>
/// Returns the value for a link in WYSIWYG mode, by default only media items that have a
/// DataTypeUploadField are linkable, however, a custom tree can be created which overrides
@@ -219,7 +144,7 @@ function openMedia(id) {
foreach (Property p in props)
{
Guid currId = p.PropertyType.DataTypeDefinition.DataType.Id;
if (LinkableMediaDataTypes.Contains(currId) && !String.IsNullOrEmpty(p.Value.ToString()))
if (LinkableMediaDataTypes.Contains(currId) && string.IsNullOrEmpty(p.Value.ToString()) == false)
{
return p.Value.ToString();
}
@@ -227,6 +152,26 @@ function openMedia(id) {
return "";
}
/// <summary>
/// NOTE: New implementation of the legacy GetLinkValue. This is however a bit quirky as a media item can have multiple "Linkable DataTypes".
/// Returns the value for a link in WYSIWYG mode, by default only media items that have a
/// DataTypeUploadField are linkable, however, a custom tree can be created which overrides
/// this method, or another GUID for a custom data type can be added to the LinkableMediaDataTypes
/// list on application startup.
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
internal virtual string GetLinkValue(UmbracoEntity entity)
{
foreach (var property in entity.UmbracoProperties)
{
if (LinkableMediaDataTypes.Contains(property.DataTypeControlId) &&
string.IsNullOrEmpty(property.Value) == false)
return property.Value;
}
return "";
}
/// <summary>
/// By default, any media type that is to be "linkable" in the WYSIWYG editor must contain
/// a DataTypeUploadField data type which will ouput the value for the link, however, if
@@ -1,26 +1,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Xml;
using System.Configuration;
using umbraco.BasePages;
using umbraco.BusinessLogic;
using umbraco.businesslogic;
using umbraco.cms.businesslogic;
using umbraco.cms.businesslogic.cache;
using umbraco.cms.businesslogic.contentitem;
using umbraco.cms.businesslogic.datatype;
using umbraco.cms.businesslogic.language;
using umbraco.cms.businesslogic.media;
using umbraco.cms.businesslogic.member;
using umbraco.cms.businesslogic.property;
using umbraco.cms.businesslogic.web;
using umbraco.interfaces;
using umbraco.DataLayer;
using umbraco.BusinessLogic.Actions;
using Umbraco.Core;
@@ -36,6 +19,14 @@ namespace umbraco.cms.presentation.Trees
public ContentRecycleBin(string application) : base(application) { }
protected override bool LoadMinimalDocument
{
get
{
return true;
}
}
protected override void CreateRootNodeActions(ref List<IAction> actions)
{
actions.Clear();
@@ -54,6 +54,14 @@ namespace umbraco
}
}
protected override bool LoadMinimalDocument
{
get
{
return true;
}
}
/// <summary>
/// Creates the root node context menu for the content tree.
/// Depending on the current User's permissions, this menu will change.
@@ -815,7 +815,7 @@ namespace umbraco.cms.businesslogic.packager
_license = _packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/license").FirstChild.Value;
_licenseUrl = _packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/license").Attributes.GetNamedItem("url").Value;
_reqMajor = int.Parse(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/major").FirstChild.Value);
_reqMinor = int.Parse(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/major").FirstChild.Value);
_reqMinor = int.Parse(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/minor").FirstChild.Value);
_reqPatch = int.Parse(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/patch").FirstChild.Value);
_authorName = _packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/author/name").FirstChild.Value;
_authorUrl = _packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/author/website").FirstChild.Value;
@@ -36,6 +36,14 @@ namespace umbraco.editorControls.MultiNodeTreePicker
/// </summary>
private int? m_DeterminedStartNodeId = null;
protected override bool LoadMinimalDocument
{
get
{
return false;
}
}
/// <summary>
/// Returns the Document object of the starting node for the current User. This ensures
/// that the Document object is only instantiated once.
@@ -74,15 +74,19 @@ namespace umbraco.editorControls.imagecropper
private static Image CropImage(Image img, Rectangle cropArea)
{
var bmpImage = new Bitmap(img);
if (cropArea.Right > img.Width)
cropArea.Width -= (cropArea.Right - img.Width);
if (cropArea.Bottom > img.Height)
cropArea.Height -= (cropArea.Bottom - img.Height);
var bmpCrop = bmpImage.Clone(cropArea, bmpImage.PixelFormat);
var bmpCrop = new Bitmap(cropArea.Width, cropArea.Height);
using (var graphics = Graphics.FromImage(bmpCrop))
{
graphics.DrawImage(img, new Rectangle(0, 0, bmpCrop.Width, bmpCrop.Height), cropArea, GraphicsUnit.Pixel);
}
return bmpCrop;
}