Merge branch '1.9.x' into dev

Conflicts:
 src/Orchard.Web/Modules/Orchard.Autoroute/Drivers/AutoroutePartDriver.cs
 src/Orchard.Web/Modules/Orchard.Autoroute/Views/EditorTemplates/Parts.Autoroute.Edit.cshtml
 src/Orchard.Web/Modules/Orchard.DynamicForms/Migrations.cs
 src/Orchard.Web/Modules/Orchard.DynamicForms/Views/Elements/ValidationMessage.Design.cshtml
 src/Orchard.Web/Modules/Orchard.DynamicForms/Views/Elements/ValidationSummary.Design.cshtml
 src/Orchard.Web/Modules/Orchard.DynamicForms/Web.config
 src/Orchard.Web/Modules/Orchard.Layouts/Drivers/LayoutPartDriver.cs
 src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj
 src/Orchard.Web/Modules/Orchard.Layouts/Scripts/LayoutEditor.js
 src/Orchard.Web/Modules/Orchard.Layouts/Scripts/LayoutEditor.min.js
 src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.js
 src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.min.js
 src/Orchard.Web/Modules/Orchard.Layouts/Styles/LayoutEditor.css
 src/Orchard.Web/Modules/Orchard.Layouts/Styles/LayoutEditor.min.css
 src/Orchard.Web/Modules/Orchard.Layouts/Views/Elements/Shape.Design.cshtml
 src/Orchard.Web/Modules/Orchard.Layouts/Web.config
This commit is contained in:
Sipke Schoorstra
2015-07-04 14:27:04 +02:00
parent bbf6700e1a
commit b37951e205
37 changed files with 228 additions and 457 deletions

View File

@@ -18,7 +18,7 @@
</appSettings> </appSettings>
<system.web.webPages.razor> <system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage"> <pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
<namespaces> <namespaces>
<add namespace="System.Collections.Generic"/> <add namespace="System.Collections.Generic"/>
@@ -60,7 +60,7 @@
<add extension=".csproj" type="Orchard.Environment.Extensions.Compilers.CSharpExtensionBuildProviderShim"/> <add extension=".csproj" type="Orchard.Environment.Extensions.Compilers.CSharpExtensionBuildProviderShim"/>
</buildProviders> </buildProviders>
<assemblies> <assemblies>
<add assembly="System.Web.Mvc, Version=5..0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/> <add assembly="System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/> <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/> <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
@@ -147,7 +147,7 @@
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0"/> <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
@@ -171,11 +171,11 @@
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral"/> <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0"/> <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral"/> <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0"/> <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral"/> <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral"/>

View File

@@ -6,6 +6,7 @@ using Orchard.DynamicForms.Services;
using Orchard.Layouts.Services; using Orchard.Layouts.Services;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Logging; using Orchard.Logging;
using Orchard.Services;
using Orchard.Tokens; using Orchard.Tokens;
using Orchard.UI.Notify; using Orchard.UI.Notify;
using Orchard.Utility.Extensions; using Orchard.Utility.Extensions;
@@ -17,17 +18,20 @@ namespace Orchard.DynamicForms.Controllers {
private readonly ILayoutManager _layoutManager; private readonly ILayoutManager _layoutManager;
private readonly IFormService _formService; private readonly IFormService _formService;
private readonly ITokenizer _tokenizer; private readonly ITokenizer _tokenizer;
private readonly IClock _clock;
public FormController( public FormController(
INotifier notifier, INotifier notifier,
ILayoutManager layoutManager, ILayoutManager layoutManager,
IFormService formService, IFormService formService,
ITokenizer tokenizer) { ITokenizer tokenizer,
IClock clock) {
_notifier = notifier; _notifier = notifier;
_layoutManager = layoutManager; _layoutManager = layoutManager;
_formService = formService; _formService = formService;
_tokenizer = tokenizer; _tokenizer = tokenizer;
_clock = clock;
T = NullLocalizer.Instance; T = NullLocalizer.Instance;
Logger = NullLogger.Instance; Logger = NullLogger.Instance;
} }
@@ -36,10 +40,11 @@ namespace Orchard.DynamicForms.Controllers {
public ILogger Logger { get; set; } public ILogger Logger { get; set; }
[HttpPost] [HttpPost]
[ValidateInput(false)]
public ActionResult Submit(int contentId, string formName) { public ActionResult Submit(int contentId, string formName) {
var layoutPart = _layoutManager.GetLayout(contentId); var layoutPart = _layoutManager.GetLayout(contentId);
var form = _formService.FindForm(layoutPart, formName); var form = _formService.FindForm(layoutPart, formName);
var urlReferrer = Request.UrlReferrer != null && Url.IsLocalUrl(Request.UrlReferrer.ToString()) ? Request.UrlReferrer.ToString() : "~/"; var urlReferrer = Request.UrlReferrer != null ? Request.UrlReferrer.LocalPath : "~/";
if (form == null) { if (form == null) {
Logger.Warning("The specified form \"{0}\" could not be found.", formName); Logger.Warning("The specified form \"{0}\" could not be found.", formName);
@@ -50,8 +55,12 @@ namespace Orchard.DynamicForms.Controllers {
var values = _formService.SubmitForm(layoutPart, form, ValueProvider, ModelState, this); var values = _formService.SubmitForm(layoutPart, form, ValueProvider, ModelState, this);
this.TransferFormSubmission(form, values); this.TransferFormSubmission(form, values);
if (!ModelState.IsValid) if (!ModelState.IsValid) {
return Redirect(urlReferrer); // We need a way to inform the output cache filter to not cache the upcoming request.
var epoch = new DateTime(2014, DateTimeKind.Utc).Ticks;
var refresh = _clock.UtcNow.Ticks - epoch;
return Redirect(urlReferrer + "?__r=" + refresh);
}
if(Response.IsRequestBeingRedirected) if(Response.IsRequestBeingRedirected)
return new EmptyResult(); return new EmptyResult();

View File

@@ -78,12 +78,19 @@ namespace Orchard.DynamicForms.Drivers {
Title: "Store Submission", Title: "Store Submission",
Value: "true", Value: "true",
Description: T("Stores the submitted form into the database.")), Description: T("Stores the submitted form into the database.")),
_HtmlEncode: shape.Checkbox(
Id: "HtmlEncode",
Name: "HtmlEncode",
Title: "Html Encode",
Value: "true",
Checked: true,
Description: T("Check this option to automatically HTML encode submitted values to prevent code injection.")),
_CreateContent: shape.Checkbox( _CreateContent: shape.Checkbox(
Id: "CreateContent", Id: "CreateContent",
Name: "CreateContent", Name: "CreateContent",
Title: "Create Content", Title: "Create Content",
Value: "true", Value: "true",
Description: T("Check this to create a content item based using the submitted values. You will have to select a Content Type here and bind the form fields to the various parts and fields of the selected Content Type.")), Description: T("Check this option to create a content item based using the submitted values. You will have to select a Content Type here and bind the form fields to the various parts and fields of the selected Content Type.")),
_ContentType: shape.SelectList( _ContentType: shape.SelectList(
Id: "FormBindingContentType", Id: "FormBindingContentType",
Name: "FormBindingContentType", Name: "FormBindingContentType",

View File

@@ -32,6 +32,11 @@ namespace Orchard.DynamicForms.Elements {
set { this.Store(x => x.StoreSubmission, value); } set { this.Store(x => x.StoreSubmission, value); }
} }
public bool HtmlEncode {
get { return this.Retrieve(x => x.HtmlEncode, () => true); }
set { this.Store(x => x.HtmlEncode, value); }
}
public bool? CreateContent { public bool? CreateContent {
get { return this.Retrieve(x => x.CreateContent); } get { return this.Retrieve(x => x.CreateContent); }
set { this.Store(x => x.CreateContent, value); } set { this.Store(x => x.CreateContent, value); }

View File

@@ -5,6 +5,27 @@ using Orchard.Data.Migration;
namespace Orchard.DynamicForms { namespace Orchard.DynamicForms {
public class Migrations : DataMigrationImpl { public class Migrations : DataMigrationImpl {
private const string DefaultFormLayoutData =
@"{
""elements"": [
{
""typeName"": ""Orchard.Layouts.Elements.Canvas"",
""elements"": [
{
""typeName"": ""Orchard.DynamicForms.Elements.Form"",
""data"": ""FormName=Untitled&amp;FormAction=&amp;FormMethod=POST&amp;FormBindingContentType=&amp;Publication=Draft&amp;Notification=&amp;RedirectUrl="",
""elements"": [
{
""typeName"": ""Orchard.DynamicForms.Elements.Button"",
""data"": ""InputName=&amp;FormBindingContentType=&amp;Text=Submit""
}
]
}
]
}
]
}";
public int Create() { public int Create() {
SchemaBuilder.CreateTable("Submission", table => table SchemaBuilder.CreateTable("Submission", table => table
.Column<int>("Id", c => c.PrimaryKey().Identity()) .Column<int>("Id", c => c.PrimaryKey().Identity())
@@ -23,23 +44,7 @@ namespace Orchard.DynamicForms {
.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False")
.WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-form\"}]")) .WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-form\"}]"))
.WithPart("LayoutPart", p => p .WithPart("LayoutPart", p => p
.WithSetting("LayoutTypePartSettings.DefaultLayoutData", .WithSetting("LayoutTypePartSettings.DefaultLayoutData", DefaultFormLayoutData))
"{" +
" \"elements\":[" +
" {" +
" \"typeName\":\"Orchard.Layouts.Elements.Canvas\"," +
" \"elements\":[" +
" {" +
" \"typeName\":\"Orchard.DynamicForms.Elements.Form\"," +
" \"data\":\"TypeName=Orchard.DynamicForms.Elements.Form&amp;FormName=Untitled&amp;FormAction=&amp;FormMethod=POST&amp;EnableClientValidation=true&amp;StoreSubmission=true&amp;FormBindingContentType=&amp;Publication=Draft&amp;Notification=&amp;RedirectUrl=\"," +
" \"elements\":[" +
" {" +
" \"typeName\":\"Orchard.DynamicForms.Elements.Button\"," +
" \"data\":\"TypeName=Orchard.DynamicForms.Elements.Button&amp;InputName=&amp;FormBindingContentType=&amp;Text=Submit\"" +
" }]" +
" }]" +
" }]" +
"}"))
.DisplayedAs("Form") .DisplayedAs("Form")
.Listable() .Listable()
.Creatable() .Creatable()
@@ -51,16 +56,7 @@ namespace Orchard.DynamicForms {
.WithSetting("DateEditorSettings.ShowDateEditor", "false")) .WithSetting("DateEditorSettings.ShowDateEditor", "false"))
.WithPart("WidgetPart") .WithPart("WidgetPart")
.WithPart("LayoutPart", p => p .WithPart("LayoutPart", p => p
.WithSetting("LayoutTypePartSettings.DefaultLayoutData", .WithSetting("LayoutTypePartSettings.DefaultLayoutData", DefaultFormLayoutData))
"{" +
"\"elements\": [{" +
"\"typeName\": \"Orchard.DynamicForms.Elements.Form\"," +
"\"elements\": [{" +
"\"typeName\": \"Orchard.DynamicForms.Elements.Button\"," +
"\"state\": \"ButtonText=Submit\"" +
"}]" +
"}]" +
"}"))
.WithSetting("Stereotype", "Widget") .WithSetting("Stereotype", "Widget")
.DisplayedAs("Form Widget")); .DisplayedAs("Form Widget"));
return 1; return 1;

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
var LayoutEditor;!function(e,t){t.Fieldset=function(n,i,o,r,l,a,c,d,s,m,h){t.Element.call(this,"Fieldset",n,i,o,r,l),t.Container.call(this,["Grid","Content"],h);var u=this;this.isContainable=!0,this.dropTargetClass="layout-common-holder",this.contentType=c,this.contentTypeLabel=d,this.contentTypeClass=s,this.legend=a||"",this.hasEditor=m,this.toObject=function(){var e=this.elementToObject();return e.legend=this.legend,e.children=this.childrenToObject(),e};var p=this.getEditorObject;this.getEditorObject=function(){var t=p();return e.extend(t,{Legend:this.legend})},this.setChildren=function(e){this.children=e,_(this.children).each(function(e){e.parent=u})},this.setChildren(h)},t.Fieldset.from=function(e){return new t.Fieldset(e.data,e.htmlId,e.htmlClass,e.htmlStyle,e.isTemplated,e.legend,e.contentType,e.contentTypeLabel,e.contentTypeClass,e.hasEditor,t.childrenFrom(e.children))},t.registerFactory("Fieldset",function(e){return t.Fieldset.from(e)})}(jQuery,LayoutEditor||(LayoutEditor={}));var LayoutEditor;!function(e,t){t.Form=function(n,i,o,r,l,a,c,d,s,m,h,u){t.Element.call(this,"Form",n,i,o,r,l),t.Container.call(this,["Grid","Content"],u);var p=this;this.isContainable=!0,this.dropTargetClass="layout-common-holder",this.contentType=d,this.contentTypeLabel=s,this.contentTypeClass=m,this.name=a||"Untitled",this.formBindingContentType=c,this.hasEditor=h,this.toObject=function(){var e=this.elementToObject();return e.name=this.name,e.formBindingContentType=this.formBindingContentType,e.children=this.childrenToObject(),e};var f=this.getEditorObject;this.getEditorObject=function(){var t=f();return e.extend(t,{FormName:this.name,FormBindingContentType:this.formBindingContentType})},this.setChildren=function(e){this.children=e,_(this.children).each(function(e){e.parent=p,p.linkChild(e)})},this.linkChild=function(t){var n=t.getEditorObject;t.getEditorObject=function(){var t=n();return e.extend(t,{FormBindingContentType:p.formBindingContentType})}},this.setChildren(u)},t.Form.from=function(e){return new t.Form(e.data,e.htmlId,e.htmlClass,e.htmlStyle,e.isTemplated,e.name,e.formBindingContentType,e.contentType,e.contentTypeLabel,e.contentTypeClass,e.hasEditor,t.childrenFrom(e.children))},t.registerFactory("Form",function(e){return t.Form.from(e)})}(jQuery,LayoutEditor||(LayoutEditor={})),angular.module("LayoutEditor").directive("orcLayoutFieldset",["$compile","scopeConfigurator","environment",function(e,t,n){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(e,n){t.configureForElement(e,n),t.configureForContainer(e,n),e.sortableOptions.axis="y",e.edit=function(){e.$root.editElement(e.element).then(function(t){t.cancel||(e.element.data=decodeURIComponent(t.element.data),e.element.legend=t.elementEditorModel.legend,e.$apply())})}}],templateUrl:n.templateUrl("Fieldset"),replace:!0}}]),angular.module("LayoutEditor").directive("orcLayoutForm",["$compile","scopeConfigurator","environment",function(e,t,n){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(e,n){t.configureForElement(e,n),t.configureForContainer(e,n),e.sortableOptions.axis="y",e.edit=function(){e.$root.editElement(e.element).then(function(t){t.cancel||(e.element.data=decodeURIComponent(t.element.data),e.element.name=t.elementEditorModel.name,e.element.formBindingContentType=t.elementEditorModel.formBindingContentType,e.$apply())})}}],templateUrl:n.templateUrl("Form"),replace:!0}}]); var LayoutEditor;!function(e,t){t.Fieldset=function(n,i,o,r,l,d,a,c,s,h,m){t.Element.call(this,"Fieldset",n,i,o,r,l),t.Container.call(this,["Grid","Content"],m);var u=this;this.isContainable=!0,this.dropTargetClass="layout-common-holder",this.contentType=a,this.contentTypeLabel=c,this.contentTypeClass=s,this.legend=d||"",this.hasEditor=h,this.toObject=function(){var e=this.elementToObject();return e.legend=this.legend,e.children=this.childrenToObject(),e};var p=this.getEditorObject;this.getEditorObject=function(){var t=p();return e.extend(t,{Legend:this.legend})},this.setChildren=function(e){this.children=e,_(this.children).each(function(e){e.parent=u})},this.applyElementEditorModel=function(e){this.legend=e.legend},this.setChildren(m)},t.Fieldset.from=function(e){return new t.Fieldset(e.data,e.htmlId,e.htmlClass,e.htmlStyle,e.isTemplated,e.legend,e.contentType,e.contentTypeLabel,e.contentTypeClass,e.hasEditor,t.childrenFrom(e.children))},t.registerFactory("Fieldset",function(e){return t.Fieldset.from(e)})}(jQuery,LayoutEditor||(LayoutEditor={}));var LayoutEditor;!function(e,t){t.Form=function(n,i,o,r,l,d,a,c,s,h,m,u,p){t.Element.call(this,"Form",n,i,o,r,l,u),t.Container.call(this,["Grid","Content"],p);var f=this;this.isContainable=!0,this.dropTargetClass="layout-common-holder",this.contentType=c,this.contentTypeLabel=s,this.contentTypeClass=h,this.name=d||"Untitled",this.formBindingContentType=a,this.hasEditor=m,this.toObject=function(){var e=this.elementToObject();return e.name=this.name,e.formBindingContentType=this.formBindingContentType,e.children=this.childrenToObject(),e};var y=this.getEditorObject;this.getEditorObject=function(){var t=y();return e.extend(t,{FormName:this.name,FormBindingContentType:this.formBindingContentType})},this.allowSealedFocus=function(){return 0===this.children.length},this.setChildren=function(e){this.children=e,_(this.children).each(function(e){e.setParent(f)})},this.onDescendantAdded=function(t){var n=t.getEditorObject;t.getEditorObject=function(){var t=n();return e.extend(t,{FormBindingContentType:f.formBindingContentType})}},this.applyElementEditorModel=function(e){this.name=e.name,this.formBindingContentType=e.formBindingContentType},this.setChildren(p)},t.Form.from=function(e){return new t.Form(e.data,e.htmlId,e.htmlClass,e.htmlStyle,e.isTemplated,e.name,e.formBindingContentType,e.contentType,e.contentTypeLabel,e.contentTypeClass,e.hasEditor,e.rule,t.childrenFrom(e.children))},t.registerFactory("Form",function(e){return t.Form.from(e)})}(jQuery,LayoutEditor||(LayoutEditor={})),angular.module("LayoutEditor").directive("orcLayoutFieldset",["$compile","scopeConfigurator","environment",function(e,t,n){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(e,n){t.configureForElement(e,n),t.configureForContainer(e,n),e.sortableOptions.axis="y",e.edit=function(){e.$root.editElement(e.element).then(function(t){t.cancel||e.$apply(function(){e.element.data=decodeURIComponent(t.element.data),e.element.applyElementEditorModel(t.elementEditorModel)})})}}],templateUrl:n.templateUrl("Fieldset"),replace:!0}}]),angular.module("LayoutEditor").directive("orcLayoutForm",["$compile","scopeConfigurator","environment",function(e,t,n){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(e,n){t.configureForElement(e,n),t.configureForContainer(e,n),e.sortableOptions.axis="y",e.edit=function(){e.$root.editElement(e.element).then(function(t){t.cancel||e.$apply(function(){e.element.data=decodeURIComponent(t.element.data),e.element.applyElementEditorModel(t.elementEditorModel)})})}}],templateUrl:n.templateUrl("Form"),replace:!0}}]);

View File

@@ -14,9 +14,10 @@
$scope.$root.editElement($scope.element).then(function (args) { $scope.$root.editElement($scope.element).then(function (args) {
if (args.cancel) if (args.cancel)
return; return;
$scope.$apply(function() {
$scope.element.data = decodeURIComponent(args.element.data); $scope.element.data = decodeURIComponent(args.element.data);
$scope.element.legend = args.elementEditorModel.legend; $scope.element.applyElementEditorModel(args.elementEditorModel);
$scope.$apply(); });
}); });
}; };
} }

View File

@@ -14,10 +14,11 @@
$scope.$root.editElement($scope.element).then(function (args) { $scope.$root.editElement($scope.element).then(function (args) {
if (args.cancel) if (args.cancel)
return; return;
$scope.$apply(function() {
$scope.element.data = decodeURIComponent(args.element.data); $scope.element.data = decodeURIComponent(args.element.data);
$scope.element.name = args.elementEditorModel.name; $scope.element.applyElementEditorModel(args.elementEditorModel);
$scope.element.formBindingContentType = args.elementEditorModel.formBindingContentType; });
$scope.$apply();
}); });
}; };
} }

View File

@@ -37,6 +37,10 @@
}); });
}; };
this.applyElementEditorModel = function(model) {
this.legend = model.legend;
};
this.setChildren(children); this.setChildren(children);
}; };

View File

@@ -40,12 +40,11 @@
this.setChildren = function (children) { this.setChildren = function (children) {
this.children = children; this.children = children;
_(this.children).each(function (child) { _(this.children).each(function (child) {
child.parent = self; child.setParent(self);
self.linkChild(child);
}); });
}; };
this.linkChild = function(element) { this.onDescendantAdded = function(element) {
var getEditorObject = element.getEditorObject; var getEditorObject = element.getEditorObject;
element.getEditorObject = function () { element.getEditorObject = function () {
var dto = getEditorObject(); var dto = getEditorObject();
@@ -55,6 +54,11 @@
}; };
}; };
this.applyElementEditorModel = function(model) {
this.name = model.name;
this.formBindingContentType = model.formBindingContentType;
};
this.setChildren(children); this.setChildren(children);
}; };

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Web;
using System.Web.Mvc; using System.Web.Mvc;
using Orchard.Collections; using Orchard.Collections;
using Orchard.ContentManagement; using Orchard.ContentManagement;
@@ -179,7 +180,12 @@ namespace Orchard.DynamicForms.Services {
ReadElementValues(element, context); ReadElementValues(element, context);
foreach (var key in from string key in context.Output where !String.IsNullOrWhiteSpace(key) && values[key] == null select key) { foreach (var key in from string key in context.Output where !String.IsNullOrWhiteSpace(key) && values[key] == null select key) {
values.Add(key, context.Output[key]); var value = context.Output[key];
if (form.HtmlEncode)
value = HttpUtility.HtmlEncode(value);
values.Add(key, value);
} }
} }

View File

@@ -2,4 +2,4 @@
@{ @{
var element = (HiddenField) Model.Element; var element = (HiddenField) Model.Element;
} }
<div class="hidden-field">@element.Name</div> <div class="layout-snippet">@element.Name</div>

View File

@@ -3,8 +3,7 @@
var element = (ValidationMessage)Model.Element; var element = (ValidationMessage)Model.Element;
var forField = element.For; var forField = element.For;
} }
<div class="layout-placeholder"> <div class="layout-snippet">
<span class="fa fa-file-code-o"></span>
@if (String.IsNullOrWhiteSpace(forField)) { @if (String.IsNullOrWhiteSpace(forField)) {
@T("Validation message (target not specified)") @T("Validation message (target not specified)")
} }

View File

@@ -1,4 +1 @@
<div class="layout-placeholder"> <div class="layout-snippet">@T("Validation summary")</div>
<span class="fa fa-file-code-o"></span>
@T("Validation summary")
</div>

View File

@@ -9,7 +9,7 @@
</sectionGroup> </sectionGroup>
</configSections> </configSections>
<system.web.webPages.razor> <system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage"> <pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
<namespaces> <namespaces>
<add namespace="System.Web.Mvc"/> <add namespace="System.Web.Mvc"/>
@@ -29,7 +29,7 @@
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add assembly="System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> <add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> <add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

View File

@@ -23,6 +23,7 @@ namespace Orchard.Email.Controllers {
public Localizer T { get; set; } public Localizer T { get; set; }
[HttpPost] [HttpPost]
[ValidateInput(false)]
public ActionResult TestSettings(TestSmtpSettings testSettings) { public ActionResult TestSettings(TestSmtpSettings testSettings) {
ILogger logger = null; ILogger logger = null;
try { try {

View File

@@ -1,9 +1,13 @@
using Orchard.ContentManagement; using System;
using Orchard.Alias;
using Orchard.Autoroute.Models;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Handlers; using Orchard.ContentManagement.Handlers;
using Orchard.Data; using Orchard.Data;
using Orchard.DisplayManagement; using Orchard.DisplayManagement;
using Orchard.Layouts.Models; using Orchard.Layouts.Models;
using Orchard.Layouts.Services; using Orchard.Layouts.Services;
using Orchard.Utility.Extensions;
namespace Orchard.Layouts.Handlers { namespace Orchard.Layouts.Handlers {
public class LayoutPartHandler : ContentHandler { public class LayoutPartHandler : ContentHandler {
@@ -13,6 +17,7 @@ namespace Orchard.Layouts.Handlers {
private readonly IShapeDisplay _shapeDisplay; private readonly IShapeDisplay _shapeDisplay;
private readonly ILayoutSerializer _serializer; private readonly ILayoutSerializer _serializer;
private readonly IStaticHttpContextScopeFactory _staticHttpContextScopeFactory; private readonly IStaticHttpContextScopeFactory _staticHttpContextScopeFactory;
private readonly IAliasService _aliasService;
public LayoutPartHandler( public LayoutPartHandler(
IRepository<LayoutPartRecord> repository, IRepository<LayoutPartRecord> repository,
@@ -21,7 +26,8 @@ namespace Orchard.Layouts.Handlers {
IContentPartDisplay contentPartDisplay, IContentPartDisplay contentPartDisplay,
IShapeDisplay shapeDisplay, IShapeDisplay shapeDisplay,
ILayoutSerializer serializer, ILayoutSerializer serializer,
IStaticHttpContextScopeFactory staticHttpContextScopeFactory) { IStaticHttpContextScopeFactory staticHttpContextScopeFactory,
IAliasService aliasService) {
_layoutManager = layoutManager; _layoutManager = layoutManager;
_contentManager = contentManager; _contentManager = contentManager;
@@ -29,6 +35,7 @@ namespace Orchard.Layouts.Handlers {
_shapeDisplay = shapeDisplay; _shapeDisplay = shapeDisplay;
_serializer = serializer; _serializer = serializer;
_staticHttpContextScopeFactory = staticHttpContextScopeFactory; _staticHttpContextScopeFactory = staticHttpContextScopeFactory;
_aliasService = aliasService;
Filters.Add(StorageFilter.For(repository)); Filters.Add(StorageFilter.For(repository));
OnPublished<LayoutPart>(UpdateTemplateClients); OnPublished<LayoutPart>(UpdateTemplateClients);
@@ -77,6 +84,12 @@ namespace Orchard.Layouts.Handlers {
draft.LayoutData = _serializer.Serialize(updatedLayout); draft.LayoutData = _serializer.Serialize(updatedLayout);
if (isPublished) { if (isPublished) {
// If the content being published is currently the homepage, we need to change the DisplayAlias from "" to "/"
// so that the autoroute part handler will not regenerate the alias and causes the homepage to become "lost".
if (IsHomePage(layout)) {
PromoteToHomePage(draft);
}
// We don't have to recurse here, since invoking Publish on a Layout will cause this handler to execute again. // We don't have to recurse here, since invoking Publish on a Layout will cause this handler to execute again.
_contentManager.Publish(draft.ContentItem); _contentManager.Publish(draft.ContentItem);
} }
@@ -85,5 +98,20 @@ namespace Orchard.Layouts.Handlers {
} }
} }
} }
private bool IsHomePage(IContent content) {
var homepage = _aliasService.Get(String.Empty);
var displayRouteValues = _contentManager.GetItemMetadata(content).DisplayRouteValues;
return homepage.Match(displayRouteValues);
}
private void PromoteToHomePage(IContent content) {
var autoroutePart = content.As<AutoroutePart>();
if (autoroutePart == null)
return;
autoroutePart.DisplayAlias = "/";
}
} }
} }

View File

@@ -12,7 +12,7 @@ using Orchard.Utility;
namespace Orchard.Layouts.Helpers { namespace Orchard.Layouts.Helpers {
public static class ElementDataHelper { public static class ElementDataHelper {
private static readonly string[] _elementDataBlackList = { "ElementData", "__RequestVerificationToken" }; private static readonly string[] _elementDataBlackList = { "ElementData", "__RequestVerificationToken", "TypeName" };
public static string Get(this ElementDataDictionary data, string key, string defaultValue = null) { public static string Get(this ElementDataDictionary data, string key, string defaultValue = null) {
return data != null ? data.ContainsKey(key) ? data[key] : defaultValue : defaultValue; return data != null ? data.ContainsKey(key) ? data[key] : defaultValue : defaultValue;

View File

@@ -149,7 +149,6 @@
<Content Include="Styles\menu.elements.png" /> <Content Include="Styles\menu.elements.png" />
<Content Include="Styles\element-editor.css" /> <Content Include="Styles\element-editor.css" />
<Content Include="Styles\element-browser.css" /> <Content Include="Styles\element-browser.css" />
<Content Include="Styles\designer.css" />
<Content Include="Styles\default-grid.css" /> <Content Include="Styles\default-grid.css" />
<Content Include="Styles\edit.png" /> <Content Include="Styles\edit.png" />
<Content Include="Styles\menu.layouts.png" /> <Content Include="Styles\menu.layouts.png" />
@@ -179,8 +178,6 @@
<Content Include="Views\Elements\MediaItem.cshtml" /> <Content Include="Views\Elements\MediaItem.cshtml" />
<Content Include="Views\Elements\Snippet.cshtml" /> <Content Include="Views\Elements\Snippet.cshtml" />
<Content Include="Views\Layout-Dialog.cshtml" /> <Content Include="Views\Layout-Dialog.cshtml" />
<Content Include="Views\Layout-Designer.cshtml" />
<Content Include="Views\Layout-Designer-Wrapper.cshtml" />
<Content Include="Views\DialogTemplate.cshtml" /> <Content Include="Views\DialogTemplate.cshtml" />
<Content Include="Views\Element\Create.cshtml" /> <Content Include="Views\Element\Create.cshtml" />
<Content Include="Views\Elements\ContentPart.cshtml" /> <Content Include="Views\Elements\ContentPart.cshtml" />
@@ -288,6 +285,14 @@
<Project>{3158c928-888c-4a84-8bc1-4a8257489538}</Project> <Project>{3158c928-888c-4a84-8bc1-4a8257489538}</Project>
<Name>Markdown</Name> <Name>Markdown</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Orchard.Alias\Orchard.Alias.csproj">
<Project>{475b6c45-b27c-438b-8966-908b9d6d1077}</Project>
<Name>Orchard.Alias</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Autoroute\Orchard.Autoroute.csproj">
<Project>{66fccd76-2761-47e3-8d11-b45d0001ddaa}</Project>
<Name>Orchard.Autoroute</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Forms\Orchard.Forms.csproj"> <ProjectReference Include="..\Orchard.Forms\Orchard.Forms.csproj">
<Project>{642a49d7-8752-4177-80d6-bfbbcfad3de0}</Project> <Project>{642a49d7-8752-4177-80d6-bfbbcfad3de0}</Project>
<Name>Orchard.Forms</Name> <Name>Orchard.Forms</Name>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -236,12 +236,14 @@
// Because of this, we need to invoke "setParent" so that specific container types can perform element speficic initialization. // Because of this, we need to invoke "setParent" so that specific container types can perform element speficic initialization.
receivedElement.setEditor(element.editor); receivedElement.setEditor(element.editor);
receivedElement.setParent(element); receivedElement.setParent(element);
if (!!receivedElement.hasEditor) { if (!!receivedElement.hasEditor) {
$scope.$root.editElement(receivedElement).then(function (args) { $scope.$root.editElement(receivedElement).then(function (args) {
if (!args.cancel) { if (!args.cancel) {
receivedElement.data = args.element.data; receivedElement.data = args.element.data;
receivedElement.applyElementEditorModel(args.elementEditorModel);
if (receivedElement.setHtml) if (!!receivedElement.setHtml)
receivedElement.setHtml(args.element.html); receivedElement.setHtml(args.element.html);
} }
$timeout(function () { $timeout(function () {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -7,12 +7,15 @@
this.children = children; this.children = children;
this.isContainer = true; this.isContainer = true;
var _self = this; var self = this;
this.onChildAdded = function (element) { /* Virtual */ };
this.onDescendantAdded = function (element, parentElement) { /* Virtual */ };
this.setChildren = function (children) { this.setChildren = function (children) {
this.children = children; this.children = children;
_(this.children).each(function (child) { _(this.children).each(function (child) {
child.parent = _self; child.setParent(self);
}); });
}; };
@@ -29,7 +32,7 @@
this.children.push(child); this.children.push(child);
child.setEditor(this.editor); child.setEditor(this.editor);
child.setIsTemplated(false); child.setIsTemplated(false);
child.parent = this; child.setParent(this);
}; };
this.deleteChild = function (child) { this.deleteChild = function (child) {

View File

@@ -28,9 +28,13 @@
this.setParent = function(parentElement) { this.setParent = function(parentElement) {
this.parent = parentElement; this.parent = parentElement;
this.parent.onChildAdded(this);
if (!!this.parent.linkChild) var currentAncestor = parentElement;
this.parent.linkChild(this); while (!!currentAncestor) {
currentAncestor.onDescendantAdded(this, parentElement);
currentAncestor = currentAncestor.parent;
}
}; };
this.setIsTemplated = function (value) { this.setIsTemplated = function (value) {
@@ -42,6 +46,8 @@
} }
}; };
this.applyElementEditorModel = function() { /* Virtual */ };
this.getIsActive = function () { this.getIsActive = function () {
if (!this.editor) if (!this.editor)
return false; return false;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -27,4 +27,8 @@
background: #e8e8e8; background: #e8e8e8;
} }
} }
.layout-snippet {
background: #e8e8e8;
}
} }

View File

@@ -1,321 +0,0 @@
.zone-content {
padding: 3px;
}
.canvas-toolbar ol li {
float: left;
margin-right: 1em;
}
.canvas-toolbar a.icon {
color: #000;
font-size: 1.5em;
line-height: 1.5em;
}
.layout-editor .canvas {
padding: 0;
min-height: 5em;
}
.layout-editor .canvas .snippet {
padding: 1em;
background: #f3f4f5;
-ms-border-radius: 4px;
border-radius: 8px;
}
.layout-editor .canvas .snippet em {
font-style: italic;
}
.layout-editor .canvas .table {
background: none repeat scroll 0 0 #fafafa;
border: 1px solid #bdbcbc;
margin: 0 0 0.3em;
padding: 20px 0.3em 20px 0;
position: relative;
}
.layout-editor .canvas > .table {
-ms-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 2px 5px 15px #525252;
-ms-box-shadow: 2px 5px 15px #525252;
box-shadow: 3px 2px 10px #e7e7e7;
}
.layout-editor .canvas .x-root {
min-height: 100px;
position: relative;
padding: 23px 0 42px 0;
}
.layout-editor .canvas .x-column {
background-color: #fafafa;
}
.layout-editor .canvas .x-container.x-root > a.add {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEXSURBVDhPrdVPSwJBHMbxTVl9Ab6DpKMnX0ewVFCgd99IeBXBi7c6BB0KPIfgK5AudSi03kGHhLxZ32f/5LQ7qwPNA5/xJ86sM/tnNihJHV3cY4mPlOo7dKA+TjnDO773eMMpSlPFELbBuwygsYWMYBvgQhP5kwi2jq42OEacGhawdZQZsqi29ZFXhBWaEzTx3xwh0gG1XF+JdHX6aMRft5lCt4U84gFKC1/IfjuEmVDNCvnz4Zr8uE8t+QDeooPp6uiEmpmnn4rqXlIGY7STMo5ZKy9qbpGfusn1tpEbLXkCX4mPpSujqdr+UVxn+ITfZ9rro5dF96Ots4tLFOJ9+8ribYM1o+39Atd4xjql+grnsLwCguAHjCrBxU/oR+AAAAAASUVORK5CYII=');
width: 20px;
height: 20px;
left: 50%;
bottom: 0;
}
.layout-editor .canvas .x-container.x-root > a.add.start {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANYSURBVHhe5dvJjwxhHMbxsURsYx3hgpMZS4hIuMzBhTiIsziIhISjcLDExUXmYr1aDv4DDuKAAwcHEiEYMyTcEEYMY52E8X2ql/Ty09Xd9dbW75N80jWTeave9523ut+qfmtSV/xZgs1YgxVF8zEL06CM4zs+4xVeYhB38R65yyacwzNMRKR9nMVGZDrzcAxDsBriwgscxVxkJoswgC+wKh2HUZxCD1KLzt+T0LlrVTIJ36A6lN5LEstKPIRVqTQ8QB8SyUH8hFWRNKlO+xFbJuM8rINnyRmork4zA9dhHTCLrkF1dhK9wdyEdaAsu4HIb45Tkaf/fC3VfQrazgVYO86T02gre2DtMI92o6WshiYZ1s7yaAyr0FR0hXgf1o7y7B6auvo9AGsHnWAfGkbX6R9gFXYlLFYZV95hDsqpnTEdhq7uOjW6OXOosFkfXc/rMtPqOZfCYpVx6RO6EaRyBOxFpm40xJQFUFvrMgyrx1wLi1XGteeoiu7hWX8Yh7BYZeKwAeVTYGfx1acEbS51wLbiq08J2qyZkT4a3ha3k0jYcTQ8k4iOs1gjoB9JNT5LUZv71QFrgx/9zDp1gO7w+po+dUBvYbvtaCi1IixWmUaipFcdsLCw7WV61AGzC9tepltD6Dei3D2NOgyjJsrH5rhGQNoNSDMT6gDdL/M1Y753wFd1wMfCtpcZUQdoPU6UlC4vmxUWq0wjUTKsDtCSFl8zpA7QaixfM6iPQM0EdStcnZFEwj52ow7rZvMHwUxQd0mf6jee5TFGS//1O8VXn1LV5vWofXeNS1isMnHQF8BVeQLrD10Li1XGtUcIUvnGd7X46kPMts5E3F+MSlisMi7pBvB0BKkcAT+gJTGdHrXxV2GzPt59PW5F62mswp1gF0KjmZrXS2SUZdAM0dpRHo1gKVrKDvyFtcM8URu2o614vVBS0TlzBdaO8+Aymj7v/xevF0uXogXHl2AdKIsuItIiaSuaNepROOuAWaJzvnKG6zxboRmVdfA0qU5bkEiW4zasiqThFjR3STyaK7yBVakkvIbqkGq06vIENNuyKhkHHes4MvXNtjpCj7XG/ejsEZSXumY1uXl4OvIsqYlYj8/rmV8tzi6tTdYibT17rKGd4OPzXV3/APplq+e/m5jfAAAAAElFTkSuQmCC');
width: 64px;
height: 64px;
left: 50%;
top: 32%;
display: block;
}
.layout-editor .canvas .x-grid .drag-handle {
cursor: move;
left: 11px;
position: absolute;
right: 0;
top: 0;
z-index: 25;
}
.layout-editor .canvas > .x-grid .drag-handle a {
color: #646464;
}
.layout-editor .canvas > .x-grid .drag-handle {
-ms-border-radius: 0;
border-radius: 3px 3px 0 0;
}
.layout-editor .canvas .x-grid .grid-toolbar {
background: none;
margin: 0;
padding: 0 0.5em 0 0;
}
.layout-editor .canvas .x-grid .drag-handle:hover a.remove,
.layout-editor .canvas .x-grid .drag-handle:hover a.edit {
}
.layout-editor .canvas .x-row {
position: relative;
margin: 0;
padding-left: 20px;
}
.layout-editor .canvas .x-row .row-toolbar {
display: none;
}
.layout-editor .canvas .x-row .row-toolbar.sortable {
cursor: move;
-ms-border-radius: 3px;
border-radius: 3px;
bottom: 6px;
left: 8px;
top: 1px;
width: 10px;
padding: 5px 4px 2px 1px;
z-index: 5;
position: absolute;
cursor: move;
background: transparent;
}
.layout-editor .canvas .x-row .row-toolbar a {
display: block;
margin: 0;
width: 16px;
}
.layout-editor .canvas .x-row .x-column {
padding: 0.5em;
position: relative;
}
.layout-editor .canvas .x-row .x-column .ui-resizable-handle {
background: #e4e4e4;
height: 100%;
width: 7px;
top: 0;
-ms-border-radius: 25px;
border-radius: 25px;
-ms-opacity: 0.75;
opacity: 0.75;
}
.layout-editor .canvas .x-row .x-column .ui-resizable-handle:hover {
-ms-opacity: 1;
opacity: 1;
}
.layout-editor .canvas .x-row .x-column .ui-resizable-e {
right: -10px;
}
.layout-editor .canvas .x-row .x-column .toolbar.column-toolbar {
position: absolute;
top: 1px;
right: 1px;
left: 1px;
cursor: move;
background: none;
display: none;
}
.layout-editor .canvas .x-row .x-column.highlight {
border: 1px solid #90a664;
}
.layout-editor .canvas .x-row .x-column .column-container {
border: 1px dashed #bdbcbc;
min-height: 5em;
padding: 2.1em 27px 24px;
}
.layout-editor .canvas .x-row .x-column.templated .element.container {
padding-top: 0.5em;
}
.layout-editor .canvas .x-container a.add {
display: none;
width: 20px;
height: 20px;
position: absolute;
bottom: 5px;
right: 5px;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEXSURBVDhPrdVPSwJBHMbxTVl9Ab6DpKMnX0ewVFCgd99IeBXBi7c6BB0KPIfgK5AudSi03kGHhLxZ32f/5LQ7qwPNA5/xJ86sM/tnNihJHV3cY4mPlOo7dKA+TjnDO773eMMpSlPFELbBuwygsYWMYBvgQhP5kwi2jq42OEacGhawdZQZsqi29ZFXhBWaEzTx3xwh0gG1XF+JdHX6aMRft5lCt4U84gFKC1/IfjuEmVDNCvnz4Zr8uE8t+QDeooPp6uiEmpmnn4rqXlIGY7STMo5ZKy9qbpGfusn1tpEbLXkCX4mPpSujqdr+UVxn+ITfZ9rro5dF96Ots4tLFOJ9+8ribYM1o+39Atd4xjql+grnsLwCguAHjCrBxU/oR+AAAAAASUVORK5CYII=');
-ms-opacity: 0.3;
opacity: 0.3;
z-index: 1200;
}
.layout-editor .canvas .x-container a.add:hover {
-ms-opacity: 1;
opacity: 1;
}
.layout-editor .canvas .toolbar {
padding: 0 0.6em;
background: #e4e4e4;
border: none;
}
.layout-editor .canvas .toolbar a {
color: #646464;
margin-right: 1.5em;
line-height: 2em;
}
.layout-editor .canvas .name {
display: block;
color: #9da0a4;
padding: 0 7px;
float: left;
}
.layout-editor .canvas article.element-box {
position: relative;
padding: 0.7em 0 0 0;
}
.layout-editor .canvas article.element-box > header {
padding: 0 0.5em 0 0.5em;
-ms-border-radius: 2px;
border-radius: 2px;
background: #9e9e9e;
color: #fff;
cursor: move;
position: absolute;
top: -23px;
left: 0;
right: 0;
height: 27px;
display: none;
z-index: 1;
}
.layout-editor .canvas article.element-box .element-overlay {
background: #333a26;
-ms-opacity: 0.12;
opacity: 0.12;
position: absolute;
left: 0;
right: 0;
top: 1px;
bottom: -5px;
display: none;
cursor: move;
-ms-border-radius: 0 0 2px 2px;
border-radius: 0 0 2px 2px;
}
.layout-editor .canvas article.element-box:hover .element-overlay {
display: block;
}
.layout-editor .canvas article.element-box:hover > header {
display: block;
}
.layout-editor .canvas article.element-box > header a {
color: #fff;
}
.layout-editor .canvas article.element-box > header .actions a {
margin-right: 0.5em;
line-height: 2em;
}
.layout-editor .canvas article.element-box > header .name {
line-height: 2.5em;
}
.layout-editor .canvas .sortable-placeholder {
display: block;
height: 2.5em;
padding: 0.5em;
border: 1px dashed #bdbcbc;
}
.layout-editor .canvas .x-row .x-column .x-holder .x-container-widget .x-grid {
background: none repeat scroll 0 0 #fafafa;
border: 1px solid #bdbcbc;
margin: 27px 0 0;
position: relative;
}
.layout-editor .canvas .x-container-widget .x-grid .grid-toolbar {
padding: 0 0.5em 0 0.5em;
}
.layout-editor .trash {
display: none;
}
.layout-editor .element-component {
background: #e5e5e5;
padding: 0.5em;
-ms-opacity: .3;
opacity: .3;
}
.layout-editor .element-snippet {
background: #e5e5e5;
padding: 0.5em;
}
.element.element-label label {
font-weight: bold;
}
.media-element {
overflow: hidden;
}
textarea.text.large {
width: 98%;
}

View File

@@ -1,3 +1,9 @@
@foreach (var contentItem in Model.ContentItems) { @using Orchard.ContentManagement
@Display(contentItem) @foreach (var contentItemShape in Model.ContentItems) {
var contentItem = (ContentItem)contentItemShape.ContentItem;
var displayTextHtmlString = Html.ItemDisplayText(contentItem);
var displayText = displayTextHtmlString != null ? displayTextHtmlString.ToString() : T("-").ToString();
<div class="layout-snippet">
@displayText
</div>
} }

View File

@@ -1,10 +1,15 @@
@{ @using Orchard.ContentManagement
var contentShapes = ((Func<string, IEnumerable<dynamic>>)Model.BuildShapes)("Summary").ToList(); @{
var list = New.List(); var contentItems = (IList<ContentItem>)Model.ContentItems;
list.AddRange(contentShapes);
} }
@if (contentShapes.Any()) { @if (contentItems.Any()) {
@Display(list) foreach (var contentItem in contentItems) {
var displayTextHtmlString = Html.ItemDisplayText(contentItem);
var displayText = displayTextHtmlString != null ? displayTextHtmlString.ToString() : T("-").ToString();
<div class="layout-snippet">
@displayText
</div>
}
} }
else { else {
<p>@T("The query returned no results.")</p> <p>@T("The query returned no results.")</p>

View File

@@ -2,7 +2,6 @@
@{ @{
var element = (Shape) Model.Element; var element = (Shape) Model.Element;
} }
<div class="element-snippet layout-placeholder"> <div class="layout-snippet">
<span class="fa fa-circle"></span> @element.ShapeType
@T("{0} {1}", element.ShapeType, element.Descriptor.DisplayText)
</div> </div>

View File

@@ -1,13 +0,0 @@
@using Orchard.Mvc.Html;
<!DOCTYPE html>
<html lang="@WorkContext.CurrentCulture" class="static @Html.ClassForPage()">
<head>
<title></title>
<meta charset="utf-8" />
@Display(Model.Head)
</head>
<body>
@Display(Model.Body)
@Display(Model.Tail)
</body>
</html>

View File

@@ -1,7 +0,0 @@
@model dynamic
@{
SetMeta("X-UA-Compatible", "IE=edge,chrome=1");
Style.Include("layout-designer.css");
Script.Require("jQuery").AtFoot();
}
@Display(Model.Content)

View File

@@ -9,7 +9,7 @@
</sectionGroup> </sectionGroup>
</configSections> </configSections>
<system.web.webPages.razor> <system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage"> <pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
<namespaces> <namespaces>
<add namespace="System.Web.Mvc"/> <add namespace="System.Web.Mvc"/>
@@ -29,7 +29,7 @@
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add assembly="System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="Orchard.Framework"/> <add assembly="Orchard.Framework"/>
<add assembly="Orchard.Core"/> <add assembly="Orchard.Core"/>