Exemple #1
0
        public void CanAppend_KeyValuePair_ToEmptyQueryString()
        {
            Url u = "/";

            u = u.AppendQuery("key=value");
            Assert.That(u.Query, Is.EqualTo("key=value"));
        }
Exemple #2
0
        protected void OnPreviewCommand(object sender, CommandEventArgs e)
        {
            var ctx = ie.CreateCommandContext();

            Commands.Save(ctx);

            Url previewUrl = Engine.GetContentAdapter <NodeAdapter>(ctx.Content).GetPreviewUrl(ctx.Content);

            previewUrl = previewUrl.AppendQuery("preview", ctx.Content.ID);
            if (ctx.Content.VersionOf.HasValue)
            {
                previewUrl = previewUrl.AppendQuery("original", ctx.Content.VersionOf.ID);
            }

            HandleResult(ctx, previewUrl);
        }
Exemple #3
0
        public void CanAppend_KeyValuePair_ToExistingQueryString()
        {
            Url u = "/?somekey=somevalue";

            u = u.AppendQuery("key=value");
            Assert.AreEqual("somekey=somevalue&key=value", u.Query);
        }
Exemple #4
0
        public void CanAppend_KeyValuePair_ToExistingQueryString()
        {
            Url u = "/?somekey=somevalue";

            u = u.AppendQuery("key=value");
            Assert.That(u.Query, Is.EqualTo("somekey=somevalue&key=value"));
        }
Exemple #5
0
        public void CanAppend_KeyValuePair_ToEmptyQueryString()
        {
            Url u = "/";

            u = u.AppendQuery("key=value");
            Assert.AreEqual("key=value", u.Query);
        }
Exemple #6
0
        public void AppendedValue_IsUrlEncoded()
        {
            Url u = "/";

            u = u.AppendQuery("key", "cristian & maria");
            Assert.That(u.Query, Is.EqualTo("key=cristian+%26+maria"));
        }
        public override Control AddTo(Control container, PluginContext context)
        {
            if (RequireCurrentItem && context.Selected == null)
            {
                return(null);
            }
            if (!ActiveFor(container, context.State))
            {
                return(null);
            }

            HyperLink link    = new HyperLink();
            string    tooltip = Utility.GetResourceString(GlobalResourceClassName, Name + ".ToolTip") ?? ToolTip;
            string    title   = Utility.GetResourceString(GlobalResourceClassName, Name + ".Title") ?? Title;

            link.Text = GetInnerHtml(context, IconUrl, tooltip, title);
            Url url = context.Rebase(context.Format(NavigateUrl, UrlEncode));

            if (!string.IsNullOrEmpty(NavigateQuery))
            {
                url = url.AppendQuery(context.Format(NavigateQuery, UrlEncode));
            }
            link.NavigateUrl = url;
            link.ToolTip     = context.Format(tooltip, false);
            link.CssClass    = Name + " authorized" + context.Engine.SecurityManager.IsAuthorized(this, context.HttpContext.User, context.Selected);

            AddTargetAttribute(link);

            container.Controls.Add(link);

            return(link);
        }
        void securityEnforcer_AuthorizationFailed(object sender, CancellableItemEventArgs e)
        {
            var url = new Url("{ManagementUrl}/Login.aspx").ResolveTokens();

            url.AppendQuery("returnUrl", _context.Url.LocalUrl);
            _context.HttpContext.Response.Redirect(url);
        }
Exemple #9
0
        public void AppendedValue_IsUrlEncoded()
        {
            Url u = "/";

            u = u.AppendQuery("key", "cristian & maria");
            Assert.AreEqual("key=cristian+%26+maria", u.Query);
        }
Exemple #10
0
        public void CanAppend_KeyAndValue_ToEmpyQueryString()
        {
            Url u = "/";

            u = u.AppendQuery("key", "value");
            Assert.AreEqual("key=value", u.Query);
        }
Exemple #11
0
        protected string GetNewDataItemUrl(object dataItem)
        {
            N2.Integrity.AvailableZoneAttribute a = (N2.Integrity.AvailableZoneAttribute)dataItem;

            Url newUrl = Engine.ManagementPaths.GetSelectNewItemUrl(CurrentItem, a.ZoneName);

            return(newUrl.AppendQuery("returnUrl", Request.RawUrl));
        }
        void cEvents_SelectionChanged(object sender, EventArgs e)
        {
            DateTime date = cEvents.SelectedDate.Date;

            if (CurrentItem.Container != null)
            {
                IList <Event> events = CurrentItem.Container.GetEvents(date);
                if (events.Count == 1)
                {
                    Response.Redirect(events[0].Url);
                }

                Url url = CurrentItem.Container.Url;
                url = url.AppendQuery("date", date);
                url = url.AppendQuery("filter", "true");
                Response.Redirect(url);
            }
        }
Exemple #13
0
        protected virtual Url GetNavigateUrl(PluginContext context)
        {
            Url url = context.Rebase(context.Format(NavigateUrl, UrlEncode));

            if (!string.IsNullOrEmpty(NavigateQuery))
            {
                url = url.AppendQuery(context.Format(NavigateQuery, UrlEncode));
            }
            return(url);
        }
Exemple #14
0
 protected void OnSaveFuturePublishCommand(object sender, CommandEventArgs e)
 {
     Validate();
     if (IsValid)
     {
         ContentItem savedVersion = SaveVersionForFuturePublishing();
         Url         redirectUrl  = ManagementPaths.GetEditExistingItemUrl(savedVersion);
         Response.Redirect(redirectUrl.AppendQuery("refresh=true"));
     }
 }
Exemple #15
0
        private static string FormatSelectedUrl(ContentItem selectedItem, string path)
        {
            Url url = Url.ResolveTokens(path);

            if (selectedItem != null)
            {
                url = url.AppendQuery(SelectionUtility.SelectedQueryKey + "=" + selectedItem.Path);
            }
            return(url);
        }
        public override Control AddTo(Control container, PluginContext context)
        {
            var selector = context.Engine.Resolve <LanguageGatewaySelector>();

            if (!selector.Enabled || selector.LanguagesPerSite /*avoid showing options that might not be relevant */)
            {
                return(null);
            }

            ILanguageGateway gateway = selector.GetAllLanguages();

            HtmlGenericControl div = new HtmlGenericControl("div");

            div.Attributes["class"] = "languages";
            container.Controls.Add(div);

            base.AddTo(div, context);

            foreach (ILanguage language in gateway.GetAvailableLanguages())
            {
                Url url = Engine.ManagementPaths.ResolveResourceUrl("{ManagementUrl}/Content/Globalization/Translate.aspx");
                url = url.AppendQuery("language", language.LanguageCode);
                url = url.AppendQuery(SelectionUtility.SelectedQueryKey + "={selected}");

                HyperLink h = new HyperLink();
                h.ID          = language.LanguageCode.Replace('-', '_').Replace(' ', '_');
                h.Target      = Targets.Preview;
                h.NavigateUrl = context.Rebase(context.Format(url, true));
                h.CssClass    = "templatedurl language";
                h.ToolTip     = language.LanguageTitle;

                // [bherila] use CSS sprite instead of flag image here
                //h.Text = string.Format("<img src='{0}' alt=''/>", Url.ToAbsolute(language.FlagUrl));
                string[] parts = language.LanguageCode.Split('-');
                h.Text = string.Format(@"<span class=""{0} sprite""></span>", parts.LastOrDefault().ToLower());

                h.Attributes["data-url-template"] = context.Rebase(url);
                div.Controls.Add(h);
            }

            return(div);
        }
Exemple #17
0
        private string GetRedirectUrl(NameValueCollection request)
        {
            ContentItem item = navigator.Navigate(request[PathData.ItemQueryKey]);
            Url         url  = editUrlManager.GetEditExistingItemUrl(item);

            if (!string.IsNullOrEmpty(request["returnUrl"]))
            {
                url = url.AppendQuery("returnUrl", request["returnUrl"]);
            }
            return(url);
        }
        public IEnumerable <TranslateSpecification> GetEditTranslations(ContentItem item, bool includeCurrent, bool generateNonTranslated)
        {
            ILanguage itemlanguage = GetLanguage(item);

            if (itemlanguage == null)
            {
                yield break;
            }

            IEnumerable <ContentItem> translations = FindTranslations(item);
            IEnumerable <ILanguage>   languages    = GetAvailableLanguages();

            var itemSite = host.GetSite(item);

            foreach (ILanguage language in languages)
            {
                if (language != itemlanguage || includeCurrent)
                {
                    ContentItem translation = GetTranslation(translations, language);
                    if (translation == null && language == itemlanguage)
                    {
                        translation = item;
                    }

                    ItemDefinition definition = definitions.GetDefinition(item);
                    if (translation != null)
                    {
                        string url = editUrlManager.GetEditExistingItemUrl(translation);
                        yield return(new TranslateSpecification(url, language, translation, definition, host.GetSite(translation)));
                    }
                    else
                    {
                        ContentItem translatedParent = GetTranslatedParent(item, language);

                        if (translatedParent == null)
                        {
                            if (generateNonTranslated)
                            {
                                yield return(new TranslateSpecification("#", language, translation, definition, host.GetSite(language as ContentItem))
                                {
                                    IsTranslatable = false
                                });
                            }
                            continue;
                        }

                        Url url = editUrlManager.GetEditNewPageUrl(translatedParent, definition, item.ZoneName, CreationPosition.Below);
                        url = url.AppendQuery(TranslationKey, item.TranslationKey ?? item.ID);

                        yield return(new TranslateSpecification(url, language, translation, definition, host.GetSite(translatedParent)));
                    }
                }
            }
        }
        public override void RenderBeginTag(System.Web.UI.HtmlTextWriter writer)
        {
            Url url = GetResizedImageUrl(ImageUrl, MaxWidth, MaxHeight);

            if (!string.IsNullOrEmpty(Hash))
            {
                url = url.AppendQuery("hash", Hash);
            }
            writer.AddAttribute("src", url);
            base.RenderBeginTag(writer);
        }
        public override Control AddTo(Control container, PluginContext context)
        {
            if (!ActiveFor(container, context.State))
            {
                return(null);
            }
            if (context.Selected == null)
            {
                return(null);
            }
            if (context.Selected.VersionOf != null)
            {
                return(null);
            }

            IEngine     engine        = Context.Current;
            ContentItem latestVersion = engine.Resolve <IVersionManager>().GetVersionsOf(context.Selected, 1)[0];

            if (latestVersion == context.Selected)
            {
                return(null);
            }

            Url versionPreviewUrl = engine.GetContentAdapter <NodeAdapter>(latestVersion).GetPreviewUrl(latestVersion);

            versionPreviewUrl = versionPreviewUrl.AppendQuery("preview", latestVersion.ID);
            versionPreviewUrl = versionPreviewUrl.AppendQuery("original", context.Selected.ID);
            versionPreviewUrl = versionPreviewUrl.AppendQuery("returnUrl=" + engine.GetContentAdapter <NodeAdapter>(context.Selected).GetPreviewUrl(context.Selected));

            HyperLink hl = new HyperLink();

            hl.NavigateUrl = versionPreviewUrl;
            hl.Text        = GetInnerHtml(context, IconUrl, ToolTip, Title);
            hl.CssClass    = "preview";
            hl.ToolTip     = Utility.GetResourceString(GlobalResourceClassName, Name + ".ToolTip") ?? context.Format(ToolTip, false);
            container.Controls.Add(hl);

            return(hl);
        }
Exemple #21
0
        protected void OnPreviewCommand(object sender, CommandEventArgs e)
        {
            var ctx = ie.CreateCommandContext();

            Commands.Save(ctx);

            string returnUrl = Request["returnUrl"];

            if (!string.IsNullOrEmpty(returnUrl))
            {
                returnUrl = Url.Parse(returnUrl).AppendQuery("preview", ctx.Content.ID);
            }

            Url previewUrl = Engine.GetContentAdapter <NodeAdapter>(ctx.Content).GetPreviewUrl(ctx.Content);

            previewUrl = previewUrl.AppendQuery("preview", ctx.Content.ID);
            if (ctx.Content.VersionOf != null)
            {
                previewUrl = previewUrl.AppendQuery("original", ctx.Content.VersionOf.ID);
            }

            HandleResult(ctx, returnUrl, previewUrl);
        }
Exemple #22
0
        protected void OnPreviewCommand(object sender, CommandEventArgs e)
        {
            var ctx = new CommandContext(ie.GetDefinition(), ie.CurrentItem, Interfaces.Editing, User, ie, new PageValidator <CommandContext>(Page));

            Commands.Save(ctx);

            string returnUrl = Request["returnUrl"];

            if (!string.IsNullOrEmpty(returnUrl))
            {
                returnUrl = Url.Parse(returnUrl).AppendQuery("preview", ctx.Content.ID);
            }

            Url previewUrl = Engine.GetContentAdapter <NodeAdapter>(ctx.Content).GetPreviewUrl(ctx.Content);

            previewUrl = previewUrl.AppendQuery("preview", ctx.Content.ID);
            if (ctx.Content.VersionOf != null)
            {
                previewUrl = previewUrl.AppendQuery("original", ctx.Content.VersionOf.ID);
            }

            HandleResult(ctx, returnUrl, previewUrl);
        }
        private static string FormatSelectedUrl(ContentItem selectedItem, string path)
        {
            Url url = Url.ResolveTokens(path);

            if (selectedItem != null)
            {
                if (selectedItem.ID == 0 && !selectedItem.VersionOf.HasValue && !selectedItem.IsPage)
                {
                    var page = Find.ClosestPage(selectedItem);
                    return(url.AppendQuery(SelectionUtility.SelectedQueryKey + "=" + page.Path)
                           .AppendQuery(PathData.VersionIndexQueryKey + "=" + page.VersionIndex)
                           .AppendQuery(PathData.VersionKeyQueryKey, selectedItem.GetVersionKey()));
                }

                url = url.AppendQuery(SelectionUtility.SelectedQueryKey + "=" + selectedItem.Path);
                if (selectedItem.VersionOf.HasValue)
                {
                    url = url.AppendQuery(PathData.VersionIndexQueryKey + "=" + selectedItem.VersionIndex)
                          .AppendQuery(PathData.VersionKeyQueryKey, selectedItem.GetVersionKey());
                }
            }
            return(url);
        }
Exemple #24
0
        public override Control AddTo(Control container, PluginContext context)
        {
            ILanguageGateway gateway = N2.Context.Current.Resolve <ILanguageGateway>();

            if (!gateway.Enabled)
            {
                return(null);
            }

            HtmlGenericControl div = new HtmlGenericControl("div");

            div.Attributes["class"] = "languages";
            container.Controls.Add(div);

            base.AddTo(div, context);

            foreach (ILanguage language in gateway.GetAvailableLanguages())
            {
                Url url = Engine.ManagementPaths.ResolveResourceUrl("{ManagementUrl}/Content/Globalization/Translate.aspx");
                url = url.AppendQuery("language", language.LanguageCode);
                url = url.AppendQuery("selected={selected}");

                HyperLink h = new HyperLink();
                h.ID          = language.LanguageCode.Replace('-', '_').Replace(' ', '_');
                h.Target      = Targets.Preview;
                h.NavigateUrl = context.Rebase(context.Format(url, true));
                h.CssClass    = "language";
                h.ToolTip     = language.LanguageTitle;
                h.Text        = string.Format("<img src='{0}' alt=''/>", Url.ToAbsolute(language.FlagUrl));
                div.Controls.Add(h);

                RegisterToolbarUrl(container, h.ClientID, url);
            }

            return(div);
        }
Exemple #25
0
        protected void OnSaveUnpublishedCommand(object sender, CommandEventArgs e)
        {
            var ctx = ie.CreateCommandContext();

            Commands.Save(ctx);

            Url redirectTo = ManagementPaths.GetEditExistingItemUrl(ctx.Content);

            if (!string.IsNullOrEmpty(Request["returnUrl"]))
            {
                redirectTo = redirectTo.AppendQuery("returnUrl", Request["returnUrl"]);
            }

            HandleResult(ctx, redirectTo);
        }
        /// <summary>Gets the url to edit page creating new items.</summary>
        /// <param name="selected">The selected item.</param>
        /// <param name="definition">The type of item to edit.</param>
        /// <param name="zoneName">The zone to add the item to.</param>
        /// <param name="position">The position relative to the selected item to add the item.</param>
        /// <returns>The url to the edit page.</returns>
        public virtual string GetEditNewPageUrl(ContentItem selected, ItemDefinition definition, string zoneName,
                                                CreationPosition position)
        {
            if (selected == null)
            {
                throw new ArgumentNullException("selected");
            }
            if (definition == null)
            {
                throw new ArgumentNullException("definition");
            }

            ContentItem parent = (position != CreationPosition.Below)
                                    ? selected.Parent
                                    : selected;

            if (selected == null)
            {
                throw new N2Exception("Cannot insert item before or after the root page.");
            }

            Url url = Url.ResolveTokens(EditItemUrl);

            url = url.AppendQuery(SelectionUtility.SelectedQueryKey, parent.Path);
            url = url.AppendQuery("discriminator", definition.Discriminator);
            if (!string.IsNullOrEmpty(zoneName))
            {
                url = url.AppendQuery("zoneName", zoneName);
            }
            if (!string.IsNullOrEmpty(definition.TemplateKey))
            {
                url = url.AppendQuery("template", definition.TemplateKey);
            }

            if (position == CreationPosition.Before)
            {
                url = url.AppendQuery("before", selected.Path);
            }
            else if (position == CreationPosition.After)
            {
                url = url.AppendQuery("after", selected.Path);
            }

            if (selected.VersionOf.HasValue)
            {
                url = url.AppendQuery(PathData.VersionIndexQueryKey, selected.VersionIndex)
                      .AppendQuery("VersionKey", selected.GetVersionKey());
            }

            return(url);
        }
Exemple #27
0
        protected void OnSaveUnpublishedCommand(object sender, CommandEventArgs e)
        {
            var ctx = new CommandContext(ie.GetDefinition(), ie.CurrentItem, Interfaces.Editing, User, ie, new PageValidator <CommandContext>(Page));

            Commands.Save(ctx);

            Url redirectTo = ManagementPaths.GetEditExistingItemUrl(ctx.Content);

            if (!string.IsNullOrEmpty(Request["returnUrl"]))
            {
                redirectTo = redirectTo.AppendQuery("returnUrl", Request["returnUrl"]);
            }

            HandleResult(ctx, redirectTo);
        }
Exemple #28
0
        protected void OnSaveFuturePublishCommand(object sender, CommandEventArgs e)
        {
            Validate();
            if (IsValid)
            {
                ContentItem savedVersion = SaveVersionForFuturePublishing();

                Engine.AddActivity(new ManagementActivity {
                    Operation = "FuturePublish", PerformedBy = User.Identity.Name, Path = ie.CurrentItem.Path, ID = ie.CurrentItem.ID
                });

                Url redirectUrl = ManagementPaths.GetEditExistingItemUrl(savedVersion);
                Response.Redirect(redirectUrl.AppendQuery("refresh=true"));
            }
        }
Exemple #29
0
        private VirtualPathData ResolveContentActionUrl(RequestContext requestContext, RouteValueDictionary values, ContentItem item)
        {
            const string controllerPlaceHolder = "---(CTRL)---";
            const string areaPlaceHolder       = "---(AREA)---";

            values[ControllerKey] = controllerPlaceHolder; // pass a placeholder we'll fill with the content path
            bool useAreas = innerRoute.DataTokens.ContainsKey("area");

            if (useAreas)
            {
                values[AreaKey] = areaPlaceHolder;
            }
            if (values.ContainsKey(ContentItemKey))
            {
                values.Remove(ContentItemKey);
            }

            VirtualPathData vpd = innerRoute.GetVirtualPath(requestContext, values);

            if (vpd == null)
            {
                return(null);
            }
            vpd.Route = this;
            vpd.DataTokens[PathData.PathKey] = new PathData(item);

            string relativeUrl = Url.ToRelative(item.Url);
            Url    actionUrl   = vpd.VirtualPath
                                 .Replace(controllerPlaceHolder, Url.PathPart(relativeUrl).TrimStart('~'));

            if (useAreas)
            {
                actionUrl = actionUrl.SetPath(actionUrl.Path.Replace(areaPlaceHolder + "/", ""));
            }

            foreach (var kvp in Url.ParseQueryString(Url.QueryPart(relativeUrl)))
            {
                if ("item".Equals(kvp.Key, StringComparison.InvariantCultureIgnoreCase))
                {
                    continue;
                }

                actionUrl = actionUrl.AppendQuery(kvp.Key, kvp.Value);
            }
            vpd.VirtualPath = actionUrl.PathAndQuery.TrimStart('/');
            return(vpd);
        }
Exemple #30
0
        protected override void OnInit(EventArgs e)
        {
            string languageCode = Request["language"];

            ILanguageGateway gateway  = Engine.Resolve <ILanguageGateway>();
            ILanguage        language = gateway.GetLanguage(languageCode);

            if (language != null)
            {
                ContentItem translation = gateway.GetTranslation(Selection.SelectedItem, language);
                if (translation != null)
                {
                    // item has a translation
                    string url = Engine.ManagementPaths.GetEditExistingItemUrl(translation);
                    Response.Redirect(url);
                }
                else if (Selection.SelectedItem.Parent != null)
                {
                    // item not translated, try to create translation
                    ContentItem parent            = Selection.SelectedItem.Parent;
                    ContentItem parentTranslation = gateway.GetTranslation(parent, language);
                    if (parentTranslation != null)
                    {
                        // create new translation below translated parent
                        ItemDefinition definition = Engine.Definitions.GetDefinition(Selection.SelectedItem.GetContentType());
                        Url            url        = Engine.ManagementPaths.GetEditNewPageUrl(parentTranslation, definition, null, CreationPosition.Below);
                        url = url.AppendQuery(LanguageGateway.LanguageKey, Selection.SelectedItem[LanguageGateway.LanguageKey] ?? Selection.SelectedItem.ID);
                        Response.Redirect(url);
                    }
                    else
                    {
                        // parent is not translated, cannot continue
                        cvCannotTranslate.IsValid = false;
                    }
                }
                else
                {
                    cvCannotTranslate.IsValid = false;
                }
            }
            else
            {
                throw new ArgumentException("Couldn't find any language for the with the language code: " + languageCode, "language");
            }

            base.OnInit(e);
        }
Exemple #31
0
 private static string FormatSelectedUrl(ContentItem selectedItem, string path)
 {
     Url url = new Url(path);
     if (selectedItem != null)
         url = url.AppendQuery("selected=" + selectedItem.Path);
     return url.ToString();
 }
Exemple #32
0
        protected string BuildUrlInternal(ContentItem item, string languageCode, out ContentItem startPage)
        {
            startPage = null;
            ContentItem current = item;
            Url url = new Url("/");

            // Walk the item's parent items to compute it's url
            do
            {
                if (IsStartPage(current))
                {
                    startPage = current;

                    if (item.VersionOf != null)
                        url = url.AppendQuery(PathData.PageQueryKey, item.ID);

                    // Prepend language identifier, if this is not the default language.
                    if (_languageManager.Enabled && !LanguageSelection.IsHostLanguageMatch(ContentLanguage.PreferredCulture.Name))
                    {
                        if (LanguageSelection.GetHostFromLanguage(ContentLanguage.PreferredCulture.Name) != _webContext.LocalUrl.Authority)
                            url = url.SetAuthority(LanguageSelection.GetHostFromLanguage(ContentLanguage.PreferredCulture.Name));
                        else if (!string.IsNullOrEmpty(languageCode))
                            url = url.PrependSegment(languageCode, true);
                    }

                    // we've reached the start page so we're done here
                    return VirtualPathUtility.ToAbsolute("~" + url.PathAndQuery);
                }

                url = url.PrependSegment(current.Name, current.Extension);

                current = current.GetParent(languageCode);
            } while (current != null);

            // If we didn't find the start page, it means the specified
            // item is not part of the current site.
            return "/?" + PathData.PageQueryKey + "=" + item.ID;
            //return item.FindPath(PathData.DefaultAction).RewrittenUrl;
        }
Exemple #33
0
        /// <summary>Gets the url to edit page creating new items.</summary>
        /// <param name="selected">The selected item.</param>
        /// <param name="definition">The type of item to edit.</param>
        /// <param name="zoneName">The zone to add the item to.</param>
        /// <param name="position">The position relative to the selected item to add the item.</param>
        /// <returns>The url to the edit page.</returns>
        public string GetEditNewPageUrl(ContentItem selected, ContentType definition, string zoneName, CreationPosition position)
        {
            if (selected == null) throw new ArgumentNullException("selected");
            if (definition == null) throw new ArgumentNullException("definition");

            ContentItem parent = (position != CreationPosition.Below) ? selected.Parent : selected;

            if (selected == null)
                throw new ZeusException("Cannot insert item before or after the root page.");

            Url url = new Url(EditItemUrl);
            url = url.AppendQuery("selected", parent.Path);
            url = url.AppendQuery("discriminator", definition.Discriminator);
            url = url.AppendQuery("zoneName", zoneName);

            switch (position)
            {
                case CreationPosition.Before:
                    url = url.AppendQuery("before", selected.Path);
                    break;
                case CreationPosition.After:
                    url = url.AppendQuery("after", selected.Path);
                    break;
            }

            return url.ToString();
        }