Skip to content

Commit

Permalink
Merge pull request #261 from Orckestra/dev
Browse files Browse the repository at this point in the history
v5.3
  • Loading branch information
napernik authored Oct 18, 2016
2 parents ed9bfb6 + 52b6cda commit b85b3f6
Show file tree
Hide file tree
Showing 213 changed files with 4,132 additions and 2,576 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using Composite.Data.GeneratedTypes;
using Composite.Data.ProcessControlled;
using Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;
using Composite.Data.Types;

namespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper
{
Expand All @@ -28,6 +27,11 @@ public sealed partial class AddAssociatedDataWorkflow : FormsWorkflow
[NonSerialized]
private bool _doPublish;

private static class BindingNames
{
public const string PageId = nameof(PageId);
}

public AddAssociatedDataWorkflow()
{
InitializeComponent();
Expand All @@ -42,15 +46,14 @@ private void initialCodeActivity_ExecuteCode(object sender, EventArgs e)
{
var entityToken = EntityToken as AssociatedDataElementProviderHelperEntityToken;

if ((entityToken != null) && (entityToken.Payload != ""))
if (!string.IsNullOrEmpty(entityToken?.Payload))
{
var type = TypeManager.GetType(entityToken.Payload);
var id = type.GetImmutableTypeId();
var dataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(id);
UpdateBinding("DataTypeDescriptor", dataTypeDescriptor);

var data = entityToken.GetData();
UpdateBinding("Data", data);
UpdateBinding(BindingNames.PageId, new Guid(entityToken.Id));

if (!PermissionsFacade.GetPermissionsForCurrentUser(EntityToken).Contains(PermissionType.Publish) || !typeof(IPublishControlled).IsAssignableFrom(type))
{
Expand Down Expand Up @@ -101,9 +104,9 @@ private void enterDataCodeActivity_ExecuteCode(object sender, EventArgs e)

var type = TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);

var page = GetBinding<IData>("Data") as IPage;
Guid pageId = GetBinding<Guid>(BindingNames.PageId);

var helper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor, true, page.GetDataEntityToken())
var helper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor, true, null)
{
LayoutIconHandle = "associated-data-add"
};
Expand All @@ -116,7 +119,7 @@ private void enterDataCodeActivity_ExecuteCode(object sender, EventArgs e)
{
newData = DataFacade.BuildNew(type);

PageFolderFacade.AssignFolderDataSpecificValues(newData, page);
PageFolderFacade.AssignFolderDataSpecificValues(newData, pageId);

var publishControlled = newData as IPublishControlled;
if (publishControlled != null)
Expand Down
2 changes: 1 addition & 1 deletion Composite.Workflows/Composite.Workflows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<RootNamespace>Composite</RootNamespace>
<AssemblyName>Composite.Workflows</AssemblyName>
<ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private string GetDocumentTitle(PackageDescription packageDescription)
{
// Valid package names:
// "Composite.Community.Versioning"
// "Composite C1 3.0"
// "Orckestra CMS 3.0"
string name = packageDescription.Name.Trim();

string documentTitle = name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,16 @@ private void DeleteCurrentVersion(object sender, EventArgs e)

PageServices.DeletePage(selectedPage.Id, selectedPage.VersionId, selectedPage.DataSourceId.LocaleScope);

Guid pageId = selectedPage.Id;
var anotherVersion = DataFacade.GetData<IPage>().FirstOrDefault(p => p.Id == pageId);

var parentTreeRefresher = this.CreateParentTreeRefresher();
parentTreeRefresher.PostRefreshMessages(selectedPage.GetDataEntityToken(), 2);
parentTreeRefresher.PostRefreshMessages((anotherVersion ?? selectedPage).GetDataEntityToken());

if (anotherVersion != null)
{
SelectElement(anotherVersion.GetDataEntityToken());
}
}

private void ifElse_ShouldAllVersionsBeDeleted(object sender, ConditionalEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,6 @@ private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)
|| selectedPage.MenuTitle != originalPage.MenuTitle
|| selectedPage.Title != originalPage.Title;

var treeviewRequiresRefreshing = false;

var dataToAdd = new Dictionary<string, IData>();
var dataToUpdate = new Dictionary<string, IData>();

Expand Down Expand Up @@ -339,12 +337,7 @@ private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)
}
}

bool newDataAdded = PageServices.AddPageTypePageFoldersAndApplications(selectedPage);

if (newDataAdded)
{
treeviewRequiresRefreshing = true;
}
PageServices.AddPageTypePageFoldersAndApplications(selectedPage);
}


Expand All @@ -361,10 +354,6 @@ private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)
DataFacade.Update(data);
}

treeviewRequiresRefreshing |= (originalPage.Title != selectedPage.Title) ||
(originalPage.Description != selectedPage.Description) ||
(originalPage.PublicationStatus != selectedPage.PublicationStatus);

// NOTE: updating originalPage object, in order to make XML & SQL provider work in the same way
originalPage.TemplateId = selectedPage.TemplateId;
originalPage.PageTypeId = selectedPage.PageTypeId;
Expand Down Expand Up @@ -418,13 +407,10 @@ private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)
var serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);

ActionExecutorFacade.Execute(EntityToken, actionToken, serviceContainer);

treeviewRequiresRefreshing = false;
}

if (treeviewRequiresRefreshing)
else
{
updateTreeRefresher.PostRefreshMesseges(selectedPage.GetDataEntityToken());
updateTreeRefresher.PostRefreshMessages(selectedPage.GetDataEntityToken());
}

UpdateBinding("OldPublicationStatus", selectedPage.PublicationStatus);
Expand Down Expand Up @@ -547,6 +533,7 @@ private void editPreviewCodeActivity_ExecuteCode(object sender, EventArgs e)
}
catch (Exception ex)
{
// TODO: add html encoding for the exception text
Control errOutput = new LiteralControl("<pre>" + ex + "</pre>");
webRenderService.SetNewPageOutput(errOutput);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private void undoCodeActivity_Undo_ExecuteCode(object sender, EventArgs e)
List<IData> publicCompositions = publicPage.GetMetaData(DataScopeIdentifier.Public).ToList();

Guid pageId = administrativePage.Id;
Guid versionId = administrativePage.Id;
Guid versionId = administrativePage.VersionId;

List<IPagePlaceholderContent> administrativePlaceholders;
using (new DataScope(DataScopeIdentifier.Administrated))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,17 @@ private void IsValidData(object sender, ConditionalEventArgs e)

private void finalizecodeActivity_ExecuteCode(object sender, EventArgs e)
{
var provider = GetFunctionProvider<RazorFunctionProvider>();

string functionName = this.GetBinding<string>(Binding_Name);
string functionNamespace = this.GetBinding<string>(Binding_Namespace);
string functionNamespace = ChangeNamespaceAccordingToExistingFolders(provider,this.GetBinding<string>(Binding_Namespace));
string functionFullName = functionNamespace + "." + functionName;

var provider = GetFunctionProvider<RazorFunctionProvider>();

AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);

string fileName = functionName + ".cshtml";
string folder = Path.Combine(provider.PhysicalPath, functionNamespace.Replace('.', '\\'));

string cshtmlFilePath = Path.Combine(folder, fileName);

string code;
Expand Down Expand Up @@ -174,6 +175,34 @@ private void finalizecodeActivity_ExecuteCode(object sender, EventArgs e)
executionService.Execute(newFunctionEntityToken, new WorkflowActionToken(typeof(EditRazorFunctionWorkflow)), null);
}

private static string ChangeNamespaceAccordingToExistingFolders(RazorFunctionProvider provider, string nameSpace)
{
string folder = Path.Combine(provider.PhysicalPath, nameSpace.Replace('.', '\\'));

if (Directory.Exists(folder))
{
return GetAlldirectoriesAndSubDirectories(provider.PhysicalPath)
.Single(f=>f.Equals(folder,StringComparison.InvariantCultureIgnoreCase))
.Replace(provider.PhysicalPath + "\\", "")
.Replace('\\','.');
}

return nameSpace;
}

private static List<string> GetAlldirectoriesAndSubDirectories(string physicalPath)
{
var res = new List<string>();

foreach (var dir in Directory.GetDirectories(physicalPath))
{
res.Add(dir);
res.AddRange(GetAlldirectoriesAndSubDirectories(dir));
}

return res;
}

private string GetFunctionCode(string copyFromFunction)
{
IFunction function = FunctionFacade.GetFunction(copyFromFunction);
Expand Down
8 changes: 4 additions & 4 deletions Composite.Workflows/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
[assembly: AssemblyTitle("Composite.Workflows")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Composite A/S")]
[assembly: AssemblyProduct("Composite C1")]
[assembly: AssemblyCopyright("Copyright © Composite A/S 2016")]
[assembly: AssemblyCompany("Orckestra Inc")]
[assembly: AssemblyProduct("Orckestra CMS")]
[assembly: AssemblyCopyright("Copyright © Orckestra Inc 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,6 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.2.*")]
[assembly: AssemblyVersion("5.3.*")]

[assembly: InternalsVisibleTo("UpgradePackage")]
Loading

0 comments on commit b85b3f6

Please sign in to comment.