private string BuildLinkUrl() { string url = ""; if (gUsePopUp && gJSRequested) { string popUpUrl = (NavigateUrl.StartsWith("~/")) ? MakeRelativePath(NavigateUrl) : NavigateUrl; string width = (Width.ToLower() == "max") ? "-1" : Width; string height = (Height.ToLower() == "max") ? "-1" : Height; string resizable = (Resizeable) ? "1" : "0"; string menus = (Menus) ? "1" : "0"; string scrollBars = (ScrollBars) ? "1" : "0"; string toolBar = (ToolBar) ? "1" : "0"; url = string.Format("javascript:OpenWindow('{0}', {1}, {2}, {3}, {4}, {5}, {6});", popUpUrl.Replace("'", @"\'"), width, height, resizable, toolBar, scrollBars, menus); } else { if (WebCommon.IsWebUrl(gNavUrl)) { url = gNavUrl; } else { url = string.Format("{0}/{1}", GetParentRelativePath(), gNavUrl); } } hlSygmaImg.Visible = DisplayImage; litSpace.Visible = DisplayImage; return(url); }
private string SetImage() { string retVal = ImageUrl; if (ImageUrl == "") { switch (Type) { case LinkType.Url: int i = NavigateUrl.IndexOf('?'); diIcon.FileName = (i > -1) ? NavigateUrl.Substring(0, i) : NavigateUrl; break; case LinkType.Document: diIcon.Visible = true; diIcon.FileName = NavigateUrl; break; case LinkType.Folder: //hlSygmaImg.ImageUrl = FOLDER_IMAGE; diIcon.Visible = true; diIcon.Extension = "folder"; break; default: //hlSygmaImg.ImageUrl = FORM_IMAGE; diIcon.Visible = true; diIcon.Extension = "form"; break; } } return(retVal); }
protected override void Render(HtmlTextWriter output) { string title = GetLocalizedTitle(); string text = GetLocalizedText(); output.BeginRender(); output.WriteBeginTag("a"); if (!String.IsNullOrEmpty(this.ClientID)) { output.WriteAttribute("id", this.ClientID); } if (!String.IsNullOrEmpty(NavigateUrl)) { output.WriteAttribute("href", NavigateUrl.Replace("&", "&")); } else if (this.LinkTo != ForumPageLinkTo.Nothing) { output.WriteAttribute("href", YafBuildLink.GetLink(GetForumLinkTo())); } output.WriteAttribute("style", HtmlEncode(Style)); if (BlankTarget) { output.WriteAttribute("target", "_blank"); } if (!String.IsNullOrEmpty(OnClick)) { output.WriteAttribute("onclick", OnClick); } if (!String.IsNullOrEmpty(OnMouseOver)) { output.WriteAttribute("onmouseover", OnMouseOver); } if (!String.IsNullOrEmpty(CssClass)) { output.WriteAttribute("class", CssClass); } if (!String.IsNullOrEmpty(title)) { output.WriteAttribute("title", title); } else if (!String.IsNullOrEmpty(TitleNonLocalized)) { output.WriteAttribute("title", TitleNonLocalized); } output.Write(HtmlTextWriter.TagRightChar); output.WriteEncodedText(text); output.WriteEndTag("a"); if (!String.IsNullOrEmpty(PostfixText)) { output.Write(PostfixText); } output.EndRender(); }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (string.IsNullOrEmpty(NavigateUrl)) { NavigateUrl = "javascript:void(0);"; } else { NavigateUrl = (IsLinkEncrypt && (NavigateUrl.IndexOf("md=") < 0)) ? CCUtilsComplex.UrlMD5(NavigateUrl) : NavigateUrl; } }
protected override void OnPreRender(EventArgs args) { if (!string.IsNullOrEmpty(SiteMarkerName)) { var portalViewContext = new PortalViewContext( new PortalContextDataAdapterDependencies( PortalCrmConfigurationManager.CreatePortalContext(PortalName), PortalName, Context.Request.RequestContext)); var target = portalViewContext.SiteMarkers.Select(SiteMarkerName); if (target != null) { NavigateUrl = new UrlBuilder(target.Url); if (string.IsNullOrEmpty(Text) && Controls.Count == 0) { var contentFormatter = PortalCrmConfigurationManager.CreateDependencyProvider(PortalName).GetDependency <ICrmEntityContentFormatter>(GetType().FullName) ?? new PassthroughCrmEntityContentFormatter(); Text = contentFormatter.Format(target.Entity.GetAttributeValue <string>("adx_name"), target.Entity, this); } } else if (AutoHiddenIfAbsent ?? true) { Visible = false; } } if (!string.IsNullOrEmpty(QueryString)) { // we need to append these querystring parameters if (!NavigateUrl.Contains("?")) { NavigateUrl += "?"; } if (!NavigateUrl.EndsWith("?")) { NavigateUrl += "&"; } NavigateUrl += QueryString; } }
protected override void OnPreRender(EventArgs args) { if (!string.IsNullOrEmpty(SiteMarkerName)) { var portal = PortalCrmConfigurationManager.CreatePortalContext(PortalName); var context = portal.ServiceContext; var website = portal.Website; var page = context.GetPageBySiteMarkerName(website, SiteMarkerName); if (page != null) { page.AssertEntityName("adx_webpage"); NavigateUrl = portal.ServiceContext.GetUrl(page); if (string.IsNullOrEmpty(Text) && Controls.Count == 0) { var contentFormatter = PortalCrmConfigurationManager.CreateDependencyProvider(PortalName).GetDependency <ICrmEntityContentFormatter>(GetType().FullName) ?? new PassthroughCrmEntityContentFormatter(); Text = contentFormatter.Format(page.GetAttributeValue <string>("adx_name"), page, this); } } } if (!string.IsNullOrEmpty(QueryString)) { // we need to append these querystring parameters if (!NavigateUrl.Contains("?")) { NavigateUrl += "?"; } if (!NavigateUrl.EndsWith("?")) { NavigateUrl += "&"; } NavigateUrl += QueryString; } }
protected override void Render(HtmlTextWriter writer) { if (NavigateUrl.IsEmpty()) { base.Render(writer); return; } var output = new StringBuilder(); base.Render(new HtmlTextWriter(new StringWriter(output))); var url = Page.ResolveUrl(NavigateUrl); output = output .Replace("<input type=\"image\" ", "<a href=\"{0}\"{1}>".FormatWith(url, Target.WithPrefix(" target=\"").WithSuffix("\"")) + "<img style=\"border=0px;\" ") .Append("</a>"); writer.Write(output.ToString()); }