public void ShowSortStatus(System.Web.UI.WebControls.Image imageControl, int sortStatus) { const int nosort = -1; const int descendingstatus = 0; const int ascendingstatus = 1; if (sortStatus == nosort) { imageControl.Visible = false; } else { if (sortStatus == descendingstatus) { imageControl.ImageUrl = @"https://cdn3.iconfinder.com/data/icons/musthave/128/Stock%20Index%20Down.png"; imageControl.ToolTip = "Descending"; imageControl.Visible = true; } else { imageControl.ImageUrl = @"https://cdn3.iconfinder.com/data/icons/musthave/128/Stock%20Index%20Up.png"; imageControl.ToolTip = "Ascending"; imageControl.Visible = true; } } }
public void Refresh() { Controls.Clear(); if (Page != null) { int i = 0; // ClientScriptProxy.Current.Page =(Page) ((WebWindowTemplateHttpHandler) HttpContext.Current.Handler).ActualHandler; string noImageUrl = ClientScriptProxy.Current.GetWebResourceUrl(GetType(), "Xpand.ExpressApp.Thumbnail.Web.Resources.noimage.jpg"); if (DataSource != null) { var rootTable = new Table(); Controls.Add(rootTable); var tableRow = new TableRow(); var tableCell = new TableCell(); tableRow.Cells.Add(tableCell); rootTable.Rows.Add(tableRow); foreach (IPictureItem item in DataSource) { Table table = CreateTable(tableCell.Controls); var img = new System.Web.UI.WebControls.Image { ID = ID + "_" + (i++) }; var requestTextPictureItemEventArgs = new RequestTextPictureItemEventArgs(item); OnRequestText(requestTextPictureItemEventArgs); SetImageProperties(item, img, noImageUrl, requestTextPictureItemEventArgs.Text); CreateImageRow(img, table); CreateTextRow(item, requestTextPictureItemEventArgs.Text, table); } } } }
void CreateImageRow(System.Web.UI.WebControls.Image img, Table table) { TableCell cell = HideImages?new TableCell() : CreateImageCell(img); table.Rows.Add(new TableRow()); table.Rows[0].Cells.Add(cell); }
TableCell CreateImageCell(System.Web.UI.WebControls.Image img) { var cell = new TableCell(); cell.Controls.Add(img); cell.Style["text-align"] = "center"; return(cell); }
private void dgFSList_ItemDataBound(object sender, DataGridItemEventArgs e) { if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) || (e.Item.ItemType == ListItemType.EditItem)) { if (e.Item.ItemType != ListItemType.EditItem) { ((LinkButton)e.Item.FindControl("lbFileName")).Text = ((DataRowView)e.Item.DataItem)["FileName"].ToString(); ((LinkButton)e.Item.FindControl("imbDel")).Visible = this._AllowDelete; ((LinkButton)e.Item.FindControl("imbRen")).Visible = this._AllowRename; this.ViewState["fpUploadFolderRelativePath"] = this.AddSlashIfNotExist(this.ViewState["fpUploadFolderRelativePath"].ToString()); string str2 = this._UploadDir + this.ViewState["fpUploadFolderRelativePath"].ToString() + ((DataRowView)e.Item.DataItem)["FileName"].ToString(); ((HyperLink)e.Item.FindControl("hlView")).NavigateUrl = str2; ((HyperLink)e.Item.FindControl("lnkEditImage")).NavigateUrl = "/Controls/ImageEditor.aspx?img=" + str2; LinkButton button = (LinkButton)e.Item.FindControl("imbDel"); button.Attributes["onclick"] = "return confirm('Do you want to proceed?');"; } ((Label)e.Item.FindControl("lbModified")).Text = ((DataRowView)e.Item.DataItem)["Modified"].ToString(); ((Label)e.Item.FindControl("lblWidth")).Text = ((DataRowView)e.Item.DataItem)["imgWidth"].ToString(); ((Label)e.Item.FindControl("lblHeight")).Text = ((DataRowView)e.Item.DataItem)["imgHeight"].ToString(); System.Web.UI.WebControls.Image image = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgFSObject"); DataRowView curData = (DataRowView)e.Item.DataItem; bool check = (bool)curData["isFile"]; int ischeck = 0; if (check) { ischeck = 1; } switch (ischeck) { case 0: image.ImageUrl = "/Images/Icons/folder.gif"; image.AlternateText = "Folder"; ((Label)e.Item.FindControl("lblSize")).Text = "Dir"; e.Item.Attributes.Add("FSOType", "Folder"); return; case 1: if (!this._ShowImageAsIcon) { image.ImageUrl = "/Images/Icons/File.gif"; break; } image.ImageUrl = this._UploadDir + this.ViewState["fpUploadFolderRelativePath"].ToString() + ((DataRowView)e.Item.DataItem)["FileName"].ToString(); break; default: return; } image.AlternateText = "File"; string fileSize = this.GetFileSize((long)((int)((DataRowView)e.Item.DataItem)["Size"])); ((Label)e.Item.FindControl("lblSize")).Text = fileSize; e.Item.Attributes.Add("FSOType", "File"); } }
private void ShowImagesUsedInResearch(List <string> images) { placeholderResearchImages.Controls.Clear(); foreach (var image in images) { var im = new System.Web.UI.WebControls.Image(); im.ImageUrl = image; im.Height = 100; placeholderResearchImages.Controls.Add(im); } }
void SetImageProperties(IPictureItem item, System.Web.UI.WebControls.Image img, string noImageUrl, string text) { img.AlternateText = text; if (item.Image != null) { img.ImageUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&loadimage=" + item.ID; } else if (!(string.IsNullOrEmpty(item.ImagePath))) { img.ImageUrl = item.ImagePath; } else { img.ImageUrl = noImageUrl; } }
public void Refresh() { Controls.Clear(); if (Page != null) { int i = 0; string noImageUrl = ClientScriptProxy.Current.GetWebResourceUrl(GetType(), "Xpand.ExpressApp.Thumbnail.Web.Resources.noimage.jpg"); if (DataSource != null) foreach (IPictureItem item in DataSource) { Table table = CreateTable(); var img = new System.Web.UI.WebControls.Image { ID = ID + "_" + (i++) }; var requestTextPictureItemEventArgs = new RequestTextPictureItemEventArgs(item); OnRequestText(requestTextPictureItemEventArgs); SetImageProperties(item, img, noImageUrl,requestTextPictureItemEventArgs.Text); CreateImageRow(img, table); CreateTextRow(item, requestTextPictureItemEventArgs.Text, table); } } }
private bool AddThumbnail(string file, string extension, Control cell) { if (!File.Exists(Path.ChangeExtension(file, extension))) { return(false); } var imgLink = new HyperLink(); var strURL = file.Substring(file.LastIndexOf("\\portals\\", StringComparison.OrdinalIgnoreCase)); imgLink.NavigateUrl = this.ResolveUrl("~" + strURL.Replace(".ascx", extension)); imgLink.Target = "_blank"; var img = new System.Web.UI.WebControls.Image { ImageUrl = CreateThumbnail(file.Replace(".ascx", extension)), BorderWidth = new Unit(1) }; imgLink.Controls.Add(img); cell.Controls.Add(imgLink); return(true); }
private void ProcessSkins(string strFolderPath, string type) { HtmlTable tbl; HtmlTableRow row = null; HtmlTableCell cell; string[] arrFiles; string strURL; var intIndex = 0; if (Directory.Exists(strFolderPath)) { bool fallbackSkin; string strRootSkin; if (type == "Skin") { tbl = tblSkins; strRootSkin = SkinController.RootSkin.ToLower(); fallbackSkin = IsFallbackSkin(strFolderPath); } else { tbl = tblContainers; strRootSkin = SkinController.RootContainer.ToLower(); fallbackSkin = IsFallbackContainer(strFolderPath); } var strSkinType = strFolderPath.ToLower().IndexOf(Globals.HostMapPath.ToLower()) != -1 ? "G" : "L"; var canDeleteSkin = SkinController.CanDeleteSkin(strFolderPath, PortalSettings.HomeDirectoryMapPath); if (fallbackSkin || !canDeleteSkin) { row = new HtmlTableRow(); cell = new HtmlTableCell {ColSpan = 3}; var pnl = new Panel {CssClass = "dnnFormMessage dnnFormWarning"}; var lbl = new Label {Text = Localization.GetString(type == "Skin" ? "CannotDeleteSkin.ErrorMessage" : "CannotDeleteContainer.ErrorMessage", LocalResourceFile)}; pnl.Controls.Add(lbl); cell.Controls.Add(pnl); row.Cells.Add(cell); tbl.Rows.Add(row); cmdDelete.Visible = false; } arrFiles = Directory.GetFiles(strFolderPath, "*.ascx"); if (arrFiles.Length == 0) { row = new HtmlTableRow(); cell = new HtmlTableCell {ColSpan = 3}; var pnl = new Panel {CssClass = "dnnFormMessage dnnFormWarning"}; var lbl = new Label {Text = Localization.GetString(type == "Skin" ? "NoSkin.ErrorMessage" : "NoContainer.ErrorMessage", LocalResourceFile)}; pnl.Controls.Add(lbl); cell.Controls.Add(pnl); row.Cells.Add(cell); tbl.Rows.Add(row); } var strFolder = strFolderPath.Substring(strFolderPath.LastIndexOf("\\") + 1); foreach (var strFile in arrFiles) { var file = strFile.ToLower(); intIndex += 1; if (intIndex == 4) { intIndex = 1; } if (intIndex == 1) { //Create new row row = new HtmlTableRow(); tbl.Rows.Add(row); } cell = new HtmlTableCell {Align = "center", VAlign = "bottom"}; cell.Attributes["class"] = "NormalBold"; //name var label = new Label {Text = Path.GetFileNameWithoutExtension(file)}; cell.Controls.Add(label); cell.Controls.Add(new LiteralControl("<br />")); //thumbnail if (File.Exists(file.Replace(".ascx", ".jpg"))) { var imgLink = new HyperLink(); strURL = file.Substring(strFile.LastIndexOf("\\portals\\")); imgLink.NavigateUrl = ResolveUrl("~" + strURL.Replace(".ascx", ".jpg")); imgLink.Target = "_new"; var img = new System.Web.UI.WebControls.Image {ImageUrl = CreateThumbnail(file.Replace(".ascx", ".jpg")), BorderWidth = new Unit(1)}; imgLink.Controls.Add(img); cell.Controls.Add(imgLink); } else { var img = new System.Web.UI.WebControls.Image {ImageUrl = ResolveUrl("~/images/thumbnail.jpg"), BorderWidth = new Unit(1)}; cell.Controls.Add(img); } cell.Controls.Add(new LiteralControl("<br />")); strURL = file.Substring(strFile.IndexOf("\\" + strRootSkin + "\\")); strURL.Replace(".ascx", ""); var previewLink = new HyperLink(); if (type == "Skin") { previewLink.NavigateUrl = Globals.NavigateURL(PortalSettings.HomeTabId, Null.NullString, "SkinSrc=" + "[" + strSkinType + "]" + Globals.QueryStringEncode(strURL.Replace(".ascx", "").Replace("\\", "/"))); } else { previewLink.NavigateUrl = Globals.NavigateURL(PortalSettings.HomeTabId, Null.NullString, "ContainerSrc=" + "[" + strSkinType + "]" + Globals.QueryStringEncode(strURL.Replace(".ascx", "").Replace("\\", "/"))); } previewLink.CssClass = "dnnSecondaryAction"; previewLink.Target = "_new"; previewLink.Text = Localization.GetString("cmdPreview", LocalResourceFile); cell.Controls.Add(previewLink); cell.Controls.Add(new LiteralControl("|")); var applyButton = new LinkButton { Text = Localization.GetString("cmdApply", LocalResourceFile), CommandName = "Apply" + type, CommandArgument = "[" + strSkinType + "]" + strRootSkin + "/" + strFolder + "/" + Path.GetFileName(strFile), CssClass = "dnnSecondaryAction" }; applyButton.Command += OnCommand; cell.Controls.Add(applyButton); if ((UserInfo.IsSuperUser || strSkinType == "L") && (!fallbackSkin && canDeleteSkin)) { cell.Controls.Add(new LiteralControl(";|")); var deleteButton = new LinkButton { Text = Localization.GetString("cmdDelete"), CommandName = "Delete", CommandArgument = "[" + strSkinType + "]" + strRootSkin + "/" + strFolder + "/" + Path.GetFileName(strFile), CssClass = "dnnSecondaryAction" }; deleteButton.Command += OnCommand; cell.Controls.Add(deleteButton); } row.Cells.Add(cell); } if (File.Exists(strFolderPath + "/" + Globals.glbAboutPage)) { row = new HtmlTableRow(); cell = new HtmlTableCell {ColSpan = 3, Align = "center"}; var strFile = strFolderPath + "/" + Globals.glbAboutPage; strURL = strFile.Substring(strFile.IndexOf("\\portals\\")); var copyrightLink = new HyperLink { NavigateUrl = ResolveUrl("~" + strURL), CssClass = "dnnSecondaryAction", Target = "_new", Text = string.Format(Localization.GetString("About", LocalResourceFile), strFolder) }; cell.Controls.Add(copyrightLink); row.Cells.Add(cell); tbl.Rows.Add(row); } } }
private void ProcessSkins(string strFolderPath, string type) { const int kColSpan = 5; HtmlTable tbl; HtmlTableRow row = null; HtmlTableCell cell; Panel pnlMsg; string[] arrFiles; string strURL; var intIndex = 0; if (Directory.Exists(strFolderPath)) { bool fallbackSkin; string strRootSkin; if (type == "Skin") { tbl = tblSkins; strRootSkin = SkinController.RootSkin.ToLower(); fallbackSkin = IsFallbackSkin(strFolderPath); pnlMsg = pnlMsgSkins; } else { tbl = tblContainers; strRootSkin = SkinController.RootContainer.ToLower(); fallbackSkin = IsFallbackContainer(strFolderPath); pnlMsg = pnlMsgContainers; } var strSkinType = strFolderPath.ToLower().IndexOf(Globals.HostMapPath.ToLower()) != -1 ? "G" : "L"; var canDeleteSkin = SkinController.CanDeleteSkin(strFolderPath, PortalSettings.HomeDirectoryMapPath); arrFiles = Directory.GetFiles(strFolderPath, "*.ascx"); int colSpan = arrFiles.Length == 0 ? 1: arrFiles.Length; tbl.Width = "auto"; if (fallbackSkin || !canDeleteSkin) { var pnl = new Panel { CssClass = "dnnFormMessage dnnFormWarning" }; var lbl = new Label { Text = Localization.GetString(type == "Skin" ? "CannotDeleteSkin.ErrorMessage" : "CannotDeleteContainer.ErrorMessage", LocalResourceFile) }; pnl.Controls.Add(lbl); pnlMsg.Controls.Add(pnl); cmdDelete.Visible = false; } if (arrFiles.Length == 0) { var pnl = new Panel { CssClass = "dnnFormMessage dnnFormWarning" }; var lbl = new Label { Text = Localization.GetString(type == "Skin" ? "NoSkin.ErrorMessage" : "NoContainer.ErrorMessage", LocalResourceFile) }; pnl.Controls.Add(lbl); pnlMsg.Controls.Add(pnl); } var strFolder = strFolderPath.Substring(strFolderPath.LastIndexOf("\\") + 1); foreach (var strFile in arrFiles) { var file = strFile.ToLower(); intIndex += 1; if (intIndex == kColSpan + 1) { intIndex = 1; } if (intIndex == 1) { //Create new row row = new HtmlTableRow(); tbl.Rows.Add(row); } cell = new HtmlTableCell { Align = "center", VAlign = "bottom" }; cell.Attributes["class"] = "NormalBold"; //thumbnail if (File.Exists(file.Replace(".ascx", ".jpg"))) { var imgLink = new HyperLink(); strURL = file.Substring(strFile.LastIndexOf("\\portals\\")); imgLink.NavigateUrl = ResolveUrl("~" + strURL.Replace(".ascx", ".jpg")); imgLink.Target = "_new"; var img = new System.Web.UI.WebControls.Image { ImageUrl = CreateThumbnail(file.Replace(".ascx", ".jpg")), BorderWidth = new Unit(1) }; imgLink.Controls.Add(img); cell.Controls.Add(imgLink); } else { var img = new System.Web.UI.WebControls.Image { ImageUrl = ResolveUrl("~/images/thumbnail_black.png"), BorderWidth = new Unit(1) }; cell.Controls.Add(img); } cell.Controls.Add(new LiteralControl("<br />")); strURL = file.Substring(strFile.IndexOf("\\" + strRootSkin + "\\")); strURL.Replace(".ascx", ""); //name var label = new Label { Text = getReducedFileName(Path.GetFileNameWithoutExtension(file)), ToolTip = Path.GetFileNameWithoutExtension(file), CssClass = "skinTitle" }; cell.Controls.Add(label); cell.Controls.Add(new LiteralControl("<br />")); //Actions var previewLink = new HyperLink(); if (type == "Skin") { previewLink.NavigateUrl = Globals.NavigateURL(PortalSettings.HomeTabId, Null.NullString, "SkinSrc=" + "[" + strSkinType + "]" + Globals.QueryStringEncode(strURL.Replace(".ascx", "").Replace("\\", "/"))); } else { previewLink.NavigateUrl = Globals.NavigateURL(PortalSettings.HomeTabId, Null.NullString, "ContainerSrc=" + "[" + strSkinType + "]" + Globals.QueryStringEncode(strURL.Replace(".ascx", "").Replace("\\", "/"))); } previewLink.CssClass = "dnnSecondaryAction"; previewLink.Target = "_new"; previewLink.Text = Localization.GetString("cmdPreview", LocalResourceFile); cell.Controls.Add(previewLink); cell.Controls.Add(new LiteralControl(" ")); var applyButton = new LinkButton { Text = Localization.GetString("cmdApply", LocalResourceFile), CommandName = "Apply" + type, CommandArgument = "[" + strSkinType + "]" + strRootSkin + "/" + strFolder + "/" + Path.GetFileName(strFile), CssClass = "dnnSecondaryAction applyAction" }; applyButton.Command += OnCommand; cell.Controls.Add(applyButton); if ((UserInfo.IsSuperUser || strSkinType == "L") && (!fallbackSkin && canDeleteSkin)) { cell.Controls.Add(new LiteralControl(" ")); var deleteButton = new LinkButton { Text = Localization.GetString("cmdDelete"), CommandName = "Delete", CommandArgument = "[" + strSkinType + "]" + strRootSkin + "/" + strFolder + "/" + Path.GetFileName(strFile), CssClass = "dnnSecondaryAction" }; deleteButton.Command += OnCommand; cell.Controls.Add(deleteButton); } row.Cells.Add(cell); } if (File.Exists(strFolderPath + "/" + Globals.glbAboutPage)) { row = new HtmlTableRow(); cell = new HtmlTableCell { ColSpan = colSpan, Align = "center" }; var strFile = strFolderPath + "/" + Globals.glbAboutPage; strURL = strFile.Substring(strFile.IndexOf("\\portals\\")); var copyrightLink = new HyperLink { NavigateUrl = ResolveUrl("~" + strURL), CssClass = "dnnSecondaryAction", Target = "_new", Text = string.Format(Localization.GetString("About", LocalResourceFile), strFolder) }; cell.Controls.Add(copyrightLink); row.Cells.Add(cell); tbl.Rows.Add(row); } } }
public void Refresh() { Controls.Clear(); if (Page != null) { int i = 0; // ClientScriptProxy.Current.Page =(Page) ((WebWindowTemplateHttpHandler) HttpContext.Current.Handler).ActualHandler; string noImageUrl = ClientScriptProxy.Current.GetWebResourceUrl(GetType(), "Xpand.ExpressApp.Thumbnail.Web.Resources.noimage.jpg"); if (DataSource != null) { var rootTable = new Table(); Controls.Add(rootTable); var tableRow = new TableRow(); var tableCell = new TableCell(); tableRow.Cells.Add(tableCell); rootTable.Rows.Add(tableRow); foreach (IPictureItem item in DataSource) { Table table = CreateTable(tableCell.Controls); var img = new System.Web.UI.WebControls.Image { ID = ID + "_" + (i++) }; var requestTextPictureItemEventArgs = new RequestTextPictureItemEventArgs(item); OnRequestText(requestTextPictureItemEventArgs); SetImageProperties(item, img, noImageUrl,requestTextPictureItemEventArgs.Text); CreateImageRow(img, table); CreateTextRow(item, requestTextPictureItemEventArgs.Text, table); } } } }
private bool AddThumbnail(string file, string extension, Control cell) { if (!File.Exists(Path.ChangeExtension(file, extension))) { return false; } var imgLink = new HyperLink(); var strURL = file.Substring(file.LastIndexOf("\\portals\\", StringComparison.OrdinalIgnoreCase)); imgLink.NavigateUrl = this.ResolveUrl("~" + strURL.Replace(".ascx", extension)); imgLink.Target = "_new"; var img = new System.Web.UI.WebControls.Image { ImageUrl = CreateThumbnail(file.Replace(".ascx", extension)), BorderWidth = new Unit(1) }; imgLink.Controls.Add(img); cell.Controls.Add(imgLink); return true; }