-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from Orckestra/dev
5.1 release - changes since February
- Loading branch information
Showing
173 changed files
with
14,054 additions
and
10,699 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
Composite.Workflows/C1Console/Tools/SetTimeZoneWorkflow.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web.Hosting; | ||
using System.Workflow.Runtime; | ||
using System.Xml.Linq; | ||
using Composite.C1Console.Actions; | ||
using Composite.C1Console.Events; | ||
using Composite.C1Console.Workflow; | ||
using Composite.Core.Configuration; | ||
using Composite.Core.ResourceSystem; | ||
|
||
namespace Composite.C1Console.Tools | ||
{ | ||
public sealed partial class SetTimeZoneWorkflow : Workflow.Activities.FormsWorkflow | ||
{ | ||
private const string TimezoneXslt = @"<?xml version=""1.0"" encoding=""utf-8""?> | ||
<xsl:stylesheet version=""1.0"" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" | ||
xmlns:msxsl=""urn:schemas-microsoft-com:xslt"" exclude-result-prefixes=""msxsl""> | ||
<xsl:param name = ""theTimezone"" select='""{0}""'/> | ||
<xsl:output method = ""xml"" indent=""yes""/> | ||
<xsl:template match = ""@* | node()"" > | ||
<xsl:copy> | ||
<xsl:apply-templates select = ""@* | node()""/> | ||
</xsl:copy> | ||
</xsl:template> | ||
<xsl:template match = ""GlobalSettingsProviderPlugins/add/@timezone""> | ||
<xsl:attribute name = ""timezone""> | ||
<xsl:value-of select = ""$theTimezone""/> | ||
</xsl:attribute> | ||
</xsl:template> | ||
<xsl:template match = ""GlobalSettingsProviderPlugins/add[not(@timezone)]""> | ||
<xsl:copy> | ||
<xsl:attribute name = ""timezone"" > | ||
<xsl:value-of select = ""$theTimezone""/> | ||
</xsl:attribute> | ||
<xsl:apply-templates select = ""@*|node()""/> | ||
</xsl:copy> | ||
</xsl:template> | ||
</xsl:stylesheet>"; | ||
public SetTimeZoneWorkflow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
|
||
private void initializeCodeActivity_InitializeBindings_ExecuteCode(object sender, EventArgs e) | ||
{ | ||
var tzs = TimeZoneInfo.GetSystemTimeZones().ToDictionary(systemTimeZone => systemTimeZone.Id, systemTimeZone => | ||
StringResourceSystemFacade.GetString("Composite.Plugins.TimezoneDisplayNames", | ||
"TimezoneDisplayName." + systemTimeZone.Id)); | ||
var bindings = new Dictionary<string, object> | ||
{ | ||
{"TimeZones", tzs}, | ||
{"TimeZonesSelected",GlobalSettingsFacade.TimeZone.Id } | ||
}; | ||
|
||
Bindings = bindings; | ||
} | ||
|
||
|
||
|
||
private void sendMessageCodeActivity_SendMessage_ExecuteCode(object sender, EventArgs e) | ||
{ | ||
CloseCurrentView(); | ||
|
||
var timeZoneStandardName = GetBinding<string>("TimeZonesSelected"); | ||
|
||
var timezoneId = TimeZoneInfo.FindSystemTimeZoneById(timeZoneStandardName); | ||
|
||
var timezoneTransform = XDocument.Parse(String.Format(TimezoneXslt, timezoneId.Id)); | ||
|
||
ConfigurationServices.TransformConfiguration(timezoneTransform,false); | ||
|
||
HostingEnvironment.InitiateShutdown(); | ||
|
||
FlowControllerServicesContainer flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId); | ||
IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>(); | ||
|
||
managementConsoleMessageService.ShowGlobalMessage(DialogType.Message, | ||
StringResourceSystemFacade.GetString("Composite.Management", "SendMessageToConsolesWorkflow.SuccessMessage.TimezoneChangedTitle"), | ||
StringResourceSystemFacade.GetString("Composite.Management", "SendMessageToConsolesWorkflow.SuccessMessage.TimezoneChangedMessage")); | ||
|
||
managementConsoleMessageService.RebootConsole(); | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.