PageRenderTime 49ms CodeModel.GetById 24ms 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. using System;
  17. using System.Web.UI;
  18. using System.Collections.Generic;
  19. using System.Text;
  20. using System.Web;
  21. using System.Globalization;
  22. namespace IZ.WebFileManager.Components
  23. {
  24. class FileViewThumbnailsRender : FileViewRender
  25. {
  26. internal FileViewThumbnailsRender (FileView fileView) : base (fileView) { }
  27. internal override void RenderItem (System.Web.UI.HtmlTextWriter output, FileViewItem item) {
  28. output.AddStyleAttribute (HtmlTextWriterStyle.Margin, "1px");
  29. output.AddStyleAttribute (HtmlTextWriterStyle.Width, "120px");
  30. output.AddStyleAttribute (HtmlTextWriterStyle.Height, "126px");
  31. output.AddStyleAttribute ("float", fileView.Controller.CurrentUICulture.TextInfo.IsRightToLeft ? "right" : "left");
  32. output.RenderBeginTag (HtmlTextWriterTag.Div);
  33. fileView.RenderItemBeginTag (output, item);
  34. output.AddAttribute (HtmlTextWriterAttribute.Cellpadding, "0");
  35. output.AddAttribute (HtmlTextWriterAttribute.Cellspacing, "0");
  36. output.AddAttribute (HtmlTextWriterAttribute.Border, "0");
  37. output.RenderBeginTag (HtmlTextWriterTag.Table);
  38. output.RenderBeginTag (HtmlTextWriterTag.Tr);
  39. output.AddStyleAttribute (HtmlTextWriterStyle.Width, "120px");
  40. output.AddStyleAttribute (HtmlTextWriterStyle.Height, "96px");
  41. output.AddStyleAttribute (HtmlTextWriterStyle.PaddingLeft, "13px");
  42. output.AddStyleAttribute (HtmlTextWriterStyle.PaddingRight, "13px");
  43. output.AddStyleAttribute (HtmlTextWriterStyle.PaddingTop, "2px");
  44. output.RenderBeginTag (HtmlTextWriterTag.Td);
  45. output.AddAttribute (HtmlTextWriterAttribute.Cellpadding, "0");
  46. output.AddAttribute (HtmlTextWriterAttribute.Cellspacing, "0");
  47. output.AddAttribute (HtmlTextWriterAttribute.Border, "0");
  48. output.RenderBeginTag (HtmlTextWriterTag.Table);
  49. output.RenderBeginTag (HtmlTextWriterTag.Tr);
  50. output.AddStyleAttribute (HtmlTextWriterStyle.BorderColor, "#ACA899");
  51. output.AddStyleAttribute (HtmlTextWriterStyle.BorderStyle, "solid");
  52. output.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "1px");
  53. output.AddStyleAttribute (HtmlTextWriterStyle.Width, "92px");
  54. output.AddStyleAttribute (HtmlTextWriterStyle.Height, "92px");
  55. output.AddStyleAttribute (HtmlTextWriterStyle.TextAlign, "center");
  56. output.AddStyleAttribute (HtmlTextWriterStyle.VerticalAlign, "middle");
  57. output.AddStyleAttribute("background-image", "url(\"" + item.ThumbnailImage + "\")");
  58. output.AddStyleAttribute ("background-position", "center center");
  59. output.AddStyleAttribute ("background-repeat", "no-repeat");
  60. if (item.Hidden)
  61. fileView.Controller.HiddenItemStyle.AddAttributesToRender (output);
  62. output.RenderBeginTag (HtmlTextWriterTag.Td);
  63. output.RenderEndTag ();
  64. output.RenderEndTag ();
  65. output.RenderEndTag ();
  66. output.RenderEndTag ();
  67. output.RenderEndTag ();
  68. output.RenderBeginTag (HtmlTextWriterTag.Tr);
  69. output.RenderBeginTag (HtmlTextWriterTag.Td);
  70. output.AddStyleAttribute (HtmlTextWriterStyle.Cursor, "default");
  71. output.AddStyleAttribute (HtmlTextWriterStyle.Width, "120px");
  72. output.AddStyleAttribute (HtmlTextWriterStyle.Height, "30px");
  73. output.AddStyleAttribute (HtmlTextWriterStyle.Overflow, "hidden");
  74. output.AddStyleAttribute (HtmlTextWriterStyle.TextAlign, "center");
  75. output.AddAttribute (HtmlTextWriterAttribute.Id, item.ClientID + "_Name");
  76. output.RenderBeginTag (HtmlTextWriterTag.Div);
  77. RenderItemName (output, item);
  78. output.RenderEndTag ();
  79. output.RenderEndTag ();
  80. output.RenderEndTag ();
  81. output.RenderEndTag ();
  82. fileView.RenderItemEndTag (output);
  83. output.RenderEndTag ();
  84. }
  85. }
  86. }