/// <summary> /// The init controls. /// </summary> private void InitControls() { string value = string.Empty; string text = this.LinkAttributes["target"]; string linkTargetValue = UltraLinkForm.GetLinkTargetValue(text); if (linkTargetValue == "Custom") { value = text; CustomTarget.Disabled = false; Custom.Class = string.Empty; } else { CustomTarget.Disabled = true; Custom.Class = "disabled"; } Text.Value = this.LinkAttributes["text"]; Target.Value = linkTargetValue; CustomTarget.Value = value; Class.Value = this.LinkAttributes["class"]; InitMediaLinkDataContext(); InitInternalLinkDataContext(); }
/// <summary> /// The set common attributes. /// </summary> /// <param name="packet">The packet.</param> private void SetCommonAttributes(Packet packet) { Assert.ArgumentNotNull(packet, "packet"); UltraLinkForm.SetAttribute(packet, "linktype", CurrentMode); UltraLinkForm.SetAttribute(packet, "text", Text); UltraLinkForm.SetAttribute(packet, "title", Title); UltraLinkForm.SetAttribute(packet, "class", Class); }
protected static void SetAttribute(Packet packet, string name, Control control) { Assert.ArgumentNotNull((object)packet, nameof(packet)); Assert.ArgumentNotNull((object)name, nameof(name)); Assert.ArgumentNotNull((object)control, nameof(control)); if (control.Value.Length <= 0) { return; } UltraLinkForm.SetAttribute(packet, name, control.Value); }
/// <summary> /// The set javascript link attributes. /// </summary> /// <param name="packet">The packet.</param> /// <returns>The set javascript link attributes.</returns> private bool SetJavascriptLinkAttributes(Packet packet) { Assert.ArgumentNotNull(packet, "packet"); string text = JavascriptCode.Value; if (text.Length > 0 && text.IndexOf("javascript:", StringComparison.InvariantCulture) < 0) { text = "javascript:" + text; } UltraLinkForm.SetAttribute(packet, "url", text); UltraLinkForm.SetAttribute(packet, "anchor", string.Empty); return(true); }
/// <summary> /// The set anchor link attributes. /// </summary> /// <param name="packet">The packet.</param> /// <returns>The set anchor link attributes.</returns> private bool SetAnchorLinkAttributes(Packet packet) { Assert.ArgumentNotNull(packet, "packet"); string text = LinkAnchor.Value; if (text.Length > 0 && text.StartsWith("#", StringComparison.InvariantCulture)) { text = text.Substring(1); } UltraLinkForm.SetAttribute(packet, "url", text); UltraLinkForm.SetAttribute(packet, "anchor", text); return(true); }
/// <summary> /// The set media link attributes. /// </summary> /// <param name="packet">The packet.</param> /// <returns>The set media link attributes.</returns> private bool SetMediaLinkAttributes(Packet packet) { Assert.ArgumentNotNull(packet, "packet"); Item selectionItem = MediaLinkTreeview.GetSelectionItem(); if (selectionItem == null) { Context.ClientPage.ClientResponse.Alert("Select a media item."); return(false); } string linkTargetAttributeFromValue = UltraLinkForm.GetLinkTargetAttributeFromValue(Target.Value, CustomTarget.Value); UltraLinkForm.SetAttribute(packet, "target", linkTargetAttributeFromValue); UltraLinkForm.SetAttribute(packet, "id", selectionItem.ID.ToString()); return(true); }
/// <summary> /// The set external link attributes. /// </summary> /// <param name="packet">The packet.</param> /// <returns>The set external link attributes.</returns> private bool SetExternalLinkAttributes(Packet packet) { Assert.ArgumentNotNull(packet, "packet"); string text = Url.Value; if (text.Length > 0 && text.IndexOf("://", StringComparison.InvariantCulture) < 0 && !text.StartsWith("/", StringComparison.InvariantCulture)) { text = "http://" + text; } string linkTargetAttributeFromValue = UltraLinkForm.GetLinkTargetAttributeFromValue(Target.Value, CustomTarget.Value); UltraLinkForm.SetAttribute(packet, "url", text); UltraLinkForm.SetAttribute(packet, "anchor", string.Empty); UltraLinkForm.SetAttribute(packet, "target", linkTargetAttributeFromValue); return(true); }
/// <summary> /// The set mail to link attributes. /// </summary> /// <param name="packet">The packet.</param> /// <returns>The set mail to link attributes.</returns> private bool SetMailToLinkAttributes(Packet packet) { Assert.ArgumentNotNull(packet, "packet"); string value = MailToLink.Value; value = StringUtil.GetLastPart(value, ':', value); if (!EmailUtility.IsValidEmailAddress(value)) { SheerResponse.Alert("The e-mail address is invalid."); return(false); } if (!string.IsNullOrEmpty(value)) { value = "mailto:" + value; } UltraLinkForm.SetAttribute(packet, "url", value ?? string.Empty); UltraLinkForm.SetAttribute(packet, "anchor", string.Empty); return(true); }
/// <summary> /// The set internal link attributes. /// </summary> /// <param name="packet">The packet.</param> /// <returns>The set internal link attributes.</returns> private bool SetInternalLinkAttributes(Packet packet) { Assert.ArgumentNotNull(packet, "packet"); Item selectionItem = InternalLinkTreeview.GetSelectionItem(); if (selectionItem == null) { Context.ClientPage.ClientResponse.Alert("Select an item."); return(false); } string linkTargetAttributeFromValue = UltraLinkForm.GetLinkTargetAttributeFromValue(Target.Value, CustomTarget.Value); string text = Querystring.Value; if (text.StartsWith("?", StringComparison.InvariantCulture)) { text = text.Substring(1); } UltraLinkForm.SetAttribute(packet, "anchor", LinkAnchor); UltraLinkForm.SetAttribute(packet, "querystring", text); UltraLinkForm.SetAttribute(packet, "target", linkTargetAttributeFromValue); UltraLinkForm.SetAttribute(packet, "id", selectionItem.ID.ToString()); return(true); }