Exemple #1
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.Name) + "'," + (item.IsDirectory ? "true" : "false") + "," + (item.CanBeRenamed ? "true" : "false") + "," + "false" + "," + fileType + ");");

            _itemIndex++;
        }
        internal override void RenderItem(System.Web.UI.HtmlTextWriter output, FileViewItem item)
        {
            output.AddStyleAttribute(HtmlTextWriterStyle.Margin, "2px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "70px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Height, "71px");
            output.AddStyleAttribute("float", fileView.Controller.CurrentUICulture.TextInfo.IsRightToLeft ? "right" : "left");
            output.RenderBeginTag(HtmlTextWriterTag.Div);

            fileView.RenderItemBeginTag(output, item);

            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "70px");
            output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            output.RenderBeginTag(HtmlTextWriterTag.Table);

            output.RenderBeginTag(HtmlTextWriterTag.Tr);
            output.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "center");
            output.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
            output.AddStyleAttribute(HtmlTextWriterStyle.Height, "41px");
            output.RenderBeginTag(HtmlTextWriterTag.Td);
            //output.AddStyleAttribute(HtmlTextWriterStyle.Width, "70px");
            //output.RenderBeginTag(HtmlTextWriterTag.Div);
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, FileManagerController.LargeImageWidth.ToString(CultureInfo.InstalledUICulture));
            output.AddStyleAttribute(HtmlTextWriterStyle.Height, FileManagerController.LargeImageHeight.ToString(CultureInfo.InstalledUICulture));
            output.AddAttribute(HtmlTextWriterAttribute.Src, item.LargeImage);
            output.AddAttribute(HtmlTextWriterAttribute.Alt, item.Info);
            output.RenderBeginTag(HtmlTextWriterTag.Img);
            output.RenderEndTag();
            //output.RenderEndTag();
            output.RenderEndTag();
            output.RenderEndTag();

            output.RenderBeginTag(HtmlTextWriterTag.Tr);
            output.RenderBeginTag(HtmlTextWriterTag.Td);
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "70px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Height, "30px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Overflow, "hidden");
            output.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "center");
            output.AddAttribute(HtmlTextWriterAttribute.Id, item.ClientID + "_Name");
            output.RenderBeginTag(HtmlTextWriterTag.Div);
            RenderItemName(output, item);
            output.RenderEndTag();
            output.RenderEndTag();
            output.RenderEndTag();

            output.RenderEndTag();

            fileView.RenderItemEndTag(output);

            output.RenderEndTag();
        }
Exemple #3
0
        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())
                {
                    if (fsi is FileInfo)
                    {
                        string ext = fsi.Extension.ToLower(CultureInfo.InvariantCulture).TrimStart('.');
                        if (Controller.HiddenFilesArray.Contains(ext))
                        {
                            continue;
                        }
                    }
                    FileViewItem item = new FileViewItem(fsi, this);

                    render.RenderItem(writer, item);
                }
            }

            render.RenderEndList(writer);
            RenderInitScript(writer);
        }
Exemple #4
0
 protected void RenderItemName(HtmlTextWriter output, FileViewItem item)
 {
     if (fileView.UseLinkToOpenItem)
     {
         string href = item.IsDirectory ?
                       "javascript:WFM_" + fileView.Controller.ClientID + ".OnExecuteCommand(WFM_" + fileView.ClientID + ",\'0:0\')" :
                       (VirtualPathUtility.AppendTrailingSlash(fileView.CurrentDirectory.VirtualPath) + item.FileSystemInfo.Name);
         if (!item.IsDirectory && !string.IsNullOrEmpty(fileView.LinkToOpenItemTarget))
         {
             output.AddAttribute(HtmlTextWriterAttribute.Target, fileView.LinkToOpenItemTarget);
         }
         output.AddAttribute(HtmlTextWriterAttribute.Href, href, true);
         output.AddAttribute(HtmlTextWriterAttribute.Class, fileView.LinkToOpenItemClass);
         output.RenderBeginTag(HtmlTextWriterTag.A);
         output.Write(HttpUtility.HtmlEncode(item.Name));
         output.RenderEndTag();
     }
     else
     {
         output.Write(HttpUtility.HtmlEncode(item.Name));
     }
 }
Exemple #5
0
        internal override void RenderItem(System.Web.UI.HtmlTextWriter output, FileViewItem item)
        {
            output.AddStyleAttribute(HtmlTextWriterStyle.Margin, "1px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "120px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Height, "126px");
            output.AddStyleAttribute("float", fileView.Controller.CurrentUICulture.TextInfo.IsRightToLeft ? "right" : "left");
            output.RenderBeginTag(HtmlTextWriterTag.Div);

            fileView.RenderItemBeginTag(output, item);

            output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            output.RenderBeginTag(HtmlTextWriterTag.Table);

            output.RenderBeginTag(HtmlTextWriterTag.Tr);
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "120px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Height, "96px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "13px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "13px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingTop, "2px");
            output.RenderBeginTag(HtmlTextWriterTag.Td);

            output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            output.RenderBeginTag(HtmlTextWriterTag.Table);
            output.RenderBeginTag(HtmlTextWriterTag.Tr);
            output.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, "#ACA899");
            output.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "solid");
            output.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "1px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "92px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Height, "92px");
            output.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "center");
            output.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
            output.RenderBeginTag(HtmlTextWriterTag.Td);
            output.AddAttribute(HtmlTextWriterAttribute.Src, item.ThumbnailImage);
            output.AddAttribute(HtmlTextWriterAttribute.Alt, item.Info);
            output.RenderBeginTag(HtmlTextWriterTag.Img);
            output.RenderEndTag();
            output.RenderEndTag();
            output.RenderEndTag();
            output.RenderEndTag();

            output.RenderEndTag();
            output.RenderEndTag();

            output.RenderBeginTag(HtmlTextWriterTag.Tr);
            output.RenderBeginTag(HtmlTextWriterTag.Td);
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "120px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Height, "30px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Overflow, "hidden");
            output.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "center");
            output.AddAttribute(HtmlTextWriterAttribute.Id, item.ClientID + "_Name");
            output.RenderBeginTag(HtmlTextWriterTag.Div);
            RenderItemName(output, item);
            output.RenderEndTag();
            output.RenderEndTag();
            output.RenderEndTag();

            output.RenderEndTag();

            fileView.RenderItemEndTag(output);

            output.RenderEndTag();
        }
Exemple #6
0
 //internal virtual void RenderUpDirectory(HtmlTextWriter output, System.IO.DirectoryInfo dir)
 //{
 //}
 internal virtual void RenderItem(HtmlTextWriter output, FileViewItem item)
 {
 }
        internal override void RenderItem(HtmlTextWriter output, FileViewItem item)
        {
            output.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Name Collumn
            if (fileView.Sort == SortMode.Name)
            {
                fileView.DetailsSortedColumnStyle.AddAttributesToRender(output);
            }
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "1px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            output.RenderBeginTag(HtmlTextWriterTag.Td);

            fileView.RenderItemBeginTag(output, item);

            output.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            output.RenderBeginTag(HtmlTextWriterTag.Table);
            output.RenderBeginTag(HtmlTextWriterTag.Tr);
            output.RenderBeginTag(HtmlTextWriterTag.Td);

            output.AddStyleAttribute(HtmlTextWriterStyle.Width, FileManagerController.SmallImageWidth.ToString(CultureInfo.InstalledUICulture));
            output.AddStyleAttribute(HtmlTextWriterStyle.Height, FileManagerController.SmallImageHeight.ToString(CultureInfo.InstalledUICulture));
            output.AddAttribute(HtmlTextWriterAttribute.Src, item.SmallImage);
            output.AddAttribute(HtmlTextWriterAttribute.Alt, item.Info);
            output.RenderBeginTag(HtmlTextWriterTag.Img);
            output.RenderEndTag();

            output.RenderEndTag();
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            output.RenderBeginTag(HtmlTextWriterTag.Td);

            output.AddAttribute(HtmlTextWriterAttribute.Id, item.ClientID + "_Name");
            output.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            output.RenderBeginTag(HtmlTextWriterTag.Div);
            output.Write(" ");
            RenderItemName(output, item);
            output.RenderEndTag();

            output.RenderEndTag();
            output.RenderEndTag();
            output.RenderEndTag();

            fileView.RenderItemEndTag(output);

            output.RenderEndTag();

            // Size Collumn
            if (fileView.Sort == SortMode.Size)
            {
                fileView.DetailsSortedColumnStyle.AddAttributesToRender(output);
            }
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "1px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Direction, "ltr");
            output.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "right");
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            output.RenderBeginTag(HtmlTextWriterTag.Td);
            output.Write(item.Size);
            output.RenderEndTag();

            // Type Collumn
            if (fileView.Sort == SortMode.Type)
            {
                fileView.DetailsSortedColumnStyle.AddAttributesToRender(output);
            }
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "1px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            output.RenderBeginTag(HtmlTextWriterTag.Td);
            output.Write(HttpUtility.HtmlEncode(item.Type));
            output.RenderEndTag();

            // Modified Collumn
            if (fileView.Sort == SortMode.Modified)
            {
                fileView.DetailsSortedColumnStyle.AddAttributesToRender(output);
            }
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "1px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            output.RenderBeginTag(HtmlTextWriterTag.Td);
            output.Write(HttpUtility.HtmlEncode(item.Modified));
            output.RenderEndTag();


            output.RenderEndTag();
        }