Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b4d88b0361 | |||
| b41cf37dd5 | |||
| 7ecbc3b391 | |||
| 13a86624ff | |||
| f36ab37f6a | |||
| aeff33d0a6 | |||
| d3ed90c23e | |||
| db4b93dbc3 | |||
| 562851b93e | |||
| f5bf05a6f5 | |||
| e50569597b | |||
| 071f3dcc01 | |||
| 834d04f8ed | |||
| 4863e657df |
+1
-1
@@ -1,5 +1,5 @@
|
||||
@ECHO OFF
|
||||
set version=4.11.8
|
||||
set version=4.11.9
|
||||
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.proj" /p:BUILD_RELEASE=%version%
|
||||
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Code\dummy.txt
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Umbraco.Core.Configuration
|
||||
#region Private static fields
|
||||
|
||||
// CURRENT UMBRACO VERSION ID
|
||||
private const string CurrentUmbracoVersion = "4.11.8";
|
||||
private const string CurrentUmbracoVersion = "4.11.9";
|
||||
|
||||
private static readonly object Locker = new object();
|
||||
//make this volatile so that we can ensure thread safety with a double check lock
|
||||
|
||||
@@ -5,12 +5,11 @@ using System.Text;
|
||||
using Umbraco.Core.CodeAnnotations;
|
||||
|
||||
namespace Umbraco.Core.IO
|
||||
{
|
||||
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
|
||||
internal class FileSystemProviderAttribute : Attribute
|
||||
public class FileSystemProviderAttribute : Attribute
|
||||
{
|
||||
public string Alias { get; set; }
|
||||
public string Alias { get; private set; }
|
||||
|
||||
public FileSystemProviderAttribute(string alias)
|
||||
{
|
||||
|
||||
+1
-2
@@ -6,8 +6,7 @@ using Umbraco.Core.CodeAnnotations;
|
||||
|
||||
namespace Umbraco.Core.IO
|
||||
{
|
||||
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
|
||||
internal class FileSystemProvider
|
||||
internal class FileSystemProviderConstants
|
||||
{
|
||||
public const string Media = "media";
|
||||
}
|
||||
@@ -9,9 +9,8 @@ using Umbraco.Core.CodeAnnotations;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Core.IO
|
||||
{
|
||||
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
|
||||
internal class FileSystemProviderManager
|
||||
{
|
||||
public class FileSystemProviderManager
|
||||
{
|
||||
private readonly FileSystemProvidersSection _config;
|
||||
|
||||
@@ -28,7 +27,7 @@ namespace Umbraco.Core.IO
|
||||
|
||||
#region Constructors
|
||||
|
||||
public FileSystemProviderManager()
|
||||
internal FileSystemProviderManager()
|
||||
{
|
||||
_config = (FileSystemProvidersSection)ConfigurationManager.GetSection("FileSystemProviders");
|
||||
}
|
||||
@@ -48,7 +47,15 @@ namespace Umbraco.Core.IO
|
||||
private readonly ConcurrentDictionary<string, ProviderConstructionInfo> _providerLookup = new ConcurrentDictionary<string, ProviderConstructionInfo>();
|
||||
private readonly ConcurrentDictionary<Type, string> _wrappedProviderLookup = new ConcurrentDictionary<Type, string>();
|
||||
|
||||
public IFileSystem GetFileSystemProvider(string alias)
|
||||
/// <summary>
|
||||
/// Returns the underlying (non-typed) file system provider for the alias specified
|
||||
/// </summary>
|
||||
/// <param name="alias"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// It is recommended to use the typed GetFileSystemProvider method instead to get a strongly typed provider instance.
|
||||
/// </remarks>
|
||||
public IFileSystem GetUnderlyingFileSystemProvider(string alias)
|
||||
{
|
||||
//either get the constructor info from cache or create it and add to cache
|
||||
var ctorInfo = _providerLookup.GetOrAdd(alias, s =>
|
||||
@@ -88,6 +95,11 @@ namespace Umbraco.Core.IO
|
||||
return fs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the strongly typed file system provider
|
||||
/// </summary>
|
||||
/// <typeparam name="TProviderTypeFilter"></typeparam>
|
||||
/// <returns></returns>
|
||||
public TProviderTypeFilter GetFileSystemProvider<TProviderTypeFilter>()
|
||||
where TProviderTypeFilter : FileSystemWrapper
|
||||
{
|
||||
@@ -111,7 +123,7 @@ namespace Umbraco.Core.IO
|
||||
return attr.Alias;
|
||||
});
|
||||
|
||||
var innerFs = GetFileSystemProvider(alias);
|
||||
var innerFs = GetUnderlyingFileSystemProvider(alias);
|
||||
var outputFs = Activator.CreateInstance(typeof (TProviderTypeFilter), innerFs);
|
||||
return (TProviderTypeFilter)outputFs;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
<Compile Include="IfExtensions.cs" />
|
||||
<Compile Include="PluginManager.cs" />
|
||||
<Compile Include="IO\FileSecurityException.cs" />
|
||||
<Compile Include="IO\FileSystemProvider.cs" />
|
||||
<Compile Include="IO\FileSystemProviderConstants.cs" />
|
||||
<Compile Include="IO\FileSystemProviderManager.cs" />
|
||||
<Compile Include="IO\IFileSystem.cs" />
|
||||
<Compile Include="IO\IOHelper.cs" />
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void Can_Get_Base_File_System()
|
||||
{
|
||||
var fs = FileSystemProviderManager.Current.GetFileSystemProvider(FileSystemProvider.Media);
|
||||
var fs = FileSystemProviderManager.Current.GetUnderlyingFileSystemProvider(FileSystemProviderConstants.Media);
|
||||
|
||||
Assert.NotNull(fs);
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace Umbraco.Tests
|
||||
public void Resolves_RestExtensions()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveRestExtensions();
|
||||
Assert.AreEqual(2, types.Count());
|
||||
Assert.AreEqual(3, types.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -34,7 +34,7 @@ UmbracoSpeechBubble.prototype.ShowMessage = function (icon, header, message, don
|
||||
if (!dontAutoHide) {
|
||||
jQuery("#" + this.id).fadeIn("slow").animate({ opacity: 1.0 }, 5000).fadeOut("fast");
|
||||
} else {
|
||||
speechBubble.jQuery(".speechClose").show();
|
||||
jQuery(".speechClose").show();
|
||||
jQuery("#" + this.id).fadeIn("slow");
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -173,7 +173,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
var self = this;
|
||||
|
||||
// Inject the upload overlay
|
||||
var instructions = 'draggable' in document.createElement('span') ? "<h1>Drag files here to upload</h1> \<p>Or, click the button below to chose the items to upload</p>" : "<h1>Click the browse button below to chose the items to upload</h1>";
|
||||
var instructions = 'draggable' in document.createElement('span') ? "<h1>Drag files here to upload</h1> \<p>Or, click the button below to choose the items to upload</p>" : "<h1>Click the browse button below to choose the items to upload</h1>";
|
||||
|
||||
var overlay = $("<div class='upload-overlay'>" +
|
||||
"<div class='upload-panel'>" +
|
||||
|
||||
@@ -7,7 +7,6 @@ var UmbracoEmbedDialog = {
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
showPreview: function () {
|
||||
|
||||
$('#insert').attr('disabled', 'disabled');
|
||||
|
||||
var url = $('#url').val();
|
||||
@@ -16,44 +15,39 @@ var UmbracoEmbedDialog = {
|
||||
|
||||
$('#preview').html('<img src="img/ajax-loader.gif" alt="loading"/>');
|
||||
$('#source').val('');
|
||||
$.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
async: true,
|
||||
url: '../../../../umbraco/webservices/api/mediaservice.asmx/Embed',
|
||||
data: '{ url: "' + url + '", width: "' + width + '", height: "' + height + '" }',
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
dataType: 'json',
|
||||
success: function (msg) {
|
||||
var resultAsJson = msg.d;
|
||||
switch (resultAsJson.Status) {
|
||||
case 0:
|
||||
//not supported
|
||||
$('#preview').html('Not Supported');
|
||||
break;
|
||||
case 1:
|
||||
//error
|
||||
$('#preview').html('Error');
|
||||
break;
|
||||
case 2:
|
||||
$('#preview').html(resultAsJson.Markup);
|
||||
$('#source').val(resultAsJson.Markup);
|
||||
if (resultAsJson.SupportsDimensions) {
|
||||
$('#dimensions').show();
|
||||
} else {
|
||||
$('#dimensions').hide();
|
||||
}
|
||||
$('#insert').removeAttr('disabled');
|
||||
break;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
async: true,
|
||||
url: '../../../../base/EmbedMediaService/Embed/',
|
||||
data: { url: url, width: width, height: height },
|
||||
dataType: 'json',
|
||||
success: function (result) {
|
||||
switch (result.Status) {
|
||||
case 0:
|
||||
//not supported
|
||||
$('#preview').html('Not Supported');
|
||||
break;
|
||||
case 1:
|
||||
//error
|
||||
$('#preview').html('Error');
|
||||
break;
|
||||
case 2:
|
||||
$('#preview').html(result.Markup);
|
||||
$('#source').val(result.Markup);
|
||||
if (result.SupportsDimensions) {
|
||||
$('#dimensions').show();
|
||||
} else {
|
||||
$('#dimensions').hide();
|
||||
}
|
||||
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
$('#preview').html("Error");
|
||||
//alert(xhr.status);
|
||||
//alert(thrownError);
|
||||
}
|
||||
});
|
||||
$('#insert').removeAttr('disabled');
|
||||
break;
|
||||
}
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
$('#preview').html("Error");
|
||||
}
|
||||
});
|
||||
},
|
||||
beforeResize: function () {
|
||||
this.width = parseInt($('#width').val(), 10);
|
||||
@@ -73,11 +67,9 @@ var UmbracoEmbedDialog = {
|
||||
$('#width').val(this.width);
|
||||
}
|
||||
}
|
||||
|
||||
if ($('#url').val() != '') {
|
||||
UmbracoEmbedDialog.showPreview();
|
||||
}
|
||||
|
||||
},
|
||||
changeSource: function (type) {
|
||||
if ($('#source').val() != '') {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
tinyMCE.addI18n('da.umbracoembed', {
|
||||
desc: 'Inds\u00E6t ekstern mediefil',
|
||||
desc: 'Inds\u00E6t ekstern mediefil'
|
||||
});
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
tinyMCE.addI18n('en.umbracoembed', {
|
||||
desc: 'Embed third party media',
|
||||
desc: 'Embed third party media'
|
||||
});
|
||||
@@ -1,3 +1,3 @@
|
||||
tinyMCE.addI18n('en_us.umbracoembed', {
|
||||
desc: 'Embed third party media',
|
||||
desc: 'Embed third party media'
|
||||
});
|
||||
@@ -114,7 +114,7 @@ namespace Umbraco.Web.Mvc
|
||||
else
|
||||
{
|
||||
//exit the loop
|
||||
currentRouteData = null;
|
||||
currentContext = null;
|
||||
}
|
||||
}
|
||||
return new Attempt<RouteDefinition>(
|
||||
|
||||
@@ -1803,6 +1803,7 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Reference.map</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WebServices\EmbedMediaService.cs" />
|
||||
<Compile Include="WebServices\FolderBrowserService.cs" />
|
||||
<Compile Include="WebServices\UmbracoAuthorizedHttpHandler.cs" />
|
||||
<Compile Include="WebServices\UmbracoAuthorizedWebService.cs">
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Media;
|
||||
using umbraco.BusinessLogic;
|
||||
using Umbraco.Web.BaseRest;
|
||||
|
||||
namespace Umbraco.Web.WebServices
|
||||
{
|
||||
[RestExtension("EmbedMediaService")]
|
||||
public class EmbedMediaService
|
||||
{
|
||||
[RestExtensionMethod(ReturnXml = false)]
|
||||
public static string Embed()
|
||||
{
|
||||
var currentUser = User.GetCurrent();
|
||||
|
||||
if (currentUser == null)
|
||||
throw new UnauthorizedAccessException("You must be logged in to use this service");
|
||||
|
||||
var url = HttpContext.Current.Request.Form["url"];
|
||||
var width = int.Parse(HttpContext.Current.Request.Form["width"]);
|
||||
var height = int.Parse(HttpContext.Current.Request.Form["height"]);
|
||||
|
||||
var result = new Result();
|
||||
|
||||
//todo cache embed doc
|
||||
var xmlConfig = new XmlDocument();
|
||||
xmlConfig.Load(GlobalSettings.FullpathToRoot + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar + "EmbeddedMedia.config");
|
||||
|
||||
foreach (XmlNode node in xmlConfig.SelectNodes("//provider"))
|
||||
{
|
||||
var regexPattern = new Regex(node.SelectSingleNode("./urlShemeRegex").InnerText, RegexOptions.IgnoreCase);
|
||||
|
||||
if (regexPattern.IsMatch(url))
|
||||
{
|
||||
var prov = (IEmbedProvider)Activator.CreateInstance(Type.GetType(node.Attributes["type"].Value));
|
||||
|
||||
if (node.Attributes["supportsDimensions"] != null)
|
||||
result.SupportsDimensions = node.Attributes["supportsDimensions"].Value == "True";
|
||||
else
|
||||
result.SupportsDimensions = prov.SupportsDimensions;
|
||||
|
||||
var settings = node.ChildNodes.Cast<XmlNode>().ToDictionary(settingNode => settingNode.Name);
|
||||
|
||||
foreach (var prop in prov.GetType().GetProperties().Where(prop => prop.IsDefined(typeof(ProviderSetting), true)))
|
||||
{
|
||||
|
||||
if (settings.Any(s => s.Key.ToLower() == prop.Name.ToLower()))
|
||||
{
|
||||
var setting = settings.FirstOrDefault(s => s.Key.ToLower() == prop.Name.ToLower()).Value;
|
||||
var settingType = typeof(Media.EmbedProviders.Settings.String);
|
||||
|
||||
if (setting.Attributes["type"] != null)
|
||||
settingType = Type.GetType(setting.Attributes["type"].Value);
|
||||
|
||||
var settingProv = (IEmbedSettingProvider)Activator.CreateInstance(settingType);
|
||||
prop.SetValue(prov, settingProv.GetSetting(settings.FirstOrDefault(s => s.Key.ToLower() == prop.Name.ToLower()).Value), null);
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
result.Markup = prov.GetMarkup(url, width, height);
|
||||
result.Status = Status.Success;
|
||||
}
|
||||
catch
|
||||
{
|
||||
result.Status = Status.Error;
|
||||
}
|
||||
|
||||
return new JavaScriptSerializer().Serialize(result);
|
||||
}
|
||||
}
|
||||
|
||||
result.Status = Status.NotSupported;
|
||||
return new JavaScriptSerializer().Serialize(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Script.Serialization;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.Media.ThumbnailProviders;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.IO;
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.cms.businesslogic.Tags;
|
||||
using umbraco.cms.businesslogic.media;
|
||||
using Umbraco.Web.BaseRest;
|
||||
|
||||
namespace Umbraco.Web.WebServices
|
||||
@@ -21,26 +16,20 @@ namespace Umbraco.Web.WebServices
|
||||
[RestExtensionMethod(ReturnXml = false)]
|
||||
public static string GetChildren(int parentId)
|
||||
{
|
||||
var currentUser = GetCurrentUser();
|
||||
|
||||
var parentMedia = new global::umbraco.cms.businesslogic.media.Media(parentId);
|
||||
var currentUser = User.GetCurrent();
|
||||
AuthorizeAccess(parentMedia, currentUser);
|
||||
|
||||
var data = new List<object>();
|
||||
|
||||
// Check user is logged in
|
||||
if (currentUser == null)
|
||||
throw new UnauthorizedAccessException("You must be logged in to use this service");
|
||||
|
||||
// Check user is allowed to access selected media item
|
||||
if(!("," + parentMedia.Path + ",").Contains("," + currentUser.StartMediaId + ","))
|
||||
throw new UnauthorizedAccessException("You do not have access to this Media node");
|
||||
|
||||
// Get children and filter
|
||||
//TODO: Only fetch files, not containers
|
||||
//TODO: Cache responses to speed up susequent searches
|
||||
foreach (var child in parentMedia.Children)
|
||||
{
|
||||
var fileProp = child.getProperty("umbracoFile") ??
|
||||
child.GenericProperties.FirstOrDefault(x =>
|
||||
x.PropertyType.DataTypeDefinition.DataType.Id == new Guid("5032a6e6-69e3-491d-bb28-cd31cd11086c"));
|
||||
child.GenericProperties.FirstOrDefault(x => x.PropertyType.DataTypeDefinition.DataType.Id == new Guid("5032a6e6-69e3-491d-bb28-cd31cd11086c"));
|
||||
|
||||
var fileUrl = fileProp != null ? fileProp.Value.ToString() : "";
|
||||
var thumbUrl = ThumbnailProvidersResolver.Current.GetThumbnailUrl(fileUrl);
|
||||
@@ -53,9 +42,9 @@ namespace Umbraco.Web.WebServices
|
||||
MediaTypeAlias = child.ContentType.Alias,
|
||||
EditUrl = string.Format("editMedia.aspx?id={0}", child.Id),
|
||||
FileUrl = fileUrl,
|
||||
ThumbnailUrl = !string.IsNullOrEmpty(thumbUrl)
|
||||
? thumbUrl
|
||||
: IOHelper.ResolveUrl(SystemDirectories.Umbraco + "/images/thumbnails/" + child.ContentType.Thumbnail)
|
||||
ThumbnailUrl = string.IsNullOrEmpty(thumbUrl)
|
||||
? IOHelper.ResolveUrl(SystemDirectories.Umbraco + "/images/thumbnails/" + child.ContentType.Thumbnail)
|
||||
: thumbUrl
|
||||
};
|
||||
|
||||
data.Add(item);
|
||||
@@ -67,15 +56,19 @@ namespace Umbraco.Web.WebServices
|
||||
[RestExtensionMethod(ReturnXml = false)]
|
||||
public static string Delete(string nodeIds)
|
||||
{
|
||||
var nodeIdParts = nodeIds.Split(',');
|
||||
var currentUser = GetCurrentUser();
|
||||
|
||||
foreach (var nodeIdPart in nodeIdParts.Where(x => !string.IsNullOrEmpty(x)))
|
||||
var nodeIdParts = nodeIds.Split(',');
|
||||
|
||||
foreach (var nodeIdPart in nodeIdParts.Where(x => string.IsNullOrEmpty(x) == false))
|
||||
{
|
||||
var nodeId = 0;
|
||||
if (!Int32.TryParse(nodeIdPart, out nodeId))
|
||||
int nodeId;
|
||||
if (Int32.TryParse(nodeIdPart, out nodeId) == false)
|
||||
continue;
|
||||
|
||||
var node = new global::umbraco.cms.businesslogic.media.Media(nodeId);
|
||||
AuthorizeAccess(node, currentUser);
|
||||
|
||||
node.delete(("," + node.Path + ",").Contains(",-21,"));
|
||||
}
|
||||
|
||||
@@ -84,5 +77,20 @@ namespace Umbraco.Web.WebServices
|
||||
success = true
|
||||
});
|
||||
}
|
||||
|
||||
private static User GetCurrentUser()
|
||||
{
|
||||
var currentUser = User.GetCurrent();
|
||||
if (currentUser == null)
|
||||
throw new UnauthorizedAccessException("You must be logged in to use this service");
|
||||
|
||||
return currentUser;
|
||||
}
|
||||
|
||||
private static void AuthorizeAccess(global::umbraco.cms.businesslogic.media.Media mediaItem, User currentUser)
|
||||
{
|
||||
if (("," + mediaItem.Path + ",").Contains("," + currentUser.StartMediaId + ",") == false)
|
||||
throw new UnauthorizedAccessException("You do not have access to this Media node");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace umbraco.cms.presentation.Trees
|
||||
|
||||
private void Init()
|
||||
{
|
||||
m_JSSerializer = new JSONSerializer();
|
||||
m_JSSerializer = new JSONSerializer { MaxJsonLength = int.MaxValue };
|
||||
|
||||
switch (m_TreeType)
|
||||
{
|
||||
|
||||
+39
-96
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using Umbraco.Web.WebServices;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.cms.businesslogic;
|
||||
@@ -25,77 +25,44 @@ namespace umbraco.presentation.umbraco.webservices
|
||||
|
||||
public override void ProcessRequest(HttpContext context)
|
||||
{
|
||||
//user must be allowed to see content or media
|
||||
if (!AuthorizeRequest(DefaultApps.content.ToString()) && !AuthorizeRequest(DefaultApps.media.ToString()))
|
||||
return;
|
||||
if (BasePage.ValidateUserContextID(BasePage.umbracoUserContextID) == false)
|
||||
throw new Exception("Client authorization failed. User is not logged in");
|
||||
|
||||
//user must be allowed to see content or media
|
||||
if (AuthorizeRequest(DefaultApps.content.ToString()) == false && AuthorizeRequest(DefaultApps.media.ToString()) == false)
|
||||
return;
|
||||
|
||||
context.Response.ContentType = "text/plain";
|
||||
|
||||
_prefix = context.Request.QueryString["q"];
|
||||
|
||||
int parentNodeId = Convert.ToInt32(context.Request.QueryString["id"]);
|
||||
bool showGrandChildren = Convert.ToBoolean(context.Request.QueryString["showchildren"]);
|
||||
var parentNodeId = Convert.ToInt32(context.Request.QueryString["id"]);
|
||||
var showGrandChildren = Convert.ToBoolean(context.Request.QueryString["showchildren"]);
|
||||
|
||||
string documentAliasFilter = context.Request.QueryString["filter"];
|
||||
string[] documentAliasFilters = documentAliasFilter.Split(",".ToCharArray());
|
||||
var documentAliasFilter = context.Request.QueryString["filter"];
|
||||
var documentAliasFilters = documentAliasFilter.Split(",".ToCharArray());
|
||||
|
||||
var parent = new CMSNode(parentNodeId);
|
||||
|
||||
CMSNode parent = new CMSNode(parentNodeId);
|
||||
if (!showGrandChildren)
|
||||
_nodeCount = 0;
|
||||
|
||||
//store children array here because iterating over an Array property object is very inneficient.
|
||||
var children = parent.Children;
|
||||
foreach (CMSNode child in children)
|
||||
{
|
||||
_nodeCount = 0;
|
||||
|
||||
//store children array here because iterating over an Array property object is very inneficient.
|
||||
var children = parent.Children;
|
||||
foreach (CMSNode child in children)
|
||||
{
|
||||
|
||||
|
||||
NodeChildrenCount(child, false, documentAliasFilters);
|
||||
|
||||
}
|
||||
|
||||
_output = new string[_nodeCount];
|
||||
|
||||
_counter = 0;
|
||||
int level = 1;
|
||||
|
||||
//why is there a 2nd iteration of the same thing here?
|
||||
foreach (CMSNode child in children)
|
||||
{
|
||||
|
||||
AddNode(child, level, showGrandChildren, documentAliasFilters);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_nodeCount = 0;
|
||||
|
||||
//store children array here because iterating over an Array property object is very inneficient.
|
||||
var children = parent.Children;
|
||||
foreach (CMSNode child in children)
|
||||
{
|
||||
NodeChildrenCount(child, true, documentAliasFilters);
|
||||
}
|
||||
|
||||
_output = new string[_nodeCount];
|
||||
_counter = 0;
|
||||
int level = 1;
|
||||
|
||||
foreach (CMSNode child in children)
|
||||
{
|
||||
AddNode(child, level, showGrandChildren, documentAliasFilters);
|
||||
}
|
||||
|
||||
|
||||
|
||||
NodeChildrenCount(child, showGrandChildren, documentAliasFilters);
|
||||
}
|
||||
|
||||
_output = new string[_nodeCount];
|
||||
_counter = 0;
|
||||
int level = 1;
|
||||
|
||||
foreach (string item in _output)
|
||||
foreach (CMSNode child in children)
|
||||
{
|
||||
AddNode(child, level, showGrandChildren, documentAliasFilters);
|
||||
}
|
||||
|
||||
foreach (var item in _output)
|
||||
{
|
||||
context.Response.Write(item + Environment.NewLine);
|
||||
}
|
||||
@@ -103,38 +70,21 @@ namespace umbraco.presentation.umbraco.webservices
|
||||
|
||||
private bool ValidNode(string nodeText)
|
||||
{
|
||||
|
||||
|
||||
if (nodeText.Length >= _prefix.Length)
|
||||
{
|
||||
|
||||
|
||||
if (nodeText.Substring(0, _prefix.Length).ToLower() == _prefix.ToLower())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return nodeText.Length >= _prefix.Length && nodeText.Substring(0, _prefix.Length).ToLower() == _prefix.ToLower();
|
||||
}
|
||||
|
||||
private void NodeChildrenCount(CMSNode node, bool countChildren, string[] documentAliasFilters)
|
||||
{
|
||||
if (documentAliasFilters.Length > 0)
|
||||
{
|
||||
|
||||
foreach (string filter in documentAliasFilters)
|
||||
foreach (var filter in documentAliasFilters)
|
||||
{
|
||||
string trimmedFilter = filter.TrimStart(" ".ToCharArray());
|
||||
var trimmedFilter = filter.TrimStart(" ".ToCharArray());
|
||||
trimmedFilter = trimmedFilter.TrimEnd(" ".ToCharArray());
|
||||
|
||||
if (new Document(node.Id).ContentType.Alias == trimmedFilter || trimmedFilter == string.Empty)
|
||||
if ((new Document(node.Id).ContentType.Alias == trimmedFilter || trimmedFilter == string.Empty) && ValidNode(node.Text))
|
||||
{
|
||||
if (ValidNode(node.Text))
|
||||
{
|
||||
_nodeCount += 1;
|
||||
}
|
||||
|
||||
_nodeCount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,28 +110,24 @@ namespace umbraco.presentation.umbraco.webservices
|
||||
|
||||
private void AddNode(CMSNode node, int level, bool showGrandChildren, string[] documentAliasFilters)
|
||||
{
|
||||
var preText = string.Empty;
|
||||
|
||||
string preText = string.Empty;
|
||||
|
||||
for (int i = 1; i < level; i++)
|
||||
for (var i = 1; i < level; i++)
|
||||
{
|
||||
preText += "- ";
|
||||
}
|
||||
|
||||
if (documentAliasFilters.Length > 0)
|
||||
{
|
||||
foreach (string filter in documentAliasFilters)
|
||||
foreach (var filter in documentAliasFilters)
|
||||
{
|
||||
string trimmedFilter = filter.TrimStart(" ".ToCharArray());
|
||||
var trimmedFilter = filter.TrimStart(" ".ToCharArray());
|
||||
trimmedFilter = trimmedFilter.TrimEnd(" ".ToCharArray());
|
||||
|
||||
if (new Document(node.Id).ContentType.Alias == trimmedFilter || trimmedFilter == string.Empty)
|
||||
if ((new Document(node.Id).ContentType.Alias == trimmedFilter || trimmedFilter == string.Empty) && ValidNode(node.Text))
|
||||
{
|
||||
if (ValidNode(node.Text))
|
||||
{
|
||||
_output[_counter] = preText + node.Text + " [" + node.Id + "]";
|
||||
_counter++;
|
||||
}
|
||||
_output[_counter] = preText + node.Text + " [" + node.Id + "]";
|
||||
_counter++;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -211,10 +157,7 @@ namespace umbraco.presentation.umbraco.webservices
|
||||
|
||||
public override bool IsReusable
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
get { return false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +163,8 @@ namespace umbraco.presentation.webservices
|
||||
[ScriptMethod]
|
||||
public string ProgressStatus(string Key)
|
||||
{
|
||||
AuthorizeRequest(true);
|
||||
|
||||
return Application[helper.Request("key")].ToString();
|
||||
}
|
||||
|
||||
|
||||
@@ -1273,7 +1273,7 @@ and node.nodeObjectType=@nodeObjectType";
|
||||
Guid newVersion = createNewVersion(versionDate);
|
||||
|
||||
SqlHelper.ExecuteNonQuery("insert into cmsDocument (nodeId, published, documentUser, versionId, updateDate, Text) "
|
||||
+ "values (" + Id + ", 0, " + u.Id + ", @versionId, @text)",
|
||||
+ "values (" + Id + ", 0, " + u.Id + ", @versionId, @updateDate, @text)",
|
||||
SqlHelper.CreateParameter("@versionId", newVersion),
|
||||
SqlHelper.CreateParameter("@updateDate", versionDate),
|
||||
SqlHelper.CreateParameter("@text", Text));
|
||||
|
||||
@@ -84,8 +84,8 @@ namespace umbraco.cms.businesslogic.workflow
|
||||
{
|
||||
// check if something was changed and display the changes otherwise display the fields
|
||||
Property oldProperty = oldDoc.getProperty(p.PropertyType.Alias);
|
||||
string oldText = oldProperty.Value.ToString();
|
||||
string newText = p.Value.ToString();
|
||||
string oldText = oldProperty.Value != null ? oldProperty.Value.ToString() : "";
|
||||
string newText = p.Value != null ? p.Value.ToString() : "";
|
||||
|
||||
// replace html with char equivalent
|
||||
ReplaceHTMLSymbols(ref oldText);
|
||||
@@ -124,7 +124,7 @@ namespace umbraco.cms.businesslogic.workflow
|
||||
summary.Append("<tr>");
|
||||
summary.Append("<th style='text-align: left; vertical-align: top; width: 25%;'>" +
|
||||
p.PropertyType.Name + "</th>");
|
||||
summary.Append("<td style='text-align: left; vertical-align: top;'>" + p.Value.ToString() + "</td>");
|
||||
summary.Append("<td style='text-align: left; vertical-align: top;'>" + newText + "</td>");
|
||||
summary.Append("</tr>");
|
||||
}
|
||||
summary.Append(
|
||||
|
||||
Reference in New Issue
Block a user