Compare commits

...

115 Commits

Author SHA1 Message Date
Warren Buckley a3f6fb78f5 Bump version to alpha-73 after downgrade to .NET 4.5 2017-03-08 12:22:47 +00:00
Warren Buckley 736b3565d0 Merge pull request #1784 from umbraco/temp-deploy-257
deploy-257 Downgrade Core and Deploy to framework 4.5
2017-03-08 12:17:08 +00:00
Claus ed782998ef Merge pull request #1779 from umbraco/temp-U4-9521
U4-9521 MediaService.GetPagedChildren should only get children and not descendants
2017-03-08 13:13:23 +01:00
Claus 31d980b0c5 Merge pull request #1782 from umbraco/temp-u4-9605
U4-9605 - debug switch for uncompleted scopes
2017-03-08 13:07:03 +01:00
Claus 9f6e4d4fd5 updating nuspec. 2017-03-08 12:04:48 +01:00
Claus d90658d814 Merge pull request #1783 from umbraco/temp-u4-9588
u4-9588 - filesystems
2017-03-08 11:58:47 +01:00
Claus 7fa8f04b11 deploy-257 Downgrade Core and Deploy to framework 4.5 2017-03-08 11:20:48 +01:00
Stephan bf2232258e U4-9588 - filesystems manager tlc 2017-03-08 11:02:30 +01:00
Stephan 5bbb44479f U4-9588 - expand filesystems manager 2017-03-07 17:57:45 +01:00
Warren Buckley 5218d31f23 Bumps version to alpha-072 2017-03-07 15:43:29 +00:00
Stephan 9e55f5835c U4-9605 - debug switch for uncompleted scopes 2017-03-07 12:42:44 +01:00
Claus 1101fc199f Merge pull request #1585 from umbraco/temp-U4-9145
U4-9145 Updating TinyMCE to latest (4.4.3)
2017-03-06 12:14:18 +01:00
Emil Wangaa 6de76571d7 Adds a couple of tests for ContentService.GetPagedChildren 2017-03-03 14:56:41 +01:00
Emil Wangaa 0f535f233e ContentService.GetPagedChildren should also only get children 2017-03-03 14:15:04 +01:00
Emil Wangaa 56da13fa79 MediaService.GetPagedChildren now only gets children even if parent id is root node instead of also getting descendants 2017-03-03 13:45:21 +01:00
Mads Rasmussen 05fa58694e Merge pull request #1773 from umbraco/temp-ui-colors
fixes: U4-9583 Update UI colours and typography
2017-03-03 09:50:28 +01:00
Mads Rasmussen ecc8575454 colour tweaks 2017-03-03 09:48:50 +01:00
Mads Rasmussen df93dfe63c Merge pull request #1766 from umbraco/temp-U4-9538
U4-9538 - Add Keyboard shortcut (overview & template editor)
2017-03-02 16:12:56 +01:00
Mads Rasmussen 711981adab remove comment 2017-03-02 16:10:41 +01:00
Mads Rasmussen 199c5a9606 add keyboard shortcuts to partial view editor 2017-03-02 16:05:31 +01:00
Claus 54efe86020 fixes broken tests... 2017-03-02 16:00:11 +01:00
mikkelhm 589704437f Bump version to alpha071 2017-03-02 15:46:06 +01:00
Mads Rasmussen 9a99ad1416 combine documentation for localize component and attribute directive 2017-03-02 15:28:40 +01:00
Mikkel Holck Madsen a4077df5b7 deploy-245 - Merge pull request #1775 from umbraco/template-virtualpath-fix
Fixes VirtualPath being null on template creation
2017-03-02 15:27:59 +01:00
Mads Rasmussen 5d298e4313 make sure overlays close after shortcut overlay has been opened 2017-03-02 14:45:08 +01:00
Morten Christensen 46ef9146c4 Setting the VirtualPath should be done before we return 2017-03-02 14:40:44 +01:00
Stephan 3c75693e20 Add a few (ignored) tests used for debugging 2017-03-02 14:01:58 +01:00
Mads Rasmussen b67286f40d make showOverlay optional 2017-03-02 13:52:56 +01:00
mikkelhm 32ad98cde2 Bump version to alpha070 2017-03-02 13:33:12 +01:00
Mads Rasmussen dabeaa26e6 fix documentation 2017-03-02 13:14:02 +01:00
Mads Rasmussen 6c3f1c0e32 add mac/win versions of keyboard shortcuts 2017-03-02 13:04:55 +01:00
Mikkel Holck Madsen f4b1df1ede U4-9575 - Merge pull request #1770 from umbraco/temp-cloud-env-title
Dev Night - Display Deploy Cloud Env in <title>
2017-03-02 12:55:08 +01:00
Mads Rasmussen 13cf9f46e7 fix ace shortcut overwrites on mac 2017-03-02 11:29:52 +01:00
Mads Rasmussen d062b51326 fix reference to notificationsService 2017-03-02 11:20:08 +01:00
Warren Buckley 2b0f2577b5 Uppercases the Section name in the page <title> & if Deploy installed grab the CurrentWorkspace from the global JS obj 2017-02-28 21:56:30 +00:00
Mads Rasmussen c2aa137293 more colour tweaking 2017-02-28 21:20:42 +01:00
Mads Rasmussen 555e0a2281 change blue button to green button 2017-02-27 21:21:38 +01:00
Mads Rasmussen 091a89b162 update colours 2017-02-27 21:21:20 +01:00
Mads Rasmussen 0eab0b606c remove border on reset password input 2017-02-27 21:20:32 +01:00
Mads Rasmussen 1fe06a0c9e update logo colour 2017-02-27 21:19:57 +01:00
Mads Rasmussen 6022c87540 clean up 2017-02-27 16:12:44 +01:00
Mads Rasmussen 06d7ae3861 update text colours / icon colours 2017-02-27 15:40:14 +01:00
Mads Rasmussen 3d4f999c07 small health check tweaks 2017-02-27 15:39:47 +01:00
Mads Rasmussen 3b7a83ab14 small colour improvements 2017-02-27 15:10:11 +01:00
Mads Rasmussen 796d665913 update grid colours 2017-02-27 15:07:19 +01:00
Mads Rasmussen 458e890c08 update health check colours 2017-02-27 15:06:52 +01:00
Mads Rasmussen e32604183c update login colours 2017-02-27 15:05:57 +01:00
Mads Rasmussen 099b05dbbc update a loooot of gray colors 2017-02-27 13:26:28 +01:00
Mads Rasmussen 4cf7ae4b4d increase base font size 2017-02-27 10:08:10 +01:00
Mads Rasmussen 757b720a68 increase all small font sizes 2017-02-24 13:55:41 +01:00
Mads Rasmussen c8968edd65 add margin bottom to item picker search field 2017-02-24 12:49:38 +01:00
Mads Rasmussen 58b4201eeb update query builder + insert code dialog 2017-02-24 12:45:34 +01:00
mikkelhm a39557a3a7 Bump version to alpha068 2017-02-24 12:31:59 +01:00
Mads Rasmussen 46eda4a3c3 update document type editor colours 2017-02-24 12:01:28 +01:00
Mads Rasmussen 89ebad2fbc fix colours + increase font-size in breadcrumb 2017-02-24 11:38:18 +01:00
Mads Rasmussen 815a288bcb update tree + sections 2017-02-24 11:37:40 +01:00
Mads Rasmussen 67bcd517bf test warmer version of turquoise 2017-02-24 11:36:07 +01:00
Mads Rasmussen 915503fb51 update content grid colours 2017-02-24 11:35:36 +01:00
Mads Rasmussen ddefdf2627 increase font size in notifications 2017-02-24 09:12:06 +01:00
Stephan 2239316889 Fix RelationRepository, debugging 2017-02-23 19:00:42 +01:00
Mads Rasmussen 2289938486 update button colours 2017-02-23 16:01:58 +01:00
Mads Rasmussen 2b8db9d1b5 set preview button to style "info" 2017-02-23 14:56:51 +01:00
Mads Rasmussen 14c903f6a3 set colour on editor navigation to turquoise 2017-02-23 14:56:13 +01:00
Mads Rasmussen b8a50b8da3 increase border-width on checkmark circle in media section 2017-02-23 14:54:47 +01:00
Mads Rasmussen 09300bba71 make checkmark in content picker green 2017-02-23 14:54:04 +01:00
Mads Rasmussen f716479d01 increase font size + line-height on property help text 2017-02-23 14:53:35 +01:00
Mads Rasmussen fa5044b011 make labels black 2017-02-23 14:52:53 +01:00
Mads Rasmussen 0aefbc045d add Lato as main font family 2017-02-23 14:25:33 +01:00
Mads Rasmussen 09788f1ab4 update base button colours 2017-02-23 13:34:38 +01:00
Mads Rasmussen 3a58cb35f8 update base form colours 2017-02-23 13:33:55 +01:00
Mads Rasmussen 8f47722d7d update base font colour 2017-02-23 13:32:45 +01:00
Mads Rasmussen ebed7c40ed update tree item hover colour 2017-02-23 13:32:19 +01:00
Mads Rasmussen 8c54e65861 update color on locked field component 2017-02-23 12:49:55 +01:00
Mads Rasmussen 157f9f3285 update umb-node-preview colours 2017-02-23 12:22:41 +01:00
Mads Rasmussen f2cefac866 update colours for package repo + installed packages 2017-02-23 12:14:08 +01:00
Mads Rasmussen cbcbb895ec Update header input + search input colours 2017-02-23 10:40:41 +01:00
Mads Rasmussen b98e96f758 add grayscale variables 2017-02-23 10:38:57 +01:00
Mads Rasmussen 9b033a3204 update icon picker + cards hover color 2017-02-23 10:10:34 +01:00
Mads Rasmussen 235014c8ca use new green for progress bars 2017-02-23 09:29:16 +01:00
Mads Rasmussen d04947a2d3 remove text indent on button text 2017-02-23 09:27:45 +01:00
Per Ploug d3582e2296 An ID is required on all items edited in backoffice editors
The ID is required when an item is saved, as the routing will
automatically redirect based on this ID - files, does not have an ID -
so the filepath is used in the same as it is used for the tree
2017-02-22 15:47:36 +00:00
Mads Rasmussen 49ff36155c update required field color 2017-02-22 13:38:04 +01:00
Mads Rasmussen 512de60693 update active tree item color 2017-02-22 13:37:28 +01:00
Mads Rasmussen a064ef4aa7 update media grid, folder grid + load indicator colours 2017-02-22 13:36:22 +01:00
Mads Rasmussen 2210bc3f79 update table colors 2017-02-22 13:35:21 +01:00
Warren Buckley b6bc83ba71 Moves the bulky JSON objects for shortcuts to show in the shortcut overviews into helper service so can be reused a bit easier 2017-02-22 11:53:36 +00:00
Warren Buckley 8f43e9450a Update JS editor to use simplier localizationMany as opposed to nested promises for sucess & error notifications 2017-02-22 11:01:05 +00:00
Warren Buckley f3242e8d6a Adds in keyboard shortcut dialog & generic keyboard shortcuts (common to all ACE editors) to the JS editor 2017-02-22 11:00:52 +00:00
Warren Buckley f9835d3ec5 Move snippets & completion out of onLoad callback out onto config object for the template editor 2017-02-22 11:00:27 +00:00
Warren Buckley 49bcf413a4 Adds the auto-complete & snippets for the JS/Scripts ACE Editor config 2017-02-22 11:00:17 +00:00
Warren Buckley bcfea6986c Updates the localizationService ugly nested promises to the new localizeMany function 2017-02-22 10:59:33 +00:00
Warren Buckley 29b297e072 Add in UI translation items 2017-02-22 10:59:12 +00:00
Warren Buckley 70accfa95a Uses new localizationService.format function for the shortcuts dialog 2017-02-22 10:58:57 +00:00
Warren Buckley b764a47e7e Adds in new format function to localizationService simialr to C# String.Format() usign %0% as tokens.
Documents the new functions added.
2017-02-22 10:58:27 +00:00
Warren Buckley fc7cba1da9 Add in localizeMany & concat to localizationService as dont like seeing nested promises in our code base to fetch two items to pass to notificationService 2017-02-22 10:58:07 +00:00
Warren Buckley 883980ab8d Update localizationService documentation about the usage of %0% tokens being replaced with passed in values 2017-02-22 10:57:52 +00:00
Warren Buckley 23abbdb288 Update Localize Directive (attribute & element) with some specifics in documentation about the format of the string for the key. Localize attribute now supports a key without having to be prefixed with @ 2017-02-22 10:57:32 +00:00
Warren Buckley 652a7a3655 Update more translation keys from Per's update to the template editor (Will need to merge in after this) 2017-02-22 10:56:46 +00:00
Warren Buckley 8f73514c1d An initial start of localising the keyboard shortcut dialog for template editor (Only adding keys into en.xml for now) 2017-02-22 10:56:18 +00:00
Warren Buckley 304b863b02 Adds in keyboard shortcuts to power the dialog/UI and adds in the custom keyboard bindings for opening our cusotm dialogs for inserting macros, partials etc 2017-02-22 10:55:59 +00:00
Warren Buckley f0bdb1a2e9 Updates ACE Editor Directive to load in the additional library that enables simple auto-complete 2017-02-22 10:55:44 +00:00
Warren Buckley 6fb3c91d3f Updates Keyboard Shorcut directive in template editor view to use the new attribute on the directive to pass in show overlay bool 2017-02-22 10:55:14 +00:00
Warren Buckley b9095629ed Update Keyboard Shortcut Directive to support a callback function being passed in & the bool thjat toggles the overlay/div from being shown 2017-02-22 10:54:54 +00:00
Mads Rasmussen f1ec692a73 update umb-overlay colours 2017-02-22 11:48:11 +01:00
Mads Rasmussen 1a2814a964 update color on navigation border + resize navigation 2017-02-22 11:01:34 +01:00
Mads Rasmussen 28d6622269 update stand alone tab border color 2017-02-22 10:55:14 +01:00
Mads Rasmussen 86971179ee update tabs border color 2017-02-22 10:52:39 +01:00
Mads Rasmussen 9c4eacf330 update main editor header and footer colors 2017-02-22 10:39:26 +01:00
Mads Rasmussen 251a67d653 update section colors 2017-02-22 10:38:34 +01:00
Mads Rasmussen abe92eabba update modals header + border colors 2017-02-22 10:20:37 +01:00
Mads Rasmussen 0e76b27a2d add new color variables 2017-02-22 10:06:22 +01:00
Stephan 1a37d88855 ShadowFS in App_Data/TEMP 2017-02-22 10:05:53 +01:00
Claus 2d5ffabe1e adding missing files from last commits. 2017-02-21 18:15:11 +01:00
Claus bbd9e4f0fd updating tinymce to 4.5.3. 2017-02-16 12:16:11 +01:00
Claus bf9a408c50 U4-9145 Updating TinyMCE to latest (4.4.3) 2017-02-16 12:13:48 +01:00
201 changed files with 2771 additions and 1489 deletions
+2 -2
View File
@@ -24,7 +24,7 @@
<dependency id="Microsoft.Owin.Security.OAuth" version="[3.0.1, 4.0.0)" />
<dependency id="Microsoft.Owin.Host.SystemWeb" version="[3.0.1, 4.0.0)" />
<dependency id="MiniProfiler" version="[2.1.0, 3.0.0)" />
<dependency id="HtmlAgilityPack" version="[1.4.9, 2.0.0)" />
<dependency id="HtmlAgilityPack" version="[1.4.9.5, 2.0.0)" />
<dependency id="Lucene.Net" version="[2.9.4.1, 3.0.0.0)" />
<dependency id="SharpZipLib" version="[0.86.0, 1.0.0)" />
<dependency id="MySql.Data" version="[6.9.8, 7.0.0)" />
@@ -36,7 +36,7 @@
<dependency id="Examine" version="[0.1.81, 1.0.0)" />
<dependency id="ImageProcessor" version="[2.5.2, 3.0.0)" />
<dependency id="ImageProcessor.Web" version="[4.8.2, 5.0.0)" />
<dependency id="semver" version="[2.0.4, 3.0.0)" />
<dependency id="semver" version="[1.1.2, 2.0.0)" />
<dependency id="UrlRewritingNet" version="[2.0.7, 3.0.0)" />
<!-- Markdown can not be updated due to: https://github.com/hey-red/markdownsharp/issues/71#issuecomment-233585487 -->
<dependency id="Markdown" version="[1.14.7, 2.0.0)" />
+1 -1
View File
@@ -1,3 +1,3 @@
# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)
7.6.0
alpha066
alpha073
+3 -1
View File
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SQLCE4Umbraco</RootNamespace>
<AssemblyName>SQLCE4Umbraco</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>
</SccProjectName>
@@ -49,9 +49,11 @@
<Reference Include="System.Core" />
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\SqlServerCE.4.0.0.1\lib\System.Data.SqlServerCe.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.SqlServerCe.Entity, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\SqlServerCE.4.0.0.1\lib\System.Data.SqlServerCe.Entity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
+1 -1
View File
@@ -32,4 +32,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup></configuration>
+1 -1
View File
@@ -12,4 +12,4 @@ using System.Resources;
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("7.6.0")]
[assembly: AssemblyInformationalVersion("7.6.0-alpha066")]
[assembly: AssemblyInformationalVersion("7.6.0-alpha073")]
@@ -0,0 +1,27 @@
using System;
namespace Umbraco.Core.Configuration
{
internal static class CoreDebugExtensions
{
private static CoreDebug _coreDebug;
public static CoreDebug CoreDebug(this UmbracoConfig config)
{
return _coreDebug ?? (_coreDebug = new CoreDebug());
}
}
internal class CoreDebug
{
public CoreDebug()
{
var appSettings = System.Configuration.ConfigurationManager.AppSettings;
LogUncompletedScopes = string.Equals("true", appSettings["Umbraco.CoreDebug.LogUncompletedScopes"], StringComparison.OrdinalIgnoreCase);
}
// when true, Scope logs the stack trace for any scope that gets disposed without being completed.
// this helps troubleshooting rogue scopes that we forget to complete
public bool LogUncompletedScopes { get; private set; }
}
}
@@ -24,7 +24,7 @@ namespace Umbraco.Core.Configuration
/// Gets the version comment (like beta or RC).
/// </summary>
/// <value>The version comment.</value>
public static string CurrentComment { get { return "alpha066"; } }
public static string CurrentComment { get { return "alpha073"; } }
// Get the version of the umbraco.dll by looking at a class in that dll
// Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx
+32
View File
@@ -0,0 +1,32 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Umbraco.Core.Deploy
{
public interface IFileType
{
Stream GetStream(StringUdi udi);
Task<Stream> GetStreamAsync(StringUdi udi, CancellationToken token);
Stream GetChecksumStream(StringUdi udi);
long GetLength(StringUdi udi);
void SetStream(StringUdi udi, Stream stream);
Task SetStreamAsync(StringUdi udi, Stream stream, CancellationToken token);
bool CanSetPhysical { get; }
void Set(StringUdi udi, string physicalPath, bool copy = false);
// this is not pretty as *everywhere* in Deploy we take care of ignoring
// the physical path and always rely on Core's virtual IFileSystem but
// Cloud wants to add some of these files to Git and needs the path...
string GetPhysicalPath(StringUdi udi);
string GetVirtualPath(StringUdi udi);
}
}
@@ -0,0 +1,9 @@
namespace Umbraco.Core.Deploy
{
public interface IFileTypeCollection
{
IFileType this[string entityType] { get; }
bool Contains(string entityType);
}
}
+168 -120
View File
@@ -12,25 +12,18 @@ namespace Umbraco.Core.IO
public class FileSystemProviderManager
{
private readonly FileSystemProvidersSection _config;
private readonly WeakSet<ShadowWrapper> _wrappers = new WeakSet<ShadowWrapper>();
private readonly ConcurrentSet<ShadowWrapper> _wrappers = new ConcurrentSet<ShadowWrapper>();
// actual well-known filesystems returned by properties
private readonly IFileSystem2 _macroPartialFileSystem;
private readonly IFileSystem2 _partialViewsFileSystem;
private readonly IFileSystem2 _stylesheetsFileSystem;
private readonly IFileSystem2 _scriptsFileSystem;
private readonly IFileSystem2 _xsltFileSystem;
private readonly IFileSystem2 _masterPagesFileSystem;
private readonly IFileSystem2 _mvcViewsFileSystem;
private readonly ConcurrentDictionary<string, ProviderConstructionInfo> _providerLookup = new ConcurrentDictionary<string, ProviderConstructionInfo>();
private readonly ConcurrentDictionary<string, IFileSystem2> _filesystems = new ConcurrentDictionary<string, IFileSystem2>();
// when shadowing is enabled, above filesystems, as wrappers
private readonly ShadowWrapper _macroPartialFileSystemWrapper;
private readonly ShadowWrapper _partialViewsFileSystemWrapper;
private readonly ShadowWrapper _stylesheetsFileSystemWrapper;
private readonly ShadowWrapper _scriptsFileSystemWrapper;
private readonly ShadowWrapper _xsltFileSystemWrapper;
private readonly ShadowWrapper _masterPagesFileSystemWrapper;
private readonly ShadowWrapper _mvcViewsFileSystemWrapper;
private ShadowWrapper _macroPartialFileSystem;
private ShadowWrapper _partialViewsFileSystem;
private ShadowWrapper _stylesheetsFileSystem;
private ShadowWrapper _scriptsFileSystem;
private ShadowWrapper _xsltFileSystem;
private ShadowWrapper _masterPagesFileSystem;
private ShadowWrapper _mvcViewsFileSystem;
#region Singleton & Constructor
@@ -41,31 +34,45 @@ namespace Umbraco.Core.IO
get { return Instance; }
}
// for tests only, totally unsafe
internal void Reset()
{
_wrappers.Clear();
_providerLookup.Clear();
_filesystems.Clear();
CreateWellKnownFileSystems();
}
private IScopeProviderInternal ScopeProvider
{
// fixme - 'course this is bad, but enough for now
// beware: means that we capture the "current" scope provider - take care in tests!
get { return ApplicationContext.Current == null ? null : ApplicationContext.Current.ScopeProvider as IScopeProviderInternal; }
}
internal FileSystemProviderManager()
{
_config = (FileSystemProvidersSection) ConfigurationManager.GetSection("umbracoConfiguration/FileSystemProviders");
CreateWellKnownFileSystems();
}
_macroPartialFileSystem = new PhysicalFileSystem(SystemDirectories.MacroPartials);
_partialViewsFileSystem = new PhysicalFileSystem(SystemDirectories.PartialViews);
_stylesheetsFileSystem = new PhysicalFileSystem(SystemDirectories.Css);
_scriptsFileSystem = new PhysicalFileSystem(SystemDirectories.Scripts);
_xsltFileSystem = new PhysicalFileSystem(SystemDirectories.Xslt);
_masterPagesFileSystem = new PhysicalFileSystem(SystemDirectories.Masterpages);
_mvcViewsFileSystem = new PhysicalFileSystem(SystemDirectories.MvcViews);
private void CreateWellKnownFileSystems()
{
var macroPartialFileSystem = new PhysicalFileSystem(SystemDirectories.MacroPartials);
var partialViewsFileSystem = new PhysicalFileSystem(SystemDirectories.PartialViews);
var stylesheetsFileSystem = new PhysicalFileSystem(SystemDirectories.Css);
var scriptsFileSystem = new PhysicalFileSystem(SystemDirectories.Scripts);
var xsltFileSystem = new PhysicalFileSystem(SystemDirectories.Xslt);
var masterPagesFileSystem = new PhysicalFileSystem(SystemDirectories.Masterpages);
var mvcViewsFileSystem = new PhysicalFileSystem(SystemDirectories.MvcViews);
_macroPartialFileSystem = _macroPartialFileSystemWrapper = new ShadowWrapper(_macroPartialFileSystem, "Views/MacroPartials", ScopeProvider);
_partialViewsFileSystem = _partialViewsFileSystemWrapper = new ShadowWrapper(_partialViewsFileSystem, "Views/Partials", ScopeProvider);
_stylesheetsFileSystem = _stylesheetsFileSystemWrapper = new ShadowWrapper(_stylesheetsFileSystem, "css", ScopeProvider);
_scriptsFileSystem = _scriptsFileSystemWrapper = new ShadowWrapper(_scriptsFileSystem, "scripts", ScopeProvider);
_xsltFileSystem = _xsltFileSystemWrapper = new ShadowWrapper(_xsltFileSystem, "xslt", ScopeProvider);
_masterPagesFileSystem = _masterPagesFileSystemWrapper = new ShadowWrapper(_masterPagesFileSystem, "masterpages", ScopeProvider);
_mvcViewsFileSystem = _mvcViewsFileSystemWrapper = new ShadowWrapper(_mvcViewsFileSystem, "Views", ScopeProvider);
_macroPartialFileSystem = new ShadowWrapper(macroPartialFileSystem, "Views/MacroPartials", ScopeProvider);
_partialViewsFileSystem = new ShadowWrapper(partialViewsFileSystem, "Views/Partials", ScopeProvider);
_stylesheetsFileSystem = new ShadowWrapper(stylesheetsFileSystem, "css", ScopeProvider);
_scriptsFileSystem = new ShadowWrapper(scriptsFileSystem, "scripts", ScopeProvider);
_xsltFileSystem = new ShadowWrapper(xsltFileSystem, "xslt", ScopeProvider);
_masterPagesFileSystem = new ShadowWrapper(masterPagesFileSystem, "masterpages", ScopeProvider);
_mvcViewsFileSystem = new ShadowWrapper(mvcViewsFileSystem, "Views", ScopeProvider);
// filesystems obtained from GetFileSystemProvider are already wrapped and do not need to be wrapped again
MediaFileSystem = GetFileSystemProvider<MediaFileSystem>();
@@ -80,7 +87,7 @@ namespace Umbraco.Core.IO
public IFileSystem2 StylesheetsFileSystem { get { return _stylesheetsFileSystem; } }
public IFileSystem2 ScriptsFileSystem { get { return _scriptsFileSystem; } }
public IFileSystem2 XsltFileSystem { get { return _xsltFileSystem; } }
public IFileSystem2 MasterPagesFileSystem { get { return _masterPagesFileSystem; } }
public IFileSystem2 MasterPagesFileSystem { get { return _mvcViewsFileSystem; } }
public IFileSystem2 MvcViewsFileSystem { get { return _mvcViewsFileSystem; } }
public MediaFileSystem MediaFileSystem { get; private set; }
@@ -98,56 +105,74 @@ namespace Umbraco.Core.IO
//public string ProviderAlias { get; set; }
}
private readonly ConcurrentDictionary<string, ProviderConstructionInfo> _providerLookup = new ConcurrentDictionary<string, ProviderConstructionInfo>();
private readonly ConcurrentDictionary<Type, string> _aliases = new ConcurrentDictionary<Type, string>();
/// <summary>
/// Gets an underlying (non-typed) filesystem supporting a strongly-typed filesystem.
/// </summary>
/// <param name="alias">The alias of the strongly-typed filesystem.</param>
/// <returns>The non-typed filesystem supporting the strongly-typed filesystem with the specified alias.</returns>
/// <remarks>This method should not be used directly, used <see cref="GetFileSystemProvider{TFileSystem}"/> instead.</remarks>
/// <remarks>This method should not be used directly, used <see cref="GetFileSystemProvider{TFileSystem}()"/> instead.</remarks>
public IFileSystem GetUnderlyingFileSystemProvider(string alias)
{
return GetUnderlyingFileSystemProvider(alias, null);
}
/// <summary>
/// Gets an underlying (non-typed) filesystem supporting a strongly-typed filesystem.
/// </summary>
/// <param name="alias">The alias of the strongly-typed filesystem.</param>
/// /// <param name="fallback">A fallback creator for the filesystem.</param>
/// <returns>The non-typed filesystem supporting the strongly-typed filesystem with the specified alias.</returns>
/// <remarks>This method should not be used directly, used <see cref="GetFileSystemProvider{TFileSystem}()"/> instead.</remarks>
private IFileSystem GetUnderlyingFileSystemProvider(string alias, Func<IFileSystem> fallback)
{
// either get the constructor info from cache or create it and add to cache
var ctorInfo = _providerLookup.GetOrAdd(alias, s =>
{
// get config
var providerConfig = _config.Providers[s];
if (providerConfig == null)
throw new ArgumentException(string.Format("No provider found with alias {0}.", s));
var ctorInfo = _providerLookup.GetOrAdd(alias, _ => GetUnderlyingFileSystemCtor(alias, fallback));
return ctorInfo == null ? fallback() : (IFileSystem) ctorInfo.Constructor.Invoke(ctorInfo.Parameters);
}
// get the filesystem type
var providerType = Type.GetType(providerConfig.Type);
if (providerType == null)
throw new InvalidOperationException(string.Format("Could not find type {0}.", providerConfig.Type));
private IFileSystem GetUnderlyingFileSystemNoCache(string alias, Func<IFileSystem> fallback)
{
var ctorInfo = GetUnderlyingFileSystemCtor(alias, fallback);
return ctorInfo == null ? fallback() : (IFileSystem) ctorInfo.Constructor.Invoke(ctorInfo.Parameters);
}
// ensure it implements IFileSystem
if (providerType.IsAssignableFrom(typeof (IFileSystem)))
throw new InvalidOperationException(string.Format("Type {0} does not implement IFileSystem.", providerType.FullName));
private ProviderConstructionInfo GetUnderlyingFileSystemCtor(string alias, Func<IFileSystem> fallback)
{
// get config
var providerConfig = _config.Providers[alias];
if (providerConfig == null)
{
if (fallback != null) return null;
throw new ArgumentException(string.Format("No provider found with alias {0}.", alias));
}
// find a ctor matching the config parameters
var paramCount = providerConfig.Parameters != null ? providerConfig.Parameters.Count : 0;
var constructor = providerType.GetConstructors().SingleOrDefault(x
=> x.GetParameters().Length == paramCount && x.GetParameters().All(y => providerConfig.Parameters.AllKeys.Contains(y.Name)));
if (constructor == null)
throw new InvalidOperationException(string.Format("Type {0} has no ctor matching the {1} configuration parameter(s).", providerType.FullName, paramCount));
// get the filesystem type
var providerType = Type.GetType(providerConfig.Type);
if (providerType == null)
throw new InvalidOperationException(string.Format("Could not find type {0}.", providerConfig.Type));
var parameters = new object[paramCount];
if (providerConfig.Parameters != null) // keeps ReSharper happy
for (var i = 0; i < paramCount; i++)
parameters[i] = providerConfig.Parameters[providerConfig.Parameters.AllKeys[i]].Value;
// ensure it implements IFileSystem
if (providerType.IsAssignableFrom(typeof(IFileSystem)))
throw new InvalidOperationException(string.Format("Type {0} does not implement IFileSystem.", providerType.FullName));
return new ProviderConstructionInfo
{
Constructor = constructor,
Parameters = parameters,
//ProviderAlias = s
};
});
// find a ctor matching the config parameters
var paramCount = providerConfig.Parameters != null ? providerConfig.Parameters.Count : 0;
var constructor = providerType.GetConstructors().SingleOrDefault(x
=> x.GetParameters().Length == paramCount && x.GetParameters().All(y => providerConfig.Parameters.AllKeys.Contains(y.Name)));
if (constructor == null)
throw new InvalidOperationException(string.Format("Type {0} has no ctor matching the {1} configuration parameter(s).", providerType.FullName, paramCount));
// create the fs and return
return (IFileSystem) ctorInfo.Constructor.Invoke(ctorInfo.Parameters);
var parameters = new object[paramCount];
if (providerConfig.Parameters != null) // keeps ReSharper happy
for (var i = 0; i < paramCount; i++)
parameters[i] = providerConfig.Parameters[providerConfig.Parameters.AllKeys[i]].Value;
return new ProviderConstructionInfo
{
Constructor = constructor,
Parameters = parameters,
//ProviderAlias = s
};
}
/// <summary>
@@ -155,38 +180,68 @@ namespace Umbraco.Core.IO
/// </summary>
/// <typeparam name="TFileSystem">The type of the filesystem.</typeparam>
/// <returns>A strongly-typed filesystem of the specified type.</returns>
/// <remarks>
/// <para>Ideally, this should cache the instances, but that would break backward compatibility, so we
/// only do it for our own MediaFileSystem - for everything else, it's the responsibility of the caller
/// to ensure that they maintain singletons. This is important for singletons, as each filesystem maintains
/// its own shadow and having multiple instances would lead to inconsistencies.</para>
/// <para>Note that any filesystem created by this method *after* shadowing begins, will *not* be
/// shadowing (and an exception will be thrown by the ShadowWrapper).</para>
/// </remarks>
public TFileSystem GetFileSystemProvider<TFileSystem>()
where TFileSystem : FileSystemWrapper
where TFileSystem : FileSystemWrapper
{
// deal with known types - avoid infinite loops!
if (typeof(TFileSystem) == typeof(MediaFileSystem) && MediaFileSystem != null)
return MediaFileSystem as TFileSystem; // else create and return
return GetFileSystemProvider<TFileSystem>(null);
}
// get/cache the alias for the filesystem type
var alias = _aliases.GetOrAdd(typeof (TFileSystem), fsType =>
{
// validate the ctor
var constructor = fsType.GetConstructors().SingleOrDefault(x
=> x.GetParameters().Length == 1 && TypeHelper.IsTypeAssignableFrom<IFileSystem>(x.GetParameters().Single().ParameterType));
if (constructor == null)
throw new InvalidOperationException("Type " + fsType.FullName + " must inherit from FileSystemWrapper and have a constructor that accepts one parameter of type " + typeof(IFileSystem).FullName + ".");
/// <summary>
/// Gets a strongly-typed filesystem.
/// </summary>
/// <typeparam name="TFileSystem">The type of the filesystem.</typeparam>
/// <param name="fallback">A fallback creator for the inner filesystem.</param>
/// <returns>A strongly-typed filesystem of the specified type.</returns>
/// <remarks>
/// <para>The fallback creator is used only if nothing is configured.</para>
/// <para>Ideally, this should cache the instances, but that would break backward compatibility, so we
/// only do it for our own MediaFileSystem - for everything else, it's the responsibility of the caller
/// to ensure that they maintain singletons. This is important for singletons, as each filesystem maintains
/// its own shadow and having multiple instances would lead to inconsistencies.</para>
/// <para>Note that any filesystem created by this method *after* shadowing begins, will *not* be
/// shadowing (and an exception will be thrown by the ShadowWrapper).</para>
/// </remarks>
public TFileSystem GetFileSystemProvider<TFileSystem>(Func<IFileSystem> fallback)
where TFileSystem : FileSystemWrapper
{
var alias = GetFileSystemAlias<TFileSystem>();
return (TFileSystem) _filesystems.GetOrAdd(alias, _ =>
{
// gets the inner fs, create the strongly-typed fs wrapping the inner fs, register & return
// so we are double-wrapping here
// could be optimized by having FileSystemWrapper inherit from ShadowWrapper, maybe
var innerFs = GetUnderlyingFileSystemNoCache(alias, fallback);
var shadowWrapper = new ShadowWrapper(innerFs, "typed/" + alias, ScopeProvider);
var fs = (IFileSystem2) Activator.CreateInstance(typeof (TFileSystem), shadowWrapper);
_wrappers.Add(shadowWrapper); // keeping a reference to the wrapper
return fs;
});
}
// find the attribute and get the alias
var attr = (FileSystemProviderAttribute) fsType.GetCustomAttributes(typeof(FileSystemProviderAttribute), false).SingleOrDefault();
if (attr == null)
throw new InvalidOperationException("Type " + fsType.FullName + "is missing the required FileSystemProviderAttribute.");
private string GetFileSystemAlias<TFileSystem>()
{
var fsType = typeof(TFileSystem);
return attr.Alias;
});
// validate the ctor
var constructor = fsType.GetConstructors().SingleOrDefault(x
=> x.GetParameters().Length == 1 && TypeHelper.IsTypeAssignableFrom<IFileSystem>(x.GetParameters().Single().ParameterType));
if (constructor == null)
throw new InvalidOperationException("Type " + fsType.FullName + " must inherit from FileSystemWrapper and have a constructor that accepts one parameter of type " + typeof(IFileSystem).FullName + ".");
// gets the inner fs, create the strongly-typed fs wrapping the inner fs, register & return
// so we are double-wrapping here
// could be optimized by having FileSystemWrapper inherit from ShadowWrapper, maybe
var innerFs = GetUnderlyingFileSystemProvider(alias);
var shadowWrapper = new ShadowWrapper(innerFs, "typed/" + alias, ScopeProvider);
var fs = (TFileSystem) Activator.CreateInstance(typeof (TFileSystem), shadowWrapper);
_wrappers.Add(shadowWrapper); // keeping a weak reference to the wrapper
return fs;
// find the attribute and get the alias
var attr = (FileSystemProviderAttribute)fsType.GetCustomAttributes(typeof(FileSystemProviderAttribute), false).SingleOrDefault();
if (attr == null)
throw new InvalidOperationException("Type " + fsType.FullName + "is missing the required FileSystemProviderAttribute.");
return attr.Alias;
}
#endregion
@@ -199,30 +254,37 @@ namespace Umbraco.Core.IO
var wrappers = new ShadowWrapper[typed.Length + 7];
var i = 0;
while (i < typed.Length) wrappers[i] = typed[i++];
wrappers[i++] = _macroPartialFileSystemWrapper;
wrappers[i++] = _partialViewsFileSystemWrapper;
wrappers[i++] = _stylesheetsFileSystemWrapper;
wrappers[i++] = _scriptsFileSystemWrapper;
wrappers[i++] = _xsltFileSystemWrapper;
wrappers[i++] = _masterPagesFileSystemWrapper;
wrappers[i] = _mvcViewsFileSystemWrapper;
wrappers[i++] = _macroPartialFileSystem;
wrappers[i++] = _partialViewsFileSystem;
wrappers[i++] = _stylesheetsFileSystem;
wrappers[i++] = _scriptsFileSystem;
wrappers[i++] = _xsltFileSystem;
wrappers[i++] = _masterPagesFileSystem;
wrappers[i] = _mvcViewsFileSystem;
return new ShadowFileSystems(id, wrappers);
}
#endregion
private class WeakSet<T>
private class ConcurrentSet<T>
where T : class
{
private readonly HashSet<WeakReference<T>> _set = new HashSet<WeakReference<T>>();
private readonly HashSet<T> _set = new HashSet<T>();
public void Add(T item)
{
lock (_set)
{
_set.Add(new WeakReference<T>(item));
CollectLocked();
_set.Add(item);
}
}
public void Clear()
{
lock (_set)
{
_set.Clear();
}
}
@@ -230,23 +292,9 @@ namespace Umbraco.Core.IO
{
lock (_set)
{
CollectLocked();
return _set.Select(x =>
{
T target;
return x.TryGetTarget(out target) ? target : null;
}).WhereNotNull().ToArray();
return _set.ToArray();
}
}
private void CollectLocked()
{
_set.RemoveWhere(x =>
{
T target;
return x.TryGetTarget(out target) == false;
});
}
}
}
}
+6 -1
View File
@@ -27,7 +27,7 @@ namespace Umbraco.Core.IO
// on ShadowFileSystemsScope.None - and if None is false then we should be running
// in a single thread anyways
var virt = "~/App_Data/Shadow/" + id + "/" + _shadowPath;
var virt = "~/App_Data/TEMP/ShadowFs/" + id + "/" + _shadowPath;
_shadowDir = IOHelper.MapPath(virt);
Directory.CreateDirectory(_shadowDir);
var tempfs = new PhysicalFileSystem(virt);
@@ -69,6 +69,11 @@ namespace Umbraco.Core.IO
{
var isScoped = _scopeProvider != null && _scopeProvider.AmbientScope != null && _scopeProvider.AmbientScope.ScopedFileSystems;
// if the filesystem is created *after* shadowing starts, it won't be shadowing
// better not ignore that situation and raised a meaningful (?) exception
if (isScoped && _shadowFileSystem == null)
throw new Exception("The filesystems are shadowing, but this filesystem is not.");
return isScoped
? _shadowFileSystem
: _innerFileSystem;
@@ -73,12 +73,16 @@ namespace Umbraco.Core.Persistence.Repositories
RelationFactory factory = null;
var relationTypeId = -1;
// the ToList() here is important because we are using _relationTypeRepository and we
// cannot wait until the result is actually enumerated to do so, because that would
// mean we kinda capture the current unit of work and reuse it after it's been disposed
return dtos.Select(x =>
{
if (relationTypeId != x.RelationType)
factory = new RelationFactory(_relationTypeRepository.Get(relationTypeId = x.RelationType));
return DtoToEntity(x, factory);
});
}).ToList();
}
private static IRelation DtoToEntity(RelationDto dto, RelationFactory factory)
@@ -270,12 +270,11 @@ namespace Umbraco.Core.Persistence.Repositories
// once content has been set, "template on disk" are not "on disk" anymore
template.Content = content;
SetVirtualPath(template);
if (dto.Design == content) return;
dto.Design = content;
Database.Update(dto); // though... we don't care about the db value really??!!
SetVirtualPath(template);
}
protected override void PersistDeletedItem(ITemplate entity)
+18 -3
View File
@@ -1,6 +1,7 @@
using System;
using System.Data;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
using Umbraco.Core.Events;
using Umbraco.Core.IO;
using Umbraco.Core.Persistence;
@@ -341,7 +342,11 @@ namespace Umbraco.Core.Scoping
{
// if child did not complete we cannot complete
if (completed.HasValue == false || completed.Value == false)
{
if (LogUncompletedScopes)
Logging.LogHelper.Debug<Scope>("Uncompleted Child Scope at\r\n" + Environment.StackTrace);
_completed = false;
}
}
private void EnsureNotDisposed()
@@ -368,13 +373,13 @@ namespace Umbraco.Core.Scoping
#endif
}
var parent = ParentScope;
_scopeProvider.AmbientScope = parent;
#if DEBUG_SCOPES
_scopeProvider.Disposed(this);
#endif
var parent = ParentScope;
_scopeProvider.AmbientScope = parent;
if (parent != null)
parent.ChildCompleted(_completed);
else
@@ -493,5 +498,15 @@ namespace Umbraco.Core.Scoping
TryFinally(index + 1, actions);
}
}
// backing field for LogUncompletedScopes
private static bool? _logUncompletedScopes;
// caching config
// true if Umbraco.CoreDebug.LogUncompletedScope appSetting is set to "true"
private static bool LogUncompletedScopes
{
get { return (_logUncompletedScopes ?? (_logUncompletedScopes = UmbracoConfig.For.CoreDebug().LogUncompletedScopes)).Value; }
}
}
}
+38 -9
View File
@@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Web;
using Umbraco.Core.Events;
using Umbraco.Core.Persistence;
@@ -99,18 +100,23 @@ namespace Umbraco.Core.Scoping
where T : class
{
var objectKey = CallContext.LogicalGetData(key).AsGuid();
if (objectKey == Guid.Empty) return null;
lock (StaticCallContextObjectsLock)
{
object callContextObject;
if (StaticCallContextObjects.TryGetValue(objectKey, out callContextObject))
{
#if DEBUG_SCOPES
//Logging.LogHelper.Debug<ScopeProvider>("GotObject " + objectKey.ToString("N").Substring(0, 8));
Logging.LogHelper.Debug<ScopeProvider>("Got " + typeof(T).Name + " Object " + objectKey.ToString("N").Substring(0, 8));
//Logging.LogHelper.Debug<ScopeProvider>("At:\r\n" + Head(Environment.StackTrace, 24));
#endif
return (T) callContextObject;
}
Logging.LogHelper.Warn<ScopeProvider>("Missed " + typeof(T).Name + " Object " + objectKey.ToString("N").Substring(0, 8));
#if DEBUG_SCOPES
//Logging.LogHelper.Debug<ScopeProvider>("MissedObject " + objectKey.ToString("N").Substring(0, 8));
//Logging.LogHelper.Debug<ScopeProvider>("At:\r\n" + Head(Environment.StackTrace, 24));
#endif
return null;
}
@@ -146,7 +152,8 @@ namespace Umbraco.Core.Scoping
lock (StaticCallContextObjectsLock)
{
#if DEBUG_SCOPES
//Logging.LogHelper.Debug<ScopeProvider>("RemoveObject " + objectKey.ToString("N").Substring(0, 8));
Logging.LogHelper.Debug<ScopeProvider>("Remove Object " + objectKey.ToString("N").Substring(0, 8));
//Logging.LogHelper.Debug<ScopeProvider>("At:\r\n" + Head(Environment.StackTrace, 24));
#endif
StaticCallContextObjects.Remove(objectKey);
}
@@ -160,7 +167,8 @@ namespace Umbraco.Core.Scoping
lock (StaticCallContextObjectsLock)
{
#if DEBUG_SCOPES
//Logging.LogHelper.Debug<ScopeProvider>("AddObject " + objectKey.ToString("N").Substring(0, 8));
Logging.LogHelper.Debug<ScopeProvider>("AddObject " + objectKey.ToString("N").Substring(0, 8));
//Logging.LogHelper.Debug<ScopeProvider>("At:\r\n" + Head(Environment.StackTrace, 24));
#endif
StaticCallContextObjects.Add(objectKey, value);
}
@@ -506,7 +514,7 @@ namespace Umbraco.Core.Scoping
lock (StaticScopeInfosLock)
{
if (StaticScopeInfos.ContainsKey(scope)) throw new Exception("oops: already registered.");
//Logging.LogHelper.Debug<ScopeProvider>("Register " + scope.InstanceId.ToString("N").Substring(0, 8));
Logging.LogHelper.Debug<ScopeProvider>("Register " + scope.InstanceId.ToString("N").Substring(0, 8));
StaticScopeInfos[scope] = new ScopeInfo(scope, Environment.StackTrace);
}
}
@@ -524,14 +532,35 @@ namespace Umbraco.Core.Scoping
if (context == null) return;
throw new Exception("oops: unregistered scope.");
}
//Logging.LogHelper.Debug<ScopeProvider>("Register context " + (context ?? "null") + " for " + scope.InstanceId.ToString("N").Substring(0, 8));
var sb = new StringBuilder();
var s = scope;
while (s != null)
{
if (sb.Length > 0) sb.Append(" < ");
sb.Append(s.InstanceId.ToString("N").Substring(0, 8));
var ss = s as IScopeInternal;
s = ss == null ? null : ss.ParentScope;
}
Logging.LogHelper.Debug<ScopeProvider>("Register " + (context ?? "null") + " context " + sb);
if (context == null) info.NullStack = Environment.StackTrace;
//if (context == null)
// Logging.LogHelper.Debug<ScopeProvider>("STACK\r\n" + info.NullStack);
//Logging.LogHelper.Debug<ScopeProvider>("At:\r\n" + Head(Environment.StackTrace, 16));
info.Context = context;
}
}
private static string Head(string s, int count)
{
var pos = 0;
var i = 0;
while (i < count && pos >= 0)
{
pos = s.IndexOf("\r\n", pos + 1, StringComparison.OrdinalIgnoreCase);
i++;
}
if (pos < 0) return s;
return s.Substring(0, pos);
}
public void Disposed(IScope scope)
{
lock (StaticScopeInfosLock)
@@ -541,7 +570,7 @@ namespace Umbraco.Core.Scoping
// enable this by default
//Console.WriteLine("unregister " + scope.InstanceId.ToString("N").Substring(0, 8));
StaticScopeInfos.Remove(scope);
//Logging.LogHelper.Debug<ScopeProvider>("Remove " + scope.InstanceId.ToString("N").Substring(0, 8));
Logging.LogHelper.Debug<ScopeProvider>("Remove " + scope.InstanceId.ToString("N").Substring(0, 8));
// instead, enable this to keep *all* scopes
// beware, there can be a lot of scopes!
+3 -5
View File
@@ -578,11 +578,9 @@ namespace Umbraco.Core.Services
var repository = RepositoryFactory.CreateContentRepository(uow);
var query = Query<IContent>.Builder;
//if the id is System Root, then just get all
if (id != Constants.System.Root)
{
query.Where(x => x.ParentId == id);
}
// always check for a parent - else it will also get decendants (and then you should use the GetPagedDescendants method)
query.Where(x => x.ParentId == id);
IQuery<IContent> filterQuery = null;
if (filter.IsNullOrWhiteSpace() == false)
{
+3 -5
View File
@@ -457,11 +457,9 @@ namespace Umbraco.Core.Services
var repository = RepositoryFactory.CreateMediaRepository(uow);
var query = Query<IMedia>.Builder;
//if the id is System Root, then just get all
if (id != Constants.System.Root)
{
query.Where(x => x.ParentId == id);
}
// always check for a parent - else it will also get decendants (and then you should use the GetPagedDescendants method)
query.Where(x => x.ParentId == id);
IQuery<IMedia> filterQuery = null;
if (filter.IsNullOrWhiteSpace() == false)
{
+25 -5
View File
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Umbraco.Core</RootNamespace>
<AssemblyName>Umbraco.Core</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
@@ -39,15 +39,19 @@
<ItemGroup>
<Reference Include="AutoMapper, Version=3.3.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="AutoMapper.Net4, Version=3.3.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.Net4.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="HtmlAgilityPack, Version=1.4.9.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlAgilityPack.1.4.9\lib\Net45\HtmlAgilityPack.dll</HintPath>
<Reference Include="HtmlAgilityPack, Version=1.4.9.5, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlAgilityPack.1.4.9.5\lib\Net45\HtmlAgilityPack.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ImageProcessor, Version=2.5.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ImageProcessor.2.5.2\lib\net45\ImageProcessor.dll</HintPath>
@@ -55,49 +59,64 @@
</Reference>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.5\lib\net45-full\log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.Owin, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Identity.Owin.2.2.1\lib\net45\Microsoft.AspNet.Identity.Owin.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Owin.Security, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Owin.Security.Cookies, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.Security.Cookies.3.0.1\lib\net45\Microsoft.Owin.Security.Cookies.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Owin.Security.OAuth, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.Security.OAuth.3.0.1\lib\net45\Microsoft.Owin.Security.OAuth.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MiniProfiler, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b44f9351044011a3, processorArchitecture=MSIL">
<HintPath>..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Semver, Version=2.0.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Semver.2.0.4\lib\net452\Semver.dll</HintPath>
<Reference Include="Semver, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\semver.1.1.2\lib\net45\Semver.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data.Entity" />
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\SqlServerCE.4.0.0.1\lib\System.Data.SqlServerCe.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.SqlServerCe.Entity, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\SqlServerCE.4.0.0.1\lib\System.Data.SqlServerCe.Entity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.DirectoryServices.AccountManagement" />
<Reference Include="System.Drawing" />
@@ -199,6 +218,7 @@
<Compile Include="Configuration\Dashboard\SectionElement.cs" />
<Compile Include="Configuration\Dashboard\TabCollection.cs" />
<Compile Include="Configuration\Dashboard\TabElement.cs" />
<Compile Include="Configuration\CoreDebug.cs" />
<Compile Include="Configuration\FileSystemProviderElement.cs" />
<Compile Include="Configuration\FileSystemProviderElementCollection.cs" />
<Compile Include="Configuration\FileSystemProvidersSection.cs" />
+6 -1
View File
@@ -32,4 +32,9 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup><system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data></configuration>
+3 -3
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="3.3.1" targetFramework="net45" />
<package id="HtmlAgilityPack" version="1.4.9" targetFramework="net45" />
<package id="HtmlAgilityPack" version="1.4.9.5" targetFramework="net45" />
<package id="ImageProcessor" version="2.5.2" targetFramework="net45" />
<package id="log4net" version="2.0.5" targetFramework="net45" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net45" />
@@ -12,9 +12,9 @@
<package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net45" />
<package id="MiniProfiler" version="2.1.0" targetFramework="net45" />
<package id="MySql.Data" version="6.9.8" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net462" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
<package id="Semver" version="2.0.4" targetFramework="net462" />
<package id="semver" version="1.1.2" targetFramework="net45" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
<package id="SqlServerCE" version="4.0.0.1" targetFramework="net45" />
</packages>
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Umbraco.Tests.Benchmarks</RootNamespace>
<AssemblyName>Umbraco.Tests.Benchmarks</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
@@ -40,101 +40,55 @@
<ItemGroup>
<Reference Include="BenchmarkDotNet, Version=0.9.9.0, Culture=neutral, PublicKeyToken=aa0ca2f9092cefc4, processorArchitecture=MSIL">
<HintPath>..\packages\BenchmarkDotNet.0.9.9\lib\net45\BenchmarkDotNet.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="BenchmarkDotNet.Core, Version=0.9.9.0, Culture=neutral, PublicKeyToken=aa0ca2f9092cefc4, processorArchitecture=MSIL">
<HintPath>..\packages\BenchmarkDotNet.Core.0.9.9\lib\net45\BenchmarkDotNet.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="BenchmarkDotNet.Diagnostics.Windows, Version=0.9.9.0, Culture=neutral, PublicKeyToken=aa0ca2f9092cefc4, processorArchitecture=MSIL">
<HintPath>..\packages\BenchmarkDotNet.Diagnostics.Windows.0.9.9\lib\net45\BenchmarkDotNet.Diagnostics.Windows.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="BenchmarkDotNet.Toolchains.Roslyn, Version=0.9.9.0, Culture=neutral, PublicKeyToken=aa0ca2f9092cefc4, processorArchitecture=MSIL">
<HintPath>..\packages\BenchmarkDotNet.Toolchains.Roslyn.0.9.9\lib\net45\BenchmarkDotNet.Toolchains.Roslyn.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.Common.1.3.2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.1.3.2\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Diagnostics.Tracing.TraceEvent, Version=1.0.41.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.41\lib\net40\Microsoft.Diagnostics.Tracing.TraceEvent.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.AppContext.4.1.0\lib\net46\System.AppContext.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.1.2.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Console, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Console.4.0.0\lib\net46\System.Console.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\SqlServerCE.4.0.0.1\lib\System.Data.SqlServerCe.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.SqlServerCe.Entity, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\SqlServerCE.4.0.0.1\lib\System.Data.SqlServerCe.Entity.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.FileVersionInfo, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.FileVersionInfo.4.0.0\lib\net46\System.Diagnostics.FileVersionInfo.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Diagnostics.StackTrace, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.StackTrace.4.0.1\lib\net46\System.Diagnostics.StackTrace.dll</HintPath>
</Reference>
<Reference Include="System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.4.0.1\lib\net46\System.IO.FileSystem.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.Primitives.4.0.1\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Numerics" />
<Reference Include="System.Reflection, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.4.1.0\lib\net462\System.Reflection.dll</HintPath>
</Reference>
<Reference Include="System.Reflection.Metadata, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.Metadata.1.3.0\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
</Reference>
<Reference Include="System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.4.1.0\lib\net462\System.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Extensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.Extensions.4.1.0\lib\net462\System.Runtime.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.4.1.0\lib\net462\System.Runtime.InteropServices.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.2.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.0.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.0.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.1.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
</Reference>
<Reference Include="System.Text.Encoding.CodePages, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encoding.CodePages.4.0.1\lib\net46\System.Text.Encoding.CodePages.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.0.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Thread, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Thread.4.0.0\lib\net46\System.Threading.Thread.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
@@ -143,18 +97,6 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.XmlDocument, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.XmlDocument.4.0.1\lib\net46\System.Xml.XmlDocument.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.XPath, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.XPath.4.0.1\lib\net46\System.Xml.XPath.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.XPath.XDocument, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.XPath.XDocument.4.0.1\lib\net46\System.Xml.XPath.XDocument.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="LinqCastBenchmarks.cs" />
@@ -168,6 +110,7 @@
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<None Include="_TraceEventProgrammersGuide.docx" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj">
@@ -187,6 +130,10 @@
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll" />
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" />
</ItemGroup>
<ItemGroup>
<Content Include="TraceEvent.ReadMe.txt" />
<Content Include="TraceEvent.ReleaseNotes.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
+24 -40
View File
@@ -10,45 +10,29 @@
<package id="Microsoft.Diagnostics.Tracing.TraceEvent" version="1.0.41" targetFramework="net45" />
<package id="Microsoft.SqlServer.Compact" version="4.0.8854.1" targetFramework="net45" />
<package id="SqlServerCE" version="4.0.0.1" targetFramework="net45" />
<package id="System.AppContext" version="4.1.0" targetFramework="net462" />
<package id="System.Collections" version="4.0.11" targetFramework="net462" />
<package id="System.Collections.Concurrent" version="4.0.12" targetFramework="net462" />
<package id="System.Collections.Immutable" version="1.2.0" targetFramework="net462" />
<package id="System.Console" version="4.0.0" targetFramework="net462" />
<package id="System.Diagnostics.Debug" version="4.0.11" targetFramework="net462" />
<package id="System.Diagnostics.FileVersionInfo" version="4.0.0" targetFramework="net462" />
<package id="System.Diagnostics.StackTrace" version="4.0.1" targetFramework="net462" />
<package id="System.Diagnostics.Tools" version="4.0.1" targetFramework="net462" />
<package id="System.Dynamic.Runtime" version="4.0.11" targetFramework="net462" />
<package id="System.Globalization" version="4.0.11" targetFramework="net462" />
<package id="System.IO.FileSystem" version="4.0.1" targetFramework="net462" />
<package id="System.IO.FileSystem.Primitives" version="4.0.1" targetFramework="net462" />
<package id="System.Linq" version="4.1.0" targetFramework="net462" />
<package id="System.Linq.Expressions" version="4.1.0" targetFramework="net462" />
<package id="System.Reflection" version="4.1.0" targetFramework="net462" />
<package id="System.Reflection.Metadata" version="1.3.0" targetFramework="net462" />
<package id="System.Reflection.Primitives" version="4.0.1" targetFramework="net462" />
<package id="System.Resources.ResourceManager" version="4.0.1" targetFramework="net462" />
<package id="System.Runtime" version="4.1.0" targetFramework="net462" />
<package id="System.Runtime.Extensions" version="4.1.0" targetFramework="net462" />
<package id="System.Runtime.Handles" version="4.0.1" targetFramework="net462" />
<package id="System.Runtime.InteropServices" version="4.1.0" targetFramework="net462" />
<package id="System.Runtime.Numerics" version="4.0.1" targetFramework="net462" />
<package id="System.Security.Cryptography.Algorithms" version="4.2.0" targetFramework="net462" />
<package id="System.Security.Cryptography.Encoding" version="4.0.0" targetFramework="net462" />
<package id="System.Security.Cryptography.Primitives" version="4.0.0" targetFramework="net462" />
<package id="System.Security.Cryptography.X509Certificates" version="4.1.0" targetFramework="net462" />
<package id="System.Text.Encoding" version="4.0.11" targetFramework="net462" />
<package id="System.Text.Encoding.CodePages" version="4.0.1" targetFramework="net462" />
<package id="System.Text.Encoding.Extensions" version="4.0.11" targetFramework="net462" />
<package id="System.Threading" version="4.0.11" targetFramework="net462" />
<package id="System.Threading.Tasks" version="4.0.11" targetFramework="net462" />
<package id="System.Collections" version="4.0.11" targetFramework="net45" />
<package id="System.Collections.Concurrent" version="4.0.12" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.2.0" targetFramework="net45" />
<package id="System.Diagnostics.Debug" version="4.0.11" targetFramework="net45" />
<package id="System.Diagnostics.Tools" version="4.0.1" targetFramework="net45" />
<package id="System.Dynamic.Runtime" version="4.0.11" targetFramework="net45" />
<package id="System.Globalization" version="4.0.11" targetFramework="net45" />
<package id="System.Linq" version="4.1.0" targetFramework="net45" />
<package id="System.Linq.Expressions" version="4.1.0" targetFramework="net45" />
<package id="System.Reflection" version="4.1.0" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.3.0" targetFramework="net45" />
<package id="System.Reflection.Primitives" version="4.0.1" targetFramework="net45" />
<package id="System.Resources.ResourceManager" version="4.0.1" targetFramework="net45" />
<package id="System.Runtime" version="4.1.0" targetFramework="net45" />
<package id="System.Runtime.Extensions" version="4.1.0" targetFramework="net45" />
<package id="System.Runtime.InteropServices" version="4.1.0" targetFramework="net45" />
<package id="System.Runtime.Numerics" version="4.0.1" targetFramework="net45" />
<package id="System.Text.Encoding" version="4.0.11" targetFramework="net45" />
<package id="System.Text.Encoding.Extensions" version="4.0.11" targetFramework="net45" />
<package id="System.Threading" version="4.0.11" targetFramework="net45" />
<package id="System.Threading.Tasks" version="4.0.11" targetFramework="net45" />
<package id="System.Threading.Tasks.Extensions" version="4.0.0" targetFramework="net45" />
<package id="System.Threading.Tasks.Parallel" version="4.0.1" targetFramework="net462" />
<package id="System.Threading.Thread" version="4.0.0" targetFramework="net462" />
<package id="System.Xml.ReaderWriter" version="4.0.11" targetFramework="net462" />
<package id="System.Xml.XDocument" version="4.0.11" targetFramework="net462" />
<package id="System.Xml.XmlDocument" version="4.0.1" targetFramework="net462" />
<package id="System.Xml.XPath" version="4.0.1" targetFramework="net462" />
<package id="System.Xml.XPath.XDocument" version="4.0.1" targetFramework="net462" />
<package id="System.Threading.Tasks.Parallel" version="4.0.1" targetFramework="net45" />
<package id="System.Xml.ReaderWriter" version="4.0.11" targetFramework="net45" />
<package id="System.Xml.XDocument" version="4.0.11" targetFramework="net45" />
</packages>
+1 -1
View File
@@ -91,7 +91,7 @@
</siteMap>
</system.web>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /></startup>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@@ -21,6 +21,17 @@ namespace Umbraco.Tests.IO
// media fs wants this
ApplicationContext.Current = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper(), new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>()));
// start clean
// because some tests will create corrupt or weird filesystems
FileSystemProviderManager.Current.Reset();
}
[TearDown]
public void TearDown()
{
// stay clean (see note in SetUp)
FileSystemProviderManager.Current.Reset();
}
[Test]
@@ -39,22 +50,53 @@ namespace Umbraco.Tests.IO
Assert.NotNull(fs);
}
[Test]
[Test]
public void Singleton_Typed_File_System()
{
var fs1 = FileSystemProviderManager.Current.GetFileSystemProvider<MediaFileSystem>();
var fs2 = FileSystemProviderManager.Current.GetFileSystemProvider<MediaFileSystem>();
Assert.AreSame(fs1, fs2);
}
[Test]
public void Exception_Thrown_On_Invalid_Typed_File_System()
{
Assert.Throws<InvalidOperationException>(() => FileSystemProviderManager.Current.GetFileSystemProvider<InvalidTypedFileSystem>());
}
/// <summary>
/// Used in unit tests, for a typed file system we need to inherit from FileSystemWrapper and they MUST have a ctor
/// that only accepts a base IFileSystem object
/// </summary>
internal class InvalidTypedFileSystem : FileSystemWrapper
[Test]
public void Exception_Thrown_On_NonConfigured_Typed_File_System()
{
// note: we need to reset the manager between tests else the Accept_Fallback test would corrupt that one
Assert.Throws<ArgumentException>(() => FileSystemProviderManager.Current.GetFileSystemProvider<NonConfiguredTypeFileSystem>());
}
[Test]
public void Accept_Fallback_On_NonConfigured_Typed_File_System()
{
var fs = FileSystemProviderManager.Current.GetFileSystemProvider<NonConfiguredTypeFileSystem>(() => new PhysicalFileSystem("~/App_Data/foo"));
Assert.NotNull(fs);
}
/// <summary>
/// Used in unit tests, for a typed file system we need to inherit from FileSystemWrapper and they MUST have a ctor
/// that only accepts a base IFileSystem object
/// </summary>
internal class InvalidTypedFileSystem : FileSystemWrapper
{
public InvalidTypedFileSystem(IFileSystem wrapped, string invalidParam) : base(wrapped)
{
}
public InvalidTypedFileSystem(IFileSystem wrapped, string invalidParam)
: base(wrapped)
{ }
}
[FileSystemProvider("noconfig")]
internal class NonConfiguredTypeFileSystem : FileSystemWrapper
{
public NonConfiguredTypeFileSystem(IFileSystem wrapped)
: base(wrapped)
{ }
}
}
}
+22 -19
View File
@@ -377,13 +377,14 @@ namespace Umbraco.Tests.IO
var path = IOHelper.MapPath("FileSysTests");
var appdata = IOHelper.MapPath("App_Data");
Directory.CreateDirectory(path);
Directory.CreateDirectory(appdata);
var scopedFileSystems = false;
var scopeProvider = MockScopeProvider(() => scopedFileSystems);
var fs = new PhysicalFileSystem(path, "ignore");
var sw = new ShadowWrapper(fs, "shadow", scopeProvider);
var swa = new[] {sw};
var swa = new[] { sw };
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
sw.AddFile("sub/f1.txt", ms);
@@ -393,47 +394,47 @@ namespace Umbraco.Tests.IO
// explicit shadow without scope does not work
sw.Shadow(id = Guid.NewGuid());
Assert.IsTrue(Directory.Exists(appdata + "/Shadow/" + id));
Assert.IsTrue(Directory.Exists(appdata + "/TEMP/ShadowFs/" + id));
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
sw.AddFile("sub/f2.txt", ms);
Assert.IsTrue(fs.FileExists("sub/f2.txt"));
sw.UnShadow(true);
Assert.IsTrue(fs.FileExists("sub/f2.txt"));
Assert.IsFalse(Directory.Exists(appdata + "/Shadow/" + id));
Assert.IsFalse(Directory.Exists(appdata + "/TEMP/ShadowFs/" + id));
// shadow with scope but no complete does not complete
scopedFileSystems = true; // pretend we have a scope
var scope = new ShadowFileSystems(id = Guid.NewGuid(), swa);
Assert.IsTrue(Directory.Exists(appdata + "/Shadow/" + id));
Assert.IsTrue(Directory.Exists(appdata + "/TEMP/ShadowFs/" + id));
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
sw.AddFile("sub/f3.txt", ms);
Assert.IsFalse(fs.FileExists("sub/f3.txt"));
Assert.AreEqual(1, Directory.GetDirectories(appdata + "/Shadow").Length);
Assert.AreEqual(1, Directory.GetDirectories(appdata + "/TEMP/ShadowFs").Length);
scope.Dispose();
scopedFileSystems = false;
Assert.IsFalse(fs.FileExists("sub/f3.txt"));
Assert.IsFalse(Directory.Exists(appdata + "/Shadow/" + id));
Assert.IsFalse(Directory.Exists(appdata + "/TEMP/ShadowFs/" + id));
// shadow with scope and complete does complete
scopedFileSystems = true; // pretend we have a scope
scope = new ShadowFileSystems(id = Guid.NewGuid(), swa);
Assert.IsTrue(Directory.Exists(appdata + "/Shadow/" + id));
Assert.IsTrue(Directory.Exists(appdata + "/TEMP/ShadowFs/" + id));
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
sw.AddFile("sub/f4.txt", ms);
Assert.IsFalse(fs.FileExists("sub/f4.txt"));
Assert.AreEqual(1, Directory.GetDirectories(appdata + "/Shadow").Length);
Assert.AreEqual(1, Directory.GetDirectories(appdata + "/TEMP/ShadowFs").Length);
scope.Complete();
scope.Dispose();
scopedFileSystems = false;
TestHelper.TryAssert(() => Assert.AreEqual(0, Directory.GetDirectories(appdata + "/Shadow").Length));
TestHelper.TryAssert(() => Assert.AreEqual(0, Directory.GetDirectories(appdata + "/TEMP/ShadowFs").Length));
Assert.IsTrue(fs.FileExists("sub/f4.txt"));
Assert.IsFalse(Directory.Exists(appdata + "/Shadow/" + id));
Assert.IsFalse(Directory.Exists(appdata + "/TEMP/ShadowFs/" + id));
// test scope for "another thread"
scopedFileSystems = true; // pretend we have a scope
scope = new ShadowFileSystems(id = Guid.NewGuid(), swa);
Assert.IsTrue(Directory.Exists(appdata + "/Shadow/" + id));
Assert.IsTrue(Directory.Exists(appdata + "/TEMP/ShadowFs/" + id));
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
sw.AddFile("sub/f5.txt", ms);
Assert.IsFalse(fs.FileExists("sub/f5.txt"));
@@ -449,7 +450,7 @@ namespace Umbraco.Tests.IO
scope.Dispose();
scopedFileSystems = false;
Assert.IsTrue(fs.FileExists("sub/f5.txt"));
Assert.IsFalse(Directory.Exists(appdata + "/Shadow/" + id));
Assert.IsFalse(Directory.Exists(appdata + "/TEMP/ShadowFs/" + id));
}
[Test]
@@ -464,7 +465,7 @@ namespace Umbraco.Tests.IO
var fs = new PhysicalFileSystem(path, "ignore");
var sw = new ShadowWrapper(fs, "shadow", scopeProvider);
var swa = new[] {sw};
var swa = new[] { sw };
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
sw.AddFile("sub/f1.txt", ms);
@@ -474,7 +475,7 @@ namespace Umbraco.Tests.IO
scopedFileSystems = true; // pretend we have a scope
var scope = new ShadowFileSystems(id = Guid.NewGuid(), swa);
Assert.IsTrue(Directory.Exists(appdata + "/Shadow/" + id));
Assert.IsTrue(Directory.Exists(appdata + "/TEMP/ShadowFs/" + id));
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
sw.AddFile("sub/f2.txt", ms);
Assert.IsFalse(fs.FileExists("sub/f2.txt"));
@@ -490,7 +491,7 @@ namespace Umbraco.Tests.IO
scope.Dispose();
scopedFileSystems = false;
Assert.IsTrue(fs.FileExists("sub/f2.txt"));
TestHelper.TryAssert(() => Assert.IsFalse(Directory.Exists(appdata + "/Shadow/" + id)));
TestHelper.TryAssert(() => Assert.IsFalse(Directory.Exists(appdata + "/TEMP/ShadowFs/" + id)));
string text;
using (var s = fs.OpenFile("sub/f2.txt"))
@@ -513,7 +514,7 @@ namespace Umbraco.Tests.IO
var fs = new PhysicalFileSystem(path, "ignore");
var sw = new ShadowWrapper(fs, "shadow", scopeProvider);
var swa = new[] {sw};
var swa = new[] { sw };
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
sw.AddFile("sub/f1.txt", ms);
@@ -523,7 +524,7 @@ namespace Umbraco.Tests.IO
scopedFileSystems = true; // pretend we have a scope
var scope = new ShadowFileSystems(id = Guid.NewGuid(), swa);
Assert.IsTrue(Directory.Exists(appdata + "/Shadow/" + id));
Assert.IsTrue(Directory.Exists(appdata + "/TEMP/ShadowFs/" + id));
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
sw.AddFile("sub/f2.txt", ms);
Assert.IsFalse(fs.FileExists("sub/f2.txt"));
@@ -555,7 +556,7 @@ namespace Umbraco.Tests.IO
var e = ae.InnerExceptions[0];
Assert.IsNotNull(e.InnerException);
Assert.IsInstanceOf<AggregateException>(e);
ae = (AggregateException) e;
ae = (AggregateException)e;
Assert.AreEqual(1, ae.InnerExceptions.Count);
e = ae.InnerExceptions[0];
@@ -651,7 +652,7 @@ namespace Umbraco.Tests.IO
// ensure we get 2 files from the shadow
var getFiles = ss.GetFiles(string.Empty);
Assert.AreEqual(2, getFiles.Count());
var fsFiles = fs.GetFiles(string.Empty).ToArray();
Assert.AreEqual(1, fsFiles.Length);
var sfsFiles = sfs.GetFiles(string.Empty).ToArray();
@@ -805,6 +806,7 @@ namespace Umbraco.Tests.IO
}
[Test]
[Ignore("Does not work on all environments, Directory.GetFiles is broken.")]
public void ShadowGetFilesUsingWildcardAndSingleCharacterFilter()
{
// Arrange
@@ -845,6 +847,7 @@ namespace Umbraco.Tests.IO
}
[Test]
[Ignore("Does not work on all environments, Directory.GetFiles is broken.")]
public void ShadowFileSystemFilterIsAsBrokenAsRealFileSystemFilter()
{
// Arrange
@@ -0,0 +1,177 @@
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
using Umbraco.Tests.Logging;
using Umbraco.Web.Scheduling;
namespace Umbraco.Tests.Scheduling
{
[TestFixture]
[Timeout(60000)]
public class BackgroundTaskRunnerTests2
{
// this tests was used to debug a background task runner issue that was unearthed by Deploy,
// where work items would never complete under certain circumstances, due to threading issues.
// (fixed now)
//
[Test]
[Timeout(4000)]
public async Task ThreadResumeIssue()
{
var logger = new ConsoleLogger();
var runner = new BackgroundTaskRunner<IBackgroundTask>(new BackgroundTaskRunnerOptions { KeepAlive = true, LongRunning = true }, logger);
var work = new ThreadResumeIssueWorkItem();
runner.Add(work);
Console.WriteLine("running");
await Task.Delay(1000); // don't complete too soon
Console.WriteLine("completing");
// this never returned, never reached "completed" because the same thread
// resumed executing the waiting on queue operation in the runner
work.Complete();
Console.WriteLine("completed");
Console.WriteLine("done");
}
public class ThreadResumeIssueWorkItem : IBackgroundTask
{
private TaskCompletionSource<int> _completionSource;
public async Task RunAsync(CancellationToken token)
{
_completionSource = new TaskCompletionSource<int>();
token.Register(() => _completionSource.TrySetCanceled()); // propagate
Console.WriteLine("item running...");
await _completionSource.Task.ConfigureAwait(false);
Console.WriteLine("item returning");
}
public bool Complete(bool success = true)
{
Console.WriteLine("item completing");
// this never returned, see test
_completionSource.SetResult(0);
Console.WriteLine("item returning from completing");
return true;
}
public void Run()
{
throw new NotImplementedException();
}
public bool IsAsync { get { return true; } }
public void Dispose()
{}
}
[Test]
[Ignore("Only runs in the debugger.")]
public async Task DebuggerInterferenceIssue()
{
var logger = new ConsoleLogger();
var runner = new BackgroundTaskRunner<IBackgroundTask>(new BackgroundTaskRunnerOptions { KeepAlive = true, LongRunning = true }, logger);
var taskCompleted = false;
runner.TaskCompleted += (sender, args) =>
{
Console.WriteLine("runner task completed");
taskCompleted = true;
};
var work = new DebuggerInterferenceIssueWorkitem();
// add the workitem to the runner and wait until it is running
runner.Add(work);
work.Running.Wait();
// then wait a little bit more to ensure that the WhenAny has been entered
await Task.Delay(500);
// then break
// when the timeout triggers, we cannot handle it
// taskCompleted value does *not* change & nothing happens
Debugger.Break();
// release after 15s
// WhenAny should return the timeout task
// and then taskCompleted should turn to true
// = debugging does not prevent task completion
Console.WriteLine("*");
Assert.IsFalse(taskCompleted);
await Task.Delay(1000);
Console.WriteLine("*");
Assert.IsTrue(taskCompleted);
}
public class DebuggerInterferenceIssueWorkitem : IBackgroundTask
{
private readonly SemaphoreSlim _timeout = new SemaphoreSlim(0, 1);
private readonly ManualResetEventSlim _running = new ManualResetEventSlim(false);
private Timer _timer;
public ManualResetEventSlim Running { get { return _running; } }
public async Task RunAsync(CancellationToken token)
{
// timeout timer
_timer = new Timer(_ => { _timeout.Release(); });
_timer.Change(1000, 0);
var timeout = _timeout.WaitAsync(token);
var source = CancellationTokenSource.CreateLinkedTokenSource(token); // cancels when token cancels
_running.Set();
var task = WorkExecuteAsync(source.Token);
Console.WriteLine("execute");
var anyTask = await Task.WhenAny(task, timeout).ConfigureAwait(false);
Console.Write("anyTask: ");
Console.WriteLine(anyTask == timeout ? "timeout" : "task");
Console.WriteLine("return");
}
private async Task WorkExecuteAsync(CancellationToken token)
{
await Task.Delay(30000);
}
public void Run()
{
throw new NotImplementedException();
}
public bool IsAsync { get { return true; } }
public void Dispose()
{ }
}
[Test]
[Ignore("Only runs in the debugger.")]
public void TimerDebuggerTest()
{
var triggered = false;
var timer = new Timer(_ => { triggered = true; });
timer.Change(1000, 0);
Debugger.Break();
// pause in debugger for 10s
// means the timer triggers while execution is suspended
// 'triggered' remains false all along
// then resume execution
// and 'triggered' becomes true, so the trigger "catches up"
// = debugging should not prevent triggered code from executing
Thread.Sleep(200);
Assert.IsTrue(triggered);
}
}
}
@@ -1,73 +0,0 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
using Umbraco.Tests.Logging;
using Umbraco.Web.Scheduling;
namespace Umbraco.Tests.Scheduling
{
// THIS REPRODUCES THE DEPLOY ISSUE IN CORE
//
// the exact same thing also reproduces in playground
// so it's not a framework version issue - but something we're doing here
[TestFixture]
[Timeout(4000)]
public class Repro
{
[Test]
public async Task ReproduceDeployIssue()
{
var logger = new ConsoleLogger();
var runner = new BackgroundTaskRunner<IBackgroundTask>(new BackgroundTaskRunnerOptions { KeepAlive = true, LongRunning = true }, logger);
var work = new SimpleWorkItem();
runner.Add(work);
Console.WriteLine("running");
await Task.Delay(1000); // don't complete too soon
Console.WriteLine("completing");
// this never returns, never reached "completed" because the same thread
// resumes executing the waiting on queue operation in the runner
work.Complete();
Console.WriteLine("completed");
Console.WriteLine("done");
}
public class SimpleWorkItem : IBackgroundTask
{
private TaskCompletionSource<int> _completionSource;
public async Task RunAsync(CancellationToken token)
{
_completionSource = new TaskCompletionSource<int>();
token.Register(() => _completionSource.TrySetCanceled()); // propagate
Console.WriteLine("item running...");
await _completionSource.Task.ConfigureAwait(false);
Console.WriteLine("item returning");
}
public bool Complete(bool success = true)
{
Console.WriteLine("item completing");
// this never returns, see test
_completionSource.SetResult(0);
Console.WriteLine("item returning from completing");
return true;
}
public void Run()
{
throw new NotImplementedException();
}
public bool IsAsync { get { return true; } }
public void Dispose()
{}
}
}
}
@@ -32,6 +32,7 @@ namespace Umbraco.Tests.Scoping
private static void ClearFiles()
{
TestHelper.DeleteDirectory(IOHelper.MapPath("media"));
TestHelper.DeleteDirectory(IOHelper.MapPath("FileSysTests"));
TestHelper.DeleteDirectory(IOHelper.MapPath("App_Data"));
}
@@ -43,6 +44,8 @@ namespace Umbraco.Tests.Scoping
var physMediaFileSystem = new PhysicalFileSystem(IOHelper.MapPath("media"), "ignore");
var mediaFileSystem = FileSystemProviderManager.Current.MediaFileSystem;
Assert.IsFalse(physMediaFileSystem.FileExists("f1.txt"));
var scopeProvider = ApplicationContext.ScopeProvider;
using (var scope = scopeProvider.CreateScope(scopeFileSystems: true))
{
@@ -1785,6 +1785,74 @@ namespace Umbraco.Tests.Services
Assert.IsTrue(content.HasPublishedVersion());
}
[Test]
public void Can_Get_Paged_Children()
{
var service = ServiceContext.ContentService;
// Start by cleaning the "db"
var umbTextPage = service.GetById(new Guid("B58B3AD4-62C2-4E27-B1BE-837BD7C533E0"));
service.Delete(umbTextPage);
var contentType = MockedContentTypes.CreateSimpleContentType();
ServiceContext.ContentTypeService.Save(contentType);
for (int i = 0; i < 10; i++)
{
var c1 = MockedContent.CreateSimpleContent(contentType);
ServiceContext.ContentService.Save(c1);
}
long total;
var entities = service.GetPagedChildren(-1, 0, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(6));
Assert.That(total, Is.EqualTo(10));
entities = service.GetPagedChildren(-1, 1, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(4));
Assert.That(total, Is.EqualTo(10));
}
[Test]
public void Can_Get_Paged_Children_Dont_Get_Descendants()
{
var service = ServiceContext.ContentService;
// Start by cleaning the "db"
var umbTextPage = service.GetById(new Guid("B58B3AD4-62C2-4E27-B1BE-837BD7C533E0"));
service.Delete(umbTextPage);
var contentType = MockedContentTypes.CreateSimpleContentType();
ServiceContext.ContentTypeService.Save(contentType);
// only add 9 as we also add a content with children
for (int i = 0; i < 9; i++)
{
var c1 = MockedContent.CreateSimpleContent(contentType);
ServiceContext.ContentService.Save(c1);
}
var willHaveChildren = MockedContent.CreateSimpleContent(contentType);
ServiceContext.ContentService.Save(willHaveChildren);
for (int i = 0; i < 10; i++)
{
var c1 = MockedContent.CreateSimpleContent(contentType, "Content" + i, willHaveChildren.Id);
ServiceContext.ContentService.Save(c1);
}
long total;
// children in root including the folder - not the descendants in the folder
var entities = service.GetPagedChildren(-1, 0, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(6));
Assert.That(total, Is.EqualTo(10));
entities = service.GetPagedChildren(-1, 1, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(4));
Assert.That(total, Is.EqualTo(10));
// children in folder
entities = service.GetPagedChildren(willHaveChildren.Id, 0, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(6));
Assert.That(total, Is.EqualTo(10));
entities = service.GetPagedChildren(willHaveChildren.Id, 1, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(4));
Assert.That(total, Is.EqualTo(10));
}
private IEnumerable<IContent> CreateContentHierarchy()
{
var contentType = ServiceContext.ContentTypeService.GetContentType("umbTextpage");
@@ -145,6 +145,70 @@ namespace Umbraco.Tests.Services
Assert.That(resolvedMedia.GetValue(Constants.Conventions.Media.File).ToString().Contains(mediaPath));
}
[Test]
public void Can_Get_Paged_Children()
{
var mediaType = MockedContentTypes.CreateImageMediaType("Image2");
ServiceContext.ContentTypeService.Save(mediaType);
for (int i = 0; i < 10; i++)
{
var c1 = MockedMedia.CreateMediaImage(mediaType, -1);
ServiceContext.MediaService.Save(c1);
}
var service = ServiceContext.MediaService;
long total;
var entities = service.GetPagedChildren(-1, 0, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(6));
Assert.That(total, Is.EqualTo(10));
entities = service.GetPagedChildren(-1, 1, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(4));
Assert.That(total, Is.EqualTo(10));
}
[Test]
public void Can_Get_Paged_Children_Dont_Get_Descendants()
{
var mediaType = MockedContentTypes.CreateImageMediaType("Image2");
ServiceContext.ContentTypeService.Save(mediaType);
// only add 9 as we also add a folder with children
for (int i = 0; i < 9; i++)
{
var m1 = MockedMedia.CreateMediaImage(mediaType, -1);
ServiceContext.MediaService.Save(m1);
}
var mediaTypeForFolder = MockedContentTypes.CreateImageMediaType("Folder2");
ServiceContext.ContentTypeService.Save(mediaTypeForFolder);
var mediaFolder = MockedMedia.CreateMediaFolder(mediaTypeForFolder, -1);
ServiceContext.MediaService.Save(mediaFolder);
for (int i = 0; i < 10; i++)
{
var m1 = MockedMedia.CreateMediaImage(mediaType, mediaFolder.Id);
ServiceContext.MediaService.Save(m1);
}
var service = ServiceContext.MediaService;
long total;
// children in root including the folder - not the descendants in the folder
var entities = service.GetPagedChildren(-1, 0, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(6));
Assert.That(total, Is.EqualTo(10));
entities = service.GetPagedChildren(-1, 1, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(4));
Assert.That(total, Is.EqualTo(10));
// children in folder
entities = service.GetPagedChildren(mediaFolder.Id, 0, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(6));
Assert.That(total, Is.EqualTo(10));
entities = service.GetPagedChildren(mediaFolder.Id, 1, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(4));
Assert.That(total, Is.EqualTo(10));
}
private Tuple<IMedia, IMedia, IMedia, IMedia, IMedia> CreateTrashedTestMedia()
{
//Create and Save folder-Media -> 1050
@@ -24,6 +24,7 @@ using Umbraco.Web.PublishedCache.XmlPublishedCache;
using Umbraco.Web.Security;
using umbraco.BusinessLogic;
using Umbraco.Core.Events;
using Umbraco.Core.IO;
using Umbraco.Core.Scoping;
namespace Umbraco.Tests.TestHelpers
@@ -110,6 +111,7 @@ namespace Umbraco.Tests.TestHelpers
{
IsReady = true
};
return _appContext;
}
@@ -18,6 +18,7 @@ using Umbraco.Web;
using Umbraco.Web.Models.Mapping;
using umbraco.BusinessLogic;
using Umbraco.Core.Events;
using Umbraco.Core.IO;
using Umbraco.Core.Scoping;
namespace Umbraco.Tests.TestHelpers
@@ -150,6 +151,11 @@ namespace Umbraco.Tests.TestHelpers
{
var applicationContext = CreateApplicationContext();
ApplicationContext.Current = applicationContext;
// FileSystemProviderManager captures the current ApplicationContext ScopeProvider
// in its current static instance (yea...) so we need to reset it here to ensure
// it is using the proper ScopeProvider
FileSystemProviderManager.Current.Reset();
}
protected virtual ApplicationContext CreateApplicationContext()
@@ -170,6 +176,7 @@ namespace Umbraco.Tests.TestHelpers
{
IsReady = true
};
return applicationContext;
}
+5 -4
View File
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Umbraco.Tests</RootNamespace>
<AssemblyName>Umbraco.Tests</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
@@ -91,8 +91,9 @@
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="Semver, Version=2.0.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Semver.2.0.4\lib\net452\Semver.dll</HintPath>
<Reference Include="Semver, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\semver.1.1.2\lib\net45\Semver.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
@@ -169,7 +170,7 @@
<Compile Include="Persistence\PetaPocoExpressionsTests.cs" />
<Compile Include="Persistence\Repositories\LockedRepositoryTests.cs" />
<Compile Include="Persistence\Repositories\RedirectUrlRepositoryTests.cs" />
<Compile Include="Scheduling\DeployTest.cs" />
<Compile Include="Scheduling\BackgroundTaskRunnerTests2.cs" />
<Compile Include="Routing\NiceUrlRoutesTests.cs" />
<Compile Include="Scoping\EventNameExtractorTests.cs" />
<Compile Include="Scoping\LeakTests.cs" />
+1 -1
View File
@@ -21,7 +21,7 @@
<package id="NUnit" version="2.6.2" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
<package id="Selenium.WebDriver" version="2.32.0" targetFramework="net45" />
<package id="Semver" version="2.0.4" targetFramework="net462" />
<package id="semver" version="1.1.2" targetFramework="net45" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
<package id="SqlServerCE" version="4.0.0.1" targetFramework="net45" />
</packages>
+1 -1
View File
@@ -25,7 +25,7 @@
"jquery-migrate": "1.4.0",
"angular-dynamic-locale": "0.1.28",
"ng-file-upload": "~7.3.8",
"tinymce": "~4.1.10",
"tinymce": "~4.5.3",
"codemirror": "~5.3.0",
"angular-local-storage": "~0.2.3",
"moment": "~2.10.3",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

@@ -20,7 +20,10 @@
<div class="fix-left-menu selected">
<div class="avatar">
<img ng-src="../assets/img/application/logo.png">
<img
ng-src="../assets/img/application/logo.png"
ng-srcset="../assets/img/application/logo@2x.png 2x,
../assets/img/application/logo@3x.png 3x" />
</div>
<ul class="sections" ng-class="{selected: showDevicesPreview}">
@@ -5,7 +5,27 @@ angular.module("umbraco.directives")
* @name umbraco.directives.directive:localize
* @restrict EA
* @function
* @description Localize directive
* @description
* <div>
* <strong>Component</strong><br />
* Localize a specific token to put into the HTML as an item
* </div>
* <div>
* <strong>Attribute</strong><br />
* Add a HTML attribute to an element containing the HTML attribute name you wish to localise
* Using the format of '@section_key' or 'section_key'
* </div>
* ##Usage
* <pre>
* <!-- Component -->
* <localize key="general_close">Close</localize>
* <localize key="section_key">Fallback value</localize>
*
* <!-- Attribute -->
* <input type="text" localize="placeholder" placeholder="@placeholders_entername" />
* <input type="text" localize="placeholder,title" title="@section_key" placeholder="@placeholders_entername" />
* <div localize="title" title="@section_key"></div>
* </pre>
**/
.directive('localize', function ($log, localizationService) {
return {
@@ -28,6 +48,7 @@ angular.module("umbraco.directives")
return {
restrict: 'A',
link: function (scope, element, attrs) {
//Support one or more attribute properties to update
var keys = attrs.localize.split(',');
angular.forEach(keys, function(value, key){
@@ -35,13 +56,15 @@ angular.module("umbraco.directives")
if(attr){
if(attr[0] === '@'){
var t = localizationService.tokenize(attr.substring(1), scope);
localizationService.localize(t.key, t.tokens).then(function(val){
element.attr(value, val);
});
//If the translation key starts with @ then remove it
attr = attr.substring(1);
}
var t = localizationService.tokenize(attr, scope);
localizationService.localize(t.key, t.tokens).then(function(val){
element.attr(value, val);
});
}
});
}
@@ -478,8 +478,10 @@ Opens an overlay to show a custom YSOD. </br>
numberOfOverlays = overlayHelper.getNumberOfOverlays();
if(numberOfOverlays === overlayNumber) {
scope.closeOverLay();
if (numberOfOverlays === overlayNumber) {
scope.$apply(function () {
scope.closeOverLay();
});
}
event.preventDefault();
@@ -125,7 +125,7 @@
function link(scope, el, attr, ngModel) {
// Load in ace library
assetsService.loadJs('lib/ace-builds/src-min-noconflict/ace.js').then(function () {
assetsService.load(['lib/ace-builds/src-min-noconflict/ace.js', 'lib/ace-builds/src-min-noconflict/ext-language_tools.js']).then(function () {
if (angular.isUndefined(window.ace)) {
throw new Error('ui-ace need ace to work... (o rly?)');
} else {
@@ -107,34 +107,76 @@ When this combination is hit an overview is opened with shortcuts based on the m
@param {object} model keyboard shortcut model. See description and example above.
**/
(function() {
'use strict';
(function () {
'use strict';
function KeyboardShortcutsOverviewDirective() {
function KeyboardShortcutsOverviewDirective(platformService) {
function link(scope, el, attr, ctrl) {
function link(scope, el, attr, ctrl) {
scope.shortcutOverlay = false;
var eventBindings = [];
var isMac = platformService.isMac();
scope.toggleShortcutsOverlay = function() {
scope.shortcutOverlay = !scope.shortcutOverlay;
};
scope.toggleShortcutsOverlay = function () {
scope.showOverlay = !scope.showOverlay;
scope.onToggle();
};
function onInit() {
angular.forEach(scope.model, function (shortcutGroup) {
angular.forEach(shortcutGroup.shortcuts, function (shortcut) {
shortcut.platformKeys = [];
// get shortcut keys for mac
if (isMac && shortcut.keys && shortcut.keys.mac) {
shortcut.platformKeys = shortcut.keys.mac;
// get shortcut keys for windows
} else if (!isMac && shortcut.keys && shortcut.keys.win) {
shortcut.platformKeys = shortcut.keys.win;
// get default shortcut keys
} else if (shortcut.keys && shortcut && shortcut.keys.length > 0) {
shortcut.platformKeys = shortcut.keys;
}
});
});
}
onInit();
eventBindings.push(scope.$watch('model', function(newValue, oldValue){
if (newValue !== oldValue) {
onInit();
}
}));
// clean up
scope.$on('$destroy', function () {
// unbind watchers
for (var e in eventBindings) {
eventBindings[e]();
}
});
}
var directive = {
restrict: 'E',
replace: true,
templateUrl: 'views/components/umb-keyboard-shortcuts-overview.html',
link: link,
scope: {
model: "=",
onToggle: "&",
showOverlay: "=?"
}
};
return directive;
}
var directive = {
restrict: 'E',
replace: true,
templateUrl: 'views/components/umb-keyboard-shortcuts-overview.html',
link: link,
scope: {
model: "="
}
};
return directive;
}
angular.module('umbraco.directives').directive('umbKeyboardShortcutsOverview', KeyboardShortcutsOverviewDirective);
angular.module('umbraco.directives').directive('umbKeyboardShortcutsOverview', KeyboardShortcutsOverviewDirective);
})();
@@ -135,8 +135,13 @@ angular.module('umbraco.services')
*
* @description
* Checks the dictionary for a localized resource string
* @param {String} value the area/key to localize
* @param {Array} tokens if specified this array will be sent as parameter values
* @param {String} value the area/key to localize in the format of 'section_key'
* alternatively if no section is set such as 'key' then we assume the key is to be looked in
* the 'general' section
*
* @param {Array} tokens if specified this array will be sent as parameter values
* This replaces %0% and %1% etc in the dictionary key value with the passed in strings
*
* @returns {String} localized resource string
*/
localize: function (value, tokens) {
@@ -146,6 +151,143 @@ angular.module('umbraco.services')
});
},
/**
* @ngdoc method
* @name umbraco.services.localizationService#localizeMany
* @methodOf umbraco.services.localizationService
*
* @description
* Checks the dictionary for multipe localized resource strings at once, preventing the need for nested promises
* with localizationService.localize
*
* ##Usage
* <pre>
* localizationService.localizeMany(["speechBubbles_templateErrorHeader", "speechBubbles_templateErrorText"]).then(function(data){
* var header = data[0];
* var message = data[1];
* notificationService.error(header, message);
* });
* </pre>
*
* @param {Array} keys is an array of strings of the area/key to localize in the format of 'section_key'
* alternatively if no section is set such as 'key' then we assume the key is to be looked in
* the 'general' section
*
* @returns {Array} An array of localized resource string in the same order
*/
localizeMany: function(keys) {
if(keys){
//The LocalizationService.localize promises we want to resolve
var promises = [];
for(var i = 0; i < keys.length; i++){
promises.push(service.localize(keys[i], undefined));
}
return $q.all(promises).then(function(localizedValues){
return localizedValues;
});
}
},
/**
* @ngdoc method
* @name umbraco.services.localizationService#concat
* @methodOf umbraco.services.localizationService
*
* @description
* Checks the dictionary for multipe localized resource strings at once & concats them to a single string
* Which was not possible with localizationSerivce.localize() due to returning a promise
*
* ##Usage
* <pre>
* localizationService.concat(["speechBubbles_templateErrorHeader", "speechBubbles_templateErrorText"]).then(function(data){
* var combinedText = data;
* });
* </pre>
*
* @param {Array} keys is an array of strings of the area/key to localize in the format of 'section_key'
* alternatively if no section is set such as 'key' then we assume the key is to be looked in
* the 'general' section
*
* @returns {String} An concatenated string of localized resource string passed into the function in the same order
*/
concat: function(keys) {
if(keys){
//The LocalizationService.localize promises we want to resolve
var promises = [];
for(var i = 0; i < keys.length; i++){
promises.push(service.localize(keys[i], undefined));
}
return $q.all(promises).then(function(localizedValues){
//Build a concat string by looping over the array of resolved promises/translations
var returnValue = "";
for(var i = 0; i < localizedValues.length; i++){
returnValue += localizedValues[i];
}
return returnValue;
});
}
},
/**
* @ngdoc method
* @name umbraco.services.localizationService#format
* @methodOf umbraco.services.localizationService
*
* @description
* Checks the dictionary for multipe localized resource strings at once & formats a tokenized message
* Which was not possible with localizationSerivce.localize() due to returning a promise
*
* ##Usage
* <pre>
* localizationService.format(["template_insert", "template_insertSections"], "%0% %1%").then(function(data){
* //Will return 'Insert Sections'
* var formattedResult = data;
* });
* </pre>
*
* @param {Array} keys is an array of strings of the area/key to localize in the format of 'section_key'
* alternatively if no section is set such as 'key' then we assume the key is to be looked in
* the 'general' section
*
* @param {String} message is the string you wish to replace containing tokens in the format of %0% and %1%
* with the localized resource strings
*
* @returns {String} An concatenated string of localized resource string passed into the function in the same order
*/
format: function(keys, message){
if(keys){
//The LocalizationService.localize promises we want to resolve
var promises = [];
for(var i = 0; i < keys.length; i++){
promises.push(service.localize(keys[i], undefined));
}
return $q.all(promises).then(function(localizedValues){
//Replace {0} and {1} etc in message with the localized values
for(var i = 0; i < localizedValues.length; i++){
var token = "%" + i + "%";
var regex = new RegExp(token, "g");
message = message.replace(regex, localizedValues[i]);
}
return message;
});
}
}
};
//This happens after login / auth and assets loading
@@ -0,0 +1,23 @@
(function() {
'use strict';
function platformService() {
function isMac() {
return navigator.platform.toUpperCase().indexOf('MAC')>=0;
}
////////////
var service = {
isMac: isMac
};
return service;
}
angular.module('umbraco.services').factory('platformService', platformService);
})();
@@ -1,7 +1,7 @@
(function() {
'use strict';
function templateHelperService() {
function templateHelperService(localizationService) {
//crappy hack due to dictionary items not in umbracoNode table
function getInsertDictionarySnippet(nodeName) {
@@ -36,6 +36,124 @@
return "@section " + sectionName + "\r\n{\r\n\r\n\t{0}\r\n\r\n}\r\n";
}
function getGeneralShortcuts(){
return {
"name": localizationService.localize("shortcuts_generalHeader"),
"shortcuts": [
{
"description": localizationService.localize("buttons_undo"),
"keys": [{ "key": "ctrl" }, { "key": "z" }]
},
{
"description": localizationService.localize("buttons_redo"),
"keys": [{ "key": "ctrl" }, { "key": "y" }]
},
{
"description": localizationService.localize("buttons_save"),
"keys": [{ "key": "ctrl" }, { "key": "s" }]
}
]
};
}
function getEditorShortcuts(){
return {
"name": localizationService.localize("shortcuts_editorHeader"),
"shortcuts": [
{
"description": localizationService.localize("shortcuts_commentLine"),
"keys": [{ "key": "ctrl" }, { "key": "/" }]
},
{
"description": localizationService.localize("shortcuts_removeLine"),
"keys": [{ "key": "ctrl" }, { "key": "d" }]
},
{
"description": localizationService.localize("shortcuts_copyLineUp"),
"keys": {
"win": [{ "key": "alt" }, { "key": "shift" }, { "key": "up" }],
"mac": [{ "key": "cmd" }, { "key": "alt" }, { "key": "up" }]
}
},
{
"description": localizationService.localize("shortcuts_copyLineDown"),
"keys": {
"win": [{ "key": "alt" }, { "key": "shift" }, { "key": "down" }],
"mac": [{ "key": "cmd" }, { "key": "alt" }, { "key": "down" }]
}
},
{
"description": localizationService.localize("shortcuts_moveLineUp"),
"keys": [{ "key": "alt" }, { "key": "up" }]
},
{
"description": localizationService.localize("shortcuts_moveLineDown"),
"keys": [{ "key": "alt" }, { "key": "down" }]
}
]
};
}
function getTemplateEditorShortcuts(){
return {
"name": "Umbraco", //No need to localise Umbraco is the same in all languages :)
"shortcuts": [
{
"description": localizationService.format(["template_insert", "template_insertPageField"], "%0% %1%"),
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "v" }]
},
{
"description": localizationService.format(["template_insert", "template_insertPartialView"], "%0% %1%"),
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "p" }]
},
{
"description": localizationService.format(["template_insert", "template_insertDictionaryItem"], "%0% %1%"),
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "d" }]
},
{
"description": localizationService.format(["template_insert", "template_insertMacro"], "%0% %1%"),
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "m" }]
},
{
"description": localizationService.localize("template_queryBuilder"),
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "q" }]
},
{
"description": localizationService.format(["template_insert", "template_insertSections"], "%0% %1%"),
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "s" }]
},
{
"description": localizationService.localize("template_mastertemplate"),
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "t" }]
}
]
};
}
function getPartialViewEditorShortcuts(){
return {
"name": "Umbraco", //No need to localise Umbraco is the same in all languages :)
"shortcuts": [
{
"description": localizationService.format(["template_insert", "template_insertPageField"], "%0% %1%"),
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "v" }]
},
{
"description": localizationService.format(["template_insert", "template_insertDictionaryItem"], "%0% %1%"),
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "d" }]
},
{
"description": localizationService.format(["template_insert", "template_insertMacro"], "%0% %1%"),
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "m" }]
},
{
"description": localizationService.localize("template_queryBuilder"),
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "q" }]
}
]
};
}
////////////
var service = {
@@ -44,7 +162,11 @@
getQuerySnippet: getQuerySnippet,
getRenderBodySnippet: getRenderBodySnippet,
getRenderSectionSnippet: getRenderSectionSnippet,
getAddSectionSnippet: getAddSectionSnippet
getAddSectionSnippet: getAddSectionSnippet,
getGeneralShortcuts: getGeneralShortcuts,
getEditorShortcuts: getEditorShortcuts,
getTemplateEditorShortcuts: getTemplateEditorShortcuts,
getPartialViewEditorShortcuts: getPartialViewEditorShortcuts
};
return service;
+27 -2
View File
@@ -26,10 +26,35 @@ app.run(['userService', '$log', '$rootScope', '$location', 'navigationService',
/** execute code on each successful route */
$rootScope.$on('$routeChangeSuccess', function(event, current, previous) {
if(current.params.section){
$rootScope.locationTitle = current.params.section + " - " + $location.$$host;
var deployConfig = Umbraco.Sys.ServerVariables.deploy;
var deployEnv, deployEnvTitle;
if (deployConfig) {
deployEnv = Umbraco.Sys.ServerVariables.deploy.CurrentWorkspace;
deployEnvTitle = "(" + deployEnv + ") ";
}
if(current.params.section) {
//Uppercase the current section, content, media, settings, developer, forms
var currentSection = current.params.section.charAt(0).toUpperCase() + current.params.section.slice(1);
var baseTitle = currentSection + " - " + $location.$$host;
//Check deploy for Global Umbraco.Sys obj workspace
if(deployEnv){
$rootScope.locationTitle = deployEnvTitle + baseTitle;
}
else {
$rootScope.locationTitle = baseTitle;
}
}
else {
if(deployEnv) {
$rootScope.locationTitle = deployEnvTitle + "Umbraco - " + $location.$$host;
}
$rootScope.locationTitle = "Umbraco - " + $location.$$host;
}
@@ -67,9 +67,9 @@
}
.alert-form {
background-color: #ECECEC;
border: 1px solid @gray !important;
color: @gray;
background-color: @gray-10;
border: 1px solid @gray-3 !important;
color: @gray-3;
}
.alert-form.-no-border {
@@ -77,7 +77,7 @@
}
.alert-form h4 {
color: @gray;
color: @gray-3;
}
@@ -19,6 +19,9 @@ body {
line-height: @baseLineHeight;
color: @textColor;
background-color: @bodyBackground;
-webkit-font-smoothing: antialiased;
font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@@ -142,7 +145,7 @@ body {
left: 0px;
right: 0px;
padding-top: 100px;
border-right: 1px solid @grayLight;
border-right: 1px solid @purple-l3;
z-index: 100;
}
@@ -197,8 +200,8 @@ body {
right: -5px;
top: 0;
bottom: 0;
background-color: @grayLighter;
border: solid 1px @grayLight;
background-color: @gray-10;
border: solid 1px @purple-l3;
border-top: none;
border-bottom: none;
position:absolute;
+23 -12
View File
@@ -9,7 +9,7 @@
// Core
.btn {
display: inline-block;
padding: 4px 12px;
padding: 6px 14px;
margin-bottom: 0; // For input.btn
font-size: @baseFontSize;
line-height: @baseLineHeight;
@@ -18,14 +18,15 @@
cursor: pointer;
background: @btnBackground;
color: @black;
border: 1px solid @btnBorder;
border: none;
box-shadow: none;
border-radius: 3px;
// Hover/focus state
&:hover,
&:focus {
background: @btnBackgroundHighlight;
color: @grayDark;
color: @gray-4;
background-position: 0 -15px;
text-decoration: none;
@@ -138,7 +139,7 @@ input[type="button"] {
// Round button
.btn-round{
font-size: 24px;
color: @gray;
color: @gray-3;
background: @white;
line-height: 32px;
@@ -167,6 +168,16 @@ input[type="button"] {
color: rgba(255,255,255,.75);
}
.btn-primary,
.btn-warning,
.btn-danger,
.btn-success,
.btn-info,
.btn-inverse,
.btn-neutral {
font-weight: bold;
}
// Set the backgrounds
// -------------------------
.btn-primary {
@@ -196,16 +207,16 @@ input[type="button"] {
// Neutral appears as lighter gray
.btn-neutral {
.buttonBackground(@btnNeutralBackground, @btnNeutralBackgroundHighlight);
color: #656565;
color: @gray-5;
// Hover/focus state
&:hover,
&:focus {
color: #656565;
color: @gray-5;
}
&.disabled,
&[disabled] {
color:#656565;
color: @gray-5;
.opacity(65);
}
@@ -217,11 +228,11 @@ input[type="button"] {
padding: 15px 50px;
font-size: 16px;
border: none;
background: @blue;
background: @green;
color: white;
&:hover {
background: #2b8ee3;
font-weight: bold;
&:hover {
background: @green-d1;
}
}
@@ -281,7 +292,7 @@ input[type="submit"].btn {
}
.btn-link[disabled]:hover,
.btn-link[disabled]:focus {
color: @grayDark;
color: @gray-4;
text-decoration: none;
}
@@ -270,10 +270,10 @@ a, a:hover{
height: 100%;
padding: 0;
margin-left: -80px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-family: "Lato", Helvetica, Arial, sans-serif;
font-size: 13px;
line-height: 16px;
background: #1D1D1D;
background: #413659;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
@@ -282,8 +282,8 @@ a, a:hover{
.avatar {
text-align:center;
padding: 25px 0 29px 0;
border-bottom: 1px solid #343434;
padding: 27px 0 29px 0;
border-bottom: 1px solid #2E2246;
}
.help {
@@ -295,7 +295,7 @@ a, a:hover{
margin: 0;
font-size: 30px;
text-align: center;
color: #d9d9d9;
color: #D8D7D9;
opacity: 0.4;
-webkit-transition: all .3s linear;
-moz-transition: all .3s linear;
@@ -304,7 +304,7 @@ a, a:hover{
ul.sections {
display: block;
background: #1d1d1d;
background: #413659;
height: 100%;
position:absolute;
top: 90px;
@@ -320,7 +320,7 @@ ul.sections {
ul.sections li {
display: block;
border-left: 4px #1d1d1d solid;
border-left: 4px #413659 solid;
-webkit-transition: all .3s linear;
-moz-transition: all .3s linear;
transition: all .3s linear;
@@ -328,7 +328,7 @@ ul.sections li {
.fix-left-menu ul.sections li a span,
.fix-left-menu ul.sections li a i {
color: #d9d9d9;
color: #8d869b;
-webkit-transition: all .3s linear;
-moz-transition: all .3s linear;
transition: all .3s linear;
@@ -342,12 +342,11 @@ ul.sections li a {
margin: 0 0 0 -4px;
text-align: center;
text-decoration: none;
border-bottom: 1px solid #343434;
border-bottom: 1px solid #2E2246;
}
ul.sections li a i {
font-size: 30px;
opacity: 0.4;
}
ul.sections li a span {
@@ -357,8 +356,16 @@ ul.sections li a span {
opacity: 0.4;
}
ul.sections li.current {
background-color: #2E2246;
}
ul.sections li.current a i {
color: #ffffff;
}
ul.sections li.current, ul.sections li:hover {
border-left: 4px #f57020 solid;
border-left: 4px #00AEA2 solid;
}
.fix-left-menu:hover ul.sections li a span,
@@ -533,7 +540,7 @@ h4.panel-title {
.field-title {
float: left;
margin-right: 10px;
font-size: 11px;
font-size: 12px;
color: #d9d9d9;
}
@@ -651,7 +658,7 @@ h4.panel-title {
padding: 0;
margin-top: -9px;
margin-right: 1px;
font-size: 11px;
font-size: 12px;
color: #d9d9d9;
text-align: right;
background-color: transparent;
@@ -684,7 +691,7 @@ h4.panel-title {
}
.canvasdesigner select {
font-size: 11px;
font-size: 12px;
}
.canvasdesigner .sp-dd {
@@ -794,7 +801,7 @@ h4.panel-title {
background-color: #ffffff;
border-radius: 10px;
opacity: 1.0;
box-shadow: 0 0 0 29px #ECECEC, 0 0 0 30px #C4C4C4;
box-shadow: 0 0 0 29px #E9E9EB, 0 0 0 30px #D8D7D9;
transition: all 0.5s ease-in-out;
}
@@ -9,6 +9,18 @@
left: auto;
}
.umb-button-group {
.umb-button__button {
border-radius: 3px 0px 0px 3px;
}
.umb-button-group__toggle {
border-radius: 0px 3px 3px 0;
}
}
// hack for umb-era-button
.umb-era-button-group {
@@ -1,16 +1,21 @@
.umb-button {
position: relative;
overflow: hidden;
display: inline;
}
.umb-button__button:focus {
outline: none;
}
.umb-button__button {
position: relative;
z-index: 1;
}
.umb-button__content {
opacity: 1;
transition: opacity 0.25s ease;
display: flex;
flex-wrap: wrap;
}
@@ -3,7 +3,6 @@
justify-content: center;
align-items: center;
font-size: 14px;
//font-weight: bold;
height: 38px;
line-height: 1;
max-width: 100%;
@@ -19,6 +18,7 @@
box-sizing: border-box;
cursor: pointer;
transition: background-color 80ms ease, color 80ms ease;
font-weight: bold;
}
@@ -53,6 +53,15 @@
background-color: darken(@btnDangerBackground, 5%);
}
.umb-era-button.-green {
background: @green;
color: @white;
}
.umb-era-button.-green:hover {
background-color: @green-d1;
}
.umb-era-button.-link {
padding: 0;
background: transparent;
@@ -7,7 +7,7 @@
padding: 5px 10px 5px 10px;
background: white;
.title{padding: 12px; color: @gray; border-bottom: 1px solid @grayLight; font-weight: 400; font-size: 16px; text-transform: none; margin: 0 -10px 10px -10px;}
.title{padding: 12px; color: @gray-3; border-bottom: 1px solid @gray-8; font-weight: 400; font-size: 16px; text-transform: none; margin: 0 -10px 10px -10px;}
}
@@ -26,12 +26,12 @@
.umb-card-content{
.item-title{color: @blackLight; font-weight: 400; border: none; font-size: 16px; text-transform: none; margin-bottom: 3px;}
p{color: @gray; margin-bottom: 1px;}
p{color: @gray-3; margin-bottom: 1px;}
}
.umb-card-actions{
padding-top: 10px;
border-top: @grayLighter 1px solid;
border-top: @gray-10 1px solid;
clear: both;
}
@@ -71,7 +71,7 @@
}
.umb-card-list li{
border-bottom: @grayLighter 1px solid;
border-bottom: @gray-10 1px solid;
padding-bottom: 3px;
display: block;
}
@@ -93,7 +93,7 @@
.umb-card-grid li {
padding: 5px;
overflow: hidden;
font-size: 11px;
font-size: 12px;
text-align: center;
width: 100px;
@@ -114,6 +114,7 @@
display: block;
width: 100%;
height: 100%;
border-radius: 3px;
}
@@ -121,14 +122,15 @@
.umb-card-grid .umb-card-grid-item:focus,
.umb-card-grid .umb-card-grid-item:hover > *,
.umb-card-grid .umb-card-grid-item:focus > * {
background: @blue;
color: white;
background: @gray-10;
//color: white;
cursor: pointer;
outline: none;
border-radius: 3px;
}
.umb-card-grid a {
color: #222;
color: @gray-2;
text-decoration: none;
}
@@ -136,7 +138,7 @@
font-size: 30px;
line-height: 50px;
display: block;
color: @grayDark;
color: @gray-3;
}
@@ -149,32 +151,32 @@
display: inline-block;
cursor: pointer;
border-radius: 200px;
background: rgba(255,255,255, 1);
border:1px solid rgb(182, 182, 182);
background: @gray-10;
border:1px solid @gray-6;
margin: 2px;
}
.umb-btn-round:hover, .umb-btn-round:hover *{
background: @blue !important;
color: white !important;
border-color: @blue !important;
background: @turquoise !important;
color: @white !important;
border-color: @turquoise !important;
text-decoration:none;
}
.umb-btn-round a:hover {
text-decoration:none;
color: white !important;
color: @white !important;
}
.umb-btn-round i {
font-size:16px !important;
color: #grayLight;
color: @gray-8;
display:block;
}
.umb-btn-round.alert:hover, .umb-btn-round.alert:hover *{
background: @red !important;
color: white !important;
color: @white !important;
border-color: @red !important;
text-decoration:none;
}
@@ -3,7 +3,7 @@
*/
.umb-editor-wrapper {
background: white;
background: @white;
position: absolute;
top: 0;
left: 0;
@@ -20,8 +20,8 @@
}
.umb-editor-header {
background: @grayLighter;
border-bottom: 1px solid @grayLight;
background: @gray-10;
border-bottom: 1px solid @purple-l3;
flex: 0 0 99px;
position: relative;
}
@@ -51,8 +51,8 @@
.umb-editor-drawer {
margin: 0;
padding: 10px 20px;
background: @grayLighter;
border-top: 1px solid @grayLight;
background: @gray-10;
border-top: 1px solid @purple-l3;
flex: 1 0 31px;
}
@@ -1,7 +1,7 @@
.umb-editor-sub-header {
padding: 15px 0;
margin-bottom: 30px;
background: #ffffff;
background: @white;
display: flex;
justify-content: space-between;
margin-top: -30px;
@@ -36,7 +36,7 @@
}
.umb-editor-sub-header__section {
border-left: 1px solid @grayLight;
border-left: 1px solid @gray-8;
display: flex;
align-items: center;
padding-left: 20px;
@@ -50,7 +50,7 @@
.umb-editor-sub-header__content-right .umb-editor-sub-header__section {
border-left: none;
border-right: 1px solid @grayLight;
border-right: 1px solid @gray-8;
}
.umb-editor-sub-header__content-right .umb-editor-sub-header__section:last-child {
@@ -22,7 +22,7 @@
.umb-notifications__notification {
padding: 5px 20px;
text-shadow: none;
font-size: 12px;
font-size: 14px;
border: none;
border-radius: 0;
position: relative;
@@ -1,7 +1,7 @@
.umb-overlay {
position: fixed;
overflow: hidden;
background: white;
background: @white;
z-index: 996660;
animation: fadeIn 0.2s;
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
@@ -15,8 +15,8 @@
}
.umb-overlay .umb-overlay-header {
background: @grayLighter;
border-bottom: 1px solid @grayLight;
background: @gray-10;
border-bottom: 1px solid @purple-l3;
padding: 10px;
margin-top: 0;
flex-grow: 0;
@@ -34,7 +34,7 @@
.umb-overlay .umb-overlay__subtitle {
font-size: @fontSizeSmall;
color: @gray;
color: @gray-3;
}
.umb-overlay .umb-overlay-container {
@@ -54,8 +54,8 @@
padding: 10px 20px;
margin: 0;
background: @grayLighter;
border-top: 1px solid @grayLight;
background: @gray-10;
border-top: 1px solid @purple-l3;
}
.umb-overlay .umb-overlay-drawer.-auto-height {
@@ -167,8 +167,8 @@
width: 100%;
padding: 20px;
box-sizing: border-box;
border-bottom: 1px solid @grayLight;
background: @grayLighter;
background: @gray-10;
border-bottom: 1px solid @purple-l3;
}
.umb-overlay__item-details-title-wrapper {
@@ -181,7 +181,7 @@
font-size: 16px;
margin-right: 10px;
vertical-align: middle;
color: #999;
color: @gray-6;
}
.umb-overlay__item-details-title {
@@ -1,7 +1,7 @@
.umb-tooltip {
position: fixed;
display: flex;
background: #ffffff;
background: @white;
padding: 10px;
z-index: 1000;
max-width: 200px;
@@ -12,8 +12,8 @@
.umb-breadcrumbs__ancestor-link,
.umb-breadcrumbs__ancestor-text {
font-size: 11px;
color: #555;
font-size: 12px;
color: @gray-3;
max-width: 150px;
white-space: nowrap;
overflow: hidden;
@@ -25,7 +25,7 @@
}
.umb-breadcrumbs__ancestor-link:hover {
color: #000;
color: @black;
}
.umb-breadcrumbs__seperator {
@@ -33,5 +33,5 @@
top: 1px;
margin-left: 5px;
margin-right: 5px;
color: #ccc;
color: @gray-7;
}
@@ -14,12 +14,12 @@
}
.umb-checkbox-list__item:hover {
background-color: @grayLighter;
background-color: @gray-10;
}
.umb-checkbox-list__item.-selected,
.umb-checkbox-list__item.-disabled {
background-color: fade(@blueDark, 4%);
background-color: @gray-10;
font-weight: bold;
}
@@ -28,22 +28,21 @@
justify-content: center;
align-items: center;
flex: 0 0 30px;
height: 30px;
margin-right: 10px;
}
.umb-checkbox-list__item-checkbox.-selected {
background: @blue;
margin-right: 5px;
}
.umb-checkbox-list__item-icon {
margin-right: 5px;
font-size: 16px;
}
.umb-checkbox-list__item-text {
font-size: 13px;
font-size: 14px;
margin-bottom: 0;
flex: 1 1 auto;
display: flex;
align-items: center;
padding: 5px 0;
}
.umb-checkbox-list__item-text.-faded {
@@ -55,14 +54,14 @@
}
.umb-checkbox-list__item-caption {
font-size: 11px;
font-size: 12px;
margin-left: 2px;
}
.umb-checkbox-list__no-data {
text-align: center;
padding-top: 50px;
color: #ccc;
color: @gray-7;
font-size: 16px;
line-height: 1.8em;
}
@@ -1,5 +1,5 @@
.umb-child-selector__child {
background: @grayLighter;
background: @gray-10;
padding: 5px 15px;
margin-bottom: 5px;
min-width: 300px;
@@ -8,13 +8,13 @@
}
.umb-child-selector__child.-parent {
background: #f1f1f1;
background: @gray-9;
padding-top: 10px;
padding-bottom: 10px;
}
.umb-child-selector__child.-placeholder {
border: 1px dashed @grayLight;
border: 1px dashed @gray-8;
background: none;
cursor: pointer;
text-align: center;
@@ -42,11 +42,11 @@
}
.umb-child-selector__child-name {
font-size: 13px;
font-size: 14px;
}
.umb-child-selector__child-name.-blue {
color: @blue;
color: @turquoise-d1;
}
.umb-child-selector__child-actions {
@@ -98,7 +98,7 @@
display: flex;
align-items: center;
justify-content: center;
color: #ffffff;
color: @white;
border-radius: 40px;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
font-size: 18px;
@@ -106,12 +106,12 @@
.umb_confirm-action__overlay-action:hover {
text-decoration: none;
color: #ffffff;
color: @white;
}
// confirm button
.umb_confirm-action__overlay-action.-confirm {
background: #ffffff;
background: @white;
color: @green !important;
}
@@ -121,7 +121,7 @@
// cancel button
.umb_confirm-action__overlay-action.-cancel {
background: #ffffff;
background: @white;
color: @red !important;
}
@@ -6,7 +6,7 @@
}
.umb-content-grid__item {
background: @grayLighter;
background: @gray-10;
flex: 0 1 200px;
cursor: pointer;
position: relative;
@@ -19,7 +19,7 @@
}
.umb-content-grid__icon-container {
background: lighten(@grayLight, 7%);
background: @gray-9;
height: 75px;
display: flex;
align-items: center;
@@ -30,11 +30,11 @@
.umb-content-grid__icon[class^="icon-"],
.umb-content-grid__icon[class*=" icon-"] {
font-size: 40px;
color: lighten(@gray, 20%);
color: @gray-6;
}
.umb-content-grid__icon.-light {
color: @grayLight;
color: @gray-8;
}
@@ -46,10 +46,10 @@
.umb-content-grid__item-name {
font-weight: bold;
margin-bottom: 10px;
color: black;
color: @black;
padding-bottom: 10px;
line-height: 1.4em;
border-bottom: 1px solid @grayLight;
border-bottom: 1px solid @gray-8;
display: inline-block;
}
@@ -58,18 +58,18 @@
}
.umb-content-grid__item-name.-light {
color: @grayLight;
color: @gray-8;
}
.umb-content-grid__details-list {
list-style: none;
margin-bottom: 0;
margin-left: 0;
font-size: 11px;
font-size: 12px;
}
.umb-content-grid__details-list.-light {
color: @grayLight;
color: @gray-8;
}
.umb-content-grid__details-label {
@@ -85,16 +85,16 @@
position: absolute;
top: 10px;
right: 10px;
border: 1px solid #ffffff;
width: 25px;
height: 25px;
background: @blue;
border: 2px solid @white;
width: 26px;
height: 26px;
background: @green;
border-radius: 50px;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
color: #ffffff;
color: @white;
cursor: pointer;
}
@@ -108,7 +108,7 @@
.umb-content-grid__no-items {
font-size: 16px;
font-weight: bold;
color: @grayLight;
color: @gray-8;
padding-top: 50px;
padding-bottom: 50px;
}
@@ -21,7 +21,7 @@
}
.umb-sub-views-nav-item.is-active {
color: @blue;
color: @turquoise-d1;
}
.show-validation .umb-sub-views-nav-item.-has-error {
@@ -35,5 +35,5 @@
}
.umb-sub-views-nav-item-text {
font-size: 11px;
font-size: 12px;
}
@@ -1,7 +1,7 @@
.umb-empty-state {
font-size: @fontSizeMedium;
line-height: 1.8em;
color: @grayMed;
color: @gray-4;
text-align: center;
}

Some files were not shown because too many files have changed in this diff Show More