예제 #1
0
        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;
        }
예제 #2
0
 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);
 }
예제 #3
0
        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;
        }
예제 #4
0
파일: FileManager.cs 프로젝트: Epitomy/CMS
        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;
        }
예제 #5
0
파일: FileManager.cs 프로젝트: Epitomy/CMS
        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;
        }
예제 #6
0
        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;
        }
예제 #7
0
 public VersionPath(DirectoryResource dir, int version)
 {
     var versionBasePath = new VersionBasePath(dir);
     this.PhysicalPath = Path.Combine(versionBasePath.PhysicalPath, version.ToString());
 }
예제 #8
0
 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);
 }