using System; using System.Data; using System.Collections; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using CMS.GlobalHelper; using CMS.SiteProvider; using CMS.UIControls; public partial class CMSModules_ImportExport_Controls_Global_ObjectAttachmentSelector : CMSUserControl { protected int mPreviewWidth = 140; protected int mPreviewHeight = 108; protected int mPanelHeight = 250; protected string mObjectType = SiteObjectType.WEBTEMPLATE; /// /// Preview width. /// public int PreviewWidth { get { return mPreviewWidth; } set { mPreviewWidth = value; } } /// /// Preview height. /// public int PreviewHeight { get { return mPreviewHeight; } set { mPreviewHeight = value; } } /// /// Panel height. /// public int PanelHeight { get { return mPanelHeight; } set { mPanelHeight = value; } } /// /// ID column name. /// public string IDColumn { get; set; } /// /// Column containing the thumbnail metafile GUID /// public string ThumbnailGUIDColumn { get; set; } /// /// Display name column name. /// public string DisplayNameColumn { get; set; } /// /// Description column name. /// public string DescriptionColumn { get; set; } /// /// Template ID. /// public int SelectedId { get { return ValidationHelper.GetInteger(hdnLastSelected.Value, 0); } set { hdnLastSelected.Value = value.ToString(); } } /// /// Data source. /// public object DataSource { get { return rptItems.DataSource; } set { rptItems.DataSource = value; } } /// /// Object type. /// public string ObjectType { get { return mObjectType; } set { mObjectType = value; } } protected void Page_Load(object sender, EventArgs e) { ltlScript.Text = ScriptHelper.GetScript("var hdnLastSelected=document.getElementById('" + hdnLastSelected.ClientID + "');"); ltlScriptAfter.Text = ScriptHelper.GetScript("SelectItem(hdnLastSelected.value);"); } /// /// Bind data. /// public void BindData() { rptItems.DataBind(); } /// /// Gets metafile preview. /// /// Thumbnail GUID protected string GetPreviewImage(object thumbnailGuid) { Guid guid = ValidationHelper.GetGuid(thumbnailGuid, Guid.Empty); if (guid == Guid.Empty) { return ResolveUrl("~/CMSPages/GetMetaFile.aspx?fileguid=" + guid); } else { return ResolveUrl("~/CMSPages/GetMetaFile.aspx?fileguid=" + guid); } } }