Merge branch '6.0.7' into 6.1.2
Conflicts: src/Umbraco.Web/Media/ImageUrl.cs src/Umbraco.Web/Media/ImageUrlProviders/ImageUrlProvider.cs src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/MediaExtensions.cs
This commit is contained in:
@@ -333,7 +333,7 @@ namespace Umbraco.Core.Services
|
||||
using (var repository = _repositoryFactory.CreateContentRepository(_uowProvider.GetUnitOfWork()))
|
||||
{
|
||||
var query = Query<IContent>.Builder.Where(x => x.ParentId == id);
|
||||
var contents = repository.GetByQuery(query);
|
||||
var contents = repository.GetByQuery(query).OrderBy(x => x.SortOrder);
|
||||
|
||||
return contents;
|
||||
}
|
||||
@@ -1114,7 +1114,7 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
//Look for children and copy those as well
|
||||
var children = GetChildren(content.Id).OrderBy(x => x.SortOrder);
|
||||
var children = GetChildren(content.Id);
|
||||
foreach (var child in children)
|
||||
{
|
||||
Copy(child, copy.Id, relateToOriginal, userId);
|
||||
|
||||
@@ -1035,5 +1035,34 @@ namespace Umbraco.Core
|
||||
{
|
||||
return ShortStringHelper.CleanStringForSafeFileName(text, culture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An extension method that returns a new string in which all occurrences of a
|
||||
/// specified string in the current instance are replaced with another specified string.
|
||||
/// StringComparison specifies the type of search to use for the specified string.
|
||||
/// </summary>
|
||||
/// <param name="source">Current instance of the string</param>
|
||||
/// <param name="oldString">Specified string to replace</param>
|
||||
/// <param name="newString">Specified string to inject</param>
|
||||
/// <param name="stringComparison">String Comparison object to specify search type</param>
|
||||
/// <returns>Updated string</returns>
|
||||
public static string Replace(this string source, string oldString, string newString, StringComparison stringComparison)
|
||||
{
|
||||
var index = source.IndexOf(oldString, stringComparison);
|
||||
|
||||
// Determine if we found a match
|
||||
var matchFound = index >= 0;
|
||||
|
||||
if (matchFound)
|
||||
{
|
||||
// Remove the old text
|
||||
source = source.Remove(index, oldString.Length);
|
||||
|
||||
// Add the replacemenet text
|
||||
source = source.Insert(index, newString);
|
||||
}
|
||||
|
||||
return source;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<div style="margin-right: 15px;">
|
||||
<asp:Button id="sbmt" Runat="server" style="Width: 90px; margin-right: 6px;" onclick="sbmt_Click"></asp:Button>
|
||||
<em> or </em>
|
||||
<em> <%= umbraco.ui.Text("or") %> </em>
|
||||
<a href="#" style="color: Blue; margin-left: 6px;" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("cancel")%></a>
|
||||
|
||||
<!--
|
||||
|
||||
@@ -111,16 +111,16 @@ Umbraco.Application.Actions = function () {
|
||||
this._currApp = whichApp.toLowerCase();
|
||||
|
||||
if (this._currApp != 'media' && this._currApp != 'content' && this._currApp != 'member') {
|
||||
jQuery("#buttonCreate").attr("disabled", "true");
|
||||
jQuery("#buttonCreate").attr("disabled", "true").fadeOut(400);
|
||||
jQuery("#FindDocuments .umbracoSearchHolder").fadeOut(400);
|
||||
}
|
||||
else {
|
||||
// create button should still remain disabled for the memebers section
|
||||
if (this._currApp == 'member') {
|
||||
jQuery("#buttonCreate").attr("disabled", "true");
|
||||
jQuery("#buttonCreate").attr("disabled", "true").css("display", "inline-block").css("visibility", "hidden");
|
||||
}
|
||||
else {
|
||||
jQuery("#buttonCreate").removeAttr("disabled");
|
||||
jQuery("#buttonCreate").removeAttr("disabled").fadeIn(500).css("visibility", "visible");
|
||||
}
|
||||
jQuery("#FindDocuments .umbracoSearchHolder").fadeIn(500);
|
||||
//need to set the recycle bin node id based on app
|
||||
|
||||
@@ -13,10 +13,17 @@ namespace Umbraco.Web.Media
|
||||
{
|
||||
public class ImageUrl
|
||||
{
|
||||
[Obsolete("Use TryGetImageUrl() instead")]
|
||||
public static string GetImageUrl(string specifiedSrc, string field, string provider, string parameters, int? nodeId = null)
|
||||
{
|
||||
string url;
|
||||
var found = TryGetImageUrl(specifiedSrc, field, provider, parameters, nodeId, out url);
|
||||
|
||||
return found ? url : string.Empty;
|
||||
}
|
||||
|
||||
public static bool TryGetImageUrl(string specifiedSrc, string field, string provider, string parameters, int? nodeId, out string url)
|
||||
{
|
||||
var imageUrlProvider = GetProvider(provider);
|
||||
|
||||
var parsedParameters = string.IsNullOrEmpty(parameters) ? new NameValueCollection() : HttpUtility.ParseQueryString(parameters);
|
||||
@@ -26,6 +33,7 @@ namespace Umbraco.Web.Media
|
||||
if (string.IsNullOrEmpty(field))
|
||||
{
|
||||
url = imageUrlProvider.GetImageUrlFromFileName(specifiedSrc, queryValues);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -58,13 +66,18 @@ namespace Umbraco.Web.Media
|
||||
}
|
||||
}
|
||||
|
||||
int mediaId;
|
||||
url = int.TryParse(fieldValue, out mediaId)
|
||||
? imageUrlProvider.GetImageUrlFromMedia(mediaId, queryValues)
|
||||
: imageUrlProvider.GetImageUrlFromFileName(fieldValue, queryValues);
|
||||
if (!string.IsNullOrWhiteSpace(fieldValue))
|
||||
{
|
||||
int mediaId;
|
||||
url = int.TryParse(fieldValue, out mediaId)
|
||||
? imageUrlProvider.GetImageUrlFromMedia(mediaId, queryValues)
|
||||
: imageUrlProvider.GetImageUrlFromFileName(fieldValue, queryValues);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return url;
|
||||
url = string.Empty;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static IImageUrlProvider GetProvider(string provider)
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Umbraco.Web.Media.ImageUrlProviders
|
||||
if (parameters.ContainsKey("thumb"))
|
||||
thumb = parameters["thumb"];
|
||||
|
||||
if (!string.IsNullOrEmpty(thumb))
|
||||
if (!string.IsNullOrEmpty(thumb) && filename.Contains("."))
|
||||
{
|
||||
var lastIndexOf = filename.LastIndexOf('.');
|
||||
var name = filename.Substring(0, lastIndexOf);
|
||||
@@ -59,7 +59,7 @@ namespace Umbraco.Web.Media.ImageUrlProviders
|
||||
if (parameters.ContainsKey("crop"))
|
||||
crop = parameters["crop"];
|
||||
|
||||
if (!string.IsNullOrEmpty(crop))
|
||||
if (!string.IsNullOrEmpty(crop) && filename.Contains("."))
|
||||
{
|
||||
var lastIndexOf = filename.LastIndexOf('.');
|
||||
var name = filename.Substring(0, lastIndexOf);
|
||||
|
||||
@@ -449,9 +449,16 @@ namespace Umbraco.Web
|
||||
app.PreSendRequestHeaders += (sender, args) =>
|
||||
{
|
||||
var httpContext = ((HttpApplication)sender).Context;
|
||||
httpContext.Response.Headers.Remove("Server");
|
||||
//this doesn't normally work since IIS sets it but we'll keep it here anyways.
|
||||
httpContext.Response.Headers.Remove("X-Powered-By");
|
||||
try
|
||||
{
|
||||
httpContext.Response.Headers.Remove("Server");
|
||||
//this doesn't normally work since IIS sets it but we'll keep it here anyways.
|
||||
httpContext.Response.Headers.Remove("X-Powered-By");
|
||||
}
|
||||
catch (PlatformNotSupportedException ex)
|
||||
{
|
||||
// can't remove headers this way on IIS6 or cassini.
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1607,7 +1607,6 @@ namespace umbraco
|
||||
{
|
||||
Mandate.ParameterNotNullOrEmpty(fileName, "fileName");
|
||||
Mandate.ParameterNotNull(model, "model");
|
||||
Mandate.ParameterNotNull(pageElements, "pageElements");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<div style="margin-right: 15px;">
|
||||
<asp:Button id="sbmt" Runat="server" style="Width: 90px; margin-right: 6px;" onclick="sbmt_Click"></asp:Button>
|
||||
<em> or </em>
|
||||
<em> <%= umbraco.ui.Text("or") %> </em>
|
||||
<a href="#" style="color: Blue; margin-left: 6px;" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("cancel")%></a>
|
||||
|
||||
<!--
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace umbraco.cms.presentation
|
||||
else
|
||||
{
|
||||
var children = contentService.GetChildren(parentId);
|
||||
foreach (var child in children.OrderBy(x => x.SortOrder))
|
||||
foreach (var child in children)
|
||||
_nodes.Add(CreateNode(child.Id, child.SortOrder, child.Name, child.CreateDate, icon));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,30 @@
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using Umbraco.Core.Media;
|
||||
using Umbraco.Web.Media;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using Umbraco.Core.Media;
|
||||
using Umbraco.Web.Media;
|
||||
|
||||
namespace umbraco.presentation.templateControls
|
||||
{
|
||||
public class Image : HtmlImage
|
||||
{
|
||||
public string NodeId { get; set; }
|
||||
public string Field { get; set; }
|
||||
public string Provider { get; set; }
|
||||
public string Parameters { get; set; }
|
||||
|
||||
protected override void Render(HtmlTextWriter writer)
|
||||
{
|
||||
int id;
|
||||
bool hasid = int.TryParse(NodeId, out id);
|
||||
int? nodeId = hasid ? id : (int?)null;
|
||||
|
||||
namespace umbraco.presentation.templateControls
|
||||
{
|
||||
public class Image : HtmlImage
|
||||
{
|
||||
public string NodeId { get; set; }
|
||||
public string Field { get; set; }
|
||||
public string Provider { get; set; }
|
||||
public string Parameters { get; set; }
|
||||
|
||||
protected override void Render(HtmlTextWriter writer)
|
||||
{
|
||||
int id;
|
||||
bool hasid = int.TryParse(NodeId, out id);
|
||||
int? nodeId = hasid ? id : (int?) null;
|
||||
|
||||
Src = ImageUrl.GetImageUrl(Src, Field, Provider, Parameters, nodeId);
|
||||
base.Render(writer);
|
||||
}
|
||||
}
|
||||
string url;
|
||||
bool imageFound = ImageUrl.TryGetImageUrl(Src, Field, Provider, Parameters, nodeId, out url);
|
||||
Src = url;
|
||||
if (imageFound)
|
||||
{
|
||||
base.Render(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,7 +216,7 @@ namespace umbraco
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
var extension = media.GetProperty<string>(Constants.Conventions.Media.Extension);
|
||||
return url.Replace(string.Concat(".", extension), "_thumb.jpg");
|
||||
return url.Replace(string.Concat(".", extension), "_thumb.jpg", StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -407,7 +407,7 @@ namespace umbraco.cms.businesslogic.web
|
||||
[Obsolete("Obsolete, Use Umbraco.Core.Services.ContentService.GetChildren()", false)]
|
||||
public static Document[] GetChildrenForTree(int NodeId)
|
||||
{
|
||||
var children = ApplicationContext.Current.Services.ContentService.GetChildren(NodeId).OrderBy(c => c.SortOrder);
|
||||
var children = ApplicationContext.Current.Services.ContentService.GetChildren(NodeId);
|
||||
var list = children.Select(x => new Document(x));
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace umbraco.providers
|
||||
if (!User.validateCredentials(username, oldPassword))
|
||||
return false;
|
||||
|
||||
ValidatePasswordEventArgs args = new ValidatePasswordEventArgs(username, newPassword, true);
|
||||
ValidatePasswordEventArgs args = new ValidatePasswordEventArgs(username, newPassword, false);
|
||||
OnValidatingPassword(args);
|
||||
|
||||
if (args.Cancel)
|
||||
|
||||
@@ -296,7 +296,7 @@ namespace umbraco.providers.members
|
||||
Member m = Member.GetMemberFromLoginNameAndPassword(username, oldPassword);
|
||||
if (m == null) return false;
|
||||
|
||||
ValidatePasswordEventArgs args = new ValidatePasswordEventArgs(username, newPassword, true);
|
||||
ValidatePasswordEventArgs args = new ValidatePasswordEventArgs(username, newPassword, false);
|
||||
OnValidatingPassword(args);
|
||||
|
||||
if (args.Cancel)
|
||||
|
||||
Reference in New Issue
Block a user