add support for public content folders
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Models
|
||||
{
|
||||
@ -41,7 +43,7 @@ namespace Oqtane.Models
|
||||
/// This is calculated at time of Upload, so if the file is manually replaced, the value will be wrong.
|
||||
/// </summary>
|
||||
public int ImageHeight { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The width of an image (if the file is an image) in pixels.
|
||||
/// This is calculated at time of Upload, so if the file is manually replaced, the value will be wrong.
|
||||
@ -65,7 +67,7 @@ namespace Oqtane.Models
|
||||
#endregion
|
||||
|
||||
#region Extended IAuditable Properties, may be moved to an Interface some day so not documented yet
|
||||
|
||||
|
||||
public string DeletedBy { get; set; }
|
||||
public DateTime? DeletedOn { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
@ -78,5 +80,11 @@ namespace Oqtane.Models
|
||||
/// TODO: not sure if this is always populated, must verify and document
|
||||
/// </summary>
|
||||
public Folder Folder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// url for accessing file
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public string Url { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,11 @@ namespace Oqtane.Models
|
||||
/// </summary>
|
||||
public int? ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Folder type - based on FolderTypes
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Folder name
|
||||
/// </summary>
|
||||
|
6
Oqtane.Shared/Shared/FolderTypes.cs
Normal file
6
Oqtane.Shared/Shared/FolderTypes.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace Oqtane.Shared {
|
||||
public class FolderTypes {
|
||||
public const string Private = "Private";
|
||||
public const string Public = "Public";
|
||||
}
|
||||
}
|
@ -113,6 +113,23 @@ namespace Oqtane.Shared
|
||||
url = (!url.StartsWith("/")) ? "/" + url : url;
|
||||
return (alias != null && !string.IsNullOrEmpty(alias.Path)) ? "/" + alias.Path + url : url;
|
||||
}
|
||||
|
||||
public static string FormatContent(string content, Alias alias, string operation)
|
||||
{
|
||||
switch (operation)
|
||||
{
|
||||
case "save":
|
||||
content = content.Replace(UrlCombine("Content", "Tenants", alias.TenantId.ToString(), "Sites", alias.SiteId.ToString()), "[siteroot]");
|
||||
content = content.Replace(alias.Path + Constants.ContentUrl, Constants.ContentUrl);
|
||||
break;
|
||||
case "render":
|
||||
content = content.Replace("[siteroot]", UrlCombine("Content", "Tenants", alias.TenantId.ToString(), "Sites", alias.SiteId.ToString()));
|
||||
content = content.Replace(Constants.ContentUrl, alias.Path + Constants.ContentUrl);
|
||||
break;
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
public static string GetTypeName(string fullyqualifiedtypename)
|
||||
{
|
||||
if (fullyqualifiedtypename.Contains(","))
|
||||
@ -325,6 +342,11 @@ namespace Oqtane.Shared
|
||||
return Path.Combine(segments).TrimEnd();
|
||||
}
|
||||
|
||||
public static string UrlCombine(params string[] segments)
|
||||
{
|
||||
return string.Join("/", segments);
|
||||
}
|
||||
|
||||
public static bool IsPathValid(this Folder folder)
|
||||
{
|
||||
return IsPathOrFileValid(folder.Name);
|
||||
|
Reference in New Issue
Block a user