Exemple #1
0
        void OnFolderPopulate(FolderNode node)
        {
            Controller.EnsureDefaults();

            DirectoryInfo directoryInfo = Controller.ResolveFileManagerItemInfo(node.ValuePath).Directory;

            if (!directoryInfo.Exists)
            {
                return;
            }

            DirectoryProvider provider = new DirectoryProvider(directoryInfo, SortMode.Name, SortDirection.Ascending);

            foreach (DirectoryInfo dir in provider.GetFileSystemInfos(DirectoryProvider.FileSystemInfosFilter.Directories))
            {
                FileViewItem item = new FileViewItem(dir, this);
                if (!ShowHiddenFilesAndFolders && item.Hidden)
                {
                    continue;
                }

                FolderNode treeNode = new FolderNode(this);
                node.ChildNodes.Add(treeNode);
                treeNode.Text     = dir.Name;
                treeNode.Hidden   = item.Hidden;
                treeNode.ImageUrl = Controller.GetFolderSmallImage(dir);
                if (_fileView != null)
                {
                    treeNode.NavigateUrl = "javascript:WFM_" + _fileView.ClientID + ".Navigate(\"" + treeNode.ValuePath + "\");";
                }
            }
        }
        internal void RenderItemBeginTag(HtmlTextWriter output, FileViewItem item)
        {
            string id = ClientID + "_Item_" + _itemIndex;

            item.ClientID = id;

            int fileType = -2;             //is Directory

            if (item.FileSystemInfo is FileInfo)
            {
                FileInfo file = (FileInfo)item.FileSystemInfo;
                FileType ft   = Controller.GetFileType(file);
                if (ft != null)
                {
                    fileType = Controller.FileTypes.IndexOf(ft);
                }
                else
                {
                    fileType = -1;
                }
            }

            itemIds.Add(id);

            output.AddAttribute(HtmlTextWriterAttribute.Id, id);
            output.RenderBeginTag(HtmlTextWriterTag.Div);

            // trace init script
            _initScript.AppendLine("var " + id + " = document.getElementById('" + id + "');");
            _initScript.AppendLine(FileManagerController.ClientScriptObjectNamePrefix + ClientID + ".InitItem(" + id + ",'" + FileManagerController.EncodeURIComponent(item.Name) + "'," + (item.IsDirectory ? "true" : "false") + "," + (item.CanBeRenamed ? "true" : "false") + "," + "false" + "," + fileType + ");");

            _itemIndex++;
        }
Exemple #3
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (DesignMode)
            {
                return;
            }

            var directoryInfo = GetCurrentDirectory().Directory;

            var render   = FileViewRender.GetRender(this);
            var provider = new DirectoryProvider(directoryInfo, Sort, SortDirection, SearchTerm);

            render.RenderBeginList(writer);

            foreach (FileSystemInfo fsi in provider.GetFileSystemInfos())
            {
                var item = new FileViewItem(directoryInfo, fsi, this);

                if (!ShowHiddenFilesAndFolders && item.Hidden)
                {
                    continue;
                }

                render.RenderItem(writer, item);
            }

            render.RenderEndList(writer);
            RenderInitScript(writer);
        }
        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (DesignMode)
            {
                return;
            }

            DirectoryInfo directoryInfo = GetCurrentDirectory().Directory;

            FileViewRender    render   = FileViewRender.GetRender(this);
            DirectoryProvider provider = new DirectoryProvider(directoryInfo, Sort, SortDirection);

            render.RenderBeginList(writer);

            //FileViewItem upDirectory = new FileViewUpDirectoryItem(directoryInfo.Parent, this);
            //render.RenderItem(output, upDirectory);

            //if (ShowInGroups) {
            //    GroupInfo [] groups = provider.GetGroups ();
            //    foreach (GroupInfo group in groups) {
            //        render.RenderBeginGroup (writer, group);
            //        foreach (FileSystemInfo fsi in provider.GetFileSystemInfos (group)) {
            //            FileViewItem item = new FileViewItem (fsi, this);
            //            render.RenderItem (writer, item);
            //        }

            //        render.RenderEndGroup (writer, group);
            //    }
            //}
            //else {
            foreach (FileSystemInfo fsi in provider.GetFileSystemInfos())
            {
                FileViewItem item = new FileViewItem(fsi, this);

                if (!ShowHiddenFilesAndFolders && item.Hidden)
                {
                    continue;
                }

                render.RenderItem(writer, item);
            }
            //}

            render.RenderEndList(writer);
            RenderInitScript(writer);
        }
Exemple #5
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (DesignMode)
                return;

            var directoryInfo = GetCurrentDirectory().Directory;

            var render = FileViewRender.GetRender(this);
            var provider = new DirectoryProvider(directoryInfo, Sort, SortDirection, SearchTerm);

            render.RenderBeginList(writer);

            foreach (FileSystemInfo fsi in provider.GetFileSystemInfos())
            {
                var item = new FileViewItem(directoryInfo, fsi, this);

                if (!ShowHiddenFilesAndFolders && item.Hidden)
                    continue;

                render.RenderItem(writer, item);
            }

            render.RenderEndList(writer);
            RenderInitScript(writer);
        }
Exemple #6
0
        internal void RenderItemBeginTag(HtmlTextWriter output, FileViewItem item)
        {
            string id = ClientID + "_Item_" + _itemIndex;
            item.ClientID = id;

            int fileType = -2; //is Directory
            if (item.FileSystemInfo is FileInfo)
            {
                FileInfo file = (FileInfo)item.FileSystemInfo;
                FileType ft = Controller.GetFileType(file);
                if (ft != null)
                    fileType = Controller.FileTypes.IndexOf(ft);
                else
                    fileType = -1;
            }

            itemIds.Add(id);

            output.AddAttribute(HtmlTextWriterAttribute.Id, id);
            output.RenderBeginTag(HtmlTextWriterTag.Div);

            // trace init script
            _initScript.AppendLine("var " + id + " = document.getElementById('" + id + "');");
            _initScript.AppendLine(FileManagerController.ClientScriptObjectNamePrefix + ClientID + ".InitItem(" + id + ",'" + FileManagerController.EncodeURIComponent(item.RelativePath) + "'," + (item.IsDirectory ? "true" : "false") + "," + (item.CanBeRenamed ? "true" : "false") + "," + "false" + "," + fileType + ");");

            _itemIndex++;
        }
        internal string GetItemThumbnailImage(FileViewItem item, FileManagerItemInfo currentDirectory)
        {
            if (item.IsDirectory)
                return GetFolderLargeImage((DirectoryInfo)item.FileSystemInfo);

            if (IsImage((FileInfo)item.FileSystemInfo))
                return ResolveUrl("~/" + ThumbnailHandler + "?" + HttpUtility.UrlEncode(VirtualPathUtility.AppendTrailingSlash(currentDirectory.VirtualPath) + item.RelativePath));

            return GetFileLargeImage((FileInfo)item.FileSystemInfo);
        }
        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (DesignMode)
                return;

            DirectoryInfo directoryInfo = GetCurrentDirectory ().Directory;

            FileViewRender render = FileViewRender.GetRender (this);
            DirectoryProvider provider = new DirectoryProvider (directoryInfo, Sort, SortDirection);

            render.RenderBeginList (writer);

            //FileViewItem upDirectory = new FileViewUpDirectoryItem(directoryInfo.Parent, this);
            //render.RenderItem(output, upDirectory);

            //if (ShowInGroups) {
            //    GroupInfo [] groups = provider.GetGroups ();
            //    foreach (GroupInfo group in groups) {
            //        render.RenderBeginGroup (writer, group);
            //        foreach (FileSystemInfo fsi in provider.GetFileSystemInfos (group)) {
            //            FileViewItem item = new FileViewItem (fsi, this);
            //            render.RenderItem (writer, item);
            //        }

            //        render.RenderEndGroup (writer, group);
            //    }
            //}
            //else {
                foreach (FileSystemInfo fsi in provider.GetFileSystemInfos ()) {
                    FileViewItem item = new FileViewItem (fsi, this);

                    if (!ShowHiddenFilesAndFolders && item.Hidden)
                        continue;

                    render.RenderItem (writer, item);
                }
            //}

            render.RenderEndList (writer);
            RenderInitScript (writer);
        }