Merge branch '1.10.x' into dev

# Conflicts:
#	src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/HiddenFieldElementDriver.cs
#	src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs
#	src/Orchard.Web/Modules/Orchard.Fields/Drivers/NumericFieldDriver.cs
#	src/Orchard.Web/Modules/Orchard.MediaLibrary/Drivers/MediaLibraryPickerFieldDriver.cs
This commit is contained in:
Sipke Schoorstra
2016-10-04 10:35:32 +02:00
26 changed files with 77 additions and 64 deletions

3
.gitignore vendored
View File

@@ -68,6 +68,9 @@ ipch/
_ReSharper*/
*.[Rr]e[Ss]harper
# CodeRush is a .NET coding add-in
.cr*/
# TeamCity is a build add-in
_TeamCity*

View File

@@ -63,8 +63,8 @@
<span class="hint">@T("Determines whether scripts and stylesheets load in their debuggable or minified form.")</span>
</div>
<div>
@Html.LabelFor(m => m.UseCdn, T("Use CDN"))
@Html.CheckBoxFor(m => m.UseCdn)
@Html.LabelFor(m => m.UseCdn, T("Use CDN").Text, new { @class = "forcheckbox" })
<span class="hint">@T("Determines whether the defined CDN value is used for scripts and stylesheets, or their local version")</span>
</div>
<div>
@@ -84,4 +84,4 @@
<span class="hint">@T("Determines the last element of the database that can be displayed. Leave 0 for unlimited.")</span>
</div>
}
</fieldset>
</fieldset>

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Orchard.ContentManagement.MetaData;
namespace Orchard.ContentTypes.ViewModels {
@@ -11,19 +10,16 @@ namespace Orchard.ContentTypes.ViewModels {
/// <summary>
/// The technical name of the field
/// </summary>
[Required]
public string Name { get; set; }
/// <summary>
/// The display name of the field
/// </summary>
[Required]
public string DisplayName { get; set; }
/// <summary>
/// The selected field type
/// </summary>
[Required]
public string FieldTypeName { get; set; }
/// <summary>

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Orchard.ContentManagement.MetaData;
namespace Orchard.ContentTypes.ViewModels {
@@ -12,7 +11,6 @@ namespace Orchard.ContentTypes.ViewModels {
/// <summary>
/// The display name of the field
/// </summary>
[Required]
public string DisplayName { get; set; }
}
}

View File

@@ -4,17 +4,19 @@
Style.Require("ContentTypesAdmin");
Layout.Title = T("Add New Field To \"{0}\"", Model.Part.DisplayName).ToString();
var returnUrl = Request.QueryString["returnUrl"];
}
@using (Html.BeginFormAntiForgeryPost()) {
@Html.ValidationSummary()
<fieldset>
<label for="DisplayName">@T("Display Name")</label>
<label for="DisplayName" class="required">@T("Display Name")</label>
@Html.TextBoxFor(m => m.DisplayName, new {@class = "text medium", autofocus = "autofocus"})
<span class="hint">@T("Name of the field as it will be displayed in screens.")</span>
<label for="Name">@T("Technical Name")</label>
<label for="Name" class="required">@T("Technical Name")</label>
@Html.TextBoxFor(m => m.Name, new {@class = "text"})
<span class="hint">@T("Technical name of the field.")</span>
<span class="hint">@T("Technical name of the field.")</span>
</fieldset>
<fieldset>
<label for="FieldTypeName">@T("Field Type")</label>
@@ -22,6 +24,9 @@
</fieldset>
<fieldset>
<button class="primaryAction" type="submit">@T("Save")</button>
@if (!String.IsNullOrWhiteSpace(returnUrl) && Request.IsLocalUrl(returnUrl)) {
<a id="button-cancel" href="@returnUrl" class="button">@T("Cancel")</a>
}
</fieldset>
}

View File

@@ -1,8 +1,10 @@
@using Orchard.Utility.Extensions;
@model Orchard.ContentTypes.ViewModels.EditTypeViewModel
@{
Style.Require("ContentTypesAdmin");
Script.Require("jQuery");
Layout.Title = T("Edit Content Type - {0}", Html.Raw(Model.DisplayName)).Text;
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
}
<div class="manage">
@@ -27,7 +29,7 @@
<div class="manage-type">
<h2>@T("Fields")</h2>
<div class="manage add-to-type">
@Html.ActionLink(T("Add Field").Text, "AddFieldTo", new { area = "Orchard.ContentTypes", id = Model.Name }, new { @class = "button" })
@Html.ActionLink(T("Add Field").Text, "AddFieldTo", new { area = "Orchard.ContentTypes", id = Model.Name, returnUrl }, new { @class = "button" })
</div>
@Html.EditorFor(m => m.Fields, "Fields", "")
<h2>@T("Parts")</h2>

View File

@@ -4,12 +4,14 @@
Style.Require("ContentTypesAdmin");
Layout.Title = T("Edit Field \"{0}\"", Html.Raw(Model.DisplayName)).ToString();
var returnUrl = Request.QueryString["returnUrl"];
}
@using (Html.BeginFormAntiForgeryPost()) {
@Html.ValidationSummary()
<fieldset>
<label for="DisplayName">@T("Display Name")</label>
<label for="DisplayName" class="required">@T("Display Name")</label>
@Html.TextBoxFor(m => m.DisplayName, new {@class = "text medium", autofocus = "autofocus"})
<span class="hint">@T("Name of the field as it will be displayed in screens.")</span>
@@ -17,5 +19,8 @@
</fieldset>
<fieldset>
<button class="primaryAction" type="submit" name="submit.Save" value="Save">@T("Save")</button>
@if (!String.IsNullOrWhiteSpace(returnUrl) && Request.IsLocalUrl(returnUrl)) {
<a id="button-cancel" href="@returnUrl" class="button">@T("Cancel")</a>
}
</fieldset>
}

View File

@@ -1,13 +1,16 @@
@using Orchard.Utility.Extensions
@model Orchard.ContentTypes.ViewModels.EditPartFieldViewModel
<fieldset class="manage-field">
<h3>@Model.DisplayName <span>(@Model.FieldDefinition.Name.CamelFriendly())</span></h3>
<div class="manage">
@Html.ActionLink(T("Edit").Text, "EditField", new { area = "Orchard.ContentTypes", id = Model.Part.Name, Model.Name }) |
@Html.ActionLink(T("Remove").Text, "RemoveFieldFrom", new { area = "Orchard.ContentTypes", id = Model.Part.Name, Model.Name }, new { itemprop = "RemoveUrl UnsafeUrl" })
</div>
<div class="details">
@{Html.RenderTemplates(Model.Templates);}
@Html.HiddenFor(m => m.Name)@Html.HiddenFor(m => m.FieldDefinition.Name)@Html.HiddenFor(m => m.Index)
</div>
</fieldset>
@{
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
}
<fieldset class="manage-field">
<h3>@Model.DisplayName <span>(@Model.FieldDefinition.Name.CamelFriendly())</span></h3>
<div class="manage">
@Html.ActionLink(T("Edit").Text, "EditField", new { area = "Orchard.ContentTypes", id = Model.Part.Name, Model.Name, returnUrl }) |
@Html.ActionLink(T("Remove").Text, "RemoveFieldFrom", new { area = "Orchard.ContentTypes", id = Model.Part.Name, Model.Name }, new { itemprop = "RemoveUrl UnsafeUrl" })
</div>
<div class="details">
@{Html.RenderTemplates(Model.Templates);}
@Html.HiddenFor(m => m.Name)@Html.HiddenFor(m => m.FieldDefinition.Name)@Html.HiddenFor(m => m.Index)
</div>
</fieldset>

View File

@@ -32,7 +32,7 @@ namespace Orchard.DynamicForms.Drivers {
Id: "Value",
Name: "Value",
Title: "Value",
Classes: new[] { "text", "large", "tokenized" },
Classes: new[] { "text", "large" },
Description: T("The value of this checkbox.")));
return form;

View File

@@ -31,7 +31,7 @@ namespace Orchard.DynamicForms.Drivers {
Id: "Value",
Name: "Value",
Title: "Value",
Classes: new[] { "text", "medium", "tokenized" },
Classes: new[] { "text", "medium" },
Description: T("The value of this email field.")));
return form;

View File

@@ -27,7 +27,7 @@ namespace Orchard.DynamicForms.Drivers {
Id: "Value",
Name: "Value",
Title: "Value",
Classes: new[] { "text", "medium", "tokenized" },
Classes: new[] { "text", "medium" },
Description: T("The value of this hidden field.")));
return form;
@@ -40,7 +40,7 @@ namespace Orchard.DynamicForms.Drivers {
// Allow the initial value to be tokenized.
// If a value was posted, use that value instead (without tokenizing it).
context.ElementShape.ProcessedValue = element.PostedValue != null ? element.PostedValue : _tokenizer.Replace(element.RuntimeValue, tokenData, new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
context.ElementShape.ProcessedValue = element.PostedValue != null ? element.PostedValue : _tokenizer.Replace(element.RuntimeValue ?? "", tokenData, new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
}
}
}
}

View File

@@ -30,7 +30,7 @@ namespace Orchard.DynamicForms.Drivers {
Id: "Value",
Name: "Value",
Title: "Value",
Classes: new[] { "text", "large", "tokenized" },
Classes: new[] { "text", "large" },
Description: T("The value of this text area.")),
_Rows: shape.Textbox(
Id: "Rows",

View File

@@ -31,7 +31,7 @@ namespace Orchard.DynamicForms.Drivers {
Id: "Value",
Name: "Value",
Title: "Value",
Classes: new[] { "text", "medium", "tokenized" },
Classes: new[] { "text", "medium" },
Description: T("The value of this text field.")));
return form;

View File

@@ -31,7 +31,7 @@ namespace Orchard.DynamicForms.Drivers {
Id: "Value",
Name: "Value",
Title: "Value",
Classes: new[] {"text", "medium", "tokenized"},
Classes: new[] { "text", "medium" },
Description: T("The value of this URL field.")));
return form;

View File

@@ -5,7 +5,7 @@
var settings = Model.PartFieldDefinition.Settings.GetModel<BooleanFieldSettings>();
}
<fieldset>
<label for="@Html.FieldIdFor(m => m.Value)">@Model.DisplayName</label>
<label for="@Html.FieldIdFor(m => m.Value)" @if (!settings.Optional) { <text> class="required" </text> }>@Model.DisplayName</label>
@switch (settings.SelectionMode) {
case SelectionMode.Checkbox:
<input type="checkbox" id="@(Html.FieldIdFor(m => m.Value))" value="true" name="@Html.FieldNameFor(m => m.Value)" @if(Model.Value.HasValue && Model.Value.Value) { <text>checked="checked"</text> } /><input name="@Html.FieldNameFor(m => m.Value)" type="hidden" value="false" />

View File

@@ -1,4 +1,4 @@
/* Reset
/* Reset
***************************************************************/
html, body, div, span, applet, object, iframe,
@@ -335,7 +335,7 @@ button:hover, .button:hover, a.button:hover {
background: -moz-linear-gradient(top, rgba(110, 127, 69, 1.0), rgba(106, 123, 66, 1.0));
}
button:active, .buton:active, a.button:active {
button:active, .button:active, a.button:active {
text-decoration:none;
background:#6a7b42;
border:1px solid #487328;

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
@@ -52,20 +52,18 @@ namespace Orchard.Layouts.Providers {
}
private IEnumerable<Tuple<ContentPartDefinition, ContentPartFieldDefinition>> GetContentFieldTuples(HarvestElementsContext context) {
var contentTypeDefinition = context.Content != null
? _contentDefinitionManager.Value.GetTypeDefinition(context.Content.ContentItem.ContentType)
: default(ContentTypeDefinition);
var parts = contentTypeDefinition != null
? contentTypeDefinition.Parts.Select(x => x.PartDefinition)
: _contentDefinitionManager.Value.ListPartDefinitions();
// If there is no content item provided as context, there are no fields made available.
if (context.Content == null)
return Enumerable.Empty<Tuple<ContentPartDefinition, ContentPartFieldDefinition>>();
var contentTypeDefinition = _contentDefinitionManager.Value.GetTypeDefinition(context.Content.ContentItem.ContentType);
var parts = contentTypeDefinition.Parts.Select(x => x.PartDefinition);
var fields = parts.SelectMany(part => part.Fields.Select(field => Tuple.Create(part, field)));
// TODO: Each module should be able to tell which fields are supported as droppable elements.
var blackList = new string[0];
return fields.Where(t => blackList.All(x => t.Item2.FieldDefinition.Name != x));
return fields.Where(t => blackList.All(x => t.Item2.FieldDefinition.Name != x)).ToList();
}
private void Displaying(ElementDisplayingContext context) {
@@ -88,4 +86,4 @@ namespace Orchard.Layouts.Providers {
context.ElementShape.ContentField = contentFieldShape;
}
}
}
}

View File

@@ -760,7 +760,7 @@ button:hover, .button:hover, a.button:hover {
background: -moz-linear-gradient(top, rgba(110, 127, 69, 1.0), rgba(106, 123, 66, 1.0));
}
button:active, .buton:active, a.button:active {
button:active, .button:active, a.button:active {
text-decoration:none;
background:#6a7b42;
border:1px solid #487328;

View File

@@ -345,7 +345,7 @@
-ms-text-overflow: ellipsis;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
text-wrap: none;
white-space: nowrap;
}
.media-library-main-list-overlay .publication-status {

View File

@@ -42,7 +42,7 @@
<div class="thumbnail" data-bind="html: data.thumbnail">
</div>
<div class="media-library-main-list-overlay">
<p class="title" data-bind="text: data.title"></p>
<p class="title" data-bind="text: data.title, attr: { title: data.title }"></p>
<p class="publication-status" data-bind="text: publicationStatus"></p>
</div>
</li>

View File

@@ -11,13 +11,14 @@
<IsSetupRecipe>true</IsSetupRecipe>
</Recipe>
<Feature enable="Orchard.Blogs,Orchard.Comments,Orchard.Tags,Orchard.Alias,Orchard.Autoroute,
<Feature enable="Orchard.Blogs,Orchard.Comments,Orchard.Tags,Orchard.Tags.TagCloud,Orchard.Alias,Orchard.Autoroute,
XmlRpc,Orchard.Blogs.RemotePublishing,Orchard.ContentPicker,
TinyMce,Orchard.MediaLibrary,Orchard.PublishLater,
Orchard.Resources,Orchard.Widgets,
Orchard.Resources,Orchard.Widgets,Orchard.ContentTypes,
Orchard.Scripting,Orchard.Scripting.Lightweight,
PackagingServices,Orchard.Packaging,Orchard.Warmup,Orchard.OutputCache,
Orchard.Taxonomies,Orchard.Workflows,
Orchard.Layouts,Orchard.Fields,
TheThemeMachine" />
<ContentDefinition>
@@ -55,9 +56,9 @@
layer create Anonymous /LayerRule:"not authenticated" /Description:"The widgets in this layer are displayed when the user is anonymous"
layer create Disabled /LayerRule:"false" /Description:"The widgets in this layer are never displayed"
layer create TheHomepage /LayerRule:"url '~/'" /Description:"The widgets in this layer are displayed on the home page"
widget create HtmlWidget /Title:"First Leader Aside" /Zone:"TripelFirst" /Position:"5" /Layer:"TheHomepage" /Identity:"SetupHtmlWidget1" /UseLoremIpsumText:true
widget create HtmlWidget /Title:"Second Leader Aside" /Zone:"TripelSecond" /Position:"5" /Layer:"TheHomepage" /Identity:"SetupHtmlWidget2" /UseLoremIpsumText:true
widget create HtmlWidget /Title:"Third Leader Aside" /Zone:"TripelThird" /Position:"5" /Layer:"TheHomepage" /Identity:"SetupHtmlWidget3" /UseLoremIpsumText:true
widget create RecentBlogPosts /Title:"Recent Blog Posts" /Zone:"AsideSecond" /Position:"5" /Layer:"TheHomepage" /Identity:"RecentBlogPosts1"
widget create BlogArchives /Title:"Blog Archives" /Zone:"AsideSecond" /Position:"6" /Layer:"TheHomepage" /Identity:"BlogArchives1"
widget create TagCloud /Title:"Blog Post Tags" /Zone:"AsideSecond" /Position:"7" /Layer:"TheHomepage" /Identity:"TagCloud1"
site setting set baseurl
theme activate "The Theme Machine"
menu create /MenuName:"Main Menu"
@@ -65,4 +66,4 @@
menuitem create /MenuPosition:"0" /MenuText:"Home" /Url:"~/" /MenuName:"Main Menu"
widget create MenuWidget /Title:"Main Menu" /RenderTitle:false /Zone:"Navigation" /Position:"1" /Layer:"Default" /Identity:"MenuWidget1" /MenuName:"Main Menu"
</Command>
</Orchard>
</Orchard>

View File

@@ -39,7 +39,7 @@ namespace Orchard.Tags.Services {
public Localizer T { get; set; }
public IEnumerable<TagRecord> GetTags() {
return _tagRepository.Table.ToList();
return _tagRepository.Table.OrderBy(x => x.TagName).ToList();
}
public IEnumerable<TagRecord> GetTagsByNameSnippet(string snippet, int maxCount = 10) {

View File

@@ -81,7 +81,7 @@ namespace Orchard.Templates.Drivers {
return true;
}
updater.AddModelError("Title", T("{0} names can only contain alphanumerical or underscore (_) characters and have to start with a letter.", part.ContentItem.TypeDefinition.DisplayName));
updater.AddModelError("Title", T("{0} names can only contain alphanumerical or underscore (_) characters and have to start with a letter.", T(part.ContentItem.TypeDefinition.DisplayName)));
return false;
}

View File

@@ -239,7 +239,7 @@ button:hover, .button:hover, a.button:hover {
background: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(110, 127, 69, 1.0)), to(rgba(106, 123, 66, 1.0)));
background: -moz-linear-gradient(top, rgba(110, 127, 69, 1.0), rgba(106, 123, 66, 1.0));
}
button:active, .buton:active, a.button:active {
button:active, .button:active, a.button:active {
text-decoration:none;
background:#6a7b42;
border:1px solid #487328;
@@ -341,4 +341,4 @@ span.message {
}
.debug.message:before {
content:"DEBUG » ";
}
}

View File

@@ -780,7 +780,7 @@ button:hover, .button:hover, a.button:hover {
background: -moz-linear-gradient(top, rgba(110, 127, 69, 1.0), rgba(106, 123, 66, 1.0));
}
button:active, .buton:active, a.button:active {
button:active, .button:active, a.button:active {
text-decoration:none;
background:#6a7b42;
border:1px solid #487328;

View File

@@ -56,12 +56,14 @@ namespace Orchard.Environment {
var appBuilder = new AppBuilder();
appBuilder.Properties["host.AppName"] = _shellSettings.Name;
var orderedMiddlewares = _owinMiddlewareProviders
.SelectMany(p => p.GetOwinMiddlewares())
.OrderBy(obj => obj.Priority, new FlatPositionComparer());
using (var scope = _workContextAccessor.CreateWorkContextScope()) {
var orderedMiddlewares = _owinMiddlewareProviders
.SelectMany(p => p.GetOwinMiddlewares())
.OrderBy(obj => obj.Priority, new FlatPositionComparer());
foreach (var middleware in orderedMiddlewares) {
middleware.Configure(appBuilder);
foreach (var middleware in orderedMiddlewares) {
middleware.Configure(appBuilder);
}
}
// Register the Orchard middleware after all others.