Skip to content

Commit

Permalink
Merge branch 'release/v4.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
sachatrauwaen committed Apr 21, 2021
2 parents a3dadd8 + 0e8e7d3 commit d76d2b2
Show file tree
Hide file tree
Showing 193 changed files with 30,524 additions and 21,168 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ obj/
Install/
*.user
OpenContentDnnHost/bin/
OpenContent/lama/node_modules/
12 changes: 10 additions & 2 deletions OpenContent-NoWebsite.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio Version 16
VisualStudioVersion = 16.0.30503.244
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenContent", "OpenContent\OpenContent.csproj", "{7D61A32C-0F21-453F-A981-BD8E5A3A5304}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenContentTests", "OpenContentTests\OpenContentTests.csproj", "{5703831E-F8C9-4832-9B06-1A2D24426CDF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DDFBA7DA-A5EB-47CF-952C-C2D6B8BC2951}"
ProjectSection(SolutionItems) = preProject
custom.targets = custom.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -25,4 +30,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0AEF2EF6-FF7E-4F28-A7AB-0DDB2FAE6921}
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions OpenContent/AlpacaFormBuilder.ascx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
newHeight,
newWidth;
newHeight = $window.height() - 36;
newWidth = Math.min($window.width() - 40, 1600);
newHeight = $window.height() - 110;
newWidth = Math.min($window.width() - 110, 1600);
popup.dialog("option", {
close: function () { window.dnnModal.closePopUp(false, ""); },
Expand Down
9 changes: 9 additions & 0 deletions OpenContent/App_LocalResources/Edit.ascx.resx
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,13 @@
<data name="cmdCopy.Text" xml:space="preserve">
<value>Copy</value>
</data>
<data name="errInvalid.Text" xml:space="preserve">
<value>Some fields are required or invalid.</value>
</data>
<data name="txtDeleteConfirmMessage.Text" xml:space="preserve">
<value>Are you sure you want to delete this Item?</value>
</data>
<data name="txtMLDeleteConfirmMessage.Text" xml:space="preserve">
<value>Are you sure you want to delete this Item (this may affect all languages)?</value>
</data>
</root>
20 changes: 20 additions & 0 deletions OpenContent/BuildScripts/ModulePackage.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="MSBuild.Community.Tasks.Targets" />

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

<Target Name="BeforeBuild">
<CallTarget Targets="SetVersionInfo" />
</Target>

<!-- Set the version numbers in AssemblyInfo -->
<Target Name="SetVersionInfo">
<XmlRead Prefix="n"
Namespace="http://schemas.microsoft.com/developer/msbuild/2003"
XPath="dotnetnuke/packages/package[1]/@version"
XmlFileName="$(DNNFileName).dnn">
<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;)" />
</Target>

<Target Name="PackageModule" Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<XmlRead Prefix="n"
Expand Down
6 changes: 6 additions & 0 deletions OpenContent/Components/Alpaca/AlpacaContext.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using DotNetNuke.Services.Localization;
using Newtonsoft.Json;

namespace Satrabel.OpenContent.Components.Alpaca
{
public class AlpacaContext
Expand Down Expand Up @@ -37,6 +38,9 @@ public AlpacaContext(int PortalId, int ModuleId, string ItemId,
public int ModuleId { get; private set; }
[JsonProperty(PropertyName = "itemId")]
public string ItemId { get; set; }



[JsonProperty(PropertyName = "currentCulture")]
public string CurrentCulture
{
Expand Down Expand Up @@ -84,5 +88,7 @@ public string AppPath
public bool Horizontal { get; set; }
[JsonProperty(PropertyName = "isNew")]
public bool IsNew { get; set; }
[JsonProperty(PropertyName = "deleteConfirmMessage")]
public string DeleteConfirmMessage { get; set; }
}
}
3 changes: 3 additions & 0 deletions OpenContent/Components/Alpaca/FormBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Newtonsoft.Json.Linq;
using Satrabel.OpenContent.Components.Json;
using Satrabel.OpenContent.Components.Lucene.Config;
using Satrabel.OpenContent.Components.Lucene.Mapping;

namespace Satrabel.OpenContent.Components.Alpaca
{
Expand Down Expand Up @@ -65,6 +66,8 @@ public JObject BuildQuerySettings(string collection)
}
List<string> fieldLst = new List<string>();
GetFields(newSchemaFilter, newOptionsFilter, schemaConfig, optionsConfig, fieldLst, indexConfig);

fieldLst.Add(JsonMappingUtils.FIELD_TIMESTAMP);
// Sort
SchemaConfig newSchemaSort = new SchemaConfig()
{
Expand Down
2 changes: 1 addition & 1 deletion OpenContent/Components/Caching/DnnCacheAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void ClearCache(string cacheKey)
public void SyncronizeCache(OpenContentModuleConfig ocModuleConfig)
{
int dataModuleId = ocModuleConfig.DataModule.ModuleId;
var dataModuleHasCrossPortalData = Json.JsonExtensions.GetValue(ocModuleConfig.DataModule.ModuleInfo.OpenContentSettings().Manifest.Permissions, "AllowCrossPortalData", false);
var dataModuleHasCrossPortalData = Json.JsonExtensions.GetValue(ocModuleConfig.DataModule.ModuleInfo.OpenContentSettings().Manifest?.Permissions, "AllowCrossPortalData", false);
if (dataModuleHasCrossPortalData)
foreach (PortalInfo portal in PortalController.Instance.GetPortals())
{
Expand Down
2 changes: 2 additions & 0 deletions OpenContent/Components/Datasource/DefaultDataItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public DefaultDataItem(JToken json)
Data = json;
}
public string Id { get; set; }
public string Key { get; set; }
public string Collection { get; set; }
public string Title { get; set; }
public JToken Data { get; set; }
Expand All @@ -22,5 +23,6 @@ public DefaultDataItem(JToken json)
public int LastModifiedByUserId { get; set; }
public DateTime LastModifiedOnDate { get; set; }
public object Item { get; set; }

}
}
16 changes: 9 additions & 7 deletions OpenContent/Components/Datasource/DnnUsersDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,12 @@ public override IDataItems GetAll(DataSourceContext context, Select selectQuery)
else
{
int pageIndex = 0;
int pageSize = 1000;
int pageSize = 100000;
int total = 0;
IEnumerable<UserInfo> users;
if (selectQuery != null)
{
pageIndex = selectQuery.PageIndex;
pageSize = selectQuery.PageSize;

var ruleDisplayName = selectQuery.Query.FilterRules.FirstOrDefault(f => f.Field == "DisplayName");
var ruleRoles = selectQuery.Query.FilterRules.FirstOrDefault(f => f.Field == "Roles");
var ruleApproved = selectQuery.Query.FilterRules.FirstOrDefault(f => f.Field == "Approved");
Expand All @@ -146,8 +145,9 @@ public override IDataItems GetAll(DataSourceContext context, Select selectQuery)
else
{
users = UserController.GetUsers(context.PortalId, pageIndex, pageSize, ref total, true, false).Cast<UserInfo>();
total = users.Count();

}
var userCount = users.Count();
if (ruleRoles != null)
{
var roleNames = ruleRoles.MultiValue.Select(r => r.AsString).ToList();
Expand All @@ -158,16 +158,18 @@ public override IDataItems GetAll(DataSourceContext context, Select selectQuery)
var val = bool.Parse(ruleApproved.Value.AsString);
users = users.Where(u => u.Membership.Approved == val);
}
total = users.Count();
pageIndex = selectQuery.PageIndex;
pageSize = selectQuery.PageSize;
users = users.Skip(pageIndex * pageSize).Take(pageSize);
}
else
{
users = UserController.GetUsers(context.PortalId, pageIndex, pageSize, ref total, true, false).Cast<UserInfo>();
}
int excluded = users.Count() - users.Count(u => u.IsInRole("Administrators"));
int excluded = users.Count(u => u.IsInRole("Administrators"));
users = users.Where(u => !u.IsInRole("Administrators"));


//users = users.Skip(pageIndex * pageSize).Take(pageSize);
var dataList = new List<IDataItem>();
foreach (var user in users)
{
Expand Down
1 change: 1 addition & 0 deletions OpenContent/Components/Datasource/IDataItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Satrabel.OpenContent.Components.Datasource
public interface IDataItem
{
string Id { get; set; }
string Key { get; set; }
string Collection { get; set; }
string Title { get; set; }
JToken Data { get; set; }
Expand Down
17 changes: 12 additions & 5 deletions OpenContent/Components/Datasource/OpenContentDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ public virtual JToken Action(DataSourceContext context, string action, IDataItem
{
if (action == "FormSubmit")
{
if (data["form"]["approvalEnabled"] != null && data["form"]["approvalEnabled"].Value<bool>() == true )
{
data["form"]["approved"] = false;
}
OpenContentController ctrl = new OpenContentController(context.PortalId);
//var indexConfig = OpenContentUtils.GetIndexConfig(new FolderUri(context.TemplateFolder), "Submissions");
var content = new OpenContentInfo()
Expand All @@ -369,11 +373,13 @@ public virtual JToken Action(DataSourceContext context, string action, IDataItem
ctrl.AddContent(content);

//Index the content item
//if (context.Index)
//{
// LuceneController.Instance.Add(content, indexConfig);
// LuceneController.Instance.Commit();
//}

if (context.Index)
{
var indexConfig = OpenContentUtils.GetIndexConfig(new FolderUri(context.TemplateFolder), "Submissions");
LuceneController.Instance.Add(content, indexConfig);
LuceneController.Instance.Commit();
}
return FormUtils.FormSubmit(data as JObject, item?.Data?.DeepClone() as JObject);
}
return null;
Expand Down Expand Up @@ -460,6 +466,7 @@ private static DefaultDataItem CreateDefaultDataItem(OpenContentInfo content)
return new DefaultDataItem
{
Id = content.Id,
Key= content.Key,
Collection = content.Collection,
Title = content.Title,
Data = content.JsonAsJToken,
Expand Down
20 changes: 16 additions & 4 deletions OpenContent/Components/DnnEntitiesAPIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,26 @@ public HttpResponseMessage ImagesLookup(string q, string d)
/// Imageses the lookup.
/// </summary>
/// <param name="q">The string that should be Contained in the name of the file (case insensitive). Use * to get all the files.</param>
/// <param name="d">The Folder path to retrieve</param>
/// <param name="folder">The Folder path to retrieve</param>
/// <param name="itemId"></param>
/// <returns></returns>
[ValidateAntiForgeryToken]
[DnnModuleAuthorize(AccessLevel = SecurityAccessLevel.Edit)]
[HttpGet]
public HttpResponseMessage ImagesLookupExt(string q, string folder)
public HttpResponseMessage ImagesLookupExt(string q, string folder, string itemKey = "")
{
try
{

var module = OpenContentModuleConfig.Create(ActiveModule, PortalSettings);
var folderManager = FolderManager.Instance;
string imageFolder = "OpenContent/Files/" + ActiveModule.ModuleID;

if (module.Settings.Manifest.DeleteFiles)
{
if (!string.IsNullOrEmpty(itemKey))
{
imageFolder += "/" + itemKey;
}
}
if (!string.IsNullOrEmpty(folder))
{
imageFolder = folder;
Expand Down Expand Up @@ -467,6 +474,10 @@ public HttpResponseMessage CropImage(CropResizeDTO cropData)
rawImageUrl = rawImageUrl.Replace(PortalSettings.HomeDirectory, "");
var file = fileManager.GetFile(ActiveModule.PortalID, rawImageUrl);
string cropfolder = "OpenContent/Cropped/" + ActiveModule.ModuleID;
if (!string.IsNullOrEmpty(cropData.itemKey))
{
cropfolder += "/" + cropData.itemKey;
}
if (!string.IsNullOrEmpty(cropData.cropfolder))
{
cropfolder = cropData.cropfolder;
Expand Down Expand Up @@ -849,6 +860,7 @@ public class CropResizeDTO
public CropDTO crop { get; set; }
public ResizeDTO resize { get; set; }
public string cropfolder { get; set; }
public string itemKey { get; set; }
}
public class CropResizeResultDTO
{
Expand Down
Loading

0 comments on commit d76d2b2

Please sign in to comment.