Skip to content

Commit

Permalink
Merge pull request #437 from Orckestra/dev
Browse files Browse the repository at this point in the history
C1 CMS 6.1
  • Loading branch information
Marcus Wendt authored Apr 26, 2017
2 parents f78b232 + e3aca58 commit ba4ad2d
Show file tree
Hide file tree
Showing 207 changed files with 4,170 additions and 3,095 deletions.
28 changes: 14 additions & 14 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# EditorConfig is awesome: http://EditorConfig.org

root = true

[*]
indent_style = tab
charset = utf-8
trim_trailing_whitespace = true

[*.cs]
indent_style = space
indent_size = 4

[*.md]
# EditorConfig is awesome: http://EditorConfig.org

root = true

[*]
indent_style = tab
charset = utf-8
trim_trailing_whitespace = true

[*.{cs,asmx,ashx,asax}]
indent_style = space
indent_size = 4

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions Composite.Workflows/Composite.Workflows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<NoWarn>618</NoWarn>
<LangVersion>7</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -26,7 +26,7 @@

namespace Composite.Workflows.Plugins.Elements.ElementProviders.AllFunctionsElementProvider
{
[AllowPersistingWorkflow(WorkflowPersistingType.Shutdown)]
[AllowPersistingWorkflow(WorkflowPersistingType.Idle)]
public sealed partial class FunctionTesterWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow
{
public FunctionTesterWorkflow()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using System;
using System;
using Composite.C1Console.Actions;
using Composite.Data;
using Composite.Data.Types;
using Composite.C1Console.Workflow;


namespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider
{
[AllowPersistingWorkflow(WorkflowPersistingType.Shutdown)]
public sealed partial class AddTypeToWhiteListWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow
{
public AddTypeToWhiteListWorkflow()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using System;
using System;
using Composite.C1Console.Actions;
using Composite.Data;
using Composite.Data.Types;
using Composite.C1Console.Workflow;


namespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider
{
[AllowPersistingWorkflow(WorkflowPersistingType.Shutdown)]
public sealed partial class RemoveTypeFromWhiteListWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow
{
public RemoveTypeFromWhiteListWorkflow()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ private void initializeCodeActivity_InitializeBindings_ExecuteCode(object sender
this.Bindings.Add("AllowOverwrite", false);
this.Bindings.Add("Title", "");
this.Bindings.Add("Description", "");
this.Bindings.Add("Tags", "");
}


Expand Down Expand Up @@ -219,6 +220,7 @@ private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs
mediaFile.FolderPath = this.FolderPath;
mediaFile.Title = this.GetBinding<string>("Title");
mediaFile.Description = this.GetBinding<string>("Description");
mediaFile.Tags = this.GetBinding<string>("Tags");
mediaFile.Culture = C1Console.Users.UserSettings.ActiveLocaleCultureInfo.Name;
mediaFile.Length = uploadedFile.ContentLength;
mediaFile.MimeType = MimeTypeInfo.GetMimeType(uploadedFile);
Expand All @@ -244,6 +246,7 @@ private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs

fileData.Title = this.GetBinding<string>("Title");
fileData.Description = this.GetBinding<string>("Description");
fileData.Tags = this.GetBinding<string>("Tags");
fileData.MimeType = MimeTypeInfo.GetMimeType(uploadedFile);
fileData.Length = uploadedFile.ContentLength;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)
DataEntityToken token = (DataEntityToken)this.EntityToken;
IMediaFile file = (IMediaFile)token.Data;
IMediaFileStore store = DataFacade.GetData<IMediaFileStore>(x => x.Id == file.StoreId).First();
var mediaURL = Composite.Core.Routing.MediaUrls.BuildUrl(file);

this.Bindings.Add("FileDataFileName", file.FileName);
this.Bindings.Add("FileDataTitle", file.Title);
this.Bindings.Add("FileDataURL", mediaURL);
this.Bindings.Add("FileDataDescription", file.Description);
this.Bindings.Add("FileDataTags", file.Tags);
this.Bindings.Add("ProvidesMetaData", store.ProvidesMetadata);

this.BindingsValidationRules.Add("FileDataTitle", new List<ClientValidationRule> { new StringLengthClientValidationRule(0, 256) });
Expand All @@ -50,6 +53,7 @@ private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)
file.FileName = this.GetBinding<string>("FileDataFileName");
file.Title = this.GetBinding<string>("FileDataTitle");
file.Description = this.GetBinding<string>("FileDataDescription");
file.Tags = this.GetBinding<string>("FileDataTags");

DataFacade.Update(file);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
Expand Down Expand Up @@ -65,14 +65,13 @@ private void HasDataReferences(object sender, ConditionalEventArgs e)
var brokenReferences = new List<IData>();
foreach (var data in dataToDelete)
{
var references = DataReferenceFacade.GetNotOptionalReferences(data);
var references = DataReferenceFacade.GetReferences(data, false,
(type, fp) => !fp.IsOptionalReference
&& type != typeof(IPagePlaceholderContent)
&& fp.SourcePropertyInfo.DeclaringType != typeof(IPageRelatedData));

foreach (var reference in references)
{
if (reference is IPagePlaceholderContent)
{
continue;
}

DataSourceId dataSourceId = reference.DataSourceId;
if (dataToDelete.Any(elem => elem.DataSourceId.Equals(dataSourceId))
|| brokenReferences.Any(brokenRef => brokenRef.DataSourceId.Equals(dataSourceId)))
Expand Down
3 changes: 3 additions & 0 deletions Composite/AspNet/Razor/C1HtmlHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ public IHtmlString Markup(IEnumerable<XNode> xNodes)
/// </summary>
/// <param name="name">Function name.</param>
/// <returns></returns>
[Obsolete("Use Function method directly on the Razor page")]
public IHtmlString Function(string name)
{
return Function(name, null);
Expand All @@ -418,6 +419,7 @@ public IHtmlString Function(string name)
/// <param name="name">Function name.</param>
/// <param name="parameters">The parameters.</param>
/// <returns></returns>
[Obsolete("Use Function method directly on the Razor page")]
public IHtmlString Function(string name, object parameters)
{
return Function(name, Functions.ObjectToDictionary(parameters));
Expand All @@ -429,6 +431,7 @@ public IHtmlString Function(string name, object parameters)
/// <param name="name">Function name.</param>
/// <param name="parameters">The parameters.</param>
/// <returns></returns>
[Obsolete("Use Function method directly on the Razor page")]
public IHtmlString Function(string name, IDictionary<string, object> parameters)
{
return Function(name, parameters, new FunctionContextContainer());
Expand Down
13 changes: 12 additions & 1 deletion Composite/AspNet/Razor/CompositeC1WebPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,20 @@ public IHtmlString Function(string name, object parameters)
/// <returns></returns>
public IHtmlString Function(string name, IDictionary<string, object> parameters)
{
return Html.C1().Function(name, parameters, GetFunctionContext());
return Function(name, parameters, GetFunctionContext());
}

/// <summary>
/// Executes a C1 Function.
/// </summary>
/// <param name="name">Function name.</param>
/// <param name="parameters">The parameters.</param>
/// <param name="functionContextContainer">The FunctionContextContainer used to execute the function.</param>
/// <returns></returns>
public IHtmlString Function(string name, IDictionary<string, object> parameters, FunctionContextContainer functionContextContainer)
{
return Html.C1().Function(name, parameters, functionContextContainer);
}

private FunctionContextContainer GetFunctionContext()
{
Expand Down
40 changes: 40 additions & 0 deletions Composite/AspNet/TempAssembliesFix.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using System.Linq;
using System.Reflection;
using Composite.Core;
using Composite.Core.Application;

namespace Composite.AspNet
{
/// <summary>
/// Fixed the issue of temporary asp.net assemblies not being resolved correctly.
/// </summary>
[ApplicationStartup]
class TempAssembliesFix
{
public static void OnInitialized()
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;
}

private static Assembly CurrentDomainOnAssemblyResolve(object sender, ResolveEventArgs args)
{
string asmName = args.Name;

if (!asmName.StartsWith("App_") || !asmName.Contains(","))
{
return null;
}

var assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(asm => asm.FullName == asmName);
if (assembly != null)
{
return assembly;
}

Log.LogVerbose("OnAssemblyResolve", $"Failed to resolve assembly: {args.Name}"
+ (args.RequestingAssembly != null ? $", requesting assembly: '{args.RequestingAssembly.FullName}'" : ""));
return null;
}
}
}
27 changes: 22 additions & 5 deletions Composite/C1Console/Elements/ElementFacade.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
Expand All @@ -10,8 +10,10 @@
using Composite.C1Console.Elements.Security;
using Composite.C1Console.Forms.DataServices;
using Composite.C1Console.Forms.Flows;
using Composite.C1Console.Security;
using Composite.Core.Logging;
using Composite.Core.Instrumentation;
using Composite.Plugins.Elements.ElementProviders.VirtualElementProvider;


namespace Composite.C1Console.Elements
Expand All @@ -22,6 +24,8 @@ namespace Composite.C1Console.Elements
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class ElementFacade
{
private static IEnumerable<EntityToken> _perspectiveEntityTokens = null;

/// <exclude />
public static IEnumerable<Element> GetRoots(SearchToken searchToken)
{
Expand Down Expand Up @@ -109,11 +113,8 @@ public static IEnumerable<LabeledProperty> GetForeignLabeledProperties(ElementHa
{
return ElementProviderPluginFacade.GetForeignLabeledProperties(elementHandle.ProviderName, elementHandle.EntityToken);
}
else
{
return ElementProviderPluginFacade.GetLabeledProperties(elementHandle.ProviderName, elementHandle.EntityToken);
}

return ElementProviderPluginFacade.GetLabeledProperties(elementHandle.ProviderName, elementHandle.EntityToken);
}


Expand Down Expand Up @@ -251,6 +252,22 @@ public static IEnumerable<Element> GetPerspectiveElementsWithNoSecurity()
}


internal static bool IsPerspectiveEntityToken(EntityToken entityToken)
{
if (!(entityToken is VirtualElementProviderEntityToken))
{
return false;
}

if (_perspectiveEntityTokens == null)
{
_perspectiveEntityTokens =
GetPerspectiveElementsWithNoSecurity().Select(e => e.ElementHandle.EntityToken).ToList();
}

return _perspectiveEntityTokens.Contains(entityToken);
}


internal static bool IsLocaleAwareElementProvider(ElementProviderHandle elementProviderHandle)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ void IObserver<ComponentChange>.OnError(Exception error)
void IObserver<ComponentChange>.OnNext(ComponentChange value)
{
_componentCache = null;
_log.LogInformation(nameof(ComponentManager), "We should flush some cache here.." + value.ProviderId);
}
#endregion
}
Expand Down
Loading

0 comments on commit ba4ad2d

Please sign in to comment.