protected virtual MenuItem GenerateItem(Site site, ControllerContext controllerContext, DirectoryResource directoryResource) { var menuItem = new MenuItem { Text = directoryResource.Name, Area = "Sites", Action = "Index", Controller = "File", Initializer = new FileFolderItemInitializer(), Localizable = false }; menuItem.RouteValues = new System.Web.Routing.RouteValueDictionary(); menuItem.RouteValues["folderPath"] = ((DirectoryEntry)directoryResource).RelativePath; menuItem.RouteValues["type"] = FileManager.Type; var subDirs = FileManager.GetDirectories(site, ((DirectoryEntry)directoryResource).RelativePath); if (subDirs != null && subDirs.Count() > 0) { var subList = new List<MenuItem>(); foreach (var sub in subDirs) { subList.Add(GenerateItem(site, controllerContext, sub)); } menuItem.Items = subList; } return menuItem; }
public VersionBasePath(DirectoryResource dir) { var baseDir = Kooboo.CMS.Common.Runtime.EngineContext.Current.Resolve<IBaseDir>(); var basePath = baseDir.Cms_DataPhysicalPath; var versionPath = Path.Combine(basePath, VersionPathName); this.PhysicalPath = dir.PhysicalPath.Replace(basePath, versionPath); }
public DirectoryEntry(DirectoryResource rootDir, DirectoryResource parent, string name) : base(parent.Site, name) { this.virtualPath = UrlUtility.Combine(parent.VirtualPath, name); this.physicalPath = Path.Combine(parent.PhysicalPath, name); this.basePhysicalPath = parent.PhysicalPath; this.baseVirtualPath = parent.VirtualPath; this.RootDir = rootDir; }
public DirectoryEntry(DirectoryResource rootDir, string relativePath) : base("") { this.physicalPath = Path.Combine(rootDir.PhysicalPath, relativePath); this.virtualPath = UrlUtility.GetVirtualPath(physicalPath); this.basePhysicalPath = Path.GetDirectoryName(this.physicalPath); var paths = this.virtualPath.Split("/".ToArray(), StringSplitOptions.RemoveEmptyEntries); this.baseVirtualPath = UrlUtility.Combine(paths.Take(paths.Count() - 1).ToArray()); this.RootDir = rootDir; }
public FileEntry(DirectoryResource rootDir, string relativePath) : base("") { this.physicalPath = Path.Combine(rootDir.PhysicalPath, relativePath); this.virtualPath = UrlUtility.GetVirtualPath(physicalPath); this.basePhysicalPath = Path.GetDirectoryName(this.physicalPath); var paths = this.virtualPath.Split("/".ToArray(), StringSplitOptions.RemoveEmptyEntries); this.baseVirtualPath = UrlUtility.Combine(paths.Take(paths.Count() - 1).ToArray()); this.FileName = paths.Last(); if (this.FileName.Contains('.')) { this.Name = FileName.Substring(0, FileName.IndexOf(".")); this.FileExtension = FileExtension.Substring(FileExtension.IndexOf(".") + 1); } else { this.Name = FileName; } this.RootDir = rootDir; //this.RelativePath = relativeVirtualPath; }
protected override MenuItem GenerateItem(Site site, ControllerContext controllerContext, DirectoryResource directoryResource) { var item = base.GenerateItem(site, controllerContext, directoryResource); if (controllerContext.RequestContext.GetRequestValue("ThemeName") == null) { item.RouteValues["ThemeName"] = directoryResource.Name; } return item; }
public VersionPath(DirectoryResource dir, int version) { var versionBasePath = new VersionBasePath(dir); this.PhysicalPath = Path.Combine(versionBasePath.PhysicalPath, version.ToString()); }
public VersionBasePath(DirectoryResource dir) { var basePath = Path.Combine(Kooboo.Settings.BaseDirectory, PathEx.BasePath); var versionPath = Path.Combine(basePath, VersionPathName); this.PhysicalPath = dir.PhysicalPath.Replace(basePath, versionPath); }