/// <summary>
            /// xhtml on the base is private
            /// </summary>
            /// <param name="pAttributes"></param>
            protected override void ParseNode(Sitecore.Collections.SafeDictionary <string> pAttributes)
            {
                var str = Extract(pAttributes, new[] { "outputMethod" });

                Xhtml = str == "xhtml" || Settings.Rendering.ImagesAsXhtml && str != "html";
                base.ParseNode(pAttributes);
            }
Example #2
0
 /// <summary>
 /// Clear all properties.
 /// </summary>
 public void Clear()
 {
     this.Prefix                = String.Empty;
     this.Suffix                = String.Empty;
     this.LanguageName          = String.Empty;
     this.Path                  = String.Empty;
     this.queryStringParameters = null;
 }
 protected override void PopulateParameters(Sitecore.Collections.SafeDictionary <string> parameters)
 {
     base.PopulateParameters(parameters);
     if (!String.IsNullOrEmpty(RelAttribute))
     {
         parameters.Add("rel", RelAttribute);
     }
 }
Example #4
0
        /// <summary>
        /// Parse the query string part of the URL.
        /// </summary>
        /// <param name="urlString">The URL string.</param>
        /// <returns>
        /// The remainder of the URL, exluding the query string.
        /// </returns>
        protected string ParseQueryString(string urlString)
        {
            int questionMark = urlString.IndexOf('?');

            if (questionMark > -1)
            {
                this.QueryStringParameters =
                    Sitecore.Web.WebUtil.ParseQueryString(urlString);
                urlString = urlString.Substring(0, questionMark);
            }

            return(urlString);
        }
        public static HtmlString RenderField(this Sitecore.Mvc.Helpers.SitecoreHelper sitecoreHelper, string fieldNameOrId, bool disableWebEdit = false, Sitecore.Collections.SafeDictionary <string> parameters = null)
        {
            if (parameters == null)
            {
                parameters = new Sitecore.Collections.SafeDictionary <string>();
            }

            return(sitecoreHelper.Field(fieldNameOrId,
                                        new
            {
                DisableWebEdit = disableWebEdit,
                Parameters = parameters
            }));
        }
        public static HtmlString RenderDate(this Sitecore.Mvc.Helpers.SitecoreHelper sitecoreHelper, string fieldNameOrId, string format = "D", bool disableWebEdit = false, bool setCulture = true, Sitecore.Collections.SafeDictionary <string> parameters = null)
        {
            if (setCulture)
            {
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(Sitecore.Context.Language.Name);
                Thread.CurrentThread.CurrentCulture   = CultureInfo.CreateSpecificCulture(Sitecore.Context.Language.Name);
            }

            if (parameters == null)
            {
                parameters = new Sitecore.Collections.SafeDictionary <string>();
            }

            parameters["format"] = format;
            return(RenderField(sitecoreHelper, fieldNameOrId, disableWebEdit, parameters));
        }
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            // if source does not consist of key=value pairs, do nothing.

            if (String.IsNullOrEmpty(this.Source) || this.Source.IndexOf("=") < 0)
            {
                return;
            }

            Sitecore.Collections.SafeDictionary <string> parsed =
                Sitecore.Web.WebUtil.ParseQueryString(this.Source);
            this.Source = String.Empty;

            foreach (string key in parsed.Keys)
            {
                switch (key.ToLower())
                {
                case "disabletextinput":
                    if (parsed[key].ToLower() == "true")
                    {
                        this.Disabled = true;
                    }

                    break;

                case "datasource":
                    this.Source = parsed[key];
                    break;

                default:
//            throw new Exception("Unrecognized source parameter: " + key);
                    break;
                }
            }
        }
 public static HtmlString TagField(this Sitecore.Mvc.Helpers.SitecoreHelper sitecoreHelper, Sitecore.Data.ID fieldId, string htmlElement, bool disableWebEdit = false, Sitecore.Collections.SafeDictionary <string> parameters = null)
 {
     return(TagField(sitecoreHelper, fieldId.ToString(), htmlElement, disableWebEdit, parameters));
 }
        public static HtmlString TagField(this Sitecore.Mvc.Helpers.SitecoreHelper sitecoreHelper, string fieldNameOrId, string htmlElement, bool disableWebEdit = false, Sitecore.Collections.SafeDictionary <string> parameters = null)
        {
            var item = Sitecore.Mvc.Presentation.RenderingContext.Current.ContextItem;

            if (item == null || string.IsNullOrEmpty(item[fieldNameOrId]))
            {
                return(new HtmlString(string.Empty));
            }

            var value = sitecoreHelper.RenderField(fieldNameOrId, disableWebEdit, parameters).ToString();

            return(new HtmlString(string.Format("<{0}>{1}</{0}>", htmlElement, value)));
        }
 public static HtmlString RenderDate(this Sitecore.Mvc.Helpers.SitecoreHelper sitecoreHelper, Sitecore.Data.ID fieldId, string format = "D", bool disableWebEdit = false, bool setCulture = true, Sitecore.Collections.SafeDictionary <string> parameters = null)
 {
     return(RenderDate(sitecoreHelper, fieldId.ToString(), format, disableWebEdit, setCulture, parameters));
 }