mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Merge branch 'dev' into use-nuget-instead-of-lib-folder
Conflicts: lib/aspnetmvc/System.Web.Helpers.xml lib/aspnetmvc/System.Web.Mvc.xml lib/aspnetmvc/System.Web.Razor.xml lib/aspnetmvc/System.Web.WebPages.Deployment.xml lib/aspnetmvc/System.Web.WebPages.Razor.xml lib/aspnetmvc/System.Web.WebPages.xml lib/aspnetwebapi/System.Net.Http.Formatting.xml lib/aspnetwebapi/System.Web.Http.WebHost.xml lib/aspnetwebapi/System.Web.Http.xml lib/autofac/Autofac.Configuration.xml lib/autofac/Autofac.XML lib/autofac/License.txt lib/dlr/LICENSE.APACHE.html lib/dlr/LICENSE.CPL.txt lib/dlr/LICENSE.Ruby.txt lib/dlr/README.txt lib/dotnetzip/Ionic.Zip.xml lib/dotnetzip/License.txt lib/htmlagilitypack/HtmlAgilityPack.XML lib/imageresizer/license.txt lib/log4net/log4net.xml lib/lucene.net/Lucene.Net.xml lib/moq/Moq.xml lib/newtonsoft.json/Newtonsoft.Json.xml lib/newtonsoft.json/license.txt lib/nhibernate/Iesi.Collections.xml lib/nunit/NUnitFitTests.html lib/nunit/NUnitTests.config lib/nunit/NUnitTests.nunit lib/nunit/agent.conf lib/nunit/agent.log.conf lib/nunit/clr.bat lib/nunit/launcher.log.conf lib/nunit/license.txt lib/nunit/nunit-agent.exe.config lib/nunit/nunit-console-x86.exe.config lib/nunit/nunit-console.exe.config lib/nunit/nunit-x86.exe.config lib/nunit/nunit.exe.config lib/nunit/pnunit-agent.exe.config lib/nunit/pnunit-launcher.exe.config lib/nunit/runFile.exe.config lib/nunit/runpnunit.bat lib/nunit/test.conf lib/specflow/LICENSE.txt lib/specflow/TechTalk.SpecFlow.targets lib/specflow/TechTalk.SpecFlow.tasks lib/specflow/changelog.txt lib/windowsazure/Microsoft.ApplicationServer.Caching.AzureCommon.xml lib/windowsazure/Microsoft.ApplicationServer.Caching.Client.xml lib/windowsazure/Microsoft.ApplicationServer.Caching.Core.xml src/Orchard.Core.Tests/Orchard.Core.Tests.csproj src/Orchard.Profile/Orchard.Profile.csproj src/Orchard.Specs/App.Config src/Orchard.Specs/Orchard.Specs.csproj src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj src/Orchard.Tests/Orchard.Framework.Tests.csproj src/Orchard.Web.Tests/Orchard.Web.Tests.csproj src/Orchard.Web/Core/Orchard.Core.csproj src/Orchard.Web/Modules/Lucene/Lucene.csproj src/Orchard.Web/Modules/Markdown/Markdown.csproj src/Orchard.Web/Modules/Orchard.Alias/Orchard.Alias.csproj src/Orchard.Web/Modules/Orchard.AntiSpam/Orchard.AntiSpam.csproj src/Orchard.Web/Modules/Orchard.ArchiveLater/Orchard.ArchiveLater.csproj src/Orchard.Web/Modules/Orchard.Autoroute/Orchard.Autoroute.csproj src/Orchard.Web/Modules/Orchard.Azure/Orchard.Azure.csproj src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj src/Orchard.Web/Modules/Orchard.CodeGeneration/Orchard.CodeGeneration.csproj src/Orchard.Web/Modules/Orchard.Comments/Orchard.Comments.csproj src/Orchard.Web/Modules/Orchard.ContentPermissions/Orchard.ContentPermissions.csproj src/Orchard.Web/Modules/Orchard.ContentPicker/Orchard.ContentPicker.csproj src/Orchard.Web/Modules/Orchard.ContentTypes/Orchard.ContentTypes.csproj src/Orchard.Web/Modules/Orchard.CustomForms/Orchard.CustomForms.csproj src/Orchard.Web/Modules/Orchard.DesignerTools/Orchard.DesignerTools.csproj src/Orchard.Web/Modules/Orchard.Email/Orchard.Email.csproj src/Orchard.Web/Modules/Orchard.Fields/Orchard.Fields.csproj src/Orchard.Web/Modules/Orchard.Forms/Orchard.Forms.csproj src/Orchard.Web/Modules/Orchard.ImageEditor/Orchard.ImageEditor.csproj src/Orchard.Web/Modules/Orchard.ImportExport/Orchard.ImportExport.csproj src/Orchard.Web/Modules/Orchard.Indexing/Orchard.Indexing.csproj src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj src/Orchard.Web/Modules/Orchard.Lists/Orchard.Lists.csproj src/Orchard.Web/Modules/Orchard.Localization/Orchard.Localization.csproj src/Orchard.Web/Modules/Orchard.Media/Orchard.Media.csproj src/Orchard.Web/Modules/Orchard.MediaPicker/Orchard.MediaPicker.csproj src/Orchard.Web/Modules/Orchard.MediaProcessing/Orchard.MediaProcessing.csproj src/Orchard.Web/Modules/Orchard.Migrations/Orchard.Migrations.csproj src/Orchard.Web/Modules/Orchard.Modules/Orchard.Modules.csproj src/Orchard.Web/Modules/Orchard.MultiTenancy/Orchard.MultiTenancy.csproj src/Orchard.Web/Modules/Orchard.OutputCache/Orchard.OutputCache.csproj src/Orchard.Web/Modules/Orchard.Packaging/Orchard.Packaging.csproj src/Orchard.Web/Modules/Orchard.Projections/Orchard.Projections.csproj src/Orchard.Web/Modules/Orchard.Projections/Tests/Orchard.Projections.Tests.csproj src/Orchard.Web/Modules/Orchard.Recipes/Orchard.Recipes.csproj src/Orchard.Web/Modules/Orchard.Roles/Orchard.Roles.csproj src/Orchard.Web/Modules/Orchard.Rules/Orchard.Rules.csproj src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Orchard.Scripting.CSharp.csproj src/Orchard.Web/Modules/Orchard.Scripting.Dlr/Orchard.Scripting.Dlr.csproj src/Orchard.Web/Modules/Orchard.Search/Orchard.Search.csproj src/Orchard.Web/Modules/Orchard.Setup/Orchard.Setup.csproj src/Orchard.Web/Modules/Orchard.Tags/Orchard.Tags.csproj src/Orchard.Web/Modules/Orchard.TaskLease/Orchard.TaskLease.csproj src/Orchard.Web/Modules/Orchard.Themes/Orchard.Themes.csproj src/Orchard.Web/Modules/Orchard.Tokens/Orchard.Tokens.csproj src/Orchard.Web/Modules/Orchard.Tokens/Tests/Orchard.Tokens.Tests.csproj src/Orchard.Web/Modules/Orchard.Users/Orchard.Users.csproj src/Orchard.Web/Modules/Orchard.Warmup/Orchard.Warmup.csproj src/Orchard.Web/Modules/Orchard.Widgets/Orchard.Widgets.csproj src/Orchard.Web/Modules/Orchard.jQuery/Orchard.jQuery.csproj src/Orchard.Web/Modules/SysCache/SysCache.csproj src/Orchard.Web/Modules/Upgrade/Upgrade.csproj src/Orchard.Web/Orchard.Web.csproj src/Orchard.sln src/Tools/Orchard.Tests/Orchard.Tests.csproj
This commit is contained in:
@@ -1,52 +1,52 @@
|
||||
using System;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Scripting.CSharp.Models;
|
||||
using Orchard.Scripting.CSharp.Services;
|
||||
using Orchard.Scripting.CSharp.Settings;
|
||||
|
||||
namespace Orchard.Scripting.CSharp.Drivers {
|
||||
[OrchardFeature("Orchard.Scripting.CSharp.Validation")]
|
||||
public class ScriptValidationPartDriver : ContentPartDriver<ScriptValidationPart> {
|
||||
private readonly ICSharpService _csharpService;
|
||||
private readonly IOrchardServices _orchardServices;
|
||||
private readonly IWorkContextAccessor _workContextAccessor;
|
||||
|
||||
public ScriptValidationPartDriver(
|
||||
ICSharpService csharpService,
|
||||
IOrchardServices orchardServices,
|
||||
IWorkContextAccessor workContextAccessor) {
|
||||
_csharpService = csharpService;
|
||||
_orchardServices = orchardServices;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
protected override string Prefix {
|
||||
get { return "SpamFilter"; }
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ScriptValidationPart part, Orchard.ContentManagement.IUpdateModel updater, dynamic shapeHelper) {
|
||||
var script = part.Settings.GetModel<ScriptValidationPartSettings>().Script;
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(script)) {
|
||||
|
||||
script = "// #{ }" + System.Environment.NewLine + script;
|
||||
|
||||
_csharpService.SetParameter("Services", _orchardServices);
|
||||
_csharpService.SetParameter("ContentItem", (dynamic)part.ContentItem);
|
||||
_csharpService.SetParameter("WorkContext", _workContextAccessor.GetContext());
|
||||
_csharpService.SetFunction("T", (Func<string, string>)(x => T(x).Text));
|
||||
_csharpService.SetFunction("AddModelError", (Action<string>)(x => updater.AddModelError("Script", T(x))));
|
||||
|
||||
_csharpService.Run(script);
|
||||
}
|
||||
|
||||
return Editor(part, shapeHelper);
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Scripting.CSharp.Models;
|
||||
using Orchard.Scripting.CSharp.Services;
|
||||
using Orchard.Scripting.CSharp.Settings;
|
||||
|
||||
namespace Orchard.Scripting.CSharp.Drivers {
|
||||
[OrchardFeature("Orchard.Scripting.CSharp.Validation")]
|
||||
public class ScriptValidationPartDriver : ContentPartDriver<ScriptValidationPart> {
|
||||
private readonly ICSharpService _csharpService;
|
||||
private readonly IOrchardServices _orchardServices;
|
||||
private readonly IWorkContextAccessor _workContextAccessor;
|
||||
|
||||
public ScriptValidationPartDriver(
|
||||
ICSharpService csharpService,
|
||||
IOrchardServices orchardServices,
|
||||
IWorkContextAccessor workContextAccessor) {
|
||||
_csharpService = csharpService;
|
||||
_orchardServices = orchardServices;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
protected override string Prefix {
|
||||
get { return "SpamFilter"; }
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ScriptValidationPart part, Orchard.ContentManagement.IUpdateModel updater, dynamic shapeHelper) {
|
||||
var script = part.Settings.GetModel<ScriptValidationPartSettings>().Script;
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(script)) {
|
||||
|
||||
script = "// #{ }" + System.Environment.NewLine + script;
|
||||
|
||||
_csharpService.SetParameter("Services", _orchardServices);
|
||||
_csharpService.SetParameter("ContentItem", (dynamic)part.ContentItem);
|
||||
_csharpService.SetParameter("WorkContext", _workContextAccessor.GetContext());
|
||||
_csharpService.SetFunction("T", (Func<string, string>)(x => T(x).Text));
|
||||
_csharpService.SetFunction("AddModelError", (Action<string>)(x => updater.AddModelError("Script", T(x))));
|
||||
|
||||
_csharpService.Run(script);
|
||||
}
|
||||
|
||||
return Editor(part, shapeHelper);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.Environment.Extensions;
|
||||
|
||||
namespace Orchard.Scripting.CSharp {
|
||||
[OrchardFeature("Orchard.Scripting.CSharp.Validation")]
|
||||
public class Migrations : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
|
||||
ContentDefinitionManager.AlterPartDefinition("ScriptValidationPart", cfg => cfg
|
||||
.Attachable()
|
||||
.WithDescription("Provides a way to validate content items using C#.")
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.Environment.Extensions;
|
||||
|
||||
namespace Orchard.Scripting.CSharp {
|
||||
[OrchardFeature("Orchard.Scripting.CSharp.Validation")]
|
||||
public class Migrations : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
|
||||
ContentDefinitionManager.AlterPartDefinition("ScriptValidationPart", cfg => cfg
|
||||
.Attachable()
|
||||
.WithDescription("Provides a way to validate content items using C#.")
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Environment.Extensions;
|
||||
|
||||
namespace Orchard.Scripting.CSharp.Models {
|
||||
[OrchardFeature("Orchard.Scripting.CSharp.Validation")]
|
||||
public class ScriptValidationPart : ContentPart {
|
||||
}
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Environment.Extensions;
|
||||
|
||||
namespace Orchard.Scripting.CSharp.Models {
|
||||
[OrchardFeature("Orchard.Scripting.CSharp.Validation")]
|
||||
public class ScriptValidationPart : ContentPart {
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
Name: C# Scripting
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.9.2
|
||||
OrchardVersion: 1.9
|
||||
Description: Description for the module
|
||||
Features:
|
||||
Orchard.Scripting.CSharp:
|
||||
Description: Provides C# compiler services.
|
||||
Category: Scripting
|
||||
Dependencies: Orchard.Workflows
|
||||
Orchard.Scripting.CSharp.Validation
|
||||
Description: Provides a Script Validation part.
|
||||
Name: Script Validation
|
||||
Category: Scripting
|
||||
Dependencies: Orchard.Scripting.CSharp
|
||||
Name: C# Scripting
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.9.2
|
||||
OrchardVersion: 1.9
|
||||
Description: Description for the module
|
||||
Features:
|
||||
Orchard.Scripting.CSharp:
|
||||
Description: Provides C# compiler services.
|
||||
Category: Scripting
|
||||
Dependencies: Orchard.Workflows
|
||||
Orchard.Scripting.CSharp.Validation
|
||||
Description: Provides a Script Validation part.
|
||||
Name: Script Validation
|
||||
Category: Scripting
|
||||
Dependencies: Orchard.Scripting.CSharp
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<Placement>
|
||||
<Place Parts_Validation_ScriptValidationPartSettings="Content:10"/>
|
||||
</Placement>
|
||||
<Placement>
|
||||
<Place Parts_Validation_ScriptValidationPartSettings="Content:10"/>
|
||||
</Placement>
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Orchard.Scripting.CSharp")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("Orchard")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("02225153-6b07-4599-b29f-7165d3dfcc4b")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.9.2")]
|
||||
[assembly: AssemblyFileVersion("1.9.2")]
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Orchard.Scripting.CSharp")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("Orchard")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("02225153-6b07-4599-b29f-7165d3dfcc4b")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.9.2")]
|
||||
[assembly: AssemblyFileVersion("1.9.2")]
|
||||
|
||||
|
||||
@@ -1,59 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Mono.CSharp;
|
||||
using Delegate = System.Delegate;
|
||||
|
||||
namespace Orchard.Scripting.CSharp.Services {
|
||||
public class CSharpService : ICSharpService {
|
||||
|
||||
public Evaluator Engine { get; private set; }
|
||||
public IDictionary<string, dynamic> Dictionary { get; private set; }
|
||||
|
||||
public void SetParameter(string name, object value) {
|
||||
DemandCompiler();
|
||||
|
||||
Dictionary[name] = value;
|
||||
Engine.Run(String.Format("dynamic {0} = dictionary[\"{0}\"]", name));
|
||||
}
|
||||
|
||||
public void SetFunction(string name, Delegate value) {
|
||||
DemandCompiler();
|
||||
|
||||
Dictionary[name] = value;
|
||||
Engine.Run(String.Format("dynamic {0} = dictionary[\"{0}\"]", name));
|
||||
}
|
||||
|
||||
public void Run(string script) {
|
||||
DemandCompiler();
|
||||
|
||||
Engine.Run(script);
|
||||
}
|
||||
|
||||
public object Evaluate(string script) {
|
||||
DemandCompiler();
|
||||
|
||||
object result;
|
||||
bool resultSet;
|
||||
|
||||
Engine.Evaluate(script, out result, out resultSet);
|
||||
if (resultSet) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void DemandCompiler() {
|
||||
if (Engine != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Engine = new Evaluator(new CompilerContext(new CompilerSettings(), new ConsoleReportPrinter()));
|
||||
|
||||
Engine.Run("using System;");
|
||||
Engine.Run("using System.Collections.Generic;");
|
||||
Engine.Run("var dictionary = new Dictionary<string, dynamic>();");
|
||||
Dictionary = Engine.Evaluate("dictionary") as IDictionary<string, dynamic>;
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Mono.CSharp;
|
||||
using Delegate = System.Delegate;
|
||||
|
||||
namespace Orchard.Scripting.CSharp.Services {
|
||||
public class CSharpService : ICSharpService {
|
||||
|
||||
public Evaluator Engine { get; private set; }
|
||||
public IDictionary<string, dynamic> Dictionary { get; private set; }
|
||||
|
||||
public void SetParameter(string name, object value) {
|
||||
DemandCompiler();
|
||||
|
||||
Dictionary[name] = value;
|
||||
Engine.Run(String.Format("dynamic {0} = dictionary[\"{0}\"]", name));
|
||||
}
|
||||
|
||||
public void SetFunction(string name, Delegate value) {
|
||||
DemandCompiler();
|
||||
|
||||
Dictionary[name] = value;
|
||||
Engine.Run(String.Format("dynamic {0} = dictionary[\"{0}\"]", name));
|
||||
}
|
||||
|
||||
public void Run(string script) {
|
||||
DemandCompiler();
|
||||
|
||||
Engine.Run(script);
|
||||
}
|
||||
|
||||
public object Evaluate(string script) {
|
||||
DemandCompiler();
|
||||
|
||||
object result;
|
||||
bool resultSet;
|
||||
|
||||
Engine.Evaluate(script, out result, out resultSet);
|
||||
if (resultSet) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void DemandCompiler() {
|
||||
if (Engine != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Engine = new Evaluator(new CompilerContext(new CompilerSettings(), new ConsoleReportPrinter()));
|
||||
|
||||
Engine.Run("using System;");
|
||||
Engine.Run("using System.Collections.Generic;");
|
||||
Engine.Run("var dictionary = new Dictionary<string, dynamic>();");
|
||||
Dictionary = Engine.Evaluate("dictionary") as IDictionary<string, dynamic>;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace Orchard.Scripting.CSharp.Services {
|
||||
public interface ICSharpService : IDependency {
|
||||
void SetParameter(string name, object value);
|
||||
void SetFunction(string name, Delegate value);
|
||||
void Run(string script);
|
||||
object Evaluate(string script);
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace Orchard.Scripting.CSharp.Services {
|
||||
public interface ICSharpService : IDependency {
|
||||
void SetParameter(string name, object value);
|
||||
void SetFunction(string name, Delegate value);
|
||||
void Run(string script);
|
||||
object Evaluate(string script);
|
||||
}
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Orchard.Scripting.CSharp.Settings {
|
||||
public class ScriptValidationPartSettings {
|
||||
public string Script { get; set; }
|
||||
}
|
||||
namespace Orchard.Scripting.CSharp.Settings {
|
||||
public class ScriptValidationPartSettings {
|
||||
public string Script { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,38 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
using Orchard.ContentManagement.ViewModels;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Scripting.CSharp.Settings {
|
||||
[OrchardFeature("Orchard.Scripting.CSharp.Validation")]
|
||||
public class ScriptValidationPartSettingsEvents : ContentDefinitionEditorEventsBase {
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
|
||||
if (definition.PartDefinition.Name != "ScriptValidationPart")
|
||||
yield break;
|
||||
|
||||
var settings = definition.Settings.GetModel<ScriptValidationPartSettings>();
|
||||
|
||||
yield return DefinitionTemplate(settings);
|
||||
}
|
||||
|
||||
public override IEnumerable<TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel) {
|
||||
if (builder.Name != "ScriptValidationPart")
|
||||
yield break;
|
||||
|
||||
var settings = new ScriptValidationPartSettings();
|
||||
|
||||
if (updateModel.TryUpdateModel(settings, "ScriptValidationPartSettings", null, null)) {
|
||||
builder.WithSetting("ScriptValidationPartSettings.Script", settings.Script);
|
||||
}
|
||||
|
||||
yield return DefinitionTemplate(settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
using Orchard.ContentManagement.ViewModels;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Scripting.CSharp.Settings {
|
||||
[OrchardFeature("Orchard.Scripting.CSharp.Validation")]
|
||||
public class ScriptValidationPartSettingsEvents : ContentDefinitionEditorEventsBase {
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
|
||||
if (definition.PartDefinition.Name != "ScriptValidationPart")
|
||||
yield break;
|
||||
|
||||
var settings = definition.Settings.GetModel<ScriptValidationPartSettings>();
|
||||
|
||||
yield return DefinitionTemplate(settings);
|
||||
}
|
||||
|
||||
public override IEnumerable<TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel) {
|
||||
if (builder.Name != "ScriptValidationPart")
|
||||
yield break;
|
||||
|
||||
var settings = new ScriptValidationPartSettings();
|
||||
|
||||
if (updateModel.TryUpdateModel(settings, "ScriptValidationPartSettings", null, null)) {
|
||||
builder.WithSetting("ScriptValidationPartSettings.Script", settings.Script);
|
||||
}
|
||||
|
||||
yield return DefinitionTemplate(settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
@model Orchard.Scripting.CSharp.Settings.ScriptValidationPartSettings
|
||||
|
||||
@Display.TokenHint()
|
||||
|
||||
<fieldset>
|
||||
<label for="@Html.FieldIdFor(m => m.Script)">@T("Script")</label>
|
||||
<div>
|
||||
@Html.TextAreaFor(m => m.Script, new { @class = "text medium", rows = "5" })
|
||||
<span class="hint">@T("The script to run everytime the content item is edited. You can use ContentItem, Services, WorkContext, T() and AddModelError().")</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
@model Orchard.Scripting.CSharp.Settings.ScriptValidationPartSettings
|
||||
|
||||
@Display.TokenHint()
|
||||
|
||||
<fieldset>
|
||||
<label for="@Html.FieldIdFor(m => m.Script)">@T("Script")</label>
|
||||
<div>
|
||||
@Html.TextAreaFor(m => m.Script, new { @class = "text medium", rows = "5" })
|
||||
<span class="hint">@T("The script to run everytime the content item is edited. You can use ContentItem, Services, WorkContext, T() and AddModelError().")</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/>
|
||||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<system.web.webPages.razor>
|
||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc"/>
|
||||
<add namespace="System.Web.Mvc.Ajax"/>
|
||||
<add namespace="System.Web.Mvc.Html"/>
|
||||
<add namespace="System.Web.Routing"/>
|
||||
<add namespace="System.Web.WebPages"/>
|
||||
<add namespace="System.Linq"/>
|
||||
<add namespace="System.Collections.Generic"/>
|
||||
<add namespace="Orchard.Mvc.Html"/>
|
||||
</namespaces>
|
||||
</pages>
|
||||
</system.web.webPages.razor>
|
||||
<system.web>
|
||||
<compilation targetFramework="4.5.1">
|
||||
<assemblies>
|
||||
<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.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<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="Orchard.Framework"/>
|
||||
<add assembly="Orchard.Core"/>
|
||||
</assemblies>
|
||||
</compilation>
|
||||
</system.web>
|
||||
<runtime>
|
||||
<!-- NOTE: These binding redirects have no runtime effect; they are only here to avoid build warnings. -->
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="AA95F207798DFDB4" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.4000" newVersion="4.0.0.4000"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="AA95F207798DFDB4" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863AF14B0044DA" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/>
|
||||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<system.web.webPages.razor>
|
||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc"/>
|
||||
<add namespace="System.Web.Mvc.Ajax"/>
|
||||
<add namespace="System.Web.Mvc.Html"/>
|
||||
<add namespace="System.Web.Routing"/>
|
||||
<add namespace="System.Web.WebPages"/>
|
||||
<add namespace="System.Linq"/>
|
||||
<add namespace="System.Collections.Generic"/>
|
||||
<add namespace="Orchard.Mvc.Html"/>
|
||||
</namespaces>
|
||||
</pages>
|
||||
</system.web.webPages.razor>
|
||||
<system.web>
|
||||
<compilation targetFramework="4.5.1">
|
||||
<assemblies>
|
||||
<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.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<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="Orchard.Framework"/>
|
||||
<add assembly="Orchard.Core"/>
|
||||
</assemblies>
|
||||
</compilation>
|
||||
</system.web>
|
||||
<runtime>
|
||||
<!-- NOTE: These binding redirects have no runtime effect; they are only here to avoid build warnings. -->
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="AA95F207798DFDB4" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.4000" newVersion="4.0.0.4000"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="AA95F207798DFDB4" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863AF14B0044DA" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
||||
Reference in New Issue
Block a user