Merge branch '1.9.x' into dev

# Conflicts:
#	src/Orchard.Web/Modules/Orchard.Layouts/Scripts/LayoutDesignerHost.js
This commit is contained in:
sfmskywalker
2015-12-18 00:33:56 +01:00
10 changed files with 65 additions and 21 deletions

3
.gitignore vendored
View File

@@ -186,5 +186,6 @@ src/Orchard.Web/Properties/PublishProfiles
src/Orchard.Azure/Orchard.Azure.CloudService/Staging/ src/Orchard.Azure/Orchard.Azure.CloudService/Staging/
#enable all /lib artifacts #enable all /lib artifacts
!lib/*/*.* !lib/**/*.*
!src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Lib/*.*
*/.vs/* */.vs/*

View File

@@ -1,9 +1,9 @@
(function ($) { (function ($) {
var LayoutDesignerHost = function (element) { var LayoutDesignerHost = function (element, layoutEditor) {
var self = this; var self = this;
this.element = element; this.element = element;
this.element.data("layout-designer-host", this); this.element.data("layout-designer-host", this);
this.editor = window.layoutEditor; this.editor = layoutEditor;
this.settings = { this.settings = {
antiForgeryToken: self.element.data("anti-forgery-token"), antiForgeryToken: self.element.data("anti-forgery-token"),
editorDialogTitleFormat: self.element.data("editor-dialog-title-format"), editorDialogTitleFormat: self.element.data("editor-dialog-title-format"),
@@ -124,20 +124,6 @@
// Export types. // Export types.
window.Orchard = window.Orchard || {}; window.Orchard = window.Orchard || {};
window.Orchard.Layouts = window.Orchard.Layouts || {}; window.Orchard.Layouts = window.Orchard.Layouts || {};
window.Orchard.Layouts.LayoutEditorHost = window.Orchard.Layouts.LayoutEditorHost || {}; window.Orchard.Layouts.LayoutDesignerHost = LayoutDesignerHost;
$(function () {
window.layoutDesignerHost = new LayoutDesignerHost($(".layout-designer"));
$(".layout-designer").each(function (e) {
var designer = $(this);
var dialog = designer.find(".layout-editor-help-dialog");
designer.find(".layout-editor-help-link").click(function (e) {
dialog.dialog({
modal: true,
width: 840
});
e.preventDefault();
});
});
});
})(jQuery); })(jQuery);

View File

@@ -38,8 +38,20 @@
jQuery(function () { jQuery(function () {
var editorConfig = JSON.parse(LayoutEditor.decode("@Html.Raw(Url.Encode(Model.ConfigurationData))")); var editorConfig = JSON.parse(LayoutEditor.decode("@Html.Raw(Url.Encode(Model.ConfigurationData))"));
var editorCanvasData = JSON.parse(LayoutEditor.decode("@Html.Raw(Url.Encode(Model.Data))")); var editorCanvasData = JSON.parse(LayoutEditor.decode("@Html.Raw(Url.Encode(Model.Data))"));
var layoutEditor = window.layoutEditor = new LayoutEditor.Editor(editorConfig, editorCanvasData);
window.layoutEditor = new LayoutEditor.Editor(editorConfig, editorCanvasData); var host = new window.Orchard.Layouts.LayoutDesignerHost($(".layout-designer"), layoutEditor);
$(".layout-designer").each(function (e) {
var designer = $(this);
var dialog = designer.find(".layout-editor-help-dialog");
designer.find(".layout-editor-help-link").click(function (e) {
dialog.dialog({
modal: true,
width: 840
});
e.preventDefault();
});
});
}); });
</script> </script>
} }

View File

@@ -54,7 +54,7 @@ namespace Orchard.Redis.Caching {
} }
public void Remove(string key) { public void Remove(string key) {
Database.KeyDelete(key); Database.KeyDelete(GetLocalizedKey(key));
} }
public void Clear() { public void Clear() {

View File

@@ -78,5 +78,9 @@ namespace Orchard.Localization {
return string.Equals(_localized, that._localized); return string.Equals(_localized, that._localized);
} }
public override object InitializeLifetimeService() {
// never expire the cross-AppDomain lease on this object
return null;
}
} }
} }

View File

@@ -421,5 +421,9 @@ namespace Orchard.Logging {
} }
} }
public override object InitializeLifetimeService() {
// never expire the cross-AppDomain lease on this object
return null;
}
} }
} }

View File

@@ -2,6 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Lifetime;
using System.Security; using System.Security;
using System.Web.Hosting; using System.Web.Hosting;
using Orchard.Parameters; using Orchard.Parameters;
@@ -32,28 +34,46 @@ namespace Orchard.Host {
[SecurityCritical] [SecurityCritical]
public override object InitializeLifetimeService() { public override object InitializeLifetimeService() {
// never expire the license // never expire the cross-AppDomain lease on this object
return null; return null;
} }
private static void ExtendLifeTimeLeases(TextReader input, TextWriter output) {
// Orchard objects passed as parameters into this AppDomain should derive from MarshalByRefObject and have
// infinite lease timeouts by means of their InitializeLifetimeService overrides. For the input/output
// stream objects we approximate that behavior by immediately renewing the lease for 30 days.
ExtendLifeTimeLease(input);
ExtendLifeTimeLease(output);
}
private static void ExtendLifeTimeLease(MarshalByRefObject obj) {
if (RemotingServices.IsObjectOutOfAppDomain(obj)) {
var lease = (ILease)RemotingServices.GetLifetimeService(obj);
lease.Renew(TimeSpan.FromDays(30));
}
}
[SecuritySafeCritical] [SecuritySafeCritical]
void IRegisteredObject.Stop(bool immediate) { void IRegisteredObject.Stop(bool immediate) {
HostingEnvironment.UnregisterObject(this); HostingEnvironment.UnregisterObject(this);
} }
public CommandReturnCodes StartSession(TextReader input, TextWriter output) { public CommandReturnCodes StartSession(TextReader input, TextWriter output) {
ExtendLifeTimeLeases(input, output);
_agent = CreateAgent(); _agent = CreateAgent();
return StartHost(_agent, input, output); return StartHost(_agent, input, output);
} }
public void StopSession(TextReader input, TextWriter output) { public void StopSession(TextReader input, TextWriter output) {
if (_agent != null) { if (_agent != null) {
ExtendLifeTimeLeases(input, output);
StopHost(_agent, input, output); StopHost(_agent, input, output);
_agent = null; _agent = null;
} }
} }
public CommandReturnCodes RunCommand(TextReader input, TextWriter output, Logger logger, OrchardParameters args) { public CommandReturnCodes RunCommand(TextReader input, TextWriter output, Logger logger, OrchardParameters args) {
ExtendLifeTimeLeases(input, output);
var agent = CreateAgent(); var agent = CreateAgent();
CommandReturnCodes result = (CommandReturnCodes)agent.GetType().GetMethod("RunSingleCommand").Invoke(agent, new object[] { CommandReturnCodes result = (CommandReturnCodes)agent.GetType().GetMethod("RunSingleCommand").Invoke(agent, new object[] {
input, input,
@@ -66,6 +86,7 @@ namespace Orchard.Host {
} }
public CommandReturnCodes RunCommandInSession(TextReader input, TextWriter output, Logger logger, OrchardParameters args) { public CommandReturnCodes RunCommandInSession(TextReader input, TextWriter output, Logger logger, OrchardParameters args) {
ExtendLifeTimeLeases(input, output);
CommandReturnCodes result = (CommandReturnCodes)_agent.GetType().GetMethod("RunCommand").Invoke(_agent, new object[] { CommandReturnCodes result = (CommandReturnCodes)_agent.GetType().GetMethod("RunCommand").Invoke(_agent, new object[] {
input, input,
output, output,
@@ -77,6 +98,7 @@ namespace Orchard.Host {
} }
public CommandReturnCodes RunCommands(TextReader input, TextWriter output, Logger logger, IEnumerable<ResponseLine> responseLines) { public CommandReturnCodes RunCommands(TextReader input, TextWriter output, Logger logger, IEnumerable<ResponseLine> responseLines) {
ExtendLifeTimeLeases(input, output);
var agent = CreateAgent(); var agent = CreateAgent();
CommandReturnCodes result = StartHost(agent, input, output); CommandReturnCodes result = StartHost(agent, input, output);

View File

@@ -17,5 +17,10 @@ namespace Orchard {
_output.WriteLine(format, args); _output.WriteLine(format, args);
} }
} }
public override object InitializeLifetimeService() {
// never expire the cross-AppDomain lease on this object
return null;
}
} }
} }

View File

@@ -10,5 +10,10 @@ namespace Orchard {
public IList<string> Arguments { get; set; } public IList<string> Arguments { get; set; }
public IList<string> ResponseFiles { get; set; } public IList<string> ResponseFiles { get; set; }
public IDictionary<string, string> Switches { get; set; } public IDictionary<string, string> Switches { get; set; }
public override object InitializeLifetimeService() {
// never expire the cross-AppDomain lease on this object
return null;
}
} }
} }

View File

@@ -10,6 +10,11 @@ namespace Orchard.ResponseFiles {
public string LineText { get; set; } public string LineText { get; set; }
public int LineNumber { get; set; } public int LineNumber { get; set; }
public string[] Args { get; set; } public string[] Args { get; set; }
public override object InitializeLifetimeService() {
// never expire the cross-AppDomain lease on this object
return null;
}
} }
public class ResponseFileReader { public class ResponseFileReader {