mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Fixing Widget / Scripting / Framework dependency loading.
--HG-- branch : dev
This commit is contained in:
@@ -87,8 +87,8 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\IScriptingManager.cs" />
|
||||
<Compile Include="Services\IScriptingRuntime.cs" />
|
||||
<Compile Include="Services\RubyScriptingRuntime.cs" />
|
||||
<Compile Include="Services\ScriptingManager.cs" />
|
||||
<Compile Include="Services\ScriptingRuntime.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
|
||||
|
@@ -9,4 +9,4 @@ namespace Orchard.Scripting.Services {
|
||||
void ExecuteFile(string fileName);
|
||||
dynamic ExecuteOperation(Func<ObjectOperations, object> invoke);
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,4 +6,4 @@ namespace Orchard.Scripting.Services {
|
||||
dynamic ExecuteExpression(string expression, ScriptScope scope);
|
||||
void ExecuteFile(string fileName, ScriptScope scope);
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,11 +2,11 @@
|
||||
using Microsoft.Scripting.Hosting;
|
||||
|
||||
namespace Orchard.Scripting.Services {
|
||||
public class ScriptingRuntime : IScriptingRuntime {
|
||||
public class RubyScriptingRuntime : IScriptingRuntime {
|
||||
private readonly LanguageSetup _defaultLanguageSetup;
|
||||
private readonly ScriptRuntime _scriptingRuntime;
|
||||
|
||||
public ScriptingRuntime() {
|
||||
public RubyScriptingRuntime() {
|
||||
_defaultLanguageSetup = Ruby.CreateRubySetup();
|
||||
|
||||
var setup = new ScriptRuntimeSetup();
|
||||
@@ -14,7 +14,7 @@ namespace Orchard.Scripting.Services {
|
||||
_scriptingRuntime = new ScriptRuntime(setup);
|
||||
}
|
||||
|
||||
ScriptEngine GetDefaultEngine() {
|
||||
public ScriptEngine GetDefaultEngine() {
|
||||
return _scriptingRuntime.GetEngineByTypeName(_defaultLanguageSetup.TypeName);
|
||||
}
|
||||
|
||||
@@ -33,4 +33,4 @@ namespace Orchard.Scripting.Services {
|
||||
engine.ExecuteFile(fileName, scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,8 +4,8 @@ using Microsoft.Scripting.Hosting;
|
||||
namespace Orchard.Scripting.Services {
|
||||
public class ScriptingManager : IScriptingManager {
|
||||
private readonly IScriptingRuntime _scriptingRuntime;
|
||||
private Lazy<ScriptScope> _scope;
|
||||
private Lazy<ObjectOperations> _operations;
|
||||
private readonly Lazy<ScriptScope> _scope;
|
||||
private readonly Lazy<ObjectOperations> _operations;
|
||||
|
||||
public ScriptingManager(IScriptingRuntime scriptingRuntime) {
|
||||
_scriptingRuntime = scriptingRuntime;
|
||||
@@ -32,6 +32,5 @@ namespace Orchard.Scripting.Services {
|
||||
public void ExecuteFile(string fileName) {
|
||||
_scriptingRuntime.ExecuteFile(fileName, _scope.Value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -69,7 +69,7 @@ namespace Orchard.Setup.Services {
|
||||
string[] hardcoded = {
|
||||
// Framework
|
||||
"Orchard.Framework",
|
||||
|
||||
|
||||
// Core
|
||||
"Common",
|
||||
"Containers",
|
||||
@@ -98,6 +98,7 @@ namespace Orchard.Setup.Services {
|
||||
"Orchard.Tags",
|
||||
"Orchard.Themes",
|
||||
"Orchard.Users",
|
||||
"Orchard.Scripting",
|
||||
"Orchard.Widgets",
|
||||
"TinyMce",
|
||||
|
||||
@@ -108,7 +109,6 @@ namespace Orchard.Setup.Services {
|
||||
context.EnabledFeatures = hardcoded;
|
||||
}
|
||||
|
||||
|
||||
var shellSettings = new ShellSettings(_shellSettings);
|
||||
|
||||
if (string.IsNullOrEmpty(shellSettings.DataProvider)) {
|
||||
|
@@ -4,7 +4,6 @@ using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Localization;
|
||||
using Orchard.UI.Widgets;
|
||||
using Orchard.Widgets.Models;
|
||||
using Orchard.Widgets.Services;
|
||||
|
||||
|
@@ -7,8 +7,8 @@ using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Mvc.Filters;
|
||||
using Orchard.UI.Admin;
|
||||
using Orchard.UI.Widgets;
|
||||
using Orchard.Widgets.Models;
|
||||
using Orchard.Widgets.Services;
|
||||
|
||||
namespace Orchard.Widgets.Filters {
|
||||
public class WidgetFilter : FilterProvider, IResultFilter {
|
||||
|
@@ -9,4 +9,4 @@ Features:
|
||||
Orchard.Widgets:
|
||||
Description: An implementation of widgets.
|
||||
Category: Widget
|
||||
Dependencies: Orchard.Scripting
|
||||
Dependencies: Orchard.Scripting
|
@@ -88,7 +88,10 @@
|
||||
<Compile Include="RuleEngine\BuiltinRuleProvider.cs" />
|
||||
<Compile Include="RuleEngine\RuleManager.cs" />
|
||||
<Compile Include="RuleEngine\UrlRuleProvider.cs" />
|
||||
<Compile Include="Services\IRuleManager.cs" />
|
||||
<Compile Include="Services\IRuleProvider.cs" />
|
||||
<Compile Include="Services\IWidgetsService.cs" />
|
||||
<Compile Include="Services\RuleContext.cs" />
|
||||
<Compile Include="Services\WidgetsService.cs" />
|
||||
<Compile Include="Shapes.cs" />
|
||||
<Compile Include="ViewModels\WidgetsIndexViewModel.cs" />
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using Orchard.Security;
|
||||
using Orchard.UI.Widgets;
|
||||
using Orchard.Widgets.Services;
|
||||
|
||||
namespace Orchard.Widgets.RuleEngine {
|
||||
public class AuthenticatedRuleProvider : IRuleProvider {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using Orchard.UI.Widgets;
|
||||
using Orchard.Widgets.Services;
|
||||
|
||||
namespace Orchard.Widgets.RuleEngine {
|
||||
public class BuiltinRuleProvider : IRuleProvider {
|
||||
|
@@ -1,8 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Orchard.Scripting;
|
||||
using Orchard.Scripting.Services;
|
||||
using Orchard.UI.Widgets;
|
||||
using Orchard.Widgets.Services;
|
||||
|
||||
namespace Orchard.Widgets.RuleEngine {
|
||||
public class RuleManager : IRuleManager {
|
||||
@@ -17,15 +16,15 @@ namespace Orchard.Widgets.RuleEngine {
|
||||
public bool Matches(string expression) {
|
||||
object execContextType = _scriptingManager.ExecuteExpression(@"
|
||||
class ExecContext
|
||||
def execute(callbacks, text)
|
||||
@callbacks = callbacks;
|
||||
temp = instance_eval(text.to_s);
|
||||
@callbacks = 0;
|
||||
def execute(callbacks, text)
|
||||
@callbacks = callbacks;
|
||||
temp = instance_eval(text.to_s);
|
||||
@callbacks = 0;
|
||||
return temp;
|
||||
end
|
||||
end
|
||||
|
||||
def method_missing(name, *args, &block)
|
||||
@callbacks.send(name, args, &block);
|
||||
def method_missing(name, *args, &block)
|
||||
@callbacks.send(name, args, &block);
|
||||
end
|
||||
end
|
||||
ExecContext
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using Orchard.Mvc;
|
||||
using Orchard.UI.Widgets;
|
||||
using Orchard.Widgets.Services;
|
||||
|
||||
namespace Orchard.Widgets.RuleEngine {
|
||||
public class UrlRuleProvider : IRuleProvider {
|
||||
|
@@ -0,0 +1,5 @@
|
||||
namespace Orchard.Widgets.Services {
|
||||
public interface IRuleManager : IDependency {
|
||||
bool Matches(string expression);
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
namespace Orchard.Widgets.Services {
|
||||
public interface IRuleProvider : IDependency {
|
||||
void Process(RuleContext ruleContext);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,7 @@
|
||||
namespace Orchard.Widgets.Services {
|
||||
public class RuleContext {
|
||||
public string FunctionName { get; set; }
|
||||
public object[] Arguments { get; set; }
|
||||
public object Result { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user