Initial commit

This commit is contained in:
2025-02-13 22:10:32 +01:00
commit 3563d783d4
162 changed files with 14738 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Bring2mind.InMemoriam.Core</AssemblyName>
<TargetFramework>net472</TargetFramework>
<OutputPath>..\..\bin</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<Authors>Peter Donker</Authors>
<Company>Bring2mind</Company>
<Product>inmemoriam</Product>
<Copyright>Copyright 2025 by Bring2mind</Copyright>
<PackageId>InMemoriam</PackageId>
<AssemblyVersion>1.0.2</AssemblyVersion>
<FileVersion>1.0.2</FileVersion>
<Description>In Memoriam module</Description>
<NeutralLanguage>en-US</NeutralLanguage>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />
<DebugType>Portable</DebugType>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DotNetNuke.Core" Version="9.13.0" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,7 @@
namespace Bring2mind.InMemoriam.Core.Common
{
public static class Globals
{
public const string uploadPath = @"InMemoriam\Pictures";
}
}

View File

@@ -0,0 +1,43 @@
using System.IO;
namespace Bring2mind.InMemoriam.Core.Common
{
public class Image
{
public string ResizedFile { get; set; }
public bool ImageExists { get; set; }
private string Location { get; set; }
public Image(string location, string id, int width, int height, string method)
{
Location = location;
var filePath = Path.Combine(location, id + ".resources");
ImageExists = File.Exists(filePath);
if (ImageExists)
{
ResizedFile = $"{id}_{width}_{height}_{method}.jpg";
var m = ImageResizer.ResizeMethod.Stretch;
switch (method)
{
case "b":
m = ImageResizer.ResizeMethod.Box;
break;
case "c":
m = ImageResizer.ResizeMethod.Crop;
break;
}
ImageResizer.ResizeImage(filePath, $"{location}\\{ResizedFile}", width, height, m);
}
}
public void CopyToStream(Stream s)
{
var imgFile = ImageExists ? string.Format("{0}\\{1}", Location, ResizedFile) : string.Format("{0}\\images\\no-content.png", DotNetNuke.Common.Globals.ApplicationMapPath);
using (var fs = new FileStream(imgFile, FileMode.Open, FileAccess.Read))
{
fs.CopyTo(s);
fs.Flush();
}
}
}
}

View File

@@ -0,0 +1,15 @@
namespace Bring2mind.InMemoriam.Core.Common
{
public enum ImageOrientation
{
Unknown = 0,
Normal = 1,
FlipHorizontal = 2,
Rotate180 = 3,
FlipVertical = 4,
Transpose = 5,
Rotate270 = 6,
Transverse = 7,
Rotate90 = 8
}
}

View File

@@ -0,0 +1,134 @@
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
namespace Bring2mind.InMemoriam.Core.Common
{
public class ImageResizer
{
public enum ResizeMethod
{
Box,
Crop,
Stretch
}
public static void ResizeImage(string source, string destination, int desiredWidth, int desiredHeight, ResizeMethod method)
{
var format = ImageFormat.Jpeg;
var target = Resize(source, desiredWidth, desiredHeight, method);
target.Save(destination, format);
}
private static System.Drawing.Image Resize(string sourceImageMapPath, int desiredWidth, int desiredHeight, ResizeMethod method)
{
//throw error if bouning box is to small
if (desiredWidth < 4 || desiredHeight < 4)
throw new InvalidOperationException("Bounding Box of Resize Photo must be larger than 4X4 pixels.");
var original = Bitmap.FromFile(sourceImageMapPath);
try
{
var orientation = (ImageOrientation)original.GetPropertyItem(274).Value[0];
switch (orientation)
{
case ImageOrientation.FlipHorizontal:
original.RotateFlip(RotateFlipType.RotateNoneFlipX);
break;
case ImageOrientation.Rotate180:
original.RotateFlip(RotateFlipType.Rotate180FlipNone);
break;
case ImageOrientation.FlipVertical:
original.RotateFlip(RotateFlipType.RotateNoneFlipY);
break;
case
ImageOrientation.Transpose:
original.RotateFlip(RotateFlipType.RotateNoneFlipXY);
break;
case ImageOrientation.Rotate270:
original.RotateFlip(RotateFlipType.Rotate90FlipNone);
break;
case
ImageOrientation.Transverse:
original.RotateFlip(RotateFlipType.Rotate90FlipXY);
break;
case ImageOrientation.Rotate90:
original.RotateFlip(RotateFlipType.Rotate270FlipNone);
break;
default:
break;
}
}
catch (Exception ex)
{
}
//store image widths in variable for easier use
var oW = (decimal)original.Width;
var oH = (decimal)original.Height;
var dW = (decimal)desiredWidth;
var dH = (decimal)desiredHeight;
var scaleWidth = dW / oW;
var scaleHeight = dH / oH;
int tW = desiredWidth;
int tH = desiredHeight;
int tX = 0;
int tY = 0;
int tDX = desiredWidth;
int tDY = desiredHeight;
//check if image already fits
if (oW <= dW && oH <= dH)
return original; //image fits in bounding box, keep size (center with css) If we made it bigger it would stretch the image resulting in loss of quality.
//check for double squares or plain stretch resizing
if ((oW == oH && dW == dH) || method == ResizeMethod.Stretch)
{
// don't do anything
}
else
{
switch (method)
{
case ResizeMethod.Crop:
var scaleMax = Math.Max(scaleHeight, scaleWidth);
if (scaleHeight > scaleWidth)
{
tX = -1 * Convert.ToInt32(((scaleMax * oW) - dW) / 2);
tDX = Convert.ToInt32(scaleMax * oW);
}
else
{
tY = -1 * Convert.ToInt32(((scaleMax * oH) - dH) / 2);
tDY = Convert.ToInt32(scaleMax * oH);
}
break;
default:
var scaleMin = Math.Min(scaleHeight, scaleWidth);
tW = Convert.ToInt32(oW * scaleMin);
tH = Convert.ToInt32(oH * scaleMin);
tDX = tW;
tDY = tH;
break;
}
}
var destImage = new Bitmap(tW, tH);
using (var graphics = Graphics.FromImage(destImage))
{
graphics.CompositingMode = CompositingMode.SourceCopy;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphics.DrawImage(original, tX, tY, tDX, tDY);
}
return destImage;
}
}
}

View File

@@ -0,0 +1,9 @@
namespace Bring2mind.InMemoriam.Core.Common
{
public enum Visibility
{
Public = 0,
Friends = 1,
Private = 2
}
}

View File

@@ -0,0 +1,46 @@
using System;
using System.Data;
using System.Runtime.Serialization;
using DotNetNuke.Common.Utilities;
namespace Bring2mind.InMemoriam.Core.Data
{
[DataContract]
public abstract class AuditableEntity
{
public void FillAuditFields(IDataReader dr)
{
CreatedByUserID = Convert.ToInt32(Null.SetNull(dr["CreatedByUserID"], CreatedByUserID));
CreatedOnDate = Convert.ToDateTime(Null.SetNull(dr["CreatedOnDate"], CreatedOnDate));
LastModifiedByUserID = Convert.ToInt32(Null.SetNull(dr["LastModifiedByUserID"], LastModifiedByUserID));
LastModifiedOnDate = Convert.ToDateTime(Null.SetNull(dr["LastModifiedOnDate"], LastModifiedOnDate));
}
public void SetAddingUser(int userId)
{
CreatedByUserID = userId;
CreatedOnDate = DateTime.Now;
SetModifyingUser(userId);
}
public void SetModifyingUser(int userId)
{
LastModifiedByUserID = userId;
LastModifiedOnDate = DateTime.Now;
}
#region Public Properties
[DataMember]
public int CreatedByUserID { get; set; }
[DataMember]
public DateTime CreatedOnDate { get; set; }
[DataMember]
public int LastModifiedByUserID { get; set; }
[DataMember]
public DateTime LastModifiedOnDate { get; set; }
#endregion
}
}

View File

@@ -0,0 +1,132 @@
using System.Collections.Generic;
using DotNetNuke.Collections;
using DotNetNuke.Data;
namespace Bring2mind.InMemoriam.Core.Data
{
public abstract class RepositoryImpl<T> : IRepository<T> where T : class
{
public virtual void Delete(T item)
{
using (IDataContext db = DataContext.Instance()) {
IRepository<T> repo = db.GetRepository<T>();
repo.Delete(item);
}
}
public virtual void Delete(string sqlCondition, params object[] args)
{
using (IDataContext db = DataContext.Instance()) {
IRepository<T> repo = db.GetRepository<T>();
repo.Delete(sqlCondition, args);
}
}
public virtual IEnumerable<T> Find(string sqlCondition, params object[] args)
{
IEnumerable<T> list = null;
using (IDataContext db = DataContext.Instance()) {
IRepository<T> repo = db.GetRepository<T>();
list = repo.Find(sqlCondition, args);
}
return list;
}
public virtual IPagedList<T> Find(int pageIndex, int pageSize, string sqlCondition, params object[] args)
{
IPagedList<T> list = null;
using (IDataContext db = DataContext.Instance()) {
IRepository<T> repo = db.GetRepository<T>();
list = repo.Find(pageIndex, pageSize, sqlCondition, args);
}
return list;
}
public virtual IEnumerable<T> Get()
{
IEnumerable<T> list = null;
using (IDataContext db = DataContext.Instance()) {
IRepository<T> repo = db.GetRepository<T>();
list = repo.Get();
}
return list;
}
public virtual IEnumerable<T> Get<TScopeType>(TScopeType scopeValue)
{
IEnumerable<T> list = null;
using (IDataContext db = DataContext.Instance()) {
IRepository<T> repo = db.GetRepository<T>();
list = repo.Get<TScopeType>(scopeValue);
}
return list;
}
public virtual T GetById<TProperty>(TProperty id)
{
T item = null;
using (IDataContext db = DataContext.Instance()) {
IRepository<T> repo = db.GetRepository<T>();
item = repo.GetById<TProperty>(id);
}
return item;
}
public virtual T GetById<TProperty, TScopeType>(TProperty id, TScopeType scopeValue)
{
T item = null;
using (IDataContext db = DataContext.Instance()) {
IRepository<T> repo = db.GetRepository<T>();
item = repo.GetById<TProperty, TScopeType>(id, scopeValue);
}
return item;
}
public virtual IPagedList<T> GetPage(int pageIndex, int pageSize)
{
IPagedList<T> list = null;
using (IDataContext db = DataContext.Instance()) {
IRepository<T> repo = db.GetRepository<T>();
list = repo.GetPage(pageIndex, pageSize);
}
return list;
}
public virtual IPagedList<T> GetPage<TScopeType>(TScopeType scopeValue, int pageIndex, int pageSize)
{
IPagedList<T> list = null;
using (IDataContext db = DataContext.Instance()) {
IRepository<T> repo = db.GetRepository<T>();
list = repo.GetPage<TScopeType>(scopeValue, pageIndex, pageSize);
}
return list;
}
public virtual void Insert(T item)
{
using (IDataContext db = DataContext.Instance()) {
IRepository<T> repo = db.GetRepository<T>();
repo.Insert(item);
}
}
public virtual void Update(T item)
{
using (IDataContext db = DataContext.Instance()) {
IRepository<T> repo = db.GetRepository<T>();
repo.Update(item);
}
}
public virtual void Update(string sqlCondition, params object[] args)
{
using (IDataContext db = DataContext.Instance()) {
IRepository<T> repo = db.GetRepository<T>();
repo.Update(sqlCondition, args);
}
}
}
}

View File

@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using DotNetNuke.Data;
namespace Bring2mind.InMemoriam.Core.Data
{
public class Sprocs
{
}
}

View File

@@ -0,0 +1,6 @@
namespace Bring2mind.InMemoriam.Core.Models.Messages
{
public partial class Message
{
}
}

View File

@@ -0,0 +1,63 @@
using System;
using System.Runtime.Serialization;
using DotNetNuke.ComponentModel.DataAnnotations;
using Bring2mind.InMemoriam.Core.Data;
namespace Bring2mind.InMemoriam.Core.Models.Messages
{
[TableName("B2M_InMemoriam_Messages")]
[PrimaryKey("MessageId", AutoIncrement = true)]
[DataContract]
[Scope("ModuleId")]
public partial class Message {
#region .ctor
public Message()
{
MessageId = -1;
}
#endregion
#region Properties
[DataMember]
public int MessageId { get; set; }
[DataMember]
public int ModuleId { get; set; }
[DataMember]
public string Contents { get; set; }
[DataMember]
public string SenderName { get; set; }
[DataMember]
public string SenderEmail { get; set; }
[DataMember]
public DateTime CreatedOn { get; set; }
#endregion
#region Methods
public void ReadMessage(Message message)
{
if (message.MessageId > -1)
MessageId = message.MessageId;
if (message.ModuleId > -1)
ModuleId = message.ModuleId;
if (!String.IsNullOrEmpty(message.Contents))
Contents = message.Contents;
if (!String.IsNullOrEmpty(message.SenderName))
SenderName = message.SenderName;
if (!String.IsNullOrEmpty(message.SenderEmail))
SenderEmail = message.SenderEmail;
CreatedOn = message.CreatedOn;
}
#endregion
}
}

View File

@@ -0,0 +1,76 @@
using System;
using System.Data;
using DotNetNuke.Common.Utilities;
using DotNetNuke.ComponentModel.DataAnnotations;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Tokens;
namespace Bring2mind.InMemoriam.Core.Models.Messages
{
public partial class Message : IHydratable, IPropertyAccess
{
#region IHydratable
public virtual void Fill(IDataReader dr)
{
MessageId = Convert.ToInt32(Null.SetNull(dr["MessageId"], MessageId));
ModuleId = Convert.ToInt32(Null.SetNull(dr["ModuleId"], ModuleId));
Contents = Convert.ToString(Null.SetNull(dr["Contents"], Contents));
SenderName = Convert.ToString(Null.SetNull(dr["SenderName"], SenderName));
SenderEmail = Convert.ToString(Null.SetNull(dr["SenderEmail"], SenderEmail));
CreatedOn = (DateTime)(Null.SetNull(dr["CreatedOn"], CreatedOn));
}
[IgnoreColumn()]
public int KeyID
{
get { return MessageId; }
set { MessageId = value; }
}
#endregion
#region IPropertyAccess
public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
{
switch (strPropertyName.ToLower())
{
case "messageid": // Int
return MessageId.ToString(strFormat, formatProvider);
case "moduleid": // Int
return ModuleId.ToString(strFormat, formatProvider);
case "contents": // NVarCharMax
return PropertyAccess.FormatString(Contents, strFormat);
case "sendername": // NVarChar
if (SenderName == null)
{
return "";
};
return PropertyAccess.FormatString(SenderName, strFormat);
case "senderemail": // NVarChar
if (SenderEmail == null)
{
return "";
};
return PropertyAccess.FormatString(SenderEmail, strFormat);
case "createdon": // DateTime
return CreatedOn.ToString(strFormat, formatProvider);
default:
propertyNotFound = true;
break;
}
return Null.NullString;
}
[IgnoreColumn()]
public CacheLevel Cacheability
{
get { return CacheLevel.fullyCacheable; }
}
#endregion
}
}

View File

@@ -0,0 +1,94 @@
using System;
using System.Runtime.Serialization;
using DotNetNuke.ComponentModel.DataAnnotations;
using Bring2mind.InMemoriam.Core.Data;
namespace Bring2mind.InMemoriam.Core.Models.Pictures
{
[TableName("B2M_InMemoriam_Pictures")]
[PrimaryKey("PictureId", AutoIncrement = true)]
[DataContract]
[Scope("ModuleId")]
public partial class PictureBase : AuditableEntity
{
#region .ctor
public PictureBase()
{
PictureId = -1;
}
#endregion
#region Properties
[DataMember]
public int PictureId { get; set; }
[DataMember]
public int ModuleId { get; set; }
[DataMember]
public Guid ImageIdentifier { get; set; }
[DataMember]
public int OriginalWidth { get; set; }
[DataMember]
public int OriginalHeight { get; set; }
[DataMember]
public string OriginalName { get; set; }
[DataMember]
public string Title { get; set; }
[DataMember]
public string Description { get; set; }
[DataMember]
public int PictureYear { get; set; }
[DataMember]
public int PictureMonth { get; set; }
[DataMember]
public int PictureDay { get; set; }
[DataMember]
public int Visibility { get; set; }
#endregion
#region Methods
public void ReadPictureBase(PictureBase picture)
{
if (picture.PictureId > -1)
PictureId = picture.PictureId;
if (picture.ModuleId > -1)
ModuleId = picture.ModuleId;
ImageIdentifier = picture.ImageIdentifier;
if (picture.OriginalWidth > -1)
OriginalWidth = picture.OriginalWidth;
if (picture.OriginalHeight > -1)
OriginalHeight = picture.OriginalHeight;
if (!String.IsNullOrEmpty(picture.OriginalName))
OriginalName = picture.OriginalName;
if (!String.IsNullOrEmpty(picture.Title))
Title = picture.Title;
if (!String.IsNullOrEmpty(picture.Description))
Description = picture.Description;
if (picture.PictureYear > -1)
PictureYear = picture.PictureYear;
if (picture.PictureMonth > -1)
PictureMonth = picture.PictureMonth;
if (picture.PictureDay > -1)
PictureDay = picture.PictureDay;
if (picture.Visibility > -1)
Visibility = picture.Visibility;
}
#endregion
}
}

View File

@@ -0,0 +1,20 @@
using Bring2mind.InMemoriam.Core.Data;
namespace Bring2mind.InMemoriam.Core.Models.Pictures
{
public partial class PictureBase : AuditableEntity
{
public void ReadEditedPictureBase(PictureBase picture)
{
Title = picture.Title.Trim();
Description = picture.Description.Trim();
PictureYear = picture.PictureYear;
PictureMonth = picture.PictureMonth;
PictureDay = picture.PictureDay;
Visibility = picture.Visibility;
}
}
}

View File

@@ -0,0 +1,99 @@
using System;
using System.Data;
using DotNetNuke.Common.Utilities;
using DotNetNuke.ComponentModel.DataAnnotations;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Tokens;
namespace Bring2mind.InMemoriam.Core.Models.Pictures
{
public partial class PictureBase : IHydratable, IPropertyAccess
{
#region IHydratable
public virtual void Fill(IDataReader dr)
{
FillAuditFields(dr);
PictureId = Convert.ToInt32(Null.SetNull(dr["PictureId"], PictureId));
ModuleId = Convert.ToInt32(Null.SetNull(dr["ModuleId"], ModuleId));
ImageIdentifier = new Guid(Convert.ToString(Null.SetNull(dr["ImageIdentifier"], ImageIdentifier)));
OriginalWidth = Convert.ToInt32(Null.SetNull(dr["OriginalWidth"], OriginalWidth));
OriginalHeight = Convert.ToInt32(Null.SetNull(dr["OriginalHeight"], OriginalHeight));
OriginalName = Convert.ToString(Null.SetNull(dr["OriginalName"], OriginalName));
Title = Convert.ToString(Null.SetNull(dr["Title"], Title));
Description = Convert.ToString(Null.SetNull(dr["Description"], Description));
PictureYear = Convert.ToInt32(Null.SetNull(dr["PictureYear"], PictureYear));
PictureMonth = Convert.ToInt32(Null.SetNull(dr["PictureMonth"], PictureMonth));
PictureDay = Convert.ToInt32(Null.SetNull(dr["PictureDay"], PictureDay));
Visibility = Convert.ToInt32(Null.SetNull(dr["Visibility"], Visibility));
}
[IgnoreColumn()]
public int KeyID
{
get { return PictureId; }
set { PictureId = value; }
}
#endregion
#region IPropertyAccess
public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
{
switch (strPropertyName.ToLower())
{
case "pictureid": // Int
return PictureId.ToString(strFormat, formatProvider);
case "moduleid": // Int
return ModuleId.ToString(strFormat, formatProvider);
case "imageidentifier": // UniqueIdentifier
return ImageIdentifier.ToString(strFormat, formatProvider);
case "originalwidth": // Int
return OriginalWidth.ToString(strFormat, formatProvider);
case "originalheight": // Int
return OriginalHeight.ToString(strFormat, formatProvider);
case "originalname": // NVarChar
if (OriginalName == null)
{
return "";
};
return PropertyAccess.FormatString(OriginalName, strFormat);
case "title": // NVarChar
if (Title == null)
{
return "";
};
return PropertyAccess.FormatString(Title, strFormat);
case "description": // NVarCharMax
if (Description == null)
{
return "";
};
return PropertyAccess.FormatString(Description, strFormat);
case "pictureyear": // Int
return PictureYear.ToString(strFormat, formatProvider);
case "picturemonth": // Int
return PictureMonth.ToString(strFormat, formatProvider);
case "pictureday": // Int
return PictureDay.ToString(strFormat, formatProvider);
case "visibility": // Int
return Visibility.ToString(strFormat, formatProvider);
default:
propertyNotFound = true;
break;
}
return Null.NullString;
}
[IgnoreColumn()]
public CacheLevel Cacheability
{
get { return CacheLevel.fullyCacheable; }
}
#endregion
}
}

View File

@@ -0,0 +1,76 @@
using System;
using System.Runtime.Serialization;
using DotNetNuke.ComponentModel.DataAnnotations;
namespace Bring2mind.InMemoriam.Core.Models.Pictures
{
[TableName("vw_B2M_InMemoriam_Pictures")]
[PrimaryKey("PictureId", AutoIncrement = true)]
[DataContract]
[Scope("ModuleId")]
public partial class Picture : PictureBase
{
#region .ctor
public Picture() : base()
{
}
#endregion
#region Properties
[DataMember]
public string CreatedByUser { get; set; }
[DataMember]
public string LastModifiedByUser { get; set; }
#endregion
#region Methods
public PictureBase GetPictureBase()
{
PictureBase res = new PictureBase();
res.PictureId = PictureId;
res.ModuleId = ModuleId;
res.ImageIdentifier = ImageIdentifier;
res.OriginalWidth = OriginalWidth;
res.OriginalHeight = OriginalHeight;
res.OriginalName = OriginalName;
res.Title = Title;
res.Description = Description;
res.PictureYear = PictureYear;
res.PictureMonth = PictureMonth;
res.PictureDay = PictureDay;
res.Visibility = Visibility;
res.CreatedByUserID = CreatedByUserID;
res.CreatedOnDate = CreatedOnDate;
res.LastModifiedByUserID = LastModifiedByUserID;
res.LastModifiedOnDate = LastModifiedOnDate;
return res;
}
public Picture Clone()
{
Picture res = new Picture();
res.PictureId = PictureId;
res.ModuleId = ModuleId;
res.ImageIdentifier = ImageIdentifier;
res.OriginalWidth = OriginalWidth;
res.OriginalHeight = OriginalHeight;
res.OriginalName = OriginalName;
res.Title = Title;
res.Description = Description;
res.PictureYear = PictureYear;
res.PictureMonth = PictureMonth;
res.PictureDay = PictureDay;
res.Visibility = Visibility;
res.CreatedByUser = CreatedByUser;
res.LastModifiedByUser = LastModifiedByUser;
res.CreatedByUserID = CreatedByUserID;
res.CreatedOnDate = CreatedOnDate;
res.LastModifiedByUserID = LastModifiedByUserID;
res.LastModifiedOnDate = LastModifiedOnDate;
return res;
}
#endregion
}
}

View File

@@ -0,0 +1,48 @@
using System;
using System.Data;
using System.Xml.Serialization;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Services.Tokens;
namespace Bring2mind.InMemoriam.Core.Models.Pictures
{
[Serializable(), XmlRoot("Picture")]
public partial class Picture
{
#region IHydratable
public override void Fill(IDataReader dr)
{
base.Fill(dr);
CreatedByUser = Convert.ToString(Null.SetNull(dr["CreatedByUser"], CreatedByUser));
LastModifiedByUser = Convert.ToString(Null.SetNull(dr["LastModifiedByUser"], LastModifiedByUser));
}
#endregion
#region IPropertyAccess
public override string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
{
switch (strPropertyName.ToLower()) {
case "createdbyuser": // NVarChar
if (CreatedByUser == null)
{
return "";
};
return PropertyAccess.FormatString(CreatedByUser, strFormat);
case "lastmodifiedbyuser": // NVarChar
if (LastModifiedByUser == null)
{
return "";
};
return PropertyAccess.FormatString(LastModifiedByUser, strFormat);
default:
return base.GetProperty(strPropertyName, strFormat, formatProvider, accessingUser, accessLevel, ref propertyNotFound);
}
}
#endregion
}
}

View File

@@ -0,0 +1,75 @@
using System;
using System.Runtime.Serialization;
using DotNetNuke.ComponentModel.DataAnnotations;
using Bring2mind.InMemoriam.Core.Data;
namespace Bring2mind.InMemoriam.Core.Models.Stories
{
[TableName("B2M_InMemoriam_Stories")]
[PrimaryKey("StoryId", AutoIncrement = true)]
[DataContract]
[Scope("ModuleId")]
public partial class StoryBase : AuditableEntity
{
#region .ctor
public StoryBase()
{
StoryId = -1;
}
#endregion
#region Properties
[DataMember]
public int StoryId { get; set; }
[DataMember]
public int ModuleId { get; set; }
[DataMember]
public string Title { get; set; }
[DataMember]
public string Contents { get; set; }
[DataMember]
public int StoryYear { get; set; }
[DataMember]
public int StoryMonth { get; set; }
[DataMember]
public int StoryDay { get; set; }
[DataMember]
public int Visibility { get; set; }
#endregion
#region Methods
public void ReadStoryBase(StoryBase story)
{
if (story.StoryId > -1)
StoryId = story.StoryId;
if (story.ModuleId > -1)
ModuleId = story.ModuleId;
if (!String.IsNullOrEmpty(story.Title))
Title = story.Title;
if (!String.IsNullOrEmpty(story.Contents))
Contents = story.Contents;
if (story.StoryYear > -1)
StoryYear = story.StoryYear;
if (story.StoryMonth > -1)
StoryMonth = story.StoryMonth;
if (story.StoryDay > -1)
StoryDay = story.StoryDay;
if (story.Visibility > -1)
Visibility = story.Visibility;
}
#endregion
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Runtime.Serialization;
using DotNetNuke.ComponentModel.DataAnnotations;
using Bring2mind.InMemoriam.Core.Data;
namespace Bring2mind.InMemoriam.Core.Models.Stories
{
public partial class StoryBase : AuditableEntity
{
public void ReadEditedStoryBase(StoryBase story)
{
Title = story.Title.Trim();
Contents = story.Contents.Trim();
StoryYear = story.StoryYear;
StoryMonth = story.StoryMonth;
StoryDay = story.StoryDay;
Visibility = story.Visibility;
}
}
}

View File

@@ -0,0 +1,83 @@
using System;
using System.Data;
using DotNetNuke.Common.Utilities;
using DotNetNuke.ComponentModel.DataAnnotations;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Tokens;
namespace Bring2mind.InMemoriam.Core.Models.Stories
{
public partial class StoryBase : IHydratable, IPropertyAccess
{
#region IHydratable
public virtual void Fill(IDataReader dr)
{
FillAuditFields(dr);
StoryId = Convert.ToInt32(Null.SetNull(dr["StoryId"], StoryId));
ModuleId = Convert.ToInt32(Null.SetNull(dr["ModuleId"], ModuleId));
Title = Convert.ToString(Null.SetNull(dr["Title"], Title));
Contents = Convert.ToString(Null.SetNull(dr["Contents"], Contents));
StoryYear = Convert.ToInt32(Null.SetNull(dr["StoryYear"], StoryYear));
StoryMonth = Convert.ToInt32(Null.SetNull(dr["StoryMonth"], StoryMonth));
StoryDay = Convert.ToInt32(Null.SetNull(dr["StoryDay"], StoryDay));
Visibility = Convert.ToInt32(Null.SetNull(dr["Visibility"], Visibility));
}
[IgnoreColumn()]
public int KeyID
{
get { return StoryId; }
set { StoryId = value; }
}
#endregion
#region IPropertyAccess
public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
{
switch (strPropertyName.ToLower())
{
case "storyid": // Int
return StoryId.ToString(strFormat, formatProvider);
case "moduleid": // Int
return ModuleId.ToString(strFormat, formatProvider);
case "title": // NVarChar
if (Title == null)
{
return "";
};
return PropertyAccess.FormatString(Title, strFormat);
case "contents": // NVarCharMax
if (Contents == null)
{
return "";
};
return PropertyAccess.FormatString(Contents, strFormat);
case "storyyear": // Int
return StoryYear.ToString(strFormat, formatProvider);
case "storymonth": // Int
return StoryMonth.ToString(strFormat, formatProvider);
case "storyday": // Int
return StoryDay.ToString(strFormat, formatProvider);
case "visibility": // Int
return Visibility.ToString(strFormat, formatProvider);
default:
propertyNotFound = true;
break;
}
return Null.NullString;
}
[IgnoreColumn()]
public CacheLevel Cacheability
{
get { return CacheLevel.fullyCacheable; }
}
#endregion
}
}

View File

@@ -0,0 +1,68 @@
using System;
using System.Runtime.Serialization;
using DotNetNuke.ComponentModel.DataAnnotations;
namespace Bring2mind.InMemoriam.Core.Models.Stories
{
[TableName("vw_B2M_InMemoriam_Stories")]
[PrimaryKey("StoryId", AutoIncrement = true)]
[DataContract]
[Scope("ModuleId")]
public partial class Story : StoryBase
{
#region .ctor
public Story() : base()
{
}
#endregion
#region Properties
[DataMember]
public string CreatedByUser { get; set; }
[DataMember]
public string LastModifiedByUser { get; set; }
#endregion
#region Methods
public StoryBase GetStoryBase()
{
StoryBase res = new StoryBase();
res.StoryId = StoryId;
res.ModuleId = ModuleId;
res.Title = Title;
res.Contents = Contents;
res.StoryYear = StoryYear;
res.StoryMonth = StoryMonth;
res.StoryDay = StoryDay;
res.Visibility = Visibility;
res.CreatedByUserID = CreatedByUserID;
res.CreatedOnDate = CreatedOnDate;
res.LastModifiedByUserID = LastModifiedByUserID;
res.LastModifiedOnDate = LastModifiedOnDate;
return res;
}
public Story Clone()
{
Story res = new Story();
res.StoryId = StoryId;
res.ModuleId = ModuleId;
res.Title = Title;
res.Contents = Contents;
res.StoryYear = StoryYear;
res.StoryMonth = StoryMonth;
res.StoryDay = StoryDay;
res.Visibility = Visibility;
res.CreatedByUser = CreatedByUser;
res.LastModifiedByUser = LastModifiedByUser;
res.CreatedByUserID = CreatedByUserID;
res.CreatedOnDate = CreatedOnDate;
res.LastModifiedByUserID = LastModifiedByUserID;
res.LastModifiedOnDate = LastModifiedOnDate;
return res;
}
#endregion
}
}

View File

@@ -0,0 +1,48 @@
using System;
using System.Data;
using System.Xml.Serialization;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Services.Tokens;
namespace Bring2mind.InMemoriam.Core.Models.Stories
{
[Serializable(), XmlRoot("Story")]
public partial class Story
{
#region IHydratable
public override void Fill(IDataReader dr)
{
base.Fill(dr);
CreatedByUser = Convert.ToString(Null.SetNull(dr["CreatedByUser"], CreatedByUser));
LastModifiedByUser = Convert.ToString(Null.SetNull(dr["LastModifiedByUser"], LastModifiedByUser));
}
#endregion
#region IPropertyAccess
public override string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
{
switch (strPropertyName.ToLower()) {
case "createdbyuser": // NVarChar
if (CreatedByUser == null)
{
return "";
};
return PropertyAccess.FormatString(CreatedByUser, strFormat);
case "lastmodifiedbyuser": // NVarChar
if (LastModifiedByUser == null)
{
return "";
};
return PropertyAccess.FormatString(LastModifiedByUser, strFormat);
default:
return base.GetProperty(strPropertyName, strFormat, formatProvider, accessingUser, accessLevel, ref propertyNotFound);
}
}
#endregion
}
}

View File

@@ -0,0 +1,54 @@
using Bring2mind.InMemoriam.Core.Models.Pictures;
using System;
using System.IO;
using System.Web;
namespace Bring2mind.InMemoriam.Core
{
public class PicturesService
{
public static PictureBase UploadPicture(string portalMapPath, int moduleId, HttpPostedFile file)
{
var newGuid = Guid.NewGuid();
var filePath = Path.Combine(portalMapPath, Common.Globals.uploadPath, moduleId.ToString());
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
var fileName = Path.Combine(filePath, newGuid.ToString() + ".resources");
file.SaveAs(fileName);
var res = new PictureBase
{
ImageIdentifier = newGuid,
OriginalName = file.FileName,
OriginalWidth = 0,
OriginalHeight = 0
};
// detect image size
using (var img = System.Drawing.Image.FromFile(fileName))
{
res.OriginalHeight = img.Height;
res.OriginalWidth = img.Width;
}
return res;
}
public static void DeletePicture(string portalMapPath, int moduleId, Guid fileId)
{
var imagesDir = new DirectoryInfo(Path.Combine(portalMapPath, Common.Globals.uploadPath, moduleId.ToString()));
var files = imagesDir.GetFiles($"{fileId}*.jpg");
foreach (var file in files)
{
file.Delete();
}
var originalFile = Path.Combine(portalMapPath, Common.Globals.uploadPath, fileId.ToString() + ".resources");
if (File.Exists(originalFile))
{
File.Delete(originalFile);
}
}
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DotNetNuke.Common;
using DotNetNuke.Data;
using DotNetNuke.Framework;
using Bring2mind.InMemoriam.Core.Models.Messages;
namespace Bring2mind.InMemoriam.Core.Repositories
{
public partial class MessageRepository : ServiceLocator<IMessageRepository, MessageRepository>, IMessageRepository
{
}
public partial interface IMessageRepository
{
}
}

View File

@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DotNetNuke.Common;
using DotNetNuke.Data;
using DotNetNuke.Framework;
using Bring2mind.InMemoriam.Core.Models.Messages;
namespace Bring2mind.InMemoriam.Core.Repositories
{
public partial class MessageRepository : ServiceLocator<IMessageRepository, MessageRepository>, IMessageRepository
{
protected override Func<IMessageRepository> GetFactory()
{
return () => new MessageRepository();
}
public IEnumerable<Message> GetMessages(int moduleId)
{
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<Message>();
return rep.Get(moduleId);
}
}
public Message GetMessage(int moduleId, int messageId)
{
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<Message>();
return rep.GetById(messageId, moduleId);
}
}
public Message AddMessage(Message message)
{
Requires.NotNull(message);
Requires.PropertyNotNegative(message, "ModuleId");
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<Message>();
rep.Insert(message);
}
return message;
}
public void DeleteMessage(Message message)
{
Requires.NotNull(message);
Requires.PropertyNotNegative(message, "MessageId");
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<Message>();
rep.Delete(message);
}
}
public void DeleteMessage(int moduleId, int messageId)
{
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<Message>();
rep.Delete("WHERE ModuleId = @0 AND MessageId = @1", moduleId, messageId);
}
}
public void UpdateMessage(Message message)
{
Requires.NotNull(message);
Requires.PropertyNotNegative(message, "MessageId");
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<Message>();
rep.Update(message);
}
}
}
public partial interface IMessageRepository
{
IEnumerable<Message> GetMessages(int moduleId);
Message GetMessage(int moduleId, int messageId);
Message AddMessage(Message message);
void DeleteMessage(Message message);
void DeleteMessage(int moduleId, int messageId);
void UpdateMessage(Message message);
}
}

View File

@@ -0,0 +1,26 @@
using Bring2mind.InMemoriam.Core.Models.Pictures;
using DotNetNuke.Data;
using DotNetNuke.Framework;
using System.Collections.Generic;
namespace Bring2mind.InMemoriam.Core.Repositories
{
public partial class PictureRepository : ServiceLocator<IPictureRepository, PictureRepository>, IPictureRepository
{
public IEnumerable<Picture> GetPictures(int moduleId, int userId, string sortBy, string sortOrder)
{
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<Picture>();
var sql = userId == -1 ? "WHERE ModuleId=@0 AND Visibility=0" : "WHERE ModuleId=@0 AND (CreatedByUserID=@1 OR Visibility<2)";
sql += " ORDER BY " + sortBy + " " + sortOrder;
return rep.Find(sql, moduleId, userId);
}
}
}
public partial interface IPictureRepository
{
IEnumerable<Picture> GetPictures(int moduleId, int userId, string sortBy, string sortOrder);
}
}

View File

@@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DotNetNuke.Common;
using DotNetNuke.Data;
using DotNetNuke.Framework;
using Bring2mind.InMemoriam.Core.Models.Pictures;
namespace Bring2mind.InMemoriam.Core.Repositories
{
public partial class PictureRepository : ServiceLocator<IPictureRepository, PictureRepository>, IPictureRepository
{
protected override Func<IPictureRepository> GetFactory()
{
return () => new PictureRepository();
}
public IEnumerable<Picture> GetPictures(int moduleId)
{
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<Picture>();
return rep.Get(moduleId);
}
}
public Picture GetPicture(int moduleId, int pictureId)
{
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<Picture>();
return rep.GetById(pictureId, moduleId);
}
}
public PictureBase AddPicture(PictureBase picture, int userId)
{
Requires.NotNull(picture);
Requires.PropertyNotNegative(picture, "ModuleId");
picture.CreatedByUserID = userId;
picture.CreatedOnDate = DateTime.Now;
picture.LastModifiedByUserID = userId;
picture.LastModifiedOnDate = DateTime.Now;
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<PictureBase>();
rep.Insert(picture);
}
return picture;
}
public void DeletePicture(PictureBase picture)
{
Requires.NotNull(picture);
Requires.PropertyNotNegative(picture, "PictureId");
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<PictureBase>();
rep.Delete(picture);
}
}
public void DeletePicture(int moduleId, int pictureId)
{
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<PictureBase>();
rep.Delete("WHERE ModuleId = @0 AND PictureId = @1", moduleId, pictureId);
}
}
public void UpdatePicture(PictureBase picture, int userId)
{
Requires.NotNull(picture);
Requires.PropertyNotNegative(picture, "PictureId");
picture.LastModifiedByUserID = userId;
picture.LastModifiedOnDate = DateTime.Now;
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<PictureBase>();
rep.Update(picture);
}
}
}
public partial interface IPictureRepository
{
IEnumerable<Picture> GetPictures(int moduleId);
Picture GetPicture(int moduleId, int pictureId);
PictureBase AddPicture(PictureBase picture, int userId);
void DeletePicture(PictureBase picture);
void DeletePicture(int moduleId, int pictureId);
void UpdatePicture(PictureBase picture, int userId);
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DotNetNuke.Common;
using DotNetNuke.Data;
using DotNetNuke.Framework;
using Bring2mind.InMemoriam.Core.Models.Stories;
namespace Bring2mind.InMemoriam.Core.Repositories
{
public partial class StoryRepository : ServiceLocator<IStoryRepository, StoryRepository>, IStoryRepository
{
}
public partial interface IStoryRepository
{
}
}

View File

@@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DotNetNuke.Common;
using DotNetNuke.Data;
using DotNetNuke.Framework;
using Bring2mind.InMemoriam.Core.Models.Stories;
namespace Bring2mind.InMemoriam.Core.Repositories
{
public partial class StoryRepository : ServiceLocator<IStoryRepository, StoryRepository>, IStoryRepository
{
protected override Func<IStoryRepository> GetFactory()
{
return () => new StoryRepository();
}
public IEnumerable<Story> GetStories(int moduleId)
{
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<Story>();
return rep.Get(moduleId);
}
}
public Story GetStory(int moduleId, int storyId)
{
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<Story>();
return rep.GetById(storyId, moduleId);
}
}
public StoryBase AddStory(StoryBase story, int userId)
{
Requires.NotNull(story);
Requires.PropertyNotNegative(story, "ModuleId");
story.CreatedByUserID = userId;
story.CreatedOnDate = DateTime.Now;
story.LastModifiedByUserID = userId;
story.LastModifiedOnDate = DateTime.Now;
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<StoryBase>();
rep.Insert(story);
}
return story;
}
public void DeleteStory(StoryBase story)
{
Requires.NotNull(story);
Requires.PropertyNotNegative(story, "StoryId");
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<StoryBase>();
rep.Delete(story);
}
}
public void DeleteStory(int moduleId, int storyId)
{
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<StoryBase>();
rep.Delete("WHERE ModuleId = @0 AND StoryId = @1", moduleId, storyId);
}
}
public void UpdateStory(StoryBase story, int userId)
{
Requires.NotNull(story);
Requires.PropertyNotNegative(story, "StoryId");
story.LastModifiedByUserID = userId;
story.LastModifiedOnDate = DateTime.Now;
using (var context = DataContext.Instance())
{
var rep = context.GetRepository<StoryBase>();
rep.Update(story);
}
}
}
public partial interface IStoryRepository
{
IEnumerable<Story> GetStories(int moduleId);
Story GetStory(int moduleId, int storyId);
StoryBase AddStory(StoryBase story, int userId);
void DeleteStory(StoryBase story);
void DeleteStory(int moduleId, int storyId);
void UpdateStory(StoryBase story, int userId);
}
}

View File

@@ -0,0 +1,48 @@
using Bring2mind.InMemoriam.Common;
using Bring2mind.InMemoriam.Core.Models.Messages;
using Bring2mind.InMemoriam.Core.Repositories;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace Bring2mind.InMemoriam.Api
{
public class MessagesController : InMemoriamApiController
{
[HttpGet]
[InMemoriamAuthorize(SecurityAccessLevel.View)]
public HttpResponseMessage GetMessages()
{
return Request.CreateResponse(HttpStatusCode.OK, MessageRepository.Instance.GetMessages(ActiveModule.ModuleID).OrderByDescending(m => m.CreatedOn));
}
[HttpPost]
[InMemoriamAuthorize(SecurityAccessLevel.AddMessage)]
public HttpResponseMessage AddMessage(int id, [FromBody] string data)
{
var message = Newtonsoft.Json.JsonConvert.DeserializeObject<Message>(data);
if (message == null || string.IsNullOrEmpty(message.Contents.Trim()))
{
return Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid message data");
}
message.CreatedOn = System.DateTime.Now;
message.ModuleId = ActiveModule.ModuleID;
message = MessageRepository.Instance.AddMessage(message);
return Request.CreateResponse(HttpStatusCode.OK, MessageRepository.Instance.GetMessage(this.ActiveModule.ModuleID, message.MessageId));
}
[HttpPost]
[InMemoriamAuthorize(SecurityAccessLevel.Family)]
public HttpResponseMessage DeleteMessage(int id)
{
var message = MessageRepository.Instance.GetMessage(ActiveModule.ModuleID, id);
if (message == null)
{
return Request.CreateResponse(HttpStatusCode.NotFound, "Message not found");
}
MessageRepository.Instance.DeleteMessage(message);
return Request.CreateResponse(HttpStatusCode.OK);
}
}
}

View File

@@ -0,0 +1,109 @@
using Bring2mind.InMemoriam.Common;
using Bring2mind.InMemoriam.Core;
using Bring2mind.InMemoriam.Core.Common;
using Bring2mind.InMemoriam.Core.Models.Pictures;
using Bring2mind.InMemoriam.Core.Repositories;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web;
using System.Web.Http;
namespace Bring2mind.InMemoriam.Api
{
public class PicturesController : InMemoriamApiController
{
[HttpGet]
[InMemoriamAuthorize(SecurityAccessLevel.View)]
public HttpResponseMessage Get(string id, int width, int height, string method)
{
var i = new Image(
Path.Combine(PortalSettings.HomeDirectoryMapPath, Globals.uploadPath, ActiveModule.ModuleID.ToString()),
id, width, height, method);
if (!i.ImageExists)
{
return Request.CreateResponse(HttpStatusCode.NotFound);
}
var res = new HttpResponseMessage(HttpStatusCode.OK);
var mem = new MemoryStream();
i.CopyToStream(mem);
mem.Seek(0, SeekOrigin.Begin);
res.Content = new StreamContent(mem);
res.Content.Headers.ContentType = new MediaTypeHeaderValue("image/jpg");
return res;
}
[HttpGet]
[InMemoriamAuthorize(SecurityAccessLevel.View)]
public HttpResponseMessage GetPictures()
{
return Request.CreateResponse(HttpStatusCode.OK, PictureRepository.Instance.GetPictures(ActiveModule.ModuleID, UserInfo.UserID, "CreatedOnDate", "DESC"));
}
[HttpPost]
[InMemoriamAuthorize(SecurityAccessLevel.AddContent)]
public HttpResponseMessage UploadPicture()
{
var context = HttpContext.Current;
var file = context.Request.Files[0];
var title = context.Request.Form["title"];
var description = context.Request.Form["description"];
var visiblity = int.Parse(context.Request.Form["visibility"]);
var pictureYear = int.Parse(context.Request.Form["pictureYear"]);
var pictureMonth = int.Parse(context.Request.Form["pictureMonth"]);
var pictureDay = int.Parse(context.Request.Form["pictureDay"]);
var pic = PicturesService.UploadPicture(PortalSettings.HomeDirectoryMapPath, ActiveModule.ModuleID, file);
pic.ModuleId = ActiveModule.ModuleID;
pic.Title = title;
pic.Description = description;
pic.Visibility = visiblity;
pic.PictureYear = pictureYear;
pic.PictureMonth = pictureMonth;
pic.PictureDay = pictureDay;
var id = PictureRepository.Instance.AddPicture(pic, UserInfo.UserID).PictureId;
return Request.CreateResponse(HttpStatusCode.OK, PictureRepository.Instance.GetPicture(ActiveModule.ModuleID, id));
}
[HttpPost]
[InMemoriamAuthorize(SecurityAccessLevel.AddContent)]
public HttpResponseMessage EditPicture(int id, [FromBody] string serializedData)
{
var data = Newtonsoft.Json.JsonConvert.DeserializeObject<PictureBase>(serializedData);
var original = PictureRepository.Instance.GetPicture(ActiveModule.ModuleID, data.PictureId);
if (original == null)
{
return ServiceError("Picture not found.");
}
if (!this.InMemoriamModuleContext.Security.IsFamily && original.CreatedByUserID != UserInfo.UserID)
{
return AccessViolation("You do not have permission to edit this picture.");
}
original.ReadEditedPictureBase(data);
PictureRepository.Instance.UpdatePicture(original.GetPictureBase(), UserInfo.UserID);
return Request.CreateResponse(HttpStatusCode.OK, PictureRepository.Instance.GetPicture(PortalSettings.PortalId, data.PictureId));
}
[HttpPost]
[InMemoriamAuthorize(SecurityAccessLevel.AddContent)]
public HttpResponseMessage DeletePicture(int id)
{
var original = PictureRepository.Instance.GetPicture(ActiveModule.ModuleID, id);
if (original == null)
{
return ServiceError("Picture not found.");
}
if (!this.InMemoriamModuleContext.Security.IsFamily && original.CreatedByUserID != UserInfo.UserID)
{
return AccessViolation("You do not have permission to edit this picture.");
}
PictureRepository.Instance.DeletePicture(ActiveModule.ModuleID, id);
PicturesService.DeletePicture(PortalSettings.HomeDirectoryMapPath, ActiveModule.ModuleID, original.ImageIdentifier);
return Request.CreateResponse(HttpStatusCode.OK);
}
}
}

View File

@@ -0,0 +1,70 @@
using Bring2mind.InMemoriam.Common;
using Bring2mind.InMemoriam.Core.Models.Stories;
using Bring2mind.InMemoriam.Core.Repositories;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace Bring2mind.InMemoriam.Api
{
public class StoriesController : InMemoriamApiController
{
[HttpGet]
[InMemoriamAuthorize(SecurityAccessLevel.View)]
public HttpResponseMessage GetStories()
{
return Request.CreateResponse(HttpStatusCode.OK, StoryRepository.Instance.GetStories(ActiveModule.ModuleID).OrderByDescending(s => s.CreatedOnDate));
}
[HttpPost]
[InMemoriamAuthorize(SecurityAccessLevel.AddContent)]
public HttpResponseMessage EditStory(int id, [FromBody] string data)
{
var story = Newtonsoft.Json.JsonConvert.DeserializeObject<StoryBase>(data);
if (story == null || string.IsNullOrEmpty(story.Title.Trim()) || string.IsNullOrEmpty(story.Contents.Trim()))
{
return Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid story data");
}
if (id == -1)
{
story.ModuleId = ActiveModule.ModuleID;
story = StoryRepository.Instance.AddStory(story, UserInfo.UserID);
return Request.CreateResponse(HttpStatusCode.OK, StoryRepository.Instance.GetStory(ActiveModule.ModuleID, story.StoryId));
}
else
{
var originalStory = StoryRepository.Instance.GetStory(ActiveModule.ModuleID, id);
if (originalStory == null)
{
return Request.CreateResponse(HttpStatusCode.NotFound, "Story not found");
}
if (!this.InMemoriamModuleContext.Security.IsFamily && originalStory.CreatedByUserID != UserInfo.UserID)
{
return AccessViolation("You are not allowed to edit this story");
}
originalStory.ReadEditedStoryBase(story);
StoryRepository.Instance.UpdateStory(originalStory, UserInfo.UserID);
return Request.CreateResponse(HttpStatusCode.OK, StoryRepository.Instance.GetStory(ActiveModule.ModuleID, id));
}
}
[HttpPost]
[InMemoriamAuthorize(SecurityAccessLevel.AddContent)]
public HttpResponseMessage DeleteStory(int id)
{
var story = StoryRepository.Instance.GetStory(ActiveModule.ModuleID, id);
if (story == null)
{
return Request.CreateResponse(HttpStatusCode.NotFound, "Story not found");
}
if (!this.InMemoriamModuleContext.Security.IsFamily && story.CreatedByUserID != UserInfo.UserID)
{
return AccessViolation("You are not allowed to delete this story");
}
StoryRepository.Instance.DeleteStory(ActiveModule.ModuleID, story.StoryId);
return Request.CreateResponse(HttpStatusCode.OK, "Story deleted");
}
}
}

View File

@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Add" xml:space="preserve">
<value>Add</value>
</data>
<data name="AddImage" xml:space="preserve">
<value>Add Picture</value>
</data>
<data name="By" xml:space="preserve">
<value>by</value>
</data>
<data name="Cancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="Contents" xml:space="preserve">
<value>Contents</value>
</data>
<data name="Created" xml:space="preserve">
<value>Created</value>
</data>
<data name="Date" xml:space="preserve">
<value>Date</value>
</data>
<data name="Day" xml:space="preserve">
<value>Day</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Delete</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>Do you wish to delete this?</value>
</data>
<data name="Description" xml:space="preserve">
<value>Description</value>
</data>
<data name="Edit" xml:space="preserve">
<value>Edit</value>
</data>
<data name="EditStory" xml:space="preserve">
<value>Edit Story</value>
</data>
<data name="Friends" xml:space="preserve">
<value>Friends</value>
</data>
<data name="Month" xml:space="preserve">
<value>Month</value>
</data>
<data name="Private" xml:space="preserve">
<value>Private (to you and family)</value>
</data>
<data name="Public" xml:space="preserve">
<value>Public</value>
</data>
<data name="Save" xml:space="preserve">
<value>Save</value>
</data>
<data name="SelectJpg" xml:space="preserve">
<value>Select jpg file</value>
</data>
<data name="SenderEmail" xml:space="preserve">
<value>Sender Email (not publically visible)</value>
</data>
<data name="SenderName" xml:space="preserve">
<value>Sender Name</value>
</data>
<data name="Title" xml:space="preserve">
<value>Title</value>
</data>
<data name="Visibility" xml:space="preserve">
<value>Visibility</value>
</data>
<data name="Year" xml:space="preserve">
<value>Year</value>
</data>
</root>

View File

@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="InPictures.Text" xml:space="preserve">
<value>In Pictures</value>
</data>
<data name="InWords.Text" xml:space="preserve">
<value>In Words</value>
</data>
<data name="Messages.Text" xml:space="preserve">
<value>Condolences</value>
</data>
</root>

View File

@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="BasicSettings.Text" xml:space="preserve">
<value>Basic Settings</value>
</data>
<data name="View.Help" xml:space="preserve">
<value>Select view to load for this module</value>
</data>
<data name="View.Text" xml:space="preserve">
<value>View</value>
</data>
</root>

View File

@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Add" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Toevoegen</value>
</data>
<data name="AddImage" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Afbeelding toevoegen</value>
</data>
<data name="By" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>door</value>
</data>
<data name="Cancel" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Annuleren</value>
</data>
<data name="Contents" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Inhoud</value>
</data>
<data name="Created" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Gemaakt</value>
</data>
<data name="Date" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Datum</value>
</data>
<data name="Day" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Dag</value>
</data>
<data name="Delete" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Verwijderen</value>
</data>
<data name="DeleteConfirm" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Wilt u dit verwijderen?</value>
</data>
<data name="Description" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Beschrijving</value>
</data>
<data name="Edit" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Bewerking</value>
</data>
<data name="EditStory" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Verhaal bewerken</value>
</data>
<data name="Friends" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Vrienden</value>
</data>
<data name="Month" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Maand</value>
</data>
<data name="Private" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Privé (voor jou en je familie)</value>
</data>
<data name="Public" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Openbaar</value>
</data>
<data name="Save" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Redden</value>
</data>
<data name="SelectJpg" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Selecteer jpg-bestand</value>
</data>
<data name="SenderEmail" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>E-mail van de afzender (niet openbaar zichtbaar)</value>
</data>
<data name="SenderName" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Naam van de afzender</value>
</data>
<data name="Title" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Titel</value>
</data>
<data name="Visibility" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Zichtbaarheid</value>
</data>
<data name="Year" xml:space="preserve" lastModified="2025-02-12 23:39:47">
<value>Jaar</value>
</data>
</root>

View File

@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Add" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Добавлять</value>
</data>
<data name="AddImage" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Добавить картинку</value>
</data>
<data name="By" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>к</value>
</data>
<data name="Cancel" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Отмена</value>
</data>
<data name="Contents" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Содержание</value>
</data>
<data name="Created" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Созданный</value>
</data>
<data name="Date" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Дата</value>
</data>
<data name="Day" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>День</value>
</data>
<data name="Delete" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Удалить</value>
</data>
<data name="DeleteConfirm" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Вы хотите это удалить?</value>
</data>
<data name="Description" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Описание</value>
</data>
<data name="Edit" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Редактировать</value>
</data>
<data name="EditStory" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Редактировать историю</value>
</data>
<data name="Friends" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Друзья</value>
</data>
<data name="Month" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Месяц</value>
</data>
<data name="Private" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Конфиденциально (для вас и вашей семьи)</value>
</data>
<data name="Public" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Публичный</value>
</data>
<data name="Save" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Сохранять</value>
</data>
<data name="SelectJpg" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Выберите файл jpg</value>
</data>
<data name="SenderEmail" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Адрес электронной почты отправителя (не виден публично)</value>
</data>
<data name="SenderName" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Имя отправителя</value>
</data>
<data name="Title" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Заголовок</value>
</data>
<data name="Visibility" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Видимость</value>
</data>
<data name="Year" xml:space="preserve" lastModified="2025-02-12 23:41:06">
<value>Год</value>
</data>
</root>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="InPictures.Text" xml:space="preserve" lastModified="2025-02-12 23:40:00">
<value>In beeld</value>
</data>
<data name="InWords.Text" xml:space="preserve" lastModified="2025-02-12 23:40:00">
<value>In woorden</value>
</data>
<data name="Messages.Text" xml:space="preserve" lastModified="2025-02-12 23:40:00">
<value>Condoleances</value>
</data>
</root>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="InPictures.Text" xml:space="preserve" lastModified="2025-02-12 23:41:20">
<value>В картинках</value>
</data>
<data name="InWords.Text" xml:space="preserve" lastModified="2025-02-12 23:41:20">
<value>В словах</value>
</data>
<data name="Messages.Text" xml:space="preserve" lastModified="2025-02-12 23:41:20">
<value>Соболезнования</value>
</data>
</root>

View File

@@ -0,0 +1,43 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<AssemblyName>Bring2mind.InMemoriam</AssemblyName>
<TargetFramework>net472</TargetFramework>
<OutputPath>..\..\bin</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<Authors>Peter Donker</Authors>
<Company>Bring2mind</Company>
<Product>inmemoriam</Product>
<Copyright>Copyright 2025 by Bring2mind</Copyright>
<PackageId>Bring2mind.InMemoriam</PackageId>
<AssemblyVersion>1.0.2</AssemblyVersion>
<FileVersion>1.0.2</FileVersion>
<Description>In Memoriam module</Description>
<NeutralLanguage>en-US</NeutralLanguage>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />
<DebugType>Portable</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DotNetNuke.Instrumentation" Version="9.13.0" />
<PackageReference Include="DotNetNuke.Web.Mvc" Version="9.13.0" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net472" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\Bring2mind.InMemoriam.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<Content Update="Views\Home\InPictures.cshtml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,172 @@
using DotNetNuke.Common;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Framework;
using DotNetNuke.Framework.JavaScriptLibraries;
using DotNetNuke.UI.Utilities;
using DotNetNuke.Web.Api;
using DotNetNuke.Web.Client.ClientResourceManagement;
using DotNetNuke.Web.Mvc.Framework.Controllers;
using System;
using System.Linq;
using System.Web.Mvc;
using System.Web.UI;
namespace Bring2mind.InMemoriam.Common
{
public class ContextHelper
{
public ModuleInfo ModuleContext { get; set; }
public System.Web.UI.Page Page { get; set; }
public virtual string ModulePath
{
get
{
return "~/DesktopModules/MVC/Bring2mind/InMemoriam";
}
}
public ContextHelper(ViewContext viewContext)
{
Requires.NotNull("viewContext", viewContext);
var controller = viewContext.Controller as IDnnController;
if (controller == null)
{
throw new InvalidOperationException("The DnnUrlHelper class can only be used in Views that inherit from DnnWebViewPage");
}
ModuleContext = controller.ModuleContext.Configuration;
Page = controller.DnnPage;
}
public ContextHelper(DnnController context)
{
Requires.NotNull("context", context);
ModuleContext = context.ModuleContext.Configuration;
Page = context.DnnPage;
}
public ContextHelper(DnnApiController context)
{
Requires.NotNull("context", context);
ModuleContext = context.ActiveModule;
}
private ContextSecurity _security;
public ContextSecurity Security
{
get { return _security ?? (_security = ContextSecurity.GetSecurity(ModuleContext)); }
}
public void RequirePermissionLevel(bool level)
{
if (!level)
{
ThrowAccessViolation();
}
}
private ModuleSettings _settings;
public ModuleSettings Settings
{
get { return _settings ?? (_settings = ModuleSettings.GetSettings(ModuleContext)); }
}
#region Css Files
public void AddCss(string cssFile, string name, string version)
{
ClientResourceManager.RegisterStyleSheet(Page, string.Format(ModulePath + "/css/{0}", cssFile), 9, "", name, version);
}
public void AddCss(string cssFile)
{
ClientResourceManager.RegisterStyleSheet(Page, string.Format(ModulePath + "/css/{0}", cssFile), 9);
}
#endregion
#region Js Files
public void AddJqueryUi()
{
DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(DotNetNuke.Framework.JavaScriptLibraries.CommonJs.jQueryUI);
}
public void AddJquery()
{
DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(DotNetNuke.Framework.JavaScriptLibraries.CommonJs.jQuery);
}
public void AddDnnSF()
{
RegisterAjaxScript();
}
public void AddScript(string scriptName, string name, string version)
{
ClientResourceManager.RegisterScript(Page, string.Format(ModulePath + "/js/{0}", scriptName), 70, "", name, version);
}
public void AddScript(string scriptName)
{
ClientResourceManager.RegisterScript(Page, string.Format(ModulePath + "/js/{0}", scriptName));
}
public void AddModuleScript(string name)
{
AddScript(name + ".js");
}
public void AddModuleScript()
{
RegisterAjaxScript();
AddModuleScript("inmemoriam");
}
public void ThrowAccessViolation()
{
throw new Exception("You do not have adequate permissions to view this resource. Please check your login status.");
}
#endregion
#region fixes for changes to DNN
public void RegisterAjaxScript()
{
ServicesFramework.Instance.RequestAjaxAntiForgerySupport();
RegisterAjaxAntiForgery();
var path = ServicesFramework.GetServiceFrameworkRoot();
if (String.IsNullOrEmpty(path))
{
return;
}
JavaScript.RegisterClientReference(Page, ClientAPI.ClientNamespaceReferences.dnn);
ClientAPI.RegisterClientVariable(Page, "sf_siteRoot", path, /*overwrite*/ true);
ClientAPI.RegisterClientVariable(Page, "sf_tabId", DotNetNuke.Entities.Portals.PortalSettings.Current.ActiveTab.TabID.ToString(System.Globalization.CultureInfo.InvariantCulture), /*overwrite*/ true);
string scriptPath;
if (HttpContextSource.Current.IsDebuggingEnabled)
{
scriptPath = "~/js/Debug/dnn.servicesframework.js";
}
else
{
scriptPath = "~/js/dnn.servicesframework.js";
}
ClientResourceManager.RegisterScript(Page, scriptPath);
}
public void RegisterAjaxAntiForgery()
{
var ctl = Page.FindControl("ClientResourcesFormBottom");
if (ctl != null)
{
var cc = ctl.Controls
.Cast<Control>()
.Where(l => l is LiteralControl)
.Select(l => (LiteralControl)l)
.Where(l => l.Text.IndexOf("__RequestVerificationToken") > 0)
.FirstOrDefault();
if (cc == null)
{
ctl.Controls.Add(new LiteralControl(System.Web.Helpers.AntiForgery.GetHtml().ToHtmlString()));
}
}
}
#endregion
}
}

View File

@@ -0,0 +1,68 @@
using System.Web.Caching;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Entities.Users;
using DotNetNuke.Security;
using DotNetNuke.Security.Permissions;
namespace Bring2mind.InMemoriam.Common
{
public class ContextSecurity
{
public bool CanView { get; set; }
public bool CanEdit { get; set; }
public bool CanAdd { get; set; }
public bool CanMessage { get; set; }
public bool IsFamily { get; set; }
public bool IsAdmin { get; set; }
private UserInfo user { get; set; }
public int UserId
{
get
{
return user.UserID;
}
}
public static ContextSecurity GetSecurity(ModuleInfo objModule)
{
return GetSecurity(objModule, UserController.Instance.GetCurrentUserInfo());
}
public static ContextSecurity GetSecurity(ModuleInfo objModule, UserInfo user)
{
return CBO.GetCachedObject<ContextSecurity>(new CacheItemArgs(string.Format("security-{0}-{1}", user.UserID, objModule.ModuleID), 10, CacheItemPriority.BelowNormal, objModule, user), GetSecurityCallBack);
}
private static object GetSecurityCallBack(CacheItemArgs args)
{
return new ContextSecurity((ModuleInfo)args.Params[0], (UserInfo)args.Params[1]);
}
#region ctor
public ContextSecurity(ModuleInfo objModule, UserInfo user)
{
this.user = user;
if (user.IsSuperUser)
{
CanView = CanEdit = CanAdd = CanMessage = IsFamily = IsAdmin = true;
}
else
{
IsAdmin = PortalSecurity.IsInRole(PortalSettings.Current.AdministratorRoleName);
if (IsAdmin)
{
CanView = CanEdit = CanAdd = CanMessage = IsFamily = true;
}
else
{
CanView = ModulePermissionController.CanViewModule(objModule);
CanEdit = ModulePermissionController.HasModulePermission(objModule.ModulePermissions, "EDIT");
CanAdd = ModulePermissionController.HasModulePermission(objModule.ModulePermissions, "ADDCONTENT");
CanMessage = ModulePermissionController.HasModulePermission(objModule.ModulePermissions, "ADDMESSAGE");
IsFamily = ModulePermissionController.HasModulePermission(objModule.ModulePermissions, "FAMILY");
}
}
}
#endregion
}
}

View File

@@ -0,0 +1,28 @@
using DotNetNuke.Instrumentation;
using DotNetNuke.Web.Api;
using System.Net;
using System.Net.Http;
namespace Bring2mind.InMemoriam.Common
{
public class InMemoriamApiController : DnnApiController
{
public static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DnnApiController));
private ContextHelper _InMemoriamModuleContext;
public ContextHelper InMemoriamModuleContext
{
get { return _InMemoriamModuleContext ?? (_InMemoriamModuleContext = new ContextHelper(this)); }
}
public HttpResponseMessage ServiceError(string message) {
return Request.CreateResponse(HttpStatusCode.InternalServerError, message);
}
public HttpResponseMessage AccessViolation(string message)
{
return Request.CreateResponse(HttpStatusCode.Unauthorized, message);
}
}
}

View File

@@ -0,0 +1,72 @@
using DotNetNuke.Common;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Entities.Users;
using DotNetNuke.Instrumentation;
using DotNetNuke.Web.Api;
namespace Bring2mind.InMemoriam.Common
{
public enum SecurityAccessLevel
{
Anonymous = 0,
Authenticated = 1,
View = 2,
Edit = 3,
AddContent = 4,
AddMessage = 5,
Family = 6,
Admin = 7,
Host = 8
}
public class InMemoriamAuthorizeAttribute : AuthorizeAttributeBase, IOverrideDefaultAuthLevel
{
private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(InMemoriamAuthorizeAttribute));
public SecurityAccessLevel SecurityLevel { get; set; }
public UserInfo User { get; set; }
public InMemoriamAuthorizeAttribute()
{
SecurityLevel = SecurityAccessLevel.Admin;
}
public InMemoriamAuthorizeAttribute(SecurityAccessLevel accessLevel)
{
SecurityLevel = accessLevel;
}
public override bool IsAuthorized(AuthFilterContext context)
{
Logger.Trace("IsAuthorized");
if (SecurityLevel == SecurityAccessLevel.Anonymous)
{
Logger.Trace("Anonymous");
return true;
}
User = HttpContextSource.Current.Request.IsAuthenticated ? UserController.Instance.GetCurrentUserInfo() : new UserInfo();
Logger.Trace("UserId " + User.UserID.ToString());
ContextSecurity security = ContextSecurity.GetSecurity(context.ActionContext.Request.FindModuleInfo());
Logger.Trace(security.ToString());
switch (SecurityLevel)
{
case SecurityAccessLevel.Authenticated:
return User.UserID != -1;
case SecurityAccessLevel.Host:
return User.IsSuperUser;
case SecurityAccessLevel.Admin:
return security.IsAdmin;
case SecurityAccessLevel.Edit:
return security.CanEdit;
case SecurityAccessLevel.AddContent:
return security.CanAdd;
case SecurityAccessLevel.Family:
return security.IsFamily;
case SecurityAccessLevel.AddMessage:
return security.CanMessage;
case SecurityAccessLevel.View:
return security.CanView;
}
return false;
}
}
}

View File

@@ -0,0 +1,18 @@
using DotNetNuke.Web.Mvc.Framework.Controllers;
using DotNetNuke.Web.Mvc.Routing;
using System.Web.Mvc;
using System.Web.Routing;
namespace Bring2mind.InMemoriam.Common
{
public class InMemoriamMvcController : DnnController
{
private ContextHelper _InMemoriamModuleContext;
public ContextHelper InMemoriamModuleContext
{
get { return _InMemoriamModuleContext ?? (_InMemoriamModuleContext = new ContextHelper(this)); }
}
}
}

View File

@@ -0,0 +1,40 @@
using System.Web.Mvc;
using DotNetNuke.Web.Mvc.Helpers;
using DotNetNuke.Web.Mvc.Framework;
namespace Bring2mind.InMemoriam.Common
{
public abstract class InMemoriamWebPage : DnnWebViewPage
{
public ContextHelper InMemoriamModuleContext { get; set; }
public override void InitHelpers()
{
Ajax = new AjaxHelper<object>(ViewContext, this);
Html = new DnnHtmlHelper<object>(ViewContext, this);
Url = new DnnUrlHelper(ViewContext);
Dnn = new DnnHelper<object>(ViewContext, this);
InMemoriamModuleContext = new ContextHelper(ViewContext);
}
public string SerializedResources()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(DotNetNuke.Services.Localization.LocalizationProvider.Instance.GetCompiledResourceFile(Dnn.PortalSettings, "/DesktopModules/MVC/Bring2mind/InMemoriam/App_LocalResources/ClientResources.resx",
System.Threading.Thread.CurrentThread.CurrentCulture.Name));
}
public void RequirePermissionLevel(bool level)
{
InMemoriamModuleContext.RequirePermissionLevel(level);
}
public string Locale
{
get
{
return System.Threading.Thread.CurrentThread.CurrentCulture.Name;
}
}
}
}

View File

@@ -0,0 +1,41 @@
using System.Web.Mvc;
using DotNetNuke.Web.Mvc.Helpers;
using DotNetNuke.Web.Mvc.Framework;
namespace Bring2mind.InMemoriam.Common
{
public abstract class InMemoriamWebPage<TModel> : DnnWebViewPage<TModel>
{
public ContextHelper InMemoriamModuleContext { get; set; }
public override void InitHelpers()
{
Ajax = new AjaxHelper<TModel>(ViewContext, this);
Html = new DnnHtmlHelper<TModel>(ViewContext, this);
Url = new DnnUrlHelper(ViewContext);
Dnn = new DnnHelper<TModel>(ViewContext, this);
InMemoriamModuleContext = new ContextHelper(ViewContext);
}
public string SerializedResources()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(DotNetNuke.Services.Localization.LocalizationProvider.Instance.GetCompiledResourceFile(Dnn.PortalSettings, "/DesktopModules/MVC/Bring2mind/InMemoriam/App_LocalResources/ClientResources.resx",
System.Threading.Thread.CurrentThread.CurrentCulture.Name));
}
public void RequirePermissionLevel(bool level)
{
InMemoriamModuleContext.RequirePermissionLevel(level);
}
public string Locale
{
get
{
return System.Threading.Thread.CurrentThread.CurrentCulture.Name;
}
}
}
}

View File

@@ -0,0 +1,29 @@
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using System;
namespace Bring2mind.InMemoriam.Common
{
public class ModuleController : IPortable
{
string IPortable.ExportModule(int ModuleID)
{
var m = DotNetNuke.Entities.Modules.ModuleController.Instance.GetModule(ModuleID, Null.NullInteger, true);
var settings = ModuleSettings.GetSettings(m);
return Newtonsoft.Json.JsonConvert.SerializeObject(settings, Newtonsoft.Json.Formatting.None);
}
void IPortable.ImportModule(int ModuleID, string Content, string Version, int UserID)
{
try
{
var settings = Newtonsoft.Json.JsonConvert.DeserializeObject<ModuleSettings>(Content);
var m = DotNetNuke.Entities.Modules.ModuleController.Instance.GetModule(ModuleID, Null.NullInteger, true);
settings.SaveSettings(m);
}
catch (Exception ex)
{
}
}
}
}

View File

@@ -0,0 +1,26 @@
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Settings;
namespace Bring2mind.InMemoriam.Common
{
public class ModuleSettings
{
[ModuleSetting]
public string View { get; set; } = "Index";
public static ModuleSettings GetSettings(ModuleInfo module)
{
var repo = new ModuleSettingsRepository();
return repo.GetSettings(module);
}
public void SaveSettings(ModuleInfo module)
{
var repo = new ModuleSettingsRepository();
repo.SaveSettings(module, this);
}
}
public class ModuleSettingsRepository : SettingsRepository<ModuleSettings>
{
}
}

View File

@@ -0,0 +1,13 @@
using DotNetNuke.Web.Api;
namespace Bring2mind.InMemoriam.Common
{
public class RouteMapper : IServiceRouteMapper
{
public void RegisterRoutes(IMapRoute mapRouteManager)
{
mapRouteManager.MapHttpRoute("Bring2mind/InMemoriam", "InMemoriamMap1", "{controller}/{action}", null, null, new[] { "Bring2mind.InMemoriam.Api" });
mapRouteManager.MapHttpRoute("Bring2mind/InMemoriam", "InMemoriamMap2", "{controller}/{action}/{id}", null, new { id = "-?\\d+" }, new[] { "Bring2mind.InMemoriam.Api" });
}
}
}

View File

@@ -0,0 +1,14 @@
using System.Web.Mvc;
using Bring2mind.InMemoriam.Common;
namespace Bring2mind.InMemoriam.Controllers
{
public class HomeController : InMemoriamMvcController
{
[HttpGet]
public ActionResult Index()
{
return View(InMemoriamModuleContext.Settings.View);
}
}
}

View File

@@ -0,0 +1,35 @@
using DotNetNuke.Web.Mvc.Framework.ActionFilters;
using Bring2mind.InMemoriam.Common;
using System.Web.Mvc;
namespace Bring2mind.InMemoriam.Controllers
{
[DnnModuleAuthorize(AccessLevel = DotNetNuke.Security.SecurityAccessLevel.Edit)]
[DnnHandleError]
public class SettingsController : InMemoriamMvcController
{
/// <summary>
///
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult Settings()
{
return View(InMemoriamModuleContext.Settings);
}
/// <summary>
///
/// </summary>
/// <param name="supportsTokens"></param>
/// <returns></returns>
[HttpPost]
[ValidateInput(false)]
[DotNetNuke.Web.Mvc.Framework.ActionFilters.ValidateAntiForgeryToken]
public ActionResult Settings(ModuleSettings settings)
{
settings.SaveSettings(ModuleContext.Configuration);
return RedirectToDefaultRoute();
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Bring2mind.InMemoriam": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:57111"
}
}
}

View File

@@ -0,0 +1,17 @@
@inherits InMemoriamWebPage
@using Bring2mind.InMemoriam.Common
@{
InMemoriamModuleContext.AddModuleScript();
}
<h1>@Dnn.LocalizeString("InPictures")</h1>
<div class="Bring2mindInMemoriam InPictures"
data-locale="@System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName"
data-moduleid="@Dnn.ActiveModule.ModuleID"
data-tabid="@Dnn.ActiveModule.TabID"
data-portalid="@Dnn.PortalSettings.PortalId"
data-resources="@SerializedResources()"
data-security="@(Newtonsoft.Json.JsonConvert.SerializeObject(InMemoriamModuleContext.Security))"
>
</div>

View File

@@ -0,0 +1,16 @@
@inherits InMemoriamWebPage
@using Bring2mind.InMemoriam.Common
@{
InMemoriamModuleContext.AddModuleScript();
}
<h1>@Dnn.LocalizeString("InWords")</h1>
<div class="Bring2mindInMemoriam InWords"
data-locale="@System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName"
data-moduleid="@Dnn.ActiveModule.ModuleID"
data-tabid="@Dnn.ActiveModule.TabID"
data-portalid="@Dnn.PortalSettings.PortalId"
data-resources="@SerializedResources()"
data-security="@(Newtonsoft.Json.JsonConvert.SerializeObject(InMemoriamModuleContext.Security))">
</div>

View File

@@ -0,0 +1,6 @@
@inherits InMemoriamWebPage
@using Bring2mind.InMemoriam.Common
@{
}

View File

@@ -0,0 +1,17 @@
@inherits InMemoriamWebPage
@using Bring2mind.InMemoriam.Common
@{
InMemoriamModuleContext.AddModuleScript();
}
<h1>@Dnn.LocalizeString("Messages")</h1>
<div class="Bring2mindInMemoriam Messages"
data-locale="@System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName"
data-moduleid="@Dnn.ActiveModule.ModuleID"
data-tabid="@Dnn.ActiveModule.TabID"
data-portalid="@Dnn.PortalSettings.PortalId"
data-resources="@SerializedResources()"
data-security="@(Newtonsoft.Json.JsonConvert.SerializeObject(InMemoriamModuleContext.Security))"
>
</div>

View File

@@ -0,0 +1,18 @@
@inherits DotNetNuke.Web.Mvc.Framework.DnnWebViewPage<Bring2mind.InMemoriam.Common.ModuleSettings>
@using System.Web.Mvc
@using System.Web.Mvc.Html
@using DotNetNuke.Web.Mvc.Helpers
@{
var viewDir = new System.IO.DirectoryInfo(Server.MapPath("~/DesktopModules/MVC/Bring2mind/InMemoriam/Views/Home"));
var list = viewDir.GetFiles("*.cshtml").Select(f => new SelectListItem() { Text = f.Name, Value= System.IO.Path.GetFileNameWithoutExtension(f.Name)});
}
<h2 id="dnnSitePanel-BasicSettings" class="dnnFormSectionHead">@Dnn.LocalizeString("BasicSettings")</h2>
<fieldset>
<div class="dnnFormItem">
<div class="dnnLabel" style="position: relative;">
@Html.LabelFor(m => Model.View, Dnn.LocalizeString("View"), new { @class = "col-md-2 control-label" })
</div>
@Html.DropDownListFor(m => Model.View, list)
</div>
</fieldset>

View File

@@ -0,0 +1,65 @@
{
"name": "Bring2mind.InMemoriam",
"projectType": "module",
"friendlyName": "InMemoriam Module",
"description": "Bring2mind InMemoriam Module",
"packageName": "Bring2mind_InMemoriam",
"folder": "MVC/Bring2mind/InMemoriam",
"iconFile": "DesktopModules\\MVC\\Bring2mind\\InMemoriam\\icon.png",
"module": {
"azureCompatible": "true",
"moduleName": "Bring2mind_InMemoriam",
"foldername": "Bring2mind/InMemoriam",
"businessControllerClass": "Bring2mind.InMemoriam.Common.ModuleController, BRING2MIND.INMEMORIAM",
"supportedFeatures": ["Portable"],
"moduleDefinitions": [
{
"friendlyName": "Bring2mind InMemoriam",
"defaultCacheTime": 0,
"moduleControls": [
{
"controlSrc": "Bring2mind.InMemoriam.Controllers/Home/Index.mvc",
"supportsPartialRendering": "False",
"controlTitle": "InMemoriam",
"controlType": "View",
"viewOrder": 0
},
{
"controlKey": "Settings",
"controlSrc": "Bring2mind.InMemoriam.Controllers/Settings/Settings.mvc",
"supportsPartialRendering": "False",
"controlTitle": "InMemoriam Settings",
"controlType": "Edit",
"viewOrder": 0
}
],
"permissions": [
{
"code": "Bring2mind_InMemoriam_MODULE",
"key": "ADDMESSAGE",
"name": "Add Message"
},
{
"code": "Bring2mind_InMemoriam_MODULE",
"key": "ADDCONTENT",
"name": "Add Content"
},
{
"code": "Bring2mind_InMemoriam_MODULE",
"key": "FAMILY",
"name": "Family"
}
]
}
]
},
"pathsAndFiles": {
"pathToAssemblies": "./bin",
"pathToScripts": "./Server/SqlScripts",
"assemblies": [
"Bring2mind.InMemoriam.dll",
"Bring2mind.InMemoriam.Core.dll"
],
"excludeFilter": ["InMemoriam/bin/", "InMemoriam/obj/"]
}
}

BIN
Server/InMemoriam/icon.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,62 @@
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
/**
* @license React
* react-dom-client.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react-dom.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* scheduler.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

View File

@@ -0,0 +1,102 @@
/******* TABLES *******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Messages') AND type in (N'U'))
BEGIN
CREATE TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Messages(
[MessageId] [int] IDENTITY(1,1) NOT NULL,
[ModuleId] [int] NOT NULL,
[Contents] [nvarchar](max) NOT NULL,
[SenderName] [nvarchar](100) NULL,
[SenderEmail] [nvarchar](100) NULL,
[CreatedOn] [datetime] NOT NULL,
CONSTRAINT PK_{objectQualifier}B2M_InMemoriam_Messages PRIMARY KEY CLUSTERED
(
[MessageId] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Pictures') AND type in (N'U'))
BEGIN
CREATE TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Pictures(
[PictureId] [int] IDENTITY(1,1) NOT NULL,
[ModuleId] [int] NOT NULL,
[ImageIdentifier] [uniqueidentifier] NOT NULL,
[OriginalWidth] [int] NOT NULL,
[OriginalHeight] [int] NOT NULL,
[OriginalName] [nvarchar](500) NULL,
[Title] [nvarchar](500) NULL,
[Description] [nvarchar](max) NULL,
[PictureYear] [int] NOT NULL,
[PictureMonth] [int] NOT NULL,
[PictureDay] [int] NOT NULL,
[Visibility] [int] NOT NULL,
[CreatedByUserID] [int] NOT NULL,
[CreatedOnDate] [datetime] NOT NULL,
[LastModifiedByUserID] [int] NOT NULL,
[LastModifiedOnDate] [datetime] NOT NULL,
CONSTRAINT PK_{objectQualifier}B2M_InMemoriam_Pictures PRIMARY KEY CLUSTERED
(
[PictureId] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Stories') AND type in (N'U'))
BEGIN
CREATE TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Stories(
[StoryId] [int] IDENTITY(1,1) NOT NULL,
[ModuleId] [int] NOT NULL,
[Title] [nvarchar](500) NULL,
[Contents] [nvarchar](max) NULL,
[StoryYear] [int] NOT NULL,
[StoryMonth] [int] NOT NULL,
[StoryDay] [int] NOT NULL,
[Visibility] [int] NOT NULL,
[CreatedByUserID] [int] NOT NULL,
[CreatedOnDate] [datetime] NOT NULL,
[LastModifiedByUserID] [int] NOT NULL,
[LastModifiedOnDate] [datetime] NOT NULL,
CONSTRAINT PK_{objectQualifier}B2M_InMemoriam_Stories PRIMARY KEY CLUSTERED
(
[StoryId] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
/******* FOREIGN KEYS *******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'{databaseOwner}FK_{objectQualifier}B2M_InMemoriam_Messages_Modules') AND parent_object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Messages'))
ALTER TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Messages WITH CHECK ADD CONSTRAINT FK_{objectQualifier}B2M_InMemoriam_Messages_Modules FOREIGN KEY([ModuleId])
REFERENCES {databaseOwner}{objectQualifier}Modules ([ModuleID])
ON DELETE CASCADE
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'{databaseOwner}FK_{objectQualifier}B2M_InMemoriam_Messages_Modules') AND parent_object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Messages'))
ALTER TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Messages CHECK CONSTRAINT FK_{objectQualifier}B2M_InMemoriam_Messages_Modules
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'{databaseOwner}FK_{objectQualifier}B2M_InMemoriam_Pictures_Modules') AND parent_object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Pictures'))
ALTER TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Pictures WITH CHECK ADD CONSTRAINT FK_{objectQualifier}B2M_InMemoriam_Pictures_Modules FOREIGN KEY([ModuleId])
REFERENCES {databaseOwner}{objectQualifier}Modules ([ModuleID])
ON DELETE CASCADE
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'{databaseOwner}FK_{objectQualifier}B2M_InMemoriam_Pictures_Modules') AND parent_object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Pictures'))
ALTER TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Pictures CHECK CONSTRAINT FK_{objectQualifier}B2M_InMemoriam_Pictures_Modules
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'{databaseOwner}FK_{objectQualifier}B2M_InMemoriam_Stories_Modules') AND parent_object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Stories'))
ALTER TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Stories WITH CHECK ADD CONSTRAINT FK_{objectQualifier}B2M_InMemoriam_Stories_Modules FOREIGN KEY([ModuleId])
REFERENCES {databaseOwner}{objectQualifier}Modules ([ModuleID])
ON DELETE CASCADE
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'{databaseOwner}FK_{objectQualifier}B2M_InMemoriam_Stories_Modules') AND parent_object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Stories'))
ALTER TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Stories CHECK CONSTRAINT FK_{objectQualifier}B2M_InMemoriam_Stories_Modules
GO

View File

@@ -0,0 +1,36 @@
/******* SPROCS *******/
/******* VIEWS AND FUNCTIONS *******/
DROP VIEW IF EXISTS {databaseOwner}{objectQualifier}vw_B2M_InMemoriam_Stories
GO
DROP VIEW IF EXISTS {databaseOwner}{objectQualifier}vw_B2M_InMemoriam_Pictures
GO
/******* TRIGGERS *******/
/******* TYPES *******/
/******* FOREIGN KEYS *******/
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'{databaseOwner}FK_{objectQualifier}B2M_InMemoriam_Messages_Modules') AND parent_object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Messages'))
ALTER TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Messages DROP CONSTRAINT FK_{objectQualifier}B2M_InMemoriam_Messages_Modules
GO
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'{databaseOwner}FK_{objectQualifier}B2M_InMemoriam_Pictures_Modules') AND parent_object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Pictures'))
ALTER TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Pictures DROP CONSTRAINT FK_{objectQualifier}B2M_InMemoriam_Pictures_Modules
GO
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'{databaseOwner}FK_{objectQualifier}B2M_InMemoriam_Stories_Modules') AND parent_object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Stories'))
ALTER TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Stories DROP CONSTRAINT FK_{objectQualifier}B2M_InMemoriam_Stories_Modules
GO
/******* TABLES *******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Messages') AND type in (N'U'))
DROP TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Messages
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Pictures') AND type in (N'U'))
DROP TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Pictures
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}B2M_InMemoriam_Stories') AND type in (N'U'))
DROP TABLE {databaseOwner}{objectQualifier}B2M_InMemoriam_Stories
GO

View File

@@ -0,0 +1,44 @@
/******* SPROCS *******/
/******* VIEWS AND FUNCTIONS *******/
DROP VIEW IF EXISTS {databaseOwner}{objectQualifier}vw_B2M_InMemoriam_Stories
GO
DROP VIEW IF EXISTS {databaseOwner}{objectQualifier}vw_B2M_InMemoriam_Pictures
GO
/******* TRIGGERS *******/
/******* TYPES *******/
/******* TYPES *******/
/******* TRIGGERS *******/
/******* VIEWS AND FUNCTIONS *******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW {databaseOwner}{objectQualifier}vw_B2M_InMemoriam_Pictures
AS
SELECT
p.*,
cu.DisplayName CreatedByUser,
mu.DisplayName LastModifiedByUser
FROM {databaseOwner}{objectQualifier}B2M_InMemoriam_Pictures p
LEFT JOIN {databaseOwner}{objectQualifier}Users cu ON cu.UserID=p.CreatedByUserID
LEFT JOIN {databaseOwner}{objectQualifier}Users mu ON mu.UserID=p.LastModifiedByUserID
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW {databaseOwner}{objectQualifier}vw_B2M_InMemoriam_Stories
AS
SELECT
s.*,
cu.DisplayName CreatedByUser,
mu.DisplayName LastModifiedByUser
FROM {databaseOwner}{objectQualifier}B2M_InMemoriam_Stories s
LEFT JOIN {databaseOwner}{objectQualifier}Users cu ON cu.UserID=s.CreatedByUserID
LEFT JOIN {databaseOwner}{objectQualifier}Users mu ON mu.UserID=s.LastModifiedByUserID
GO
/******* SPROCS *******/