diff --git a/Sunfish/ShareWeb/$sunfish/$index.html b/Sunfish/ShareWeb/$sunfish/$index.html index 89bda8f..d054589 100644 --- a/Sunfish/ShareWeb/$sunfish/$index.html +++ b/Sunfish/ShareWeb/$sunfish/$index.html @@ -9,10 +9,13 @@
-
+
{Name}
diff --git a/Sunfish/ShareWeb/$sunfish/style.css b/Sunfish/ShareWeb/$sunfish/style.css index c58f684..5501e54 100644 --- a/Sunfish/ShareWeb/$sunfish/style.css +++ b/Sunfish/ShareWeb/$sunfish/style.css @@ -32,7 +32,7 @@ #main-title { font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif; - font-size: 2.5rem; + font-size: 2.2rem; left: 5rem; top: 0; position: absolute; @@ -40,12 +40,29 @@ #main-subtitle { position: absolute; - font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; - font-size: 0.9rem; + font-family: tahoma, verdana, sans-serif; + font-size: 1.1rem; color: #000000b2; - top: 2.5rem; - left: 11rem; - font-weight: bold; + top: 1.3rem; + left: 13rem; +} + +#main-location { + position: absolute; + bottom: 0.5rem; + left: 6rem; + font-family: Verdana, Geneva, Tahoma, sans-serif; + font-size: 0.8rem; + color: #696969; +} + +.breadcrumb::after { + content: "/"; +} + +.breadcrumb i.material-icons{ + font-size: 1.0rem; + vertical-align: bottom; } #wrapper { @@ -97,4 +114,4 @@ font-weight: 400; font-size: 0.7rem; color: gray; -} +} \ No newline at end of file diff --git a/Sunfish/Sunfish/Middleware/VFS.cs b/Sunfish/Sunfish/Middleware/VFS.cs index 5ad96a9..ede52e4 100644 --- a/Sunfish/Sunfish/Middleware/VFS.cs +++ b/Sunfish/Sunfish/Middleware/VFS.cs @@ -61,8 +61,10 @@ public VFSItem GetItem(string path) { - while (path.EndsWith("/")) + while (path != "/" && path.EndsWith("/")) path = path.Substring(0, path.Length - 1); + if (path.Length == 0) + path = "/"; VFSFolder folder = LocateFolder(ref path); if (folder == null) return null; diff --git a/Sunfish/Sunfish/Middleware/WebUI.cs b/Sunfish/Sunfish/Middleware/WebUI.cs index 97f44e3..24a7478 100644 --- a/Sunfish/Sunfish/Middleware/WebUI.cs +++ b/Sunfish/Sunfish/Middleware/WebUI.cs @@ -11,7 +11,7 @@ { static WebUI() { - InitResources(); + InitResources(); } #region Frontend Resources @@ -51,12 +51,16 @@ #endregion - public static void WriteHeader(HttpCall call) + public static void WriteHeader(WebUILink[] breadcrumb, WebUILink[] toolbar, HttpCall call) { call.Write(Templs["head-a"].Process(BaseData)); - //call.Write(Templs["head-location-item"].Process(BaseData)); + if (breadcrumb != null) + foreach (WebUILink l in breadcrumb) + call.Write(Templs["head-location-item"].Process(l, BaseData)); call.Write(Templs["head-b"].Process(BaseData)); - //call.Write(Templs["head-toolbar-item"].Process(BaseData)); + if (breadcrumb != null) + foreach (WebUILink l in breadcrumb) + call.Write(Templs["head-toolbar-item"].Process(l, BaseData)); call.Write(Templs["head-c"].Process(BaseData)); } @@ -65,7 +69,7 @@ call.Write(Templs["footer"].Process(BaseData)); } - public static void WriteItem(WebUIListItem item, HttpCall call) + public static void WriteItem(WebUILink item, HttpCall call) { call.Write(Templs["item"].Process(item, BaseData)); } @@ -89,12 +93,13 @@ } - public struct WebUIListItem + public class WebUILink { public string Name { get; set; } public string Description { get; set; } public string Link { get; set; } public string Icon { get; set; } + public string Tooltip { get; set; } public string Styles { get; set; } } diff --git a/Sunfish/Sunfish/Services/RootService.cs b/Sunfish/Sunfish/Services/RootService.cs index 9dc0efa..66640ab 100644 --- a/Sunfish/Sunfish/Services/RootService.cs +++ b/Sunfish/Sunfish/Services/RootService.cs @@ -1,6 +1,7 @@ using DolphinWebXplorer2.Middleware; using System; using System.IO; +using System.Linq.Expressions; using System.Reflection; namespace DolphinWebXplorer2.Services @@ -10,6 +11,18 @@ { public const string DIR_COMMON = "/$sunfish/"; public const string DIR_API = "api/"; + private static WebUILink linkHome; + + static RootService() + { + linkHome = new WebUILink() + { + Icon = "home", + Link = "/", + Tooltip = "Root", + }; + } + public RootService() : base(new SunfishServiceConfiguration() { Enabled = true, @@ -28,14 +41,20 @@ // Root page if (ShowMenu) { - WebUI.WriteHeader(call); + WebUI.WriteHeader(new WebUILink[]{ + new WebUILink() + { + Icon = "home", + Link = "/", + } + }, null, call); foreach (SunfishService s in Sunfish.Services) { if (!s.Enabled) continue; - WebUI.WriteItem(new WebUIListItem() + WebUI.WriteItem(new WebUILink() { - Icon= "/$sunfish/folder.png", + Icon = "/$sunfish/folder.png", Name = s.Configuration.Name, Description = s.Configuration.Location, Link = s.Configuration.Location, @@ -78,6 +97,8 @@ { } + public static WebUILink LinkHome => linkHome; + public override string Description => "Root page service and API"; public bool ShowMenu { get; set; } = true; } diff --git a/Sunfish/Sunfish/Services/WebService.cs b/Sunfish/Sunfish/Services/WebService.cs index b709a1a..987b161 100644 --- a/Sunfish/Sunfish/Services/WebService.cs +++ b/Sunfish/Sunfish/Services/WebService.cs @@ -99,9 +99,10 @@ } if (allowNavigation) { + //TODO: Block subfolder navigation if not allowed checking path idx = vfs.GetItem(path); if (idx != null && idx.Directory) - WriteIndex(idx, call); + WriteIndex(path, idx, call); else call.HTTPNotFound(); } @@ -183,10 +184,10 @@ } } - private void WriteIndex(VFSItem dir, HttpCall call) + private void WriteIndex(string path, VFSItem dir, HttpCall call) { WebUI.InitResources(); - WebUI.WriteHeader(call); + WebUI.WriteHeader(getBreadcrumb(path), null, call); List fileList = new List(); if (allowSubfolderNavigation) { @@ -195,7 +196,7 @@ fileList.Sort(); foreach (string d in fileList) { - WebUI.WriteItem(new WebUIListItem() + WebUI.WriteItem(new WebUILink() { Icon = "/$sunfish/folder.png", Name = d, @@ -210,7 +211,7 @@ fileList.Sort(); foreach (string d in fileList) { - WebUI.WriteItem(new WebUIListItem() + WebUI.WriteItem(new WebUILink() { Icon = d + "?meta=icon", Name = d, @@ -221,6 +222,26 @@ WebUI.WriteFooter(call); } + private WebUILink[] getBreadcrumb(string path) + { + string link = ""; + path = Configuration.Location + path; + List lst = new List(); + lst.Add(RootService.LinkHome); + foreach (string p in path.Split('/')) + { + if (p.Length == 0) + continue; + link += "/" + p; + lst.Add(new WebUILink() + { + Name = p, + Link = link, + }); + } + return lst.ToArray(); + } + protected override void Start() { } diff --git a/Sunfish/Sunfish/Services/WebServiceConfigurator.cs b/Sunfish/Sunfish/Services/WebServiceConfigurator.cs index 74ff2af..9ae7830 100644 --- a/Sunfish/Sunfish/Services/WebServiceConfigurator.cs +++ b/Sunfish/Sunfish/Services/WebServiceConfigurator.cs @@ -10,6 +10,7 @@ internal const string CFG_SHARE = "folderShare"; internal const string CFG_NAVIGATION = "allowSubfolderNavigation"; internal const string CFG_UPLOAD = "allowUploads"; + internal const string CFG_EDITOR = "allowEditor"; internal const string CFG_RENAME = "allowRenaming"; internal const string CFG_DELETE = "allowDeletion"; internal const string CFG_EXECUTE = "allowServerExecution"; @@ -49,7 +50,11 @@ }, new ConfigurationBool(CFG_UPLOAD,"Allow upload") { - Tooltip = "Allow upload of files and folders." + Tooltip = "Allow upload of files and folders, also enables the create folder option if subfolder navigation is enabled." + }, + new ConfigurationBool(CFG_EDITOR,"Allow text editor") + { + Tooltip = "Allow text file creation and edition, also enables the create folder option if subfolder navigation is enabled." }, new ConfigurationBool(CFG_RENAME,"Allow rename") {