Beispiel #1
0
        internal virtual string GetUrl(SelectBaseLayoutOptions options, Database db)
        {
            var url = options.ToUrlString(db);

            url.Path = "/sitecore/shell/default.aspx";
            return(url.ToString());
        }
        public void AddCurrentBaseLayout_WithCurrentBaseLayoutIdNull_DoesNotAddQueryStringParameter()
        {
            // Arrange
            var urlString = new UrlString();
            var options   = new SelectBaseLayoutOptions();

            // Act
            var result = options.AddCurrentBaseLayout(urlString);

            // Assert
            Assert.Null(result.Parameters[SelectBaseLayoutOptions.CurrentBaseLayoutQueryKey]);
        }
        public void AddCurrentBaseLayout_WithCurrentBaseLayoutIdNull_DoesNotAddQueryStringParameter()
        {
            // Arrange
            var urlString = new UrlString();
            var options = new SelectBaseLayoutOptions();

            // Act
            var result = options.AddCurrentBaseLayout(urlString);

            // Assert
            Assert.Null(result.Parameters[SelectBaseLayoutOptions.CurrentBaseLayoutQueryKey]);
        }
        public void AddCurrentBaseLayout_WithCurrentBaseLayoutIdNotNull_AddsQueryStringParameter()
        {
            // Arrange
            var urlString = new UrlString();
            var id = new ID();
            var options = new SelectBaseLayoutOptions {CurrentBaseLayoutId = id};

            // Act
            var result = options.AddCurrentBaseLayout(urlString);

            // Assert
            Assert.Equal(id.ToShortID().ToString(), result.Parameters[SelectBaseLayoutOptions.CurrentBaseLayoutQueryKey]);
        }
        public void AddCurrentBaseLayout_WithCurrentBaseLayoutIdNotNull_AddsQueryStringParameter()
        {
            // Arrange
            var urlString = new UrlString();
            var id        = new ID();
            var options   = new SelectBaseLayoutOptions {
                CurrentBaseLayoutId = id
            };

            // Act
            var result = options.AddCurrentBaseLayout(urlString);

            // Assert
            Assert.Equal(id.ToShortID().ToString(), result.Parameters[SelectBaseLayoutOptions.CurrentBaseLayoutQueryKey]);
        }
        /// <summary>
        ///     Gets the select base layout dialog URL with parameters for the given item
        /// </summary>
        /// <param name="item">the item</param>
        /// <returns>the dialog url</returns>
        public string GetDialogUrl(Item item)
        {
            var args = new GetBaseLayoutItemsArgs(item);
            _pipelineRunner.Run(args);

            if (args.BaseLayoutItems.Count == 0) return null;

            BaseLayoutItem baseLayoutItem = item;
            var options = new SelectBaseLayoutOptions {Items = args.BaseLayoutItems};
            if (baseLayoutItem.BaseLayout != null)
            {
                options.CurrentBaseLayoutId = baseLayoutItem.BaseLayout.ID;
            }

            return GetUrl(options, item.Database);
        }
Beispiel #7
0
        /// <summary>
        ///     Gets the select base layout dialog URL with parameters for the given item
        /// </summary>
        /// <param name="item">the item</param>
        /// <returns>the dialog url</returns>
        public string GetDialogUrl(Item item)
        {
            var args = new GetBaseLayoutItemsArgs(item);

            _pipelineRunner.Run(args);

            if (args.BaseLayoutItems.Count == 0)
            {
                return(null);
            }

            BaseLayoutItem baseLayoutItem = item;
            var            options        = new SelectBaseLayoutOptions {
                Items = args.BaseLayoutItems
            };

            if (baseLayoutItem.BaseLayout != null)
            {
                options.CurrentBaseLayoutId = baseLayoutItem.BaseLayout.ID;
            }

            return(GetUrl(options, item.Database));
        }
 internal virtual string GetUrl(SelectBaseLayoutOptions options, Database db)
 {
     var url = options.ToUrlString(db);
     url.Path = "/sitecore/shell/default.aspx";
     return url.ToString();
 }