v7@11d4189c8d

This commit is contained in:
Stephan
2018-04-05 12:50:00 +02:00
parent 0dba812053
commit eb6a08af31
12 changed files with 106 additions and 251 deletions

View File

@@ -29,6 +29,7 @@ namespace Umbraco.Core.IO
private ShadowWrapper _xsltFileSystem;
private ShadowWrapper _masterPagesFileSystem;
private ShadowWrapper _mvcViewsFileSystem;
private ShadowWrapper _javaScriptLibraryFileSystem;
// well-known file systems lazy initialization
private object _wkfsLock = new object();
@@ -165,7 +166,7 @@ namespace Umbraco.Core.IO
var xsltFileSystem = new PhysicalFileSystem(SystemDirectories.Xslt);
var masterPagesFileSystem = new PhysicalFileSystem(SystemDirectories.Masterpages);
var mvcViewsFileSystem = new PhysicalFileSystem(SystemDirectories.MvcViews);
var javaScriptLibraryFileSystem = new PhysicalFileSystem(SystemDirectories.JavaScriptLibrary);
_macroPartialFileSystem = new ShadowWrapper(macroPartialFileSystem, "Views/MacroPartials", () => IsScoped());
_partialViewsFileSystem = new ShadowWrapper(partialViewsFileSystem, "Views/Partials", () => IsScoped());
@@ -174,8 +175,7 @@ namespace Umbraco.Core.IO
_xsltFileSystem = new ShadowWrapper(xsltFileSystem, "xslt", () => IsScoped());
_masterPagesFileSystem = new ShadowWrapper(masterPagesFileSystem, "masterpages", () => IsScoped());
_mvcViewsFileSystem = new ShadowWrapper(mvcViewsFileSystem, "Views", () => IsScoped());
_javascriptLibraryFileSystem = new PhysicalFileSystem(Path.Combine(SystemDirectories.Umbraco, "lib"));
_javascriptLibraryFileSystem = new ShadowWrapper(javaScriptLibraryFileSystem, "Lib", () => IsScoped());
// filesystems obtained from GetFileSystemProvider are already wrapped and do not need to be wrapped again
_mediaFileSystem = GetFileSystemProvider<MediaFileSystem>();

View File

@@ -131,9 +131,9 @@ namespace Umbraco.Core.IO
//use a tilde character instead of the complete path
internal static string ReturnPath(string settingsKey, string standardPath, bool useTilde)
{
string retval = ConfigurationManager.AppSettings[settingsKey];
var retval = ConfigurationManager.AppSettings[settingsKey];
if (String.IsNullOrEmpty(retval))
if (string.IsNullOrEmpty(retval))
retval = standardPath;
return retval.TrimEnd('/');

View File

@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Web;
using System.IO;
using System.Web;
namespace Umbraco.Core.IO
{
@@ -13,179 +6,56 @@ namespace Umbraco.Core.IO
public class SystemDirectories
{
//TODO: Why on earth is this even configurable? You cannot change the /Bin folder in ASP.Net
public static string Bin
{
get
{
return IOHelper.ReturnPath("umbracoBinDirectory", "~/bin");
}
}
public static string Bin => IOHelper.ReturnPath("umbracoBinDirectory", "~/bin");
public static string Base
{
get
{
return IOHelper.ReturnPath("umbracoBaseDirectory", "~/base");
}
}
public static string Base => IOHelper.ReturnPath("umbracoBaseDirectory", "~/base");
public static string Config
{
get
{
return IOHelper.ReturnPath("umbracoConfigDirectory", "~/config");
}
}
public static string Config => IOHelper.ReturnPath("umbracoConfigDirectory", "~/config");
public static string Css
{
get
{
return IOHelper.ReturnPath("umbracoCssDirectory", "~/css");
}
}
public static string Css => IOHelper.ReturnPath("umbracoCssDirectory", "~/css");
public static string Data
{
get
{
return IOHelper.ReturnPath("umbracoStorageDirectory", "~/App_Data");
}
}
public static string Data => IOHelper.ReturnPath("umbracoStorageDirectory", "~/App_Data");
public static string Install
{
get
{
return IOHelper.ReturnPath("umbracoInstallPath", "~/install");
}
}
public static string Install => IOHelper.ReturnPath("umbracoInstallPath", "~/install");
public static string Masterpages
{
get
{
return IOHelper.ReturnPath("umbracoMasterPagesPath", "~/masterpages");
}
}
public static string Masterpages => IOHelper.ReturnPath("umbracoMasterPagesPath", "~/masterpages");
public static string AppCode
{
get
{
//NOTE: this is not configurable and shouldn't need to be
return "~/App_Code";
}
}
//NOTE: this is not configurable and shouldn't need to be
public static string AppCode => "~/App_Code";
public static string AppPlugins
{
get
{
//NOTE: this is not configurable and shouldn't need to be
return "~/App_Plugins";
}
}
//NOTE: this is not configurable and shouldn't need to be
public static string AppPlugins => "~/App_Plugins";
public static string MvcViews
{
get
{
//NOTE: this is not configurable and shouldn't need to be
return "~/Views";
}
}
//NOTE: this is not configurable and shouldn't need to be
public static string MvcViews => "~/Views";
public static string PartialViews
{
get
{
return MvcViews + "/Partials/";
}
}
public static string PartialViews => MvcViews + "/Partials/";
public static string MacroPartials
{
get
{
return MvcViews + "/MacroPartials/";
public static string MacroPartials => MvcViews + "/MacroPartials/";
}
}
public static string Media => IOHelper.ReturnPath("umbracoMediaPath", "~/media");
public static string Media
{
get
{
return IOHelper.ReturnPath("umbracoMediaPath", "~/media");
}
}
public static string Scripts => IOHelper.ReturnPath("umbracoScriptsPath", "~/scripts");
public static string Scripts
{
get
{
return IOHelper.ReturnPath("umbracoScriptsPath", "~/scripts");
}
}
public static string Umbraco => IOHelper.ReturnPath("umbracoPath", "~/umbraco");
public static string Umbraco
{
get
{
return IOHelper.ReturnPath("umbracoPath", "~/umbraco");
}
}
public static string UmbracoClient => IOHelper.ReturnPath("umbracoClientPath", "~/umbraco_client");
public static string UmbracoClient
{
get
{
return IOHelper.ReturnPath("umbracoClientPath", "~/umbraco_client");
}
}
public static string UserControls => IOHelper.ReturnPath("umbracoUsercontrolsPath", "~/usercontrols");
public static string UserControls
{
get
{
return IOHelper.ReturnPath("umbracoUsercontrolsPath", "~/usercontrols");
}
}
public static string WebServices => IOHelper.ReturnPath("umbracoWebservicesPath", Umbraco.EnsureEndsWith("/") + "webservices");
public static string WebServices
{
get
{
return IOHelper.ReturnPath("umbracoWebservicesPath", Umbraco.EnsureEndsWith("/") + "webservices");
}
}
public static string Xslt => IOHelper.ReturnPath("umbracoXsltPath", "~/xslt");
public static string Xslt
{
get {
return IOHelper.ReturnPath("umbracoXsltPath", "~/xslt");
}
}
//by default the packages folder should exist in the data folder
public static string Packages => IOHelper.ReturnPath("umbracoPackagesPath", Data + IOHelper.DirSepChar + "packages");
public static string Packages
{
get
{
//by default the packages folder should exist in the data folder
return IOHelper.ReturnPath("umbracoPackagesPath", Data + IOHelper.DirSepChar + "packages");
}
}
public static string Preview => IOHelper.ReturnPath("umbracoPreviewPath", Data + IOHelper.DirSepChar + "preview");
public static string JavaScriptLibrary => IOHelper.ReturnPath("umbracoJavaScriptLibraryPath", Umbraco + IOHelper.DirSepChar + "lib");
public static string Preview
{
get
{
return IOHelper.ReturnPath("umbracoPreviewPath", Data + IOHelper.DirSepChar + "preview");
}
}
private static string _root;
private static string _root;
/// <summary>
/// Gets the root path of the application
/// </summary>
@@ -193,21 +63,16 @@ namespace Umbraco.Core.IO
{
get
{
if (_root == null)
{
string appPath = HttpRuntime.AppDomainAppVirtualPath ?? string.Empty;
if (appPath == "/")
appPath = string.Empty;
if (_root != null) return _root;
_root = appPath;
}
var appPath = HttpRuntime.AppDomainAppVirtualPath;
if (appPath == "/") appPath = string.Empty;
_root = appPath;
return _root;
}
//Only required for unit tests
internal set { _root = value; }
internal set => _root = value;
}
}
}

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Data;
using System.Linq;
using NPoco;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.SqlSyntax;
@@ -216,8 +215,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_7_7_0
var usersWithApps = new Dictionary<int, List<string>>();
foreach (var userApps in userAppsData)
{
List<string> apps;
if (usersWithApps.TryGetValue(userApps.id, out apps) == false)
if (usersWithApps.TryGetValue(userApps.id, out List<string> apps) == false)
{
apps = new List<string> {userApps.app};
usersWithApps.Add(userApps.id, apps);

View File

@@ -1,8 +1,6 @@
LazyLoad.js([
'../lib/jquery/jquery.min.js',
//'../lib/jquery-ui/jquery-ui.min.js',
'/Scripts/jquery-1.6.4.min.js',
'../lib/angular/1.1.5/angular.min.js',
'../lib/underscore/underscore-min.js',
'../lib/umbraco/Extensions.js',
@@ -13,9 +11,8 @@ LazyLoad.js([
'../ServerVariables',
'../lib/spectrum/spectrum.js',
'../lib/signalr/jquery.signalR.js',
'/umbraco/signalr/hubs',
'/umbraco/BackOffice/signalr/hubs',
'../js/umbraco.canvasdesigner.js'
'../js/canvasdesigner.panel.js'
], function () {
jQuery(document).ready(function () {
angular.bootstrap(document, ['Umbraco.canvasdesigner']);

View File

@@ -42,9 +42,8 @@ namespace Umbraco.Web.Cache
public override void Refresh(JsonPayload[] payloads)
{
if (payloads == null) return;
bool anythingChanged;
_publishedSnapshotService.Notify(payloads, out anythingChanged);
_publishedSnapshotService.Notify(payloads, out var anythingChanged);
if (anythingChanged)
{

View File

@@ -11,13 +11,20 @@ namespace Umbraco.Web.Editors
[DisableBrowserCache]
public class PreviewController : Controller
{
private readonly UmbracoFeatures _features;
public PreviewController(UmbracoFeatures features)
{
_features = features;
}
[UmbracoAuthorize(redirectToUmbracoLogin: true)]
public ActionResult Index()
{
var model = new BackOfficePreview
{
DisableDevicePreview = FeaturesResolver.Current.Features.Disabled.DisableDevicePreview,
PreviewExtendedHeaderView = FeaturesResolver.Current.Features.Enabled.PreviewExtendedView
DisableDevicePreview = _features.Disabled.DisableDevicePreview,
PreviewExtendedHeaderView = _features.Enabled.PreviewExtendedView
};
if (model.PreviewExtendedHeaderView.IsNullOrWhiteSpace() == false)
@@ -34,7 +41,7 @@ namespace Umbraco.Web.Editors
public ActionResult Editors(string editor)
{
if (string.IsNullOrEmpty(editor)) throw new ArgumentNullException("editor");
if (string.IsNullOrEmpty(editor)) throw new ArgumentNullException(nameof(editor));
return View(GlobalSettings.Path.EnsureEndsWith('/') + "Views/Preview/" + editor.Replace(".html", string.Empty) + ".cshtml");
}
}

View File

@@ -1,12 +1,8 @@
using System;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "auditLog", Namespace = "")]
public class AuditLog
{

View File

@@ -6,6 +6,7 @@
public class BackOfficePreview
{
public string PreviewExtendedHeaderView { get; set; }
//TODO: We could potentially have a 'footer' view
public bool DisableDevicePreview { get; set; }
}

View File

@@ -150,6 +150,7 @@
<Compile Include="Editors\LanguageController.cs" />
<Compile Include="Editors\ParameterSwapControllerActionSelector.cs" />
<Compile Include="Editors\PasswordChanger.cs" />
<Compile Include="Editors\PreviewController.cs" />
<Compile Include="Editors\TemplateController.cs" />
<Compile Include="Editors\TourController.cs" />
<Compile Include="Editors\UserEditorAuthorizationHelper.cs" />