PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 6ms RepoModel.GetById 35ms app.codeStats 0ms

/IZWebFileManager/Components/FileViewIconsRender.cs

http://izwebfilemanager.googlecode.com/
C# | 79 lines | 54 code | 10 blank | 15 comment | 1 complexity | d7e0c5c57c4824158b3afe3f61a17006 MD5 | raw file
 1// Copyright (C) 2006 Igor Zelmanovich <izwebfilemanager@gmail.com>
 2//
 3// This program is free software; you can redistribute it and/or modify
 4// it under the terms of the GNU General Public License as published by
 5// the Free Software Foundation; either version 2 of the License, or
 6// (at your option) any later version.
 7//
 8// This program is distributed in the hope that it will be useful,
 9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17using System;
18using System.Web.UI;
19using System.Collections.Generic;
20using System.Text;
21using System.Web;
22using System.Globalization;
23
24namespace IZ.WebFileManager.Components
25{
26	class FileViewIconsRender : FileViewRender
27	{
28		internal FileViewIconsRender (FileView fileView) : base (fileView) { }
29
30		internal override void RenderItem (System.Web.UI.HtmlTextWriter output, FileViewItem item) {
31			output.AddStyleAttribute (HtmlTextWriterStyle.Margin, "2px");
32			output.AddStyleAttribute (HtmlTextWriterStyle.Width, "70px");
33			output.AddStyleAttribute (HtmlTextWriterStyle.Height, "71px");
34			output.AddStyleAttribute ("float", fileView.Controller.CurrentUICulture.TextInfo.IsRightToLeft ? "right" : "left");
35			output.RenderBeginTag (HtmlTextWriterTag.Div);
36
37			fileView.RenderItemBeginTag (output, item);
38
39			output.AddStyleAttribute (HtmlTextWriterStyle.Width, "70px");
40			output.AddAttribute (HtmlTextWriterAttribute.Cellpadding, "0");
41			output.AddAttribute (HtmlTextWriterAttribute.Cellspacing, "0");
42			output.AddAttribute (HtmlTextWriterAttribute.Border, "0");
43			output.RenderBeginTag (HtmlTextWriterTag.Table);
44
45			output.RenderBeginTag (HtmlTextWriterTag.Tr);
46			output.AddStyleAttribute (HtmlTextWriterStyle.TextAlign, "center");
47			output.AddStyleAttribute (HtmlTextWriterStyle.VerticalAlign, "middle");
48			output.AddStyleAttribute (HtmlTextWriterStyle.Height, "41px");
49			output.AddStyleAttribute (HtmlTextWriterStyle.BackgroundImage, item.LargeImage);
50			output.AddStyleAttribute ("background-position", "center center");
51			output.AddStyleAttribute ("background-repeat", "no-repeat");
52			if (item.Hidden)
53				fileView.Controller.HiddenItemStyle.AddAttributesToRender (output);
54			output.RenderBeginTag (HtmlTextWriterTag.Td);
55			output.RenderEndTag ();
56			output.RenderEndTag ();
57
58			output.RenderBeginTag (HtmlTextWriterTag.Tr);
59			output.RenderBeginTag (HtmlTextWriterTag.Td);
60			output.AddStyleAttribute (HtmlTextWriterStyle.Cursor, "default");
61			output.AddStyleAttribute (HtmlTextWriterStyle.Width, "70px");
62			output.AddStyleAttribute (HtmlTextWriterStyle.Height, "30px");
63			output.AddStyleAttribute (HtmlTextWriterStyle.Overflow, "hidden");
64			output.AddStyleAttribute (HtmlTextWriterStyle.TextAlign, "center");
65			output.AddAttribute (HtmlTextWriterAttribute.Id, item.ClientID + "_Name");
66			output.RenderBeginTag (HtmlTextWriterTag.Div);
67			RenderItemName (output, item);
68			output.RenderEndTag ();
69			output.RenderEndTag ();
70			output.RenderEndTag ();
71
72			output.RenderEndTag ();
73
74			fileView.RenderItemEndTag (output);
75
76			output.RenderEndTag ();
77		}
78	}
79}