protected override void OnOK(object sender, EventArgs args) { Assert.ArgumentNotNull(sender, "sender"); Assert.ArgumentNotNull(args, "args"); string path = this.GetPath(); string attributeFromValue = LinkForm.GetLinkTargetAttributeFromValue(this.Target.Value, this.CustomTarget.Value); Packet packet = new Packet("link"); LinkForm.SetAttribute(packet, "text", this.Text); LinkForm.SetAttribute(packet, "linktype", "external"); LinkForm.SetAttribute(packet, "url", path); LinkForm.SetAttribute(packet, "anchor", string.Empty); LinkForm.SetAttribute(packet, "title", this.Title); LinkForm.SetAttribute(packet, "class", this.Class); LinkForm.SetAttribute(packet, "target", attributeFromValue); this.TrimComboboxControl(this.Goal); LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalTriggerAttName, this.TriggerGoal); LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalAttributeName, this.Goal); LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalDataAttName, this.GoalData); this.TrimComboboxControl(this.PageEvent); LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventTriggerAttName, this.TriggerPageEvent); LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventAttributeName, this.PageEvent); LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventDataAttName, this.PageEventData); SheerResponse.SetDialogValue(packet.OuterXml); SheerResponse.CloseWindow(); }
private bool SetInternalLinkAttributes(Packet packet) { Assert.ArgumentNotNull((object)packet, nameof(packet)); Item selectionItem = this.InternalLinkTreeview.GetSelectionItem(); if (selectionItem == null) { Context.ClientPage.ClientResponse.Alert("Select an item."); return(false); } string attributeFromValue = LinkForm.GetLinkTargetAttributeFromValue(this.Target.Value, this.CustomTarget.Value); string str = this.Querystring.Value; if (str.StartsWith("?", StringComparison.InvariantCulture)) { str = str.Substring(1); } LinkForm.SetAttribute(packet, Attributes.anchor, (Sitecore.Web.UI.HtmlControls.Control) this.LinkAnchor); LinkForm.SetAttribute(packet, Attributes.querystring, str); LinkForm.SetAttribute(packet, Attributes.target, attributeFromValue); LinkForm.SetAttribute(packet, Attributes.id, selectionItem.ID.ToString()); this.TrimComboboxControl(this.GoalId); LinkForm.SetAttribute(packet, Attributes.goalid, this.GoalId); this.TrimComboboxControl(this.EventId); LinkForm.SetAttribute(packet, Attributes.eventid, this.EventId); return(true); }
private void SetCommonAttributes(Packet packet) { Assert.ArgumentNotNull((object)packet, nameof(packet)); LinkForm.SetAttribute(packet, Attributes.linktype, this.CurrentMode); LinkForm.SetAttribute(packet, Attributes.text, (Sitecore.Web.UI.HtmlControls.Control) this.Text); LinkForm.SetAttribute(packet, Attributes.title, (Sitecore.Web.UI.HtmlControls.Control) this.Title); LinkForm.SetAttribute(packet, Attributes._class, (Sitecore.Web.UI.HtmlControls.Control) this.Class); }
protected override void OnOK(object sender, EventArgs args) { // Sitecore Assert.ArgumentNotNull(sender, "sender"); Assert.ArgumentNotNull(args, "args"); Item selectionItem = this.Treeview.GetSelectionItem(); if (selectionItem == null) { Context.ClientPage.ClientResponse.Alert("Select an item."); return; } string linkTargetAttributeFromValue = LinkForm.GetLinkTargetAttributeFromValue(this.Target.Value, this.CustomTarget.Value); string value = this.Querystring.Value; if (value.StartsWith("?", StringComparison.InvariantCulture)) { value = value.Substring(1); } Packet packet = new Packet("link", Array.Empty <string>()); LinkForm.SetAttribute(packet, "text", this.Text); LinkForm.SetAttribute(packet, "linktype", "internal"); LinkForm.SetAttribute(packet, "anchor", this.Anchor); LinkForm.SetAttribute(packet, "querystring", this.Anchor); LinkForm.SetAttribute(packet, "title", this.Title); LinkForm.SetAttribute(packet, "class", this.Class); LinkForm.SetAttribute(packet, "querystring", value); LinkForm.SetAttribute(packet, "target", linkTargetAttributeFromValue); LinkForm.SetAttribute(packet, "id", selectionItem.ID.ToString()); Assert.IsTrue((string.IsNullOrEmpty(selectionItem.ID.ToString()) ? false : ID.IsID(selectionItem.ID.ToString())), "ID doesn't exist."); // Custom this.TrimComboboxControl(this.Goal); //LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalTriggerAttName, this.TriggerGoal); LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalAttributeName, this.Goal); //LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalDataAttName, this.GoalData); this.TrimComboboxControl(this.PageEvent); //LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventTriggerAttName, this.TriggerPageEvent); LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventAttributeName, this.PageEvent); //LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventDataAttName, this.PageEventData); //this.TrimComboboxControl(this.Campaign); //LinkForm.SetAttribute(packet, LinkTrackerConstants.CampaignTriggerAttName, this.TriggerCampaign); //LinkForm.SetAttribute(packet, LinkTrackerConstants.CampaignAttributeName, this.Campaign); //LinkForm.SetAttribute(packet, LinkTrackerConstants.CampaignDataAttName, this.CampaignData); // Sitecore Context.ClientPage.ClientResponse.SetDialogValue(packet.OuterXml); SheerResponse.CloseWindow(); }
private bool SetJavascriptLinkAttributes(Packet packet) { Assert.ArgumentNotNull((object)packet, nameof(packet)); string str = this.JavascriptCode.Value; if (str.Length > 0 && str.IndexOf("javascript:", StringComparison.InvariantCulture) < 0) { str = "javascript:" + str; } LinkForm.SetAttribute(packet, Attributes.url, str); LinkForm.SetAttribute(packet, Attributes.anchor, string.Empty); return(true); }
private bool SetAnchorLinkAttributes(Packet packet) { Assert.ArgumentNotNull((object)packet, nameof(packet)); string str = this.LinkAnchor.Value; if (str.Length > 0 && str.StartsWith("#", StringComparison.InvariantCulture)) { str = str.Substring(1); } LinkForm.SetAttribute(packet, Attributes.url, str); LinkForm.SetAttribute(packet, Attributes.anchor, str); return(true); }
private bool SetMediaLinkAttributes(Packet packet) { Assert.ArgumentNotNull((object)packet, nameof(packet)); Item selectionItem = this.MediaLinkTreeview.GetSelectionItem(); if (selectionItem == null) { Context.ClientPage.ClientResponse.Alert("Select a media item."); return(false); } string attributeFromValue = LinkForm.GetLinkTargetAttributeFromValue(this.Target.Value, this.CustomTarget.Value); LinkForm.SetAttribute(packet, Attributes.target, attributeFromValue); LinkForm.SetAttribute(packet, Attributes.id, selectionItem.ID.ToString()); return(true); }
private bool SetMailToLinkAttributes(Packet packet) { Assert.ArgumentNotNull((object)packet, nameof(packet)); string str = this.MailToLink.Value; string email = StringUtil.GetLastPart(str, ':', str); if (!EmailUtility.IsValidEmailAddress(email)) { SheerResponse.Alert("The e-mail address is invalid.", (string[])Array.Empty <string>()); return(false); } if (!string.IsNullOrEmpty(email)) { email = "mailto:" + email; } LinkForm.SetAttribute(packet, Attributes.url, email ?? string.Empty); LinkForm.SetAttribute(packet, Attributes.anchor, string.Empty); return(true); }
protected override void OnOK(object sender, EventArgs args) { // Sitecore Assert.ArgumentNotNull(sender, "sender"); Assert.ArgumentNotNull(args, "args"); Item selectionItem = this.MediaLinkTreeview.GetSelectionItem(); if (selectionItem == null) { Context.ClientPage.ClientResponse.Alert("Select a media item."); return; } string mediaPath = selectionItem.Paths.MediaPath; string linkTargetAttributeFromValue = LinkForm.GetLinkTargetAttributeFromValue(this.Target.Value, this.CustomTarget.Value); Packet packet = new Packet("link", Array.Empty <string>()); LinkForm.SetAttribute(packet, "text", this.Text); LinkForm.SetAttribute(packet, "linktype", "media"); LinkForm.SetAttribute(packet, "title", this.Title); LinkForm.SetAttribute(packet, "class", this.Class); LinkForm.SetAttribute(packet, "target", linkTargetAttributeFromValue); LinkForm.SetAttribute(packet, "id", selectionItem.ID.ToString()); // Custom this.TrimComboboxControl(this.Goal); //LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalTriggerAttName, this.TriggerGoal); LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalAttributeName, this.Goal); //LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalDataAttName, this.GoalData); this.TrimComboboxControl(this.PageEvent); //LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventTriggerAttName, this.TriggerPageEvent); LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventAttributeName, this.PageEvent); //LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventDataAttName, this.PageEventData); //this.TrimComboboxControl(this.Campaign); //LinkForm.SetAttribute(packet, LinkTrackerConstants.CampaignTriggerAttName, this.TriggerCampaign); //LinkForm.SetAttribute(packet, LinkTrackerConstants.CampaignAttributeName, this.Campaign); //LinkForm.SetAttribute(packet, LinkTrackerConstants.CampaignDataAttName, this.CampaignData); // Sitecore SheerResponse.SetDialogValue(packet.OuterXml); SheerResponse.CloseWindow(); }
/// <summary> /// Handles a click on the OK button. /// </summary> /// <param name="sender"> /// </param> /// <param name="args"> /// </param> /// <remarks> /// When the user clicks OK, the dialog is closed by calling /// the <see cref="M:Sitecore.Web.UI.Sheer.ClientResponse.CloseWindow">CloseWindow</see> method. /// </remarks> protected override void OnOK(object sender, EventArgs args) { Assert.ArgumentNotNull(sender, "sender"); Assert.ArgumentNotNull(args, "args"); string path = this.GetPath(); string linkTargetAttributeFromValue = LinkForm.GetLinkTargetAttributeFromValue(this.Target.Value, this.CustomTarget.Value); Packet packet = new Packet("link", Array.Empty <string>()); LinkForm.SetAttribute(packet, "text", this.Text); LinkForm.SetAttribute(packet, "linktype", "external"); LinkForm.SetAttribute(packet, "url", path); LinkForm.SetAttribute(packet, "anchor", string.Empty); LinkForm.SetAttribute(packet, "title", this.Title); LinkForm.SetAttribute(packet, "class", this.Class); LinkForm.SetAttribute(packet, "customattributes", this.CustomAttributes); LinkForm.SetAttribute(packet, "target", linkTargetAttributeFromValue); Context.ClientPage.ClientResponse.SetDialogValue(packet.OuterXml); base.OnOK(sender, args); }
protected override void OnOK(object sender, EventArgs args) { // Sitecore Assert.ArgumentNotNull(sender, "sender"); Assert.ArgumentNotNull(args, "args"); string mail = this.GetMail(); if (mail == "__Canceled") { SheerResponse.Alert("The e-mail address is invalid.", Array.Empty <string>()); return; } Packet packet = new Packet("link", Array.Empty <string>()); LinkForm.SetAttribute(packet, "text", this.Text); LinkForm.SetAttribute(packet, "linktype", "mailto"); LinkForm.SetAttribute(packet, "url", mail); LinkForm.SetAttribute(packet, "anchor", string.Empty); LinkForm.SetAttribute(packet, "title", this.Title); LinkForm.SetAttribute(packet, "class", this.Class); // Custom this.TrimComboboxControl(this.Goal); //LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalTriggerAttName, this.TriggerGoal); LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalAttributeName, this.Goal); //LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalDataAttName, this.GoalData); this.TrimComboboxControl(this.PageEvent); //LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventTriggerAttName, this.TriggerPageEvent); LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventAttributeName, this.PageEvent); //LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventDataAttName, this.PageEventData); //this.TrimComboboxControl(this.Campaign); //LinkForm.SetAttribute(packet, LinkTrackerConstants.CampaignTriggerAttName, this.TriggerCampaign); //LinkForm.SetAttribute(packet, LinkTrackerConstants.CampaignAttributeName, this.Campaign); //LinkForm.SetAttribute(packet, LinkTrackerConstants.CampaignDataAttName, this.CampaignData); // Sitecore SheerResponse.SetDialogValue(packet.OuterXml); SheerResponse.CloseWindow(); }
protected override void OnOK(object sender, EventArgs args) { // Sitecore Assert.ArgumentNotNull(sender, "sender"); Assert.ArgumentNotNull(args, "args"); string value = this.Url.Value; if (value.Length > 0 && value.StartsWith("#", StringComparison.InvariantCulture)) { value = value.Substring(1); } Packet packet = new Packet("link", Array.Empty <string>()); LinkForm.SetAttribute(packet, "text", this.Text); LinkForm.SetAttribute(packet, "linktype", "anchor"); LinkForm.SetAttribute(packet, "url", value); LinkForm.SetAttribute(packet, "anchor", value); LinkForm.SetAttribute(packet, "title", this.Title); LinkForm.SetAttribute(packet, "class", this.Class); // Custom this.TrimComboboxControl(this.Goal); //LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalTriggerAttName, this.TriggerGoal); LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalAttributeName, this.Goal); //LinkForm.SetAttribute(packet, LinkTrackerConstants.GoalDataAttName, this.GoalData); this.TrimComboboxControl(this.PageEvent); //LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventTriggerAttName, this.TriggerPageEvent); LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventAttributeName, this.PageEvent); //LinkForm.SetAttribute(packet, LinkTrackerConstants.PageEventDataAttName, this.PageEventData); //this.TrimComboboxControl(this.Campaign); //LinkForm.SetAttribute(packet, LinkTrackerConstants.CampaignTriggerAttName, this.TriggerCampaign); //LinkForm.SetAttribute(packet, LinkTrackerConstants.CampaignAttributeName, this.Campaign); //LinkForm.SetAttribute(packet, LinkTrackerConstants.CampaignDataAttName, this.CampaignData); // Sitecore Context.ClientPage.ClientResponse.SetDialogValue(packet.OuterXml); SheerResponse.CloseWindow(); }
protected override void OnOK(object sender, EventArgs args) { Assert.ArgumentNotNull(sender, "sender"); Assert.ArgumentNotNull(args, "args"); string path = GetPath(); string attributeFromValue = LinkForm.GetLinkTargetAttributeFromValue(Target.Value, CustomTarget.Value); Packet packet = new Packet("link", new string[0]); LinkForm.SetAttribute(packet, "text", (Control)Text); LinkForm.SetAttribute(packet, "linktype", "external"); LinkForm.SetAttribute(packet, "url", path); LinkForm.SetAttribute(packet, "anchor", string.Empty); LinkForm.SetAttribute(packet, "title", (Control)Title); LinkForm.SetAttribute(packet, "class", (Control)Class); LinkForm.SetAttribute(packet, "target", attributeFromValue); TrimComboboxControl(Campaign); LinkForm.SetAttribute(packet, CampaignTriggerAttName, (Control)TriggerCampaign); LinkForm.SetAttribute(packet, CampaignAttributeName, (Control)Campaign); SheerResponse.SetDialogValue(packet.OuterXml); SheerResponse.CloseWindow(); }
private bool SetExternalLinkAttributes(Packet packet) { Assert.ArgumentNotNull((object)packet, nameof(packet)); string str = this.Url.Value; if (str.Length > 0 && str.IndexOf("://", StringComparison.InvariantCulture) < 0 && !str.StartsWith("/", StringComparison.InvariantCulture)) { str = "http://" + str; } string attributeFromValue = LinkForm.GetLinkTargetAttributeFromValue(this.Target.Value, this.CustomTarget.Value); LinkForm.SetAttribute(packet, Attributes.url, str); LinkForm.SetAttribute(packet, Attributes.anchor, string.Empty); LinkForm.SetAttribute(packet, Attributes.target, attributeFromValue); this.TrimComboboxControl(this.GoalId); LinkForm.SetAttribute(packet, Attributes.goalid, this.GoalId); this.TrimComboboxControl(this.EventId); LinkForm.SetAttribute(packet, Attributes.eventid, this.EventId); return(true); }