PageRenderTime 26ms CodeModel.GetById 19ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/IZWebFileManager/Components/FileViewThumbnailsRender.cs

http://izwebfilemanager.googlecode.com/
C# | 98 lines | 71 code | 12 blank | 15 comment | 1 complexity | dd733bf7f36dd5998df1150827fad530 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 FileViewThumbnailsRender : FileViewRender
27	{
28		internal FileViewThumbnailsRender (FileView fileView) : base (fileView) { }
29
30		internal override void RenderItem (System.Web.UI.HtmlTextWriter output, FileViewItem item) {
31			output.AddStyleAttribute (HtmlTextWriterStyle.Margin, "1px");
32			output.AddStyleAttribute (HtmlTextWriterStyle.Width, "120px");
33			output.AddStyleAttribute (HtmlTextWriterStyle.Height, "126px");
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.AddAttribute (HtmlTextWriterAttribute.Cellpadding, "0");
40			output.AddAttribute (HtmlTextWriterAttribute.Cellspacing, "0");
41			output.AddAttribute (HtmlTextWriterAttribute.Border, "0");
42			output.RenderBeginTag (HtmlTextWriterTag.Table);
43
44			output.RenderBeginTag (HtmlTextWriterTag.Tr);
45			output.AddStyleAttribute (HtmlTextWriterStyle.Width, "120px");
46			output.AddStyleAttribute (HtmlTextWriterStyle.Height, "96px");
47			output.AddStyleAttribute (HtmlTextWriterStyle.PaddingLeft, "13px");
48			output.AddStyleAttribute (HtmlTextWriterStyle.PaddingRight, "13px");
49			output.AddStyleAttribute (HtmlTextWriterStyle.PaddingTop, "2px");
50			output.RenderBeginTag (HtmlTextWriterTag.Td);
51
52			output.AddAttribute (HtmlTextWriterAttribute.Cellpadding, "0");
53			output.AddAttribute (HtmlTextWriterAttribute.Cellspacing, "0");
54			output.AddAttribute (HtmlTextWriterAttribute.Border, "0");
55			output.RenderBeginTag (HtmlTextWriterTag.Table);
56			output.RenderBeginTag (HtmlTextWriterTag.Tr);
57			output.AddStyleAttribute (HtmlTextWriterStyle.BorderColor, "#ACA899");
58			output.AddStyleAttribute (HtmlTextWriterStyle.BorderStyle, "solid");
59			output.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "1px");
60			output.AddStyleAttribute (HtmlTextWriterStyle.Width, "92px");
61			output.AddStyleAttribute (HtmlTextWriterStyle.Height, "92px");
62			output.AddStyleAttribute (HtmlTextWriterStyle.TextAlign, "center");
63			output.AddStyleAttribute (HtmlTextWriterStyle.VerticalAlign, "middle");
64            output.AddStyleAttribute("background-image", "url(\"" + item.ThumbnailImage + "\")");
65			output.AddStyleAttribute ("background-position", "center center");
66			output.AddStyleAttribute ("background-repeat", "no-repeat");
67			if (item.Hidden)
68				fileView.Controller.HiddenItemStyle.AddAttributesToRender (output);
69			output.RenderBeginTag (HtmlTextWriterTag.Td);
70			output.RenderEndTag ();
71			output.RenderEndTag ();
72			output.RenderEndTag ();
73			
74			output.RenderEndTag ();
75			output.RenderEndTag ();
76
77			output.RenderBeginTag (HtmlTextWriterTag.Tr);
78			output.RenderBeginTag (HtmlTextWriterTag.Td);
79			output.AddStyleAttribute (HtmlTextWriterStyle.Cursor, "default");
80			output.AddStyleAttribute (HtmlTextWriterStyle.Width, "120px");
81			output.AddStyleAttribute (HtmlTextWriterStyle.Height, "30px");
82			output.AddStyleAttribute (HtmlTextWriterStyle.Overflow, "hidden");
83			output.AddStyleAttribute (HtmlTextWriterStyle.TextAlign, "center");
84			output.AddAttribute (HtmlTextWriterAttribute.Id, item.ClientID + "_Name");
85			output.RenderBeginTag (HtmlTextWriterTag.Div);
86			RenderItemName (output, item);
87			output.RenderEndTag ();
88			output.RenderEndTag ();
89			output.RenderEndTag ();
90
91			output.RenderEndTag ();
92
93			fileView.RenderItemEndTag (output);
94
95			output.RenderEndTag ();
96		}
97	}
98}