This commit is contained in:
2022-05-16 15:01:01 +01:00
parent 4cc1185c3c
commit d17cce340e
18 changed files with 318 additions and 203 deletions
@@ -73,8 +73,29 @@ namespace Saxonite.Net.Standard.Base.App
public static int Periodic { get; } = SacsSystem.DebugMode ? 120 : 1800;
}
}
public static class Profile
{
public static class User
{
public static class Image
{
public static ushort WidthMax { get; } = 320;
public static ushort HeightMax { get; } = 400;
}
}
}
public static class Articles
{
public static class Segments
{
public static ushort Max { get; } = 12;
public static ushort CharsMax { get; } = 8000;
}
public static class Images
{
public static ushort WidthMax { get; } = 800;
public static ushort HeightMax { get; } = 640;
}
public static ushort PublishMaxDaysBefore { get; } = 7;
public static ushort PublishMaxDaysAhead { get; } = 10;
}
+3 -1
View File
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
//-------------------------------------------------------------------
public static class Version
{
private static String version { get; } = "1.2.5.1";
private static String version { get; } = "1.2.6.0";
// Retrieve version.
public static String GetFullVersion () { return version; }
public static String GetAppVersion ()
@@ -40,6 +40,8 @@ namespace Saxonite.Net.Standard.Base.App
//-------------------------------------------------------------------
// Version history.
//-------------------------------------------------------------------
// 1.2.6 ??-May-2022 Image resizing
// - Profile and article images resized to maximum width/height.
// 1.2.5 20-Apr-2022 Article feedback
// - Online Activity/Article feedback 5 stars, summary on Article list/popup.
// - Online Activity filter.
@@ -211,6 +211,37 @@ namespace Saxonite.Net.Standard.Base.Bus
return new ItemId((short)Sax.DataItemType.ItemImage, Id);
}
// Validation.
public static List<Sax.DataItemType> ValidItemTypes
{
get
{
return new List<Sax.DataItemType> { Sax.DataItemType.UserAccount, Sax.DataItemType.Organisation, Sax.DataItemType.Article };
}
}
public static List<Sacs.MimeType> GetValidMimeTypes(Sax.DataItemType itemType)
{
switch (itemType)
{
case Sax.DataItemType.UserAccount:
case Sax.DataItemType.Organisation:
case Sax.DataItemType.Article:
return new List<Sacs.MimeType> { Sacs.MimeType.Jpeg, Sacs.MimeType.Webp, Sacs.MimeType.Png };
}
return new List<Sacs.MimeType>();
}
public static List<String> GetValidContentTypes(Sax.DataItemType itemType)
{
switch (itemType)
{
case Sax.DataItemType.UserAccount:
case Sax.DataItemType.Organisation:
case Sax.DataItemType.Article:
return new List<string> { "image/jpg", "image/jpeg", "image/webp", "image/png" };
}
return new List<string>();
}
//-------------------------------------------------------------------
// Properties.
public Data GetData() { return data.Clone(); }
@@ -72,10 +72,18 @@ namespace Saxonite.Net.Standard.Base.Mgr
//---------------------------------------------------------------
// Item Id.
if (errField.ItemId != SacsHierarchyItem.ValidValue.Ignore && !ItemId.IsValid(data.ItemId))
if (errField.ItemId != SacsHierarchyItem.ValidValue.Ignore)
{
errField.ItemId = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Item Id must be specified");
if (!ItemId.IsValid(data.ItemId))
{
errField.ItemId = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Item Id must be specified");
}
if (!SaxItemImage.ValidItemTypes.Contains((Sax.DataItemType)data.ItemId.Type))
{
errField.ItemId = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Invalid item type specified");
}
}
// Image type.
if (errField.ImageType != SacsHierarchyItem.ValidValue.Ignore && (int)data.ImageType < 1)