Skip to content

Commit

Permalink
Merge pull request #215 from Orckestra/dev
Browse files Browse the repository at this point in the history
C1 5.2
  • Loading branch information
napernik authored Aug 31, 2016
2 parents 513e4e4 + 44b1f45 commit 3574f49
Show file tree
Hide file tree
Showing 257 changed files with 7,278 additions and 4,446 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@
/Bin/Composite.dll
/Bin/Composite.Workflows.dll

/Packages/
/Packages/

selenium-debug.log
/Website/test/e2e/reports/
Original file line number Diff line number Diff line change
@@ -1,59 +1,26 @@
using System;
using System.ComponentModel;
using System.Globalization;
using System.Linq;

using Composite.Core;
using Composite.Data;
using Composite.Data.ProcessControlled;
using Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;
using Composite.Data.PublishScheduling;
using Composite.Data.Transactions;
using Composite.Data.Types;

namespace Composite.C1Console.Scheduling
{
[Obsolete]
public sealed class PagePublishSchedulerWorkflow : BaseSchedulerWorkflow
{
private static readonly string LogTitle = typeof(PagePublishSchedulerWorkflow).Name;

[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public Guid PageId { get; set; }

protected override void Execute()
{
using (new DataScope(DataScopeIdentifier.Administrated, CultureInfo.CreateSpecificCulture(LocaleName)))
{
IPage page;

using (var transaction = TransactionsFacade.CreateNewScope())
{
var pagePublishSchedule = PublishScheduleHelper.GetPublishSchedule(typeof(IPage), PageId.ToString(), LocaleName);
DataFacade.Delete(pagePublishSchedule);

page = DataFacade.GetData<IPage>(p => p.Id == PageId).FirstOrDefault();


Verify.IsNotNull(page, "The page with the id {0} does not exist", PageId);

var transitions = ProcessControllerFacade.GetValidTransitions(page).Keys;
if (transitions.Contains(GenericPublishProcessController.Published))
{
page.PublicationStatus = GenericPublishProcessController.Published;

DataFacade.Update(page);

Log.LogVerbose(LogTitle, "Scheduled publishing of page with title '{0}' is complete", page.Title);
}
else
{
Log.LogWarning(LogTitle, "Scheduled publishing of page with title '{0}' could not be done because the page is not in a publisheble state", page.Title);
}

transaction.Complete();
}
var pagePublishSchedule = PublishScheduleHelper.GetPublishSchedule(typeof(IPage), PageId.ToString(), LocaleName);
DataFacade.Delete(pagePublishSchedule);

PublishControlledHelper.ReloadPageElementInConsole(page);
// NOTE: publication logic removed
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,78 +1,28 @@
using System;
using System.ComponentModel;
using System.Globalization;
using System.Linq;

using Composite.Core;
using Composite.Core.Linq;
using Composite.Data;
using Composite.Data.ProcessControlled;
using Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;
using Composite.Data.PublishScheduling;
using Composite.Data.Transactions;
using Composite.Data.Types;

namespace Composite.C1Console.Scheduling
{
[Obsolete]
public sealed class PageUnpublishSchedulerWorkflow : BaseSchedulerWorkflow
{
private static readonly string LogTitle = typeof(PageUnpublishSchedulerWorkflow).Name;

[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public Guid PageId { get; set; }

protected override void Execute()
{
using (new DataScope(DataScopeIdentifier.Administrated, CultureInfo.CreateSpecificCulture(LocaleName)))
{
IPage page;

using (var transaction = TransactionsFacade.CreateNewScope())
{
var pageUnpublishSchedule = PublishScheduleHelper.GetUnpublishSchedule(typeof (IPage), PageId.ToString(), LocaleName);
Verify.IsNotNull(pageUnpublishSchedule, "Missing an unpublish page schedule record.");

DataFacade.Delete(pageUnpublishSchedule);

var deletePublished = false;

page = DataFacade.GetData<IPage>(p => p.Id == PageId).FirstOrDefault();

var transitions = ProcessControllerFacade.GetValidTransitions(page).Keys;
if (transitions.Contains(GenericPublishProcessController.Draft))
{
page.PublicationStatus = GenericPublishProcessController.Draft;

DataFacade.Update(page);

deletePublished = true;
}
else
{
Log.LogWarning(LogTitle, "Scheduled unpublishing of page with title '{0}' could not be done because the page is not in a unpublisheble state", page.Title);
}

if (deletePublished)
{
using (new DataScope(DataScopeIdentifier.Public))
{
var deletePage = DataFacade.GetData<IPage>(p => p.Id == PageId).FirstOrDefault();
if (deletePage != null)
{
var metaDataSet = deletePage.GetMetaData(DataScopeIdentifier.Public).Evaluate();

DataFacade.Delete(deletePage, CascadeDeleteType.Disable);
DataFacade.Delete(metaDataSet, CascadeDeleteType.Disable);

Log.LogVerbose(LogTitle, "Scheduled unpublishing of page with title '{0}' is complete", deletePage.Title);
}
}
}
var pageUnpublishSchedule = PublishScheduleHelper.GetUnpublishSchedule(typeof (IPage), PageId.ToString(), LocaleName);
Verify.IsNotNull(pageUnpublishSchedule, "Missing an unpublish page schedule record.");

transaction.Complete();
}
DataFacade.Delete(pageUnpublishSchedule);

PublishControlledHelper.ReloadPageElementInConsole(page);
// NOTE: Unpublication logic removed
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,53 +73,6 @@ public static void HandlePublishUnpublishWorkflows(IData selectedData, string cu
}
}

public static void HandlePublishUnpublishWorkflows(IPage selectedPage, string cultureName, DateTime? publishDate, DateTime? unpublishDate, ref WorkflowInstance publishWorkflowInstance, ref WorkflowInstance unpublishWorkflowInstance)
{
var existingPublishSchedule = PublishScheduleHelper.GetPublishSchedule(typeof(IPage), selectedPage.Id.ToString(), cultureName);
if (existingPublishSchedule != null)
{
WorkflowFacade.AbortWorkflow(existingPublishSchedule.WorkflowInstanceId);

DataFacade.Delete(existingPublishSchedule);
}

if (publishDate != null)
{
publishWorkflowInstance = WorkflowFacade.CreateNewWorkflow(
typeof(PagePublishSchedulerWorkflow),
new Dictionary<string, object>
{
{ "Date", publishDate },
{ "PageId", selectedPage.Id },
{ "LocaleName", cultureName }
});

PublishScheduleHelper.CreatePublishSchedule(typeof(IPage), selectedPage.Id.ToString(), cultureName, publishDate.Value, publishWorkflowInstance);
}

var existingUnpublishSchedule = PublishScheduleHelper.GetUnpublishSchedule(typeof(IPage), selectedPage.Id.ToString(), cultureName);
if (existingUnpublishSchedule != null)
{
WorkflowFacade.AbortWorkflow(existingUnpublishSchedule.WorkflowInstanceId);

DataFacade.Delete(existingUnpublishSchedule);
}

if (unpublishDate != null)
{
unpublishWorkflowInstance = WorkflowFacade.CreateNewWorkflow(
typeof(PageUnpublishSchedulerWorkflow),
new Dictionary<string, object>
{
{ "Date", unpublishDate },
{ "PageId", selectedPage.Id },
{ "LocaleName", cultureName }
});

PublishScheduleHelper.CreateUnpublishSchedule(typeof(IPage), selectedPage.Id.ToString(), cultureName, unpublishDate.Value, unpublishWorkflowInstance);
}
}

public static void ReloadPageElementInConsole(IPage page)
{
var parentPageId = PageManager.GetParentId(page.Id);
Expand Down
18 changes: 0 additions & 18 deletions Composite.Workflows/Composite.Workflows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -448,18 +448,6 @@
<Compile Include="Plugins\Elements\ElementProviders\PageElementProvider\LocalizePageWorkflow.designer.cs">
<DependentUpon>LocalizePageWorkflow.cs</DependentUpon>
</Compile>
<Compile Include="Plugins\Elements\ElementProviders\PageElementProvider\PagePublishSchedulerWorkflow.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Plugins\Elements\ElementProviders\PageElementProvider\PagePublishSchedulerWorkflow.designer.cs">
<DependentUpon>PagePublishSchedulerWorkflow.cs</DependentUpon>
</Compile>
<Compile Include="Plugins\Elements\ElementProviders\PageElementProvider\PageUnpublishSchedulerWorkflow.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Plugins\Elements\ElementProviders\PageElementProvider\PageUnpublishSchedulerWorkflow.designer.cs">
<DependentUpon>PageUnpublishSchedulerWorkflow.cs</DependentUpon>
</Compile>
<Compile Include="Plugins\Elements\ElementProviders\PageElementProvider\UndoUnpublishedChangesWorkflow.cs">
<SubType>Component</SubType>
</Compile>
Expand Down Expand Up @@ -1109,12 +1097,6 @@
<EmbeddedResource Include="Plugins\Elements\ElementProviders\PageElementProvider\LocalizePageWorkflow.layout">
<DependentUpon>LocalizePageWorkflow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Plugins\Elements\ElementProviders\PageElementProvider\PagePublishSchedulerWorkflow.layout">
<DependentUpon>PagePublishSchedulerWorkflow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Plugins\Elements\ElementProviders\PageElementProvider\PageUnpublishSchedulerWorkflow.layout">
<DependentUpon>PageUnpublishSchedulerWorkflow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Plugins\Elements\ElementProviders\PageElementProvider\UndoUnpublishedChangesWorkflow.layout">
<DependentUpon>UndoUnpublishedChangesWorkflow.cs</DependentUpon>
</EmbeddedResource>
Expand Down
Loading

0 comments on commit 3574f49

Please sign in to comment.