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);
        }
Beispiel #2
0
        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();
        }
        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 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);
        }
Beispiel #5
0
        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();
        }
Beispiel #6
0
        /// <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);
        }
Beispiel #7
0
        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);
        }