Пример #1
0
        /// <summary>
        /// Appends the content of the required header.
        /// </summary>
        /// <param name="stringBuilder">The string builder.</param>
        /// <exception cref="System.InvalidOperationException">Invalid SiteMap node specified. Either the current group node doesn't have child nodes or the current user does not have rights to view any of the child nodes.</exception>
        private void AppendRequiredHeaderContent(StringBuilder stringBuilder, bool setTitle = true)
        {
            var pageData = MasterPageBuilder.GetRequestedPageData();

            if (pageData != null)
            {
                stringBuilder.Append(this.ResourceRegistrations());
                var robotsTag = this.GetRobotsMetaTag(pageData);

                if (!string.IsNullOrEmpty(robotsTag))
                {
                    stringBuilder.Append("\r\n\t" + robotsTag);
                }

                if (setTitle)
                {
                    stringBuilder.Append("\r\n\t<title>" + pageData.HtmlTitle.ToString() + "\r\n\t</title>");
                }

                var descriptionTag = this.GetDescriptionTag(pageData);

                if (!string.IsNullOrEmpty(descriptionTag))
                {
                    stringBuilder.Append("\r\n\t" + descriptionTag);
                }

                var keywordsTag = this.GetKeywordsTag(pageData);

                if (!string.IsNullOrEmpty(keywordsTag))
                {
                    stringBuilder.Append("\r\n\t" + keywordsTag);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Appends the content of the required header.
        /// </summary>
        /// <param name="stringBuilder">The string builder.</param>
        /// <param name="setTitle">if set to <c>true</c> will set the title.</param>
        /// <exception cref="System.InvalidOperationException">Invalid SiteMap node specified. Either the current group node doesn't have child nodes or the current user does not have rights to view any of the child nodes.</exception>
        private void AppendRequiredHeaderContent(StringBuilder stringBuilder, bool setTitle = true)
        {
            var pageData = MasterPageBuilder.GetRequestedPageData();

            if (pageData != null && setTitle)
            {
                stringBuilder.Append("\r\n\t<title>" + pageData.HtmlTitle.ToString() + "\r\n\t</title>");
            }
        }
Пример #3
0
        /// <summary>
        /// Adds variable parameters to the virtual path to allow caching of multiple versions based on parameters.
        /// </summary>
        /// <param name="layoutVirtualPath">The layout virtual path.</param>
        /// <returns>The path with appended variables.</returns>
        protected virtual string AddVariablesToPath(string layoutVirtualPath)
        {
            var varies = new List <string>();

            var packagesManager = new PackageManager();
            var currentPackage  = packagesManager.GetCurrentPackage();

            if (!currentPackage.IsNullOrEmpty())
            {
                varies.Add(currentPackage);
            }

            if (SystemManager.CurrentContext.AppSettings.Multilingual)
            {
                varies.Add(CultureInfo.CurrentUICulture.Name);
            }

            if (MasterPageBuilder.IsFormTagRequired())
            {
                varies.Add("form");
            }
            else
            {
                varies.Add("noform");
            }

            var pageData = MasterPageBuilder.GetRequestedPageData();

            if (pageData != null)
            {
                varies.Add(pageData.Id.ToString());
                varies.Add(pageData.Version.ToString(CultureInfo.InvariantCulture));
            }

            layoutVirtualPath = (new VirtualPathBuilder()).AddParams(layoutVirtualPath, string.Join("_", varies));

            return(layoutVirtualPath);
        }