Merge with 6.1.2

This commit is contained in:
Shannon Deminick
2013-06-03 13:36:40 -10:00
31 changed files with 260 additions and 120 deletions
+2 -1
View File
@@ -34,4 +34,5 @@ aed55cba29009ad3db48880a7cfb66407ce9805f release-6.0.3
0dee9964687ea51ea797984cf7cce3655d6a6558 release-6.0.4
7670bb47a671a9ecc15118589d8048907ea76241 release-6.1.0-beta2
953c466faf8fcfd6e85e06ccd04c2346bbdb88a8 release-6.0.6
8309c3bd6db5885c9ef37e71db0672b8947fcb59 release-6.1.0
8309c3bd6db5885c9ef37e71db0672b8947fcb59 release-6.1.0
7271ae03cb53f44d3fac909e6b254036f7f1ebc9 release-6.1.1
+2 -8
View File
@@ -543,10 +543,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;
}
@@ -567,10 +564,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()
+3 -2
View File
@@ -102,9 +102,9 @@
<Project>{07fbc26b-2927-4a22-8d96-d644c667fecc}</Project>
<Name>UmbracoExamine</Name>
</ProjectReference>
<Reference Include="ClientDependency.Core, Version=1.7.0.1, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="ClientDependency.Core, Version=1.7.0.2, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ClientDependency.1.7.0.1\lib\ClientDependency.Core.dll</HintPath>
<HintPath>..\packages\ClientDependency.1.7.0.2\lib\ClientDependency.Core.dll</HintPath>
</Reference>
<Reference Include="ClientDependency.Core.Mvc, Version=1.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -862,6 +862,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" />
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ClientDependency" version="1.7.0.1" targetFramework="net40" />
<package id="ClientDependency" version="1.7.0.2" targetFramework="net40" />
<package id="ClientDependency-Mvc" version="1.7.0.0" targetFramework="net40" />
<package id="Examine" version="0.1.51.2941" targetFramework="net40" />
<package id="log4net-mediumtrust" version="2.0.0" targetFramework="net40" />
@@ -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); });
+2 -2
View File
@@ -95,9 +95,9 @@
<Project>{07fbc26b-2927-4a22-8d96-d644c667fecc}</Project>
<Name>UmbracoExamine</Name>
</ProjectReference>
<Reference Include="ClientDependency.Core, Version=1.7.0.1, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="ClientDependency.Core, Version=1.7.0.2, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ClientDependency.1.7.0.1\lib\ClientDependency.Core.dll</HintPath>
<HintPath>..\packages\ClientDependency.1.7.0.2\lib\ClientDependency.Core.dll</HintPath>
</Reference>
<Reference Include="CookComputing.XmlRpcV2, Version=2.5.0.0, Culture=neutral, PublicKeyToken=a7d6e17aa302004d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -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);
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ClientDependency" version="1.7.0.1" targetFramework="net40" />
<package id="ClientDependency" version="1.7.0.2" targetFramework="net40" />
<package id="CodeSharp.Package.AspNetWebPage" version="1.0" targetFramework="net40" />
<package id="Examine" version="0.1.51.2941" targetFramework="net40" />
<package id="HtmlAgilityPack" version="1.4.5" targetFramework="net40" />
@@ -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)
@@ -91,15 +91,17 @@ function openMedia(id) {
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
{
if (string.Equals(entity.ContentTypeAlias, Constants.Conventions.MediaTypes.Folder, StringComparison.OrdinalIgnoreCase))
{
xNode.Action = "javascript:jQuery('.umbTree #" + entity.Id.ToString(CultureInfo.InvariantCulture) + "').click();";
//#U4-2254 - Inspiration to use void from here: http://stackoverflow.com/questions/4924383/jquery-object-object-error
xNode.Action = "javascript:void jQuery('.umbTree #" + entity.Id.ToString(CultureInfo.InvariantCulture) + "').click();";
}
else
{
@@ -143,7 +145,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();
}
@@ -151,6 +153,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;
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ClientDependency" version="1.7.0.1" targetFramework="net40" />
<package id="ClientDependency" version="1.7.0.2" targetFramework="net40" />
<package id="HtmlAgilityPack" version="1.4.5" targetFramework="net40" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net40" />
<package id="Tidy.Net" version="1.0.0" targetFramework="net40" />
+2 -2
View File
@@ -106,9 +106,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ClientDependency.Core, Version=1.7.0.1, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="ClientDependency.Core, Version=1.7.0.2, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ClientDependency.1.7.0.1\lib\ClientDependency.Core.dll</HintPath>
<HintPath>..\packages\ClientDependency.1.7.0.2\lib\ClientDependency.Core.dll</HintPath>
</Reference>
<Reference Include="HtmlAgilityPack, Version=1.4.5.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ClientDependency" version="1.7.0.1" targetFramework="net40" />
<package id="ClientDependency" version="1.7.0.2" targetFramework="net40" />
</packages>
+2 -2
View File
@@ -68,9 +68,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ClientDependency.Core, Version=1.7.0.1, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="ClientDependency.Core, Version=1.7.0.2, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ClientDependency.1.7.0.1\lib\ClientDependency.Core.dll</HintPath>
<HintPath>..\packages\ClientDependency.1.7.0.2\lib\ClientDependency.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
@@ -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;
}
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ClientDependency" version="1.7.0.1" targetFramework="net40" />
<package id="ClientDependency" version="1.7.0.2" targetFramework="net40" />
</packages>
@@ -114,9 +114,9 @@
<Project>{651E1350-91B6-44B7-BD60-7207006D7003}</Project>
<Name>Umbraco.Web</Name>
</ProjectReference>
<Reference Include="ClientDependency.Core, Version=1.7.0.1, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="ClientDependency.Core, Version=1.7.0.2, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ClientDependency.1.7.0.1\lib\ClientDependency.Core.dll</HintPath>
<HintPath>..\packages\ClientDependency.1.7.0.2\lib\ClientDependency.Core.dll</HintPath>
</Reference>
<Reference Include="System">
<Name>System</Name>
+1 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ClientDependency" version="1.7.0.1" targetFramework="net40" />
<package id="ClientDependency" version="1.7.0.2" targetFramework="net40" />
<package id="Microsoft.ApplicationBlocks.Data" version="1.0.1559.20655" targetFramework="net40" />
</packages>
@@ -106,9 +106,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ClientDependency.Core, Version=1.7.0.1, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="ClientDependency.Core, Version=1.7.0.2, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ClientDependency.1.7.0.1\lib\ClientDependency.Core.dll</HintPath>
<HintPath>..\packages\ClientDependency.1.7.0.2\lib\ClientDependency.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.ApplicationBlocks.Data, Version=1.0.1559.20655, Culture=neutral">
<SpecificVersion>False</SpecificVersion>