Skip to content

Commit

Permalink
Merge branch 'release/4.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
sachatrauwaen committed Nov 16, 2021
2 parents d76d2b2 + 97c2233 commit e9de4ae
Show file tree
Hide file tree
Showing 27 changed files with 768 additions and 273 deletions.
6 changes: 4 additions & 2 deletions OpenContent/BuildScripts/ModulePackage.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<PropertyGroup>
<AssemblyInfoFile>$(MSBuildProjectDirectory)\Properties\AssemblyInfo.cs</AssemblyInfoFile>
<AppVeyorFile>$(MSBuildProjectDirectory)\..\appveyor.yml</AppVeyorFile>
</PropertyGroup>

<Target Name="BeforeBuild">
Expand All @@ -23,8 +24,9 @@
<Output TaskParameter="Value" PropertyName="Version" />
</XmlRead>
<!-- Write new version to assemblyinfo.cs -->
<FileUpdate Files="$(AssemblyInfoFile)" Encoding="ASCII" Regex="AssemblyVersion\(&quot;.*&quot;\)" ReplacementText="AssemblyVersion(&quot;$(Version)&quot;)" />
<FileUpdate Files="$(AssemblyInfoFile)" Encoding="ASCII" Regex="AssemblyFileVersion\(&quot;.*&quot;\)" ReplacementText="AssemblyFileVersion(&quot;$(Version)&quot;)" />
<FileUpdate Files="$(AssemblyInfoFile)" Encoding="ASCII" Regex="AssemblyVersion\(&quot;.*&quot;\)" ReplacementText="AssemblyVersion(&quot;$(Version).00&quot;)" />
<FileUpdate Files="$(AssemblyInfoFile)" Encoding="ASCII" Regex="AssemblyFileVersion\(&quot;.*&quot;\)" ReplacementText="AssemblyFileVersion(&quot;$(Version).00&quot;)" />
<FileUpdate Files="$(AppVeyorFile)" Encoding="ASCII" Regex="version: (.*)\.{build}-{branch}" ReplacementText="version: $(Version).{build}-{branch}" />
</Target>

<Target Name="PackageModule" Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
Expand Down
16 changes: 15 additions & 1 deletion OpenContent/Components/Datasource/DefaultDataItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,29 @@ namespace Satrabel.OpenContent.Components.Datasource
{
public class DefaultDataItem : IDataItem
{
[Obsolete("Please use constructor with parameters 12/10/2021")]
public DefaultDataItem()
{
}
public DefaultDataItem(string id)
{
Id = id;
Key = id;
}

public DefaultDataItem(string id, string key)
{
Id = id;
Key = key;
}

public DefaultDataItem(JToken json)
{
Id = null;
Key = null;
Data = json;
}

public string Id { get; set; }
public string Key { get; set; }
public string Collection { get; set; }
Expand All @@ -23,6 +38,5 @@ public DefaultDataItem(JToken json)
public int LastModifiedByUserId { get; set; }
public DateTime LastModifiedOnDate { get; set; }
public object Item { get; set; }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ public override IDataItem Get(DataSourceContext context, string id)
}
private static IDataItem ToData(PortalSettingInfoBase setting)
{
var item = new DefaultDataItem()
var item = new DefaultDataItem(setting.Id())
{
Id = setting.Id(),
Title = $"{setting.SettingName}",
Data = JObject.FromObject(new
{
Expand Down
3 changes: 1 addition & 2 deletions OpenContent/Components/Datasource/DnnTabsDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ public override IDataItems GetAll(DataSourceContext context, Select selectQuery)
var dataList = new List<IDataItem>();
foreach (var tab in tabs)
{
var item = new DefaultDataItem()
var item = new DefaultDataItem(tab.TabID.ToString())
{
Id = tab.TabID.ToString(),
Title = tab.TabName,
Data = JObject.FromObject(new
{
Expand Down
3 changes: 1 addition & 2 deletions OpenContent/Components/Datasource/DnnUsersDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ public override IDataItem Get(DataSourceContext context, string id)
}
private static IDataItem ToData(UserInfo user)
{
var item = new DefaultDataItem()
var item = new DefaultDataItem(user.UserID.ToString())
{
Id = user.UserID.ToString(),
Title = user.DisplayName,
Data = JObject.FromObject(new
{
Expand Down
15 changes: 8 additions & 7 deletions OpenContent/Components/Datasource/OpenContentDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Portals;
using Satrabel.OpenContent.Components.Datasource.Search;
using Satrabel.OpenContent.Components.Logging;
using Satrabel.OpenContent.Components.Form;
Expand Down Expand Up @@ -165,7 +167,7 @@ public virtual IDataItem GetData(DataSourceContext context, string scope, string
var json = dc.GetData(scopeStorage, key);
if (json != null)
{
var dataItem = new DefaultDataItem
var dataItem = new DefaultDataItem("")
{
Data = json.Json.ToJObject("GetContent " + scope + "/" + key),
CreatedByUserId = json.CreatedByUserId,
Expand Down Expand Up @@ -304,8 +306,9 @@ public virtual void Update(DataSourceContext context, IDataItem item, JToken dat
ctrl.UpdateContent(content);
if (context.Index)
{
var module = OpenContentModuleConfig.Create(ModuleController.Instance.GetModule(context.ModuleId, -1, false), new PortalSettings(context.PortalId));
var indexConfig = OpenContentUtils.GetIndexConfig(new FolderUri(context.TemplateFolder), context.Collection);
content.HydrateDefaultFields(indexConfig);
content.HydrateDefaultFields(indexConfig, module.Settings?.Manifest?.UsePublishTime ?? false);
LuceneController.Instance.Update(content, indexConfig);
LuceneController.Instance.Commit();
}
Expand Down Expand Up @@ -353,7 +356,7 @@ public virtual JToken Action(DataSourceContext context, string action, IDataItem
{
if (action == "FormSubmit")
{
if (data["form"]["approvalEnabled"] != null && data["form"]["approvalEnabled"].Value<bool>() == true )
if (data["form"]["approvalEnabled"] != null && data["form"]["approvalEnabled"].Value<bool>() == true)
{
data["form"]["approved"] = false;
}
Expand All @@ -373,7 +376,7 @@ public virtual JToken Action(DataSourceContext context, string action, IDataItem
ctrl.AddContent(content);

//Index the content item

if (context.Index)
{
var indexConfig = OpenContentUtils.GetIndexConfig(new FolderUri(context.TemplateFolder), "Submissions");
Expand Down Expand Up @@ -463,10 +466,8 @@ private static int GetTabId(DataSourceContext context)

private static DefaultDataItem CreateDefaultDataItem(OpenContentInfo content)
{
return new DefaultDataItem
return new DefaultDataItem(content.Id)
{
Id = content.Id,
Key= content.Key,
Collection = content.Collection,
Title = content.Title,
Data = content.JsonAsJToken,
Expand Down
Loading

0 comments on commit e9de4ae

Please sign in to comment.