Merge branch 'dev' into feature/auto-enable-dependencies

Conflicts:
	src/Orchard/Orchard.Framework.csproj
This commit is contained in:
Sipke Schoorstra
2015-08-21 19:45:53 +01:00
67 changed files with 363 additions and 12340 deletions

View File

@@ -4,16 +4,16 @@ var glob = require("glob"),
gulpif = require("gulp-if"), gulpif = require("gulp-if"),
gulp = require("gulp"), gulp = require("gulp"),
newer = require("gulp-newer"), newer = require("gulp-newer"),
plumber = require("gulp-plumber"), plumber = require("gulp-plumber"),
sourcemaps = require("gulp-sourcemaps"), sourcemaps = require("gulp-sourcemaps"),
less = require("gulp-less"), less = require("gulp-less"),
autoprefixer = require("gulp-autoprefixer"), autoprefixer = require("gulp-autoprefixer"),
minify = require("gulp-minify-css"), minify = require("gulp-minify-css"),
typescript = require("gulp-typescript"), typescript = require("gulp-typescript"),
uglify = require("gulp-uglify"), uglify = require("gulp-uglify"),
rename = require("gulp-rename"), rename = require("gulp-rename"),
concat = require("gulp-concat"), concat = require("gulp-concat"),
header = require("gulp-header") header = require("gulp-header");
/* /*
** GULP TASKS ** GULP TASKS
@@ -39,10 +39,17 @@ gulp.task("rebuild", function () {
// Continuous watch (each asset group is built whenever one of its inputs changes). // Continuous watch (each asset group is built whenever one of its inputs changes).
gulp.task("watch", function () { gulp.task("watch", function () {
var pathWin32 = require("path");
getAssetGroups().forEach(function (assetGroup) { getAssetGroups().forEach(function (assetGroup) {
gulp.watch(assetGroup.inputPaths, function (event) { var watchPaths = assetGroup.inputPaths.concat(assetGroup.watchPaths);
console.log("Asset file '" + event.path + "' was " + event.type + ", rebuilding output '" + assetGroup.outputPath + "'."); gulp.watch(watchPaths, function (event) {
var task = createAssetGroupTask(assetGroup); var isConcat = path.basename(assetGroup.outputFileName, path.extname(assetGroup.outputFileName)) !== "@";
if (isConcat)
console.log("Asset file '" + event.path + "' was " + event.type + ", rebuilding asset group with output '" + assetGroup.outputPath + "'.");
else
console.log("Asset file '" + event.path + "' was " + event.type + ", rebuilding asset group.");
var doRebuild = true;
var task = createAssetGroupTask(assetGroup, doRebuild);
}); });
}); });
}); });
@@ -69,6 +76,12 @@ function resolveAssetGroupPaths(assetGroup, assetManifestPath) {
assetGroup.inputPaths = assetGroup.inputs.map(function (inputPath) { assetGroup.inputPaths = assetGroup.inputs.map(function (inputPath) {
return path.join(assetGroup.basePath, inputPath); return path.join(assetGroup.basePath, inputPath);
}); });
assetGroup.watchPaths = [];
if (!!assetGroup.watch) {
assetGroup.watchPaths = assetGroup.watch.map(function (watchPath) {
return path.join(assetGroup.basePath, watchPath);
});
}
assetGroup.outputPath = path.join(assetGroup.basePath, assetGroup.output); assetGroup.outputPath = path.join(assetGroup.basePath, assetGroup.output);
assetGroup.outputDir = path.dirname(assetGroup.outputPath); assetGroup.outputDir = path.dirname(assetGroup.outputPath);
assetGroup.outputFileName = path.basename(assetGroup.output); assetGroup.outputFileName = path.basename(assetGroup.output);
@@ -95,6 +108,7 @@ function buildCssPipeline(assetGroup, doRebuild) {
throw "Input file '" + inputPath + "' is not of a valid type for output file '" + assetGroup.outputPath + "'."; throw "Input file '" + inputPath + "' is not of a valid type for output file '" + assetGroup.outputPath + "'.";
}); });
var doConcat = path.basename(assetGroup.outputFileName, ".css") !== "@"; var doConcat = path.basename(assetGroup.outputFileName, ".css") !== "@";
var generateSourceMaps = assetGroup.hasOwnProperty("generateSourceMaps") ? assetGroup.generateSourceMaps : true;
return gulp.src(assetGroup.inputPaths) return gulp.src(assetGroup.inputPaths)
.pipe(gulpif(!doRebuild, .pipe(gulpif(!doRebuild,
gulpif(doConcat, gulpif(doConcat,
@@ -104,7 +118,7 @@ function buildCssPipeline(assetGroup, doRebuild) {
ext: ".css" ext: ".css"
})))) }))))
.pipe(plumber()) .pipe(plumber())
.pipe(sourcemaps.init()) .pipe(gulpif(generateSourceMaps, sourcemaps.init()))
.pipe(gulpif("*.less", less())) .pipe(gulpif("*.less", less()))
.pipe(gulpif(doConcat, concat(assetGroup.outputFileName))) .pipe(gulpif(doConcat, concat(assetGroup.outputFileName)))
.pipe(autoprefixer({ browsers: ["last 2 versions"] })) .pipe(autoprefixer({ browsers: ["last 2 versions"] }))
@@ -115,7 +129,7 @@ function buildCssPipeline(assetGroup, doRebuild) {
// "** Any changes made directly to this file will be overwritten next time the Gulp compilation runs.\n" + // "** Any changes made directly to this file will be overwritten next time the Gulp compilation runs.\n" +
// "** For more information, see the Readme.txt file in the Gulp solution folder.\n" + // "** For more information, see the Readme.txt file in the Gulp solution folder.\n" +
// "*/\n\n")) // "*/\n\n"))
.pipe(sourcemaps.write()) .pipe(gulpif(generateSourceMaps, sourcemaps.write()))
.pipe(gulp.dest(assetGroup.outputDir)) .pipe(gulp.dest(assetGroup.outputDir))
.pipe(minify()) .pipe(minify())
.pipe(rename({ .pipe(rename({
@@ -131,6 +145,7 @@ function buildJsPipeline(assetGroup, doRebuild) {
throw "Input file '" + inputPath + "' is not of a valid type for output file '" + assetGroup.outputPath + "'."; throw "Input file '" + inputPath + "' is not of a valid type for output file '" + assetGroup.outputPath + "'.";
}); });
var doConcat = path.basename(assetGroup.outputFileName, ".js") !== "@"; var doConcat = path.basename(assetGroup.outputFileName, ".js") !== "@";
var generateSourceMaps = assetGroup.hasOwnProperty("generateSourceMaps") ? assetGroup.generateSourceMaps : true;
return gulp.src(assetGroup.inputPaths) return gulp.src(assetGroup.inputPaths)
.pipe(gulpif(!doRebuild, .pipe(gulpif(!doRebuild,
gulpif(doConcat, gulpif(doConcat,
@@ -140,14 +155,14 @@ function buildJsPipeline(assetGroup, doRebuild) {
ext: ".js" ext: ".js"
})))) }))))
.pipe(plumber()) .pipe(plumber())
.pipe(sourcemaps.init()) .pipe(gulpif(generateSourceMaps, sourcemaps.init()))
.pipe(gulpif("*.ts", typescript({ .pipe(gulpif("*.ts", typescript({
declaration: false, declaration: false,
//noImplicitAny: true, //noImplicitAny: true,
noEmitOnError: true, noEmitOnError: true,
sortOutput: true, sortOutput: true,
}).js)) }).js))
.pipe(gulpif(doConcat, concat(assetGroup.outputFileName))) .pipe(gulpif(doConcat, concat(assetGroup.outputFileName)))
// TODO: Start using below whenever gulp-header supports sourcemaps. // TODO: Start using below whenever gulp-header supports sourcemaps.
//.pipe(header( //.pipe(header(
// "/*\n" + // "/*\n" +
@@ -155,11 +170,11 @@ function buildJsPipeline(assetGroup, doRebuild) {
// "** Any changes made directly to this file will be overwritten next time the Gulp compilation runs.\n" + // "** Any changes made directly to this file will be overwritten next time the Gulp compilation runs.\n" +
// "** For more information, see the Readme.txt file in the Gulp solution folder.\n" + // "** For more information, see the Readme.txt file in the Gulp solution folder.\n" +
// "*/\n\n")) // "*/\n\n"))
.pipe(sourcemaps.write()) .pipe(gulpif(generateSourceMaps, sourcemaps.write()))
.pipe(gulp.dest(assetGroup.outputDir)) .pipe(gulp.dest(assetGroup.outputDir))
.pipe(uglify()) .pipe(uglify())
.pipe(rename({ .pipe(rename({
suffix: ".min" suffix: ".min"
})) }))
.pipe(gulp.dest(assetGroup.outputDir)); .pipe(gulp.dest(assetGroup.outputDir));
} }

View File

@@ -87,9 +87,16 @@ namespace Orchard.Tests.Localization {
var container = TestHelpers.InitializeContainer(culture.Name, "GregorianCalendar", TimeZoneInfo.Utc); var container = TestHelpers.InitializeContainer(culture.Name, "GregorianCalendar", TimeZoneInfo.Utc);
var formats = container.Resolve<IDateTimeFormatProvider>(); var formats = container.Resolve<IDateTimeFormatProvider>();
var target = container.Resolve<IDateFormatter>(); var target = container.Resolve<IDateFormatter>();
var hoursToTest = new[] { 0, 6, 12, 18 };
// Fix for some cultures on Windows 10 where both designators for some reason
// are empty strings. A 24-hour time cannot possibly be round-tripped without any
// way to distinguish AM from PM, so for these cases test only 12-hour time.
if (culture.DateTimeFormat.AMDesignator == culture.DateTimeFormat.PMDesignator)
hoursToTest = new[] { 1, 6, 9, 12 };
foreach (var dateTimeFormat in formats.AllDateTimeFormats) { // All date and time formats supported by the culture. foreach (var dateTimeFormat in formats.AllDateTimeFormats) { // All date and time formats supported by the culture.
foreach (var hour in new[] { 0, 6, 12, 18 }) { // Enough hours to cover all code paths (AM/PM, 12<->00, etc). foreach (var hour in hoursToTest) { // Enough hours to cover all code paths (AM/PM, 12<->00, etc).
DateTime dateTime = new DateTime(1998, 1, 1, hour, 30, 30, DateTimeKind.Utc); DateTime dateTime = new DateTime(1998, 1, 1, hour, 30, 30, DateTimeKind.Utc);
@@ -320,9 +327,16 @@ namespace Orchard.Tests.Localization {
var container = TestHelpers.InitializeContainer(culture.Name, null, TimeZoneInfo.Utc); var container = TestHelpers.InitializeContainer(culture.Name, null, TimeZoneInfo.Utc);
var formats = container.Resolve<IDateTimeFormatProvider>(); var formats = container.Resolve<IDateTimeFormatProvider>();
var target = container.Resolve<IDateFormatter>(); var target = container.Resolve<IDateFormatter>();
var hoursToTest = Enumerable.Range(0, 23);
// Fix for some cultures on Windows 10 where both designators for some reason
// are empty strings. A 24-hour time cannot possibly be round-tripped without any
// way to distinguish AM from PM, so for these cases test only 12-hour time.
if (culture.DateTimeFormat.AMDesignator == culture.DateTimeFormat.PMDesignator)
hoursToTest = Enumerable.Range(1, 12);
foreach (var timeFormat in formats.AllTimeFormats) { // All time formats supported by the culture. foreach (var timeFormat in formats.AllTimeFormats) { // All time formats supported by the culture.
for (var hour = 0; hour <= 23; hour++) { // All hours in the day. foreach (var hour in hoursToTest) { // All hours in the day.
DateTime time = new DateTime(1998, 1, 1, hour, 30, 30); DateTime time = new DateTime(1998, 1, 1, hour, 30, 30);
var timeString = time.ToString(timeFormat, culture); var timeString = time.ToString(timeFormat, culture);

View File

@@ -111,5 +111,27 @@ namespace Orchard.Core.Settings {
return 4; return 4;
} }
public int UpdateFrom4() {
SchemaBuilder.AlterTable("ContentFieldDefinitionRecord",
table => table.AddUniqueConstraint("UC_CFDR_Name", "Name"));
SchemaBuilder.AlterTable("ContentPartDefinitionRecord",
table => table.AddUniqueConstraint("UC_CPDR_Name", "Name"));
SchemaBuilder.AlterTable("ContentPartFieldDefinitionRecord",
table => table.AddUniqueConstraint("UC_CPFDR_CPDRId_Name", "ContentPartDefinitionRecord_Id", "Name"));
SchemaBuilder.AlterTable("ContentTypeDefinitionRecord",
table => table.AddUniqueConstraint("UC_CTDR_CPDRId", "Name"));
SchemaBuilder.AlterTable("ContentTypePartDefinitionRecord",
table => table.AddUniqueConstraint("UC_CTPDR_CPDRId_CTDRId", "ContentPartDefinitionRecord_id", "ContentTypeDefinitionRecord_Id"));
// TODO: Orchard creates dupes in this table so no can do for now.
//SchemaBuilder.AlterTable("ShellFeatureRecord",
// table => table.AddUniqueConstraint("UC_SFR_SDRId_Name", "ShellDescriptorRecord_id", "Name"));
SchemaBuilder.AlterTable("ShellFeatureStateRecord",
table => table.AddUniqueConstraint("UC_SFSR_SSRId_Name", "ShellStateRecord_Id", "Name"));
SchemaBuilder.AlterTable("ShellParameterRecord",
table => table.AddUniqueConstraint("UC_SPR_SDRId_Component_Name", "ShellDescriptorRecord_id", "Component", "Name"));
return 5;
}
} }
} }

View File

@@ -1,14 +0,0 @@
using System.Collections.Generic;
using Orchard.Events;
namespace Orchard.Autoroute.ImportExport {
public interface ICustomExportStep : IEventHandler {
void Register(IList<string> steps);
}
public class HomeAliasExportStep : ICustomExportStep {
public void Register(IList<string> steps) {
steps.Add("HomeAlias");
}
}
}

View File

@@ -81,9 +81,6 @@
<Content Include="Web.config" /> <Content Include="Web.config" />
<Content Include="Scripts\Web.config" /> <Content Include="Scripts\Web.config" />
<Content Include="Styles\Web.config" /> <Content Include="Styles\Web.config" />
<Compile Include="ImportExport\HomeAliasExportStep.cs" />
<Compile Include="ImportExport\HomeAliasExportHandler.cs" />
<Compile Include="ImportExport\HomeAliasImportHandler.cs" />
<Compile Include="Permissions.cs" /> <Compile Include="Permissions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Content Include="Module.txt" /> <Content Include="Module.txt" />
@@ -115,6 +112,8 @@
<ItemGroup> <ItemGroup>
<Compile Include="Commands\AutorouteCommands.cs" /> <Compile Include="Commands\AutorouteCommands.cs" />
<Compile Include="Providers\ContentDefinition\ContentDefinitionEventHandler.cs" /> <Compile Include="Providers\ContentDefinition\ContentDefinitionEventHandler.cs" />
<Compile Include="Recipes\Builders\HomeAliasStep.cs" />
<Compile Include="Recipes\Executors\HomeAliasStep.cs" />
<Compile Include="ResourceManifest.cs" /> <Compile Include="ResourceManifest.cs" />
<Compile Include="Services\AliasResolverSelector.cs" /> <Compile Include="Services\AliasResolverSelector.cs" />
<Compile Include="Services\HomeAliasService.cs" /> <Compile Include="Services\HomeAliasService.cs" />

View File

@@ -1,36 +1,35 @@
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Web.Routing; using System.Web.Routing;
using System.Xml.Linq; using System.Xml.Linq;
using Orchard.Autoroute.Services; using Orchard.Autoroute.Services;
using Orchard.ContentManagement; using Orchard.ContentManagement;
using Orchard.Events; using Orchard.Localization;
using Orchard.Recipes.Services;
namespace Orchard.Autoroute.ImportExport { namespace Orchard.Autoroute.Recipes.Builders {
public interface IExportEventHandler : IEventHandler { public class HomeAliasStep : RecipeBuilderStep {
void Exporting(dynamic context);
void Exported(dynamic context);
}
public class HomeAliasHandler : IExportEventHandler {
private readonly IHomeAliasService _homeAliasService; private readonly IHomeAliasService _homeAliasService;
private readonly IContentManager _contentManager; private readonly IContentManager _contentManager;
public HomeAliasHandler(IHomeAliasService homeAliasService, IContentManager contentManager) { public HomeAliasStep(IHomeAliasService homeAliasService, IContentManager contentManager) {
_homeAliasService = homeAliasService; _homeAliasService = homeAliasService;
_contentManager = contentManager; _contentManager = contentManager;
} }
public void Exporting(dynamic context) { public override string Name {
get { return "HomeAlias"; }
} }
public void Exported(dynamic context) { public override LocalizedString DisplayName {
get { return T("Home Alias"); }
}
if (!((IEnumerable<string>)context.ExportOptions.CustomSteps).Contains("HomeAlias")) { public override LocalizedString Description {
return; get { return T("Exports home alias."); }
} }
public override void Build(BuildContext context) {
var homeAliasRoute = _homeAliasService.GetHomeRoute() ?? new RouteValueDictionary(); var homeAliasRoute = _homeAliasService.GetHomeRoute() ?? new RouteValueDictionary();
var root = new XElement("HomeAlias", homeAliasRoute.Select(x => new XElement(Capitalize(x.Key), x.Value))); var root = new XElement("HomeAlias", homeAliasRoute.Select(x => new XElement(Capitalize(x.Key), x.Value)));
var homePage = _homeAliasService.GetHomePage(VersionOptions.Latest); var homePage = _homeAliasService.GetHomePage(VersionOptions.Latest);
@@ -40,10 +39,10 @@ namespace Orchard.Autoroute.ImportExport {
// so we can't rely on the route values in that case. // so we can't rely on the route values in that case.
if (homePage != null) { if (homePage != null) {
var homePageIdentifier = _contentManager.GetItemMetadata(homePage).Identity.ToString(); var homePageIdentifier = _contentManager.GetItemMetadata(homePage).Identity.ToString();
root.Attr("Identifier", homePageIdentifier); root.Attr("Id", homePageIdentifier);
} }
context.Document.Element("Orchard").Add(root); context.RecipeDocument.Element("Orchard").Add(root);
} }
private string Capitalize(string value) { private string Capitalize(string value) {
@@ -54,4 +53,3 @@ namespace Orchard.Autoroute.ImportExport {
} }
} }
} }

View File

@@ -6,33 +6,29 @@ using Orchard.ContentManagement;
using Orchard.Recipes.Models; using Orchard.Recipes.Models;
using Orchard.Recipes.Services; using Orchard.Recipes.Services;
namespace Orchard.Autoroute.ImportExport { namespace Orchard.Autoroute.Recipes.Executors {
public class HomeAliasImportHandler : Component, IRecipeHandler { public class HomeAliasStep : RecipeExecutionStep {
private readonly IHomeAliasService _homeAliasService;
private readonly IContentManager _contentManager; private readonly IContentManager _contentManager;
private readonly IHomeAliasService _homeAliasService;
public HomeAliasImportHandler(IHomeAliasService homeAliasService, IContentManager contentManager) { public HomeAliasStep(RecipeExecutionLogger logger, IContentManager contentManager, IHomeAliasService homeAliasService) : base(logger) {
_homeAliasService = homeAliasService;
_contentManager = contentManager; _contentManager = contentManager;
_homeAliasService = homeAliasService;
} }
public void ExecuteRecipeStep(RecipeContext recipeContext) { public override string Name { get { return "HomeAlias"; } }
if (!String.Equals(recipeContext.RecipeStep.Name, "HomeAlias", StringComparison.OrdinalIgnoreCase)) {
return;
}
var root = recipeContext.RecipeStep.Step; public override void Execute(RecipeExecutionContext context) {
var root = context.RecipeStep.Step;
var routeValueDictionary = root.Elements().ToDictionary(x => x.Name.LocalName.ToLower(), x => (object)x.Value); var routeValueDictionary = root.Elements().ToDictionary(x => x.Name.LocalName.ToLower(), x => (object)x.Value);
var homePageIdentifier = root.Attr("Identifier"); var homePageIdentifier = root.Attr("Id");
var homePageIdentity = new ContentIdentity(homePageIdentifier); var homePageIdentity = new ContentIdentity(homePageIdentifier);
var homePage = !String.IsNullOrEmpty(homePageIdentifier) ? _contentManager.ResolveIdentity(homePageIdentity) : default(ContentItem); var homePage = !String.IsNullOrEmpty(homePageIdentifier) ? _contentManager.ResolveIdentity(homePageIdentity) : default(ContentItem);
if(homePage != null) if (homePage != null)
_homeAliasService.PublishHomeAlias(homePage); _homeAliasService.PublishHomeAlias(homePage);
else else
_homeAliasService.PublishHomeAlias(new RouteValueDictionary(routeValueDictionary)); _homeAliasService.PublishHomeAlias(new RouteValueDictionary(routeValueDictionary));
recipeContext.Executed = true;
} }
} }
} }

View File

@@ -6,6 +6,7 @@ using System.Xml.Linq;
using System.Xml.XPath; using System.Xml.XPath;
using Orchard.FileSystems.Media; using Orchard.FileSystems.Media;
using Orchard.Azure.MediaServices.Helpers; using Orchard.Azure.MediaServices.Helpers;
using Newtonsoft.Json;
namespace Orchard.Azure.MediaServices.Models.Assets.EncoderMetadata { namespace Orchard.Azure.MediaServices.Models.Assets.EncoderMetadata {
public class AssetFile { public class AssetFile {
@@ -120,6 +121,7 @@ namespace Orchard.Azure.MediaServices.Models.Assets.EncoderMetadata {
/// <summary> /// <summary>
/// A direct URL to download the asset file using a private locator. /// A direct URL to download the asset file using a private locator.
/// </summary> /// </summary>
[JsonIgnore]
public string PrivateUrl { public string PrivateUrl {
get { get {
if (!String.IsNullOrEmpty(_parentMetadata.PrivateLocatorUrl)) { if (!String.IsNullOrEmpty(_parentMetadata.PrivateLocatorUrl)) {

View File

@@ -1,12 +1,11 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Web;
using System.Xml; using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using System.Xml.XPath; using System.Xml.XPath;
using Orchard.FileSystems.Media; using Orchard.FileSystems.Media;
using Orchard.Azure.MediaServices.Helpers; using Orchard.Azure.MediaServices.Helpers;
using Newtonsoft.Json;
namespace Orchard.Azure.MediaServices.Models.Assets.EncoderMetadata { namespace Orchard.Azure.MediaServices.Models.Assets.EncoderMetadata {
public class Metadata { public class Metadata {
@@ -46,6 +45,7 @@ namespace Orchard.Azure.MediaServices.Models.Assets.EncoderMetadata {
} }
} }
[JsonIgnore]
public string PrivateLocatorUrl { public string PrivateLocatorUrl {
get { get {
return _privateLocatorUrl; return _privateLocatorUrl;

View File

@@ -217,6 +217,7 @@
<Content Include="Assets\JavaScript\Lib\moment.js" /> <Content Include="Assets\JavaScript\Lib\moment.js" />
<Content Include="Assets\JavaScript\Lib\swfobject.js" /> <Content Include="Assets\JavaScript\Lib\swfobject.js" />
<Content Include="Assets\JavaScript\Lib\uri.js" /> <Content Include="Assets\JavaScript\Lib\uri.js" />
<Content Include="Assets\JavaScript\Lib\underscore.js" />
<Content Include="Scripts\Lib\console-shim.js" /> <Content Include="Scripts\Lib\console-shim.js" />
<Content Include="Scripts\Lib\console-shim.min.js" /> <Content Include="Scripts\Lib\console-shim.min.js" />
<Content Include="Scripts\Lib\dash.all.js" /> <Content Include="Scripts\Lib\dash.all.js" />
@@ -239,7 +240,6 @@
<Content Include="Scripts\Lib\underscore.min.js" /> <Content Include="Scripts\Lib\underscore.min.js" />
<Content Include="Scripts\Lib\uri.js" /> <Content Include="Scripts\Lib\uri.js" />
<Content Include="Scripts\Lib\uri.min.js" /> <Content Include="Scripts\Lib\uri.min.js" />
<Content Include="Assets\JavaScript\Lib\underscore.js" />
<Content Include="Styles\cloudmedia-admin-asset.css" /> <Content Include="Styles\cloudmedia-admin-asset.css" />
<Content Include="Styles\cloudmedia-admin-asset.min.css" /> <Content Include="Styles\cloudmedia-admin-asset.min.css" />
<Content Include="Styles\cloudmedia-admin-job.css" /> <Content Include="Styles\cloudmedia-admin-job.css" />

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","./jquery.fileupload"],e):e(window.jQuery)}(function(e){"use strict";var s=e.blueimp.fileupload.prototype.options.add;e.widget("blueimp.fileupload",e.blueimp.fileupload,{options:{processQueue:[],add:function(r,i){var o=e(this);i.process(function(){return o.fileupload("process",i)}),s.call(this,r,i)}},processActions:{},_processFile:function(s,r){var i=this,o=e.Deferred().resolveWith(i,[s]),t=o.promise();return this._trigger("process",null,s),e.each(s.processQueue,function(s,o){var n=function(s){return r.errorThrown?e.Deferred().rejectWith(i,[r]).promise():i.processActions[o.action].call(i,s,o)};t=t.pipe(n,o.always&&n)}),t.done(function(){i._trigger("processdone",null,s),i._trigger("processalways",null,s)}).fail(function(){i._trigger("processfail",null,s),i._trigger("processalways",null,s)}),t},_transformProcessQueue:function(s){var r=[];e.each(s.processQueue,function(){var i={},o=this.action,t=this.prefix===!0?o:this.prefix;e.each(this,function(r,o){i[r]="string"===e.type(o)&&"@"===o.charAt(0)?s[o.slice(1)||(t?t+r.charAt(0).toUpperCase()+r.slice(1):r)]:o}),r.push(i)}),s.processQueue=r},processing:function(){return this._processing},process:function(s){var r=this,i=e.extend({},this.options,s);return i.processQueue&&i.processQueue.length&&(this._transformProcessQueue(i),0===this._processing&&this._trigger("processstart"),e.each(s.files,function(o){var t=o?e.extend({},i):i,n=function(){return s.errorThrown?e.Deferred().rejectWith(r,[s]).promise():r._processFile(t,s)};t.index=o,r._processing+=1,r._processingQueue=r._processingQueue.pipe(n,n).always(function(){r._processing-=1,0===r._processing&&r._trigger("processstop")})})),this._processingQueue},_create:function(){this._super(),this._processing=0,this._processingQueue=e.Deferred().resolveWith(this).promise()}})});

View File

@@ -1 +0,0 @@
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","./jquery.fileupload-process"],e):e(window.jQuery)}(function(e){"use strict";e.blueimp.fileupload.prototype.options.processQueue.push({action:"validate",always:!0,acceptFileTypes:"@",maxFileSize:"@",minFileSize:"@",maxNumberOfFiles:"@",disabled:"@disableValidation"}),e.widget("blueimp.fileupload",e.blueimp.fileupload,{options:{getNumberOfFiles:e.noop,messages:{maxNumberOfFiles:"Maximum number of files exceeded",acceptFileTypes:"File type not allowed",maxFileSize:"File is too large",minFileSize:"File is too small"}},processActions:{validate:function(i,l){if(l.disabled)return i;var r,s=e.Deferred(),t=this.options,o=i.files[i.index];return(l.minFileSize||l.maxFileSize)&&(r=o.size),"number"===e.type(l.maxNumberOfFiles)&&(t.getNumberOfFiles()||0)+i.files.length>l.maxNumberOfFiles?o.error=t.i18n("maxNumberOfFiles"):!l.acceptFileTypes||l.acceptFileTypes.test(o.type)||l.acceptFileTypes.test(o.name)?r>l.maxFileSize?o.error=t.i18n("maxFileSize"):"number"===e.type(r)&&r<l.minFileSize?o.error=t.i18n("minFileSize"):delete o.error:o.error=t.i18n("acceptFileTypes"),o.error||i.files.error?(i.files.error=!0,s.rejectWith(this,[i])):s.resolveWith(this,[i]),s.promise()}}})});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","./jquery.fileupload"],e):e(window.jQuery)}(function(e){"use strict";var s=e.blueimp.fileupload.prototype.options.add;e.widget("blueimp.fileupload",e.blueimp.fileupload,{options:{processQueue:[],add:function(r,i){var o=e(this);i.process(function(){return o.fileupload("process",i)}),s.call(this,r,i)}},processActions:{},_processFile:function(s,r){var i=this,o=e.Deferred().resolveWith(i,[s]),t=o.promise();return this._trigger("process",null,s),e.each(s.processQueue,function(s,o){var n=function(s){return r.errorThrown?e.Deferred().rejectWith(i,[r]).promise():i.processActions[o.action].call(i,s,o)};t=t.pipe(n,o.always&&n)}),t.done(function(){i._trigger("processdone",null,s),i._trigger("processalways",null,s)}).fail(function(){i._trigger("processfail",null,s),i._trigger("processalways",null,s)}),t},_transformProcessQueue:function(s){var r=[];e.each(s.processQueue,function(){var i={},o=this.action,t=this.prefix===!0?o:this.prefix;e.each(this,function(r,o){i[r]="string"===e.type(o)&&"@"===o.charAt(0)?s[o.slice(1)||(t?t+r.charAt(0).toUpperCase()+r.slice(1):r)]:o}),r.push(i)}),s.processQueue=r},processing:function(){return this._processing},process:function(s){var r=this,i=e.extend({},this.options,s);return i.processQueue&&i.processQueue.length&&(this._transformProcessQueue(i),0===this._processing&&this._trigger("processstart"),e.each(s.files,function(o){var t=o?e.extend({},i):i,n=function(){return s.errorThrown?e.Deferred().rejectWith(r,[s]).promise():r._processFile(t,s)};t.index=o,r._processing+=1,r._processingQueue=r._processingQueue.pipe(n,n).always(function(){r._processing-=1,0===r._processing&&r._trigger("processstop")})})),this._processingQueue},_create:function(){this._super(),this._processing=0,this._processingQueue=e.Deferred().resolveWith(this).promise()}})});

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","./jquery.fileupload-process"],e):e(window.jQuery)}(function(e){"use strict";e.blueimp.fileupload.prototype.options.processQueue.push({action:"validate",always:!0,acceptFileTypes:"@",maxFileSize:"@",minFileSize:"@",maxNumberOfFiles:"@",disabled:"@disableValidation"}),e.widget("blueimp.fileupload",e.blueimp.fileupload,{options:{getNumberOfFiles:e.noop,messages:{maxNumberOfFiles:"Maximum number of files exceeded",acceptFileTypes:"File type not allowed",maxFileSize:"File is too large",minFileSize:"File is too small"}},processActions:{validate:function(i,l){if(l.disabled)return i;var r,s=e.Deferred(),t=this.options,o=i.files[i.index];return(l.minFileSize||l.maxFileSize)&&(r=o.size),"number"===e.type(l.maxNumberOfFiles)&&(t.getNumberOfFiles()||0)+i.files.length>l.maxNumberOfFiles?o.error=t.i18n("maxNumberOfFiles"):!l.acceptFileTypes||l.acceptFileTypes.test(o.type)||l.acceptFileTypes.test(o.name)?r>l.maxFileSize?o.error=t.i18n("maxFileSize"):"number"===e.type(r)&&r<l.minFileSize?o.error=t.i18n("minFileSize"):delete o.error:o.error=t.i18n("acceptFileTypes"),o.error||i.files.error?(i.files.error=!0,s.rejectWith(this,[i])):s.resolveWith(this,[i]),s.promise()}}})});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
[
{
"inputs": [ "Assets/Styles.less" ],
"output": "Styles/Styles.css"
}
]

View File

@@ -0,0 +1,2 @@

/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJTdHlsZXMuY3NzIiwic291cmNlc0NvbnRlbnQiOltdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ== */

View File

@@ -21,10 +21,10 @@ namespace Orchard.CodeGeneration.Commands {
private const string SolutionDirectoryThemes = "74492CBC-7201-417E-BC29-28B4C25A58B0"; private const string SolutionDirectoryThemes = "74492CBC-7201-417E-BC29-28B4C25A58B0";
private static readonly string[] _themeDirectories = new[] { private static readonly string[] _themeDirectories = new[] {
"", "Content", "Styles", "Scripts", "Views" "", "Assets", "Content", "Styles", "Scripts", "Views"
}; };
private static readonly string[] _moduleDirectories = new[] { private static readonly string[] _moduleDirectories = new[] {
"", "Properties", "Controllers", "Views", "Models", "Scripts", "Styles" "", "Properties", "Assets", "Controllers", "Views", "Models", "Scripts", "Styles"
}; };
private static readonly string[] _moduleTestsDirectories = new[] { private static readonly string[] _moduleTestsDirectories = new[] {
"", "Properties" "", "Properties"
@@ -281,6 +281,15 @@ namespace Orchard.CodeGeneration.Commands {
} }
} }
File.WriteAllText(modulePath + "Assets.json", File.ReadAllText(_codeGenTemplatePath + "ModuleAssetsJson.txt"));
content.Add(modulePath + "Assets.json");
File.WriteAllText(modulePath + "Assets\\Styles.less", File.ReadAllText(_codeGenTemplatePath + "ModuleStylesLess.txt"));
content.Add(modulePath + "Assets\\Styles.less");
File.WriteAllText(modulePath + "Styles\\Styles.css", File.ReadAllText(_codeGenTemplatePath + "ModuleStylesCss.txt"));
content.Add(modulePath + "Styles\\Styles.css");
File.WriteAllText(modulePath + "Styles\\Styles.min.css", File.ReadAllText(_codeGenTemplatePath + "ModuleStylesMinCss.txt"));
content.Add(modulePath + "Styles\\Styles.min.css");
File.WriteAllText(modulePath + "Web.config", File.ReadAllText(_codeGenTemplatePath + "ModuleRootWebConfig.txt")); File.WriteAllText(modulePath + "Web.config", File.ReadAllText(_codeGenTemplatePath + "ModuleRootWebConfig.txt"));
content.Add(modulePath + "Web.config"); content.Add(modulePath + "Web.config");
File.WriteAllText(modulePath + "Scripts\\Web.config", File.ReadAllText(_codeGenTemplatePath + "StaticFilesWebConfig.txt")); File.WriteAllText(modulePath + "Scripts\\Web.config", File.ReadAllText(_codeGenTemplatePath + "StaticFilesWebConfig.txt"));
@@ -355,6 +364,15 @@ namespace Orchard.CodeGeneration.Commands {
} }
} }
File.WriteAllText(themePath + "Assets.json", File.ReadAllText(_codeGenTemplatePath + "ModuleAssetsJson.txt"));
createdFiles.Add(themePath + "Assets.json");
File.WriteAllText(themePath + "Assets\\Styles.less", File.ReadAllText(_codeGenTemplatePath + "ModuleStylesLess.txt"));
createdFiles.Add(themePath + "Assets\\Styles.less");
File.WriteAllText(themePath + "Styles\\Styles.css", File.ReadAllText(_codeGenTemplatePath + "ModuleStylesCss.txt"));
createdFiles.Add(themePath + "Styles\\Styles.css");
File.WriteAllText(themePath + "Styles\\Styles.min.css", File.ReadAllText(_codeGenTemplatePath + "ModuleStylesMinCss.txt"));
createdFiles.Add(themePath + "Styles\\Styles.min.css");
File.WriteAllText(themePath + "Web.config", File.ReadAllText(_codeGenTemplatePath + "ModuleRootWebConfig.txt")); File.WriteAllText(themePath + "Web.config", File.ReadAllText(_codeGenTemplatePath + "ModuleRootWebConfig.txt"));
createdFiles.Add(themePath + "Web.config"); createdFiles.Add(themePath + "Web.config");
File.WriteAllText(themePath + "Scripts\\Web.config", File.ReadAllText(_codeGenTemplatePath + "StaticFilesWebConfig.txt")); File.WriteAllText(themePath + "Scripts\\Web.config", File.ReadAllText(_codeGenTemplatePath + "StaticFilesWebConfig.txt"));

View File

@@ -26,6 +26,7 @@
<IISExpressAnonymousAuthentication /> <IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication /> <IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode /> <IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -69,6 +70,9 @@
<Compile Include="Services\CodeGenerationCommandInterpreter.cs" /> <Compile Include="Services\CodeGenerationCommandInterpreter.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="CodeGenerationTemplates\ModuleStylesMinCss.txt" />
<Content Include="CodeGenerationTemplates\ModuleStylesCss.txt" />
<Content Include="CodeGenerationTemplates\ModuleStylesLess.txt" />
<Content Include="CodeGenerationTemplates\ModuleTestsCsProj.txt" /> <Content Include="CodeGenerationTemplates\ModuleTestsCsProj.txt" />
<Content Include="CodeGenerationTemplates\StaticFilesWebConfig.txt" /> <Content Include="CodeGenerationTemplates\StaticFilesWebConfig.txt" />
<Content Include="CodeGenerationTemplates\Theme.png" /> <Content Include="CodeGenerationTemplates\Theme.png" />
@@ -103,6 +107,9 @@
<ItemGroup> <ItemGroup>
<Content Include="CodeGenerationTemplates\Placement.info" /> <Content Include="CodeGenerationTemplates\Placement.info" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="CodeGenerationTemplates\ModuleAssetsJson.txt" />
</ItemGroup>
<PropertyGroup> <PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

View File

@@ -92,11 +92,15 @@ namespace Orchard.ImportExport.Services
environment.Resolve<ITransactionManager>().RequireNew(); environment.Resolve<ITransactionManager>().RequireNew();
var schemaBuilder = new SchemaBuilder(environment.Resolve<IDataMigrationInterpreter>()); var schemaBuilder = new SchemaBuilder(environment.Resolve<IDataMigrationInterpreter>());
schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord", table => table schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord", table => table
.Column<int>("Id", column => column.PrimaryKey().Identity()) .Column<int>("Id", column => column.PrimaryKey().Identity())
.Column<string>("DataMigrationClass") .Column<string>("DataMigrationClass")
.Column<int>("Version")); .Column<int>("Version"));
schemaBuilder.AlterTable("Orchard_Framework_DataMigrationRecord",
table => table.AddUniqueConstraint("UC_DMR_DataMigrationClass_Version", "DataMigrationClass", "Version"));
var dataMigrationManager = environment.Resolve<IDataMigrationManager>(); var dataMigrationManager = environment.Resolve<IDataMigrationManager>();
dataMigrationManager.Update("Settings"); dataMigrationManager.Update("Settings");

View File

@@ -29,6 +29,7 @@ namespace Orchard.Layouts {
.WithSetting("OwnerEditorSettings.ShowOwnerEditor", "false") .WithSetting("OwnerEditorSettings.ShowOwnerEditor", "false")
.WithSetting("DateEditorSettings.ShowDateEditor", "false")) .WithSetting("DateEditorSettings.ShowDateEditor", "false"))
.WithPart("TitlePart") .WithPart("TitlePart")
.WithPart("IdentityPart")
.WithPart("LayoutPart", p => p .WithPart("LayoutPart", p => p
.WithSetting("LayoutTypePartSettings.IsTemplate", "True")) .WithSetting("LayoutTypePartSettings.IsTemplate", "True"))
.DisplayedAs("Layout") .DisplayedAs("Layout")
@@ -62,7 +63,7 @@ namespace Orchard.Layouts {
.WithPart("LayoutPart", p => p .WithPart("LayoutPart", p => p
.WithSetting("LayoutTypePartSettings.IsTemplate", "False"))); .WithSetting("LayoutTypePartSettings.IsTemplate", "False")));
return 2; return 3;
} }
public int UpdateFrom1() { public int UpdateFrom1() {
@@ -70,6 +71,13 @@ namespace Orchard.Layouts {
return 2; return 2;
} }
public int UpdateFrom2() {
ContentDefinitionManager.AlterTypeDefinition("Layout", type => type
.WithPart("IdentityPart"));
return 3;
}
private void DefineElementWidget(string widgetTypeName, string widgetDisplayedAs, string elementTypeName) { private void DefineElementWidget(string widgetTypeName, string widgetDisplayedAs, string elementTypeName) {
ContentDefinitionManager.AlterTypeDefinition(widgetTypeName, type => type ContentDefinitionManager.AlterTypeDefinition(widgetTypeName, type => type
.WithPart("CommonPart", p => p .WithPart("CommonPart", p => p

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -20,7 +20,7 @@ namespace Orchard.MediaLibrary.Services {
private readonly IStorageProvider _storageProvider; private readonly IStorageProvider _storageProvider;
private readonly IEnumerable<IMediaFactorySelector> _mediaFactorySelectors; private readonly IEnumerable<IMediaFactorySelector> _mediaFactorySelectors;
private static char[] HttpUnallowed = new char[] { '<', '>', '*', '%', '&', ':', '\\', '?' }; private static char[] HttpUnallowed = new char[] { '<', '>', '*', '%', '&', ':', '\\', '?', '#' };
public MediaLibraryService( public MediaLibraryService(
IOrchardServices orchardServices, IOrchardServices orchardServices,

View File

@@ -93,6 +93,7 @@
<Compile Include="Providers\Builders\SettingsStep.cs" /> <Compile Include="Providers\Builders\SettingsStep.cs" />
<Compile Include="Providers\Executors\ActivateSweepGeneratorStep.cs" /> <Compile Include="Providers\Executors\ActivateSweepGeneratorStep.cs" />
<Compile Include="Providers\Executors\CommandStep.cs" /> <Compile Include="Providers\Executors\CommandStep.cs" />
<Compile Include="Providers\Executors\RemoveContentStep.cs" />
<Compile Include="Providers\Executors\RecipesStep.cs" /> <Compile Include="Providers\Executors\RecipesStep.cs" />
<Compile Include="ViewModels\ContentExecutionStepViewModel.cs" /> <Compile Include="ViewModels\ContentExecutionStepViewModel.cs" />
<Compile Include="Providers\Executors\ContentStep.cs" /> <Compile Include="Providers\Executors\ContentStep.cs" />

View File

@@ -0,0 +1,56 @@
using System;
using System.Linq;
using Orchard.ContentManagement;
using Orchard.Localization;
using Orchard.Logging;
using Orchard.Recipes.Models;
using Orchard.Recipes.Services;
namespace Orchard.Recipes.Providers.Executors {
public class RemoveContentStep : RecipeExecutionStep {
private readonly IContentManager _contentManager;
public RemoveContentStep(
RecipeExecutionLogger logger, IContentManager contentManager) : base(logger) {
_contentManager = contentManager;
}
public override string Name {
get { return "RemoveContent"; }
}
public override LocalizedString DisplayName {
get { return T("Remove Content"); }
}
public override LocalizedString Description {
get { return T("Removes a list of content items."); }
}
// <RemoveContent>
// <Page Id="{identifier}" />
// <BlogPost Id="{identifier}" />
// ...
// </RemoveContent>
public override void Execute(RecipeExecutionContext context) {
var identitiesQuery =
from element in context.RecipeStep.Step.Elements()
let id = element.Attr("Id")
where !String.IsNullOrWhiteSpace(id)
select new ContentIdentity(id);
foreach (var identity in identitiesQuery) {
Logger.Information("Removing content item with identity '{0}'...", identity);
var contentItem = _contentManager.ResolveIdentity(identity);
if (contentItem == null) {
Logger.Warning("No content item with identity '{0}' could be found.", identity);
continue;
}
_contentManager.Remove(contentItem);
Logger.Information("Content item with identity '{0}' was found with id '{1}' and has been successfully removed.", identity, contentItem.Id);
}
}
}
}

View File

@@ -47,8 +47,6 @@ namespace Orchard.Search.Controllers {
public ActionResult Index(PagerParameters pagerParameters, string part, string field, string searchText = "") { public ActionResult Index(PagerParameters pagerParameters, string part, string field, string searchText = "") {
var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters); var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
var searchSettingsPart = Services.WorkContext.CurrentSite.As<SearchSettingsPart>(); var searchSettingsPart = Services.WorkContext.CurrentSite.As<SearchSettingsPart>();
var searchIndex = searchSettingsPart.SearchIndex;
var searchFields = searchSettingsPart.GetSearchFields(searchSettingsPart.SearchIndex);
var totalCount = 0; var totalCount = 0;
var foundIds = new int[0]; var foundIds = new int[0];
@@ -66,6 +64,11 @@ namespace Orchard.Search.Controllers {
return View("NoIndex"); return View("NoIndex");
} }
var searchIndex = searchSettingsPart.SearchIndex;
if (settings != null && !String.IsNullOrEmpty(settings.SearchIndex))
searchIndex = settings.SearchIndex;
var searchFields = searchSettingsPart.GetSearchFields(searchIndex);
var builder = _indexManager.GetSearchIndexProvider().CreateSearchBuilder(searchIndex); var builder = _indexManager.GetSearchIndexProvider().CreateSearchBuilder(searchIndex);
try { try {
@@ -75,12 +78,12 @@ namespace Orchard.Search.Controllers {
var rawTypes = settings.DisplayedContentTypes.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList(); var rawTypes = settings.DisplayedContentTypes.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
var contentTypes = _contentDefinitionManager var contentTypes = _contentDefinitionManager
.ListTypeDefinitions() .ListTypeDefinitions()
.Where(x => x.Parts.Any(p => rawTypes.Contains(p.PartDefinition.Name))) .Where(x => x.Parts.Any(p => rawTypes.Contains(p.PartDefinition.Name)) || rawTypes.Contains(x.Name))
.ToArray(); .ToArray();
foreach (string type in contentTypes.Select(x => x.Name)) { foreach (string type in contentTypes.Select(x => x.Name)) {
builder.WithField("type", type).AsFilter(); builder.WithField("type", type).NotAnalyzed().AsFilter();
} }
} }

View File

@@ -34,7 +34,7 @@ namespace Orchard.Search.Controllers {
} }
if (!String.IsNullOrEmpty(mediaType)) { if (!String.IsNullOrEmpty(mediaType)) {
builder.WithField("type", mediaType).Mandatory().AsFilter(); builder.WithField("type", mediaType).NotAnalyzed().AsFilter();
} }
if (!String.IsNullOrEmpty(folderPath)) { if (!String.IsNullOrEmpty(folderPath)) {

View File

@@ -13,6 +13,20 @@ namespace Orchard.Search {
public IEnumerable<RouteDescriptor> GetRoutes() { public IEnumerable<RouteDescriptor> GetRoutes() {
return new[] { return new[] {
new RouteDescriptor {
Priority = 5,
Route = new Route("Search/ContentPicker",
new RouteValueDictionary {
{"area", "Orchard.Search"},
{"controller", "ContentPicker"},
{"action", "Index"}
},
null,
new RouteValueDictionary {
{"area", "Orchard.Search"}
},
new MvcRouteHandler())
},
new RouteDescriptor { new RouteDescriptor {
Priority = 5, Priority = 5,
Route = new Route("Search/{searchIndex}", Route = new Route("Search/{searchIndex}",

View File

@@ -146,11 +146,13 @@ namespace Orchard.Setup.Services {
// Make a workaround to avoid the Transaction issue for PostgreSQL // Make a workaround to avoid the Transaction issue for PostgreSQL
environment.Resolve<ITransactionManager>().RequireNew(); environment.Resolve<ITransactionManager>().RequireNew();
schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord", schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord", table => table
table => table .Column<int>("Id", column => column.PrimaryKey().Identity())
.Column<int>("Id", column => column.PrimaryKey().Identity()) .Column<string>("DataMigrationClass")
.Column<string>("DataMigrationClass") .Column<int>("Version"));
.Column<int>("Version"));
schemaBuilder.AlterTable("Orchard_Framework_DataMigrationRecord",
table => table.AddUniqueConstraint("UC_DMR_DataMigrationClass_Version", "DataMigrationClass", "Version"));
var dataMigrationManager = environment.Resolve<IDataMigrationManager>(); var dataMigrationManager = environment.Resolve<IDataMigrationManager>();
dataMigrationManager.Update("Settings"); dataMigrationManager.Update("Settings");

View File

@@ -193,7 +193,7 @@ namespace Orchard.Users.Controllers {
} }
if(String.IsNullOrWhiteSpace(username)){ if(String.IsNullOrWhiteSpace(username)){
ModelState.AddModelError("userNameOrEmail", T("Invalid username or E-mail.")); ModelState.AddModelError("username", T("You must specify a username or e-mail."));
return View(); return View();
} }

View File

@@ -69,7 +69,7 @@ namespace Orchard.Widgets.Controllers {
} }
LayerPart currentLayer = layerId == null LayerPart currentLayer = layerId == null
? layers.FirstOrDefault() ? layers.FirstOrDefault(layer => layer.Name == "Default") ?? layers.FirstOrDefault()
: layers.FirstOrDefault(layer => layer.Id == layerId); : layers.FirstOrDefault(layer => layer.Id == layerId);
if (currentLayer == null && layerId != null) { // Incorrect layer id passed if (currentLayer == null && layerId != null) { // Incorrect layer id passed

View File

@@ -1,11 +0,0 @@
--- CommandBackgroundService.cs
+++ CommandBackgroundService.cs
@@ -1,7 +1,7 @@
using Orchard.Tasks;
namespace Orchard.Commands {
- public class CommandBackgroundService : IBackgroundService {
+ class CommandBackgroundService : IBackgroundService {
public void Sweep() {
// Don't run any background service in command line
}

View File

@@ -64,5 +64,14 @@ namespace Orchard.ContentManagement.DataMigrations {
return 3; return 3;
} }
public int UpdateFrom3() {
SchemaBuilder.AlterTable("ContentItemVersionRecord", table => {
table.AddUniqueConstraint("UC_CIVR_CIRId_Number", "ContentItemRecord_id", "Number");
table.AddUniqueConstraint("UC_CIVR_CIRId_Published", "ContentItemRecord_id", "Published");
table.AddUniqueConstraint("UC_CIVR_CIRId_Latest", "ContentItemRecord_id", "Latest");
});
return 4;
}
} }
} }

View File

@@ -125,41 +125,54 @@ namespace Orchard.Data.Migration.Interpreters {
return; return;
} }
// drop columns // Drop columns.
foreach (var dropColumn in command.TableCommands.OfType<DropColumnCommand>()) { foreach (var dropColumn in command.TableCommands.OfType<DropColumnCommand>()) {
var builder = new StringBuilder(); var builder = new StringBuilder();
Visit(builder, dropColumn); Visit(builder, dropColumn);
RunPendingStatements(); RunPendingStatements();
} }
// add columns // Add columns.
foreach (var addColumn in command.TableCommands.OfType<AddColumnCommand>()) { foreach (var addColumn in command.TableCommands.OfType<AddColumnCommand>()) {
var builder = new StringBuilder(); var builder = new StringBuilder();
Visit(builder, addColumn); Visit(builder, addColumn);
RunPendingStatements(); RunPendingStatements();
} }
// alter columns // Alter columns.
foreach (var alterColumn in command.TableCommands.OfType<AlterColumnCommand>()) { foreach (var alterColumn in command.TableCommands.OfType<AlterColumnCommand>()) {
var builder = new StringBuilder(); var builder = new StringBuilder();
Visit(builder, alterColumn); Visit(builder, alterColumn);
RunPendingStatements(); RunPendingStatements();
} }
// add index // Add index.
foreach (var addIndex in command.TableCommands.OfType<AddIndexCommand>()) { foreach (var addIndex in command.TableCommands.OfType<AddIndexCommand>()) {
var builder = new StringBuilder(); var builder = new StringBuilder();
Visit(builder, addIndex); Visit(builder, addIndex);
RunPendingStatements(); RunPendingStatements();
} }
// drop index // Drop index.
foreach (var dropIndex in command.TableCommands.OfType<DropIndexCommand>()) { foreach (var dropIndex in command.TableCommands.OfType<DropIndexCommand>()) {
var builder = new StringBuilder(); var builder = new StringBuilder();
Visit(builder, dropIndex); Visit(builder, dropIndex);
RunPendingStatements(); RunPendingStatements();
} }
// Add unique constraint.
foreach (var addUniqueConstraint in command.TableCommands.OfType<AddUniqueConstraintCommand>()) {
var builder = new StringBuilder();
Visit(builder, addUniqueConstraint);
RunPendingStatements();
}
// Drop unique constraint.
foreach (var dropUniqueConstraint in command.TableCommands.OfType<DropUniqueConstraintCommand>()) {
var builder = new StringBuilder();
Visit(builder, dropUniqueConstraint);
RunPendingStatements();
}
} }
public void Visit(StringBuilder builder, AddColumnCommand command) { public void Visit(StringBuilder builder, AddColumnCommand command) {
@@ -210,7 +223,6 @@ namespace Orchard.Data.Migration.Interpreters {
_sqlStatements.Add(builder.ToString()); _sqlStatements.Add(builder.ToString());
} }
public void Visit(StringBuilder builder, AddIndexCommand command) { public void Visit(StringBuilder builder, AddIndexCommand command) {
if (ExecuteCustomInterpreter(command)) { if (ExecuteCustomInterpreter(command)) {
return; return;
@@ -235,6 +247,31 @@ namespace Orchard.Data.Migration.Interpreters {
_sqlStatements.Add(builder.ToString()); _sqlStatements.Add(builder.ToString());
} }
public void Visit(StringBuilder builder, AddUniqueConstraintCommand command) {
if (ExecuteCustomInterpreter(command)) {
return;
}
builder.AppendFormat("alter table {0} add constraint {1} unique ({2})",
_dialectLazy.Value.QuoteForTableName(PrefixTableName(command.TableName)),
_dialectLazy.Value.QuoteForColumnName(PrefixTableName(command.ConstraintName)),
String.Join(", ", command.ColumnNames));
_sqlStatements.Add(builder.ToString());
}
public void Visit(StringBuilder builder, DropUniqueConstraintCommand command) {
if (ExecuteCustomInterpreter(command)) {
return;
}
builder.AppendFormat("alter table {0} drop constraint {1}",
_dialectLazy.Value.QuoteForTableName(PrefixTableName(command.TableName)),
_dialectLazy.Value.QuoteForColumnName(PrefixTableName(command.ConstraintName)));
_sqlStatements.Add(builder.ToString());
}
public override void Visit(SqlStatementCommand command) { public override void Visit(SqlStatementCommand command) {
if (command.Providers.Count != 0 && !command.Providers.Contains(_shellSettings.DataProvider)) { if (command.Providers.Count != 0 && !command.Providers.Contains(_shellSettings.DataProvider)) {
return; return;

View File

@@ -0,0 +1,13 @@
namespace Orchard.Data.Migration.Schema {
public class AddUniqueConstraintCommand : TableCommand {
public string ConstraintName { get; set; }
public AddUniqueConstraintCommand(string tableName, string constraintName, params string[] columnNames)
: base(tableName) {
ColumnNames = columnNames;
ConstraintName = constraintName;
}
public string[] ColumnNames { get; private set; }
}
}

View File

@@ -47,5 +47,15 @@ namespace Orchard.Data.Migration.Schema {
var command = new DropIndexCommand(Name, indexName); var command = new DropIndexCommand(Name, indexName);
TableCommands.Add(command); TableCommands.Add(command);
} }
public void AddUniqueConstraint(string constraintName, params string[] columnNames) {
var command = new AddUniqueConstraintCommand(Name, constraintName, columnNames);
TableCommands.Add(command);
}
public void DropUniqueConstraint(string constraintName) {
var command = new DropUniqueConstraintCommand(Name, constraintName);
TableCommands.Add(command);
}
} }
} }

View File

@@ -0,0 +1,10 @@
namespace Orchard.Data.Migration.Schema {
public class DropUniqueConstraintCommand : TableCommand {
public string ConstraintName { get; set; }
public DropUniqueConstraintCommand(string tableName, string constraintName)
: base(tableName) {
ConstraintName = constraintName;
}
}
}

View File

@@ -7,13 +7,20 @@ using System.Threading.Tasks;
namespace Orchard.Environment.Configuration { namespace Orchard.Environment.Configuration {
public class AppConfigurationAccessor : IAppConfigurationAccessor { public class AppConfigurationAccessor : IAppConfigurationAccessor {
private readonly ShellSettings _shellSettings;
public AppConfigurationAccessor(ShellSettings shellSettings) {
_shellSettings = shellSettings;
}
public string GetConfiguration(string name) { public string GetConfiguration(string name) {
var appSettingsValue = ConfigurationManager.AppSettings[name]; var tenantName = String.Format("{0}:{1}", _shellSettings.Name, name);
var appSettingsValue = ConfigurationManager.AppSettings[tenantName] ?? ConfigurationManager.AppSettings[name];
if (appSettingsValue != null) { if (appSettingsValue != null) {
return appSettingsValue; return appSettingsValue;
} }
var connectionStringSettings = ConfigurationManager.ConnectionStrings[name]; var connectionStringSettings = ConfigurationManager.ConnectionStrings[tenantName] ?? ConfigurationManager.ConnectionStrings[name];
if (connectionStringSettings != null) { if (connectionStringSettings != null) {
return connectionStringSettings.ConnectionString; return connectionStringSettings.ConnectionString;
} }

View File

@@ -238,8 +238,17 @@ namespace Orchard.Localization.Services {
if (!m.Groups["amPm"].Success) { if (!m.Groups["amPm"].Success) {
throw new FormatException("The string was not recognized as a valid time. The hour is in 12-hour notation but no AM/PM designator was found."); throw new FormatException("The string was not recognized as a valid time. The hour is in 12-hour notation but no AM/PM designator was found.");
} }
var isPm = m.Groups["amPm"].Value.Equals(_dateTimeFormatProvider.AmPmDesignators[1], StringComparison.InvariantCultureIgnoreCase);
hour = ConvertToHour24(Int32.Parse(m.Groups["hour12"].Value), isPm); var hour12 = Int32.Parse(m.Groups["hour12"].Value);
var isPm = false;
// Fix for some cultures on Windows 10 where both designators for some reason are empty strings.
if (_dateTimeFormatProvider.AmPmDesignators[0] == _dateTimeFormatProvider.AmPmDesignators[1])
isPm = hour12 >= 12;
else
isPm = m.Groups["amPm"].Value.Equals(_dateTimeFormatProvider.AmPmDesignators[1], StringComparison.InvariantCultureIgnoreCase);
hour = ConvertToHour24(hour12, isPm);
} }
if (m.Groups["minute"].Success) { if (m.Groups["minute"].Success) {

View File

@@ -149,6 +149,8 @@
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Data\Migration\Schema\AddUniqueConstraintCommand.cs" />
<Compile Include="Data\Migration\Schema\DropUniqueConstraintCommand.cs" />
<Compile Include="Environment\Extensions\Models\LifecycleStatus.cs" /> <Compile Include="Environment\Extensions\Models\LifecycleStatus.cs" />
<Compile Include="Environment\ShellBuilders\ICompositionStrategy.cs" /> <Compile Include="Environment\ShellBuilders\ICompositionStrategy.cs" />
<Compile Include="Mvc\Updater.cs" /> <Compile Include="Mvc\Updater.cs" />