Example #1
0
        private static Dictionary <string, string> FromItemByFillEmptyValue(String cssString)
        {
            Dictionary <String, String> css = CssInfo.GetEmptyValues();

            Dictionary <String, String> items = FromItem(cssString);

            foreach (KeyValuePair <String, String> kv in items)
            {
                css[kv.Key] = kv.Value;
            }

            processBackgroundImage(css);

            return(css);
        }
Example #2
0
        public static Dictionary <String, String> getPostValues(MvcContext ctx)
        {
            Dictionary <String, String> result = new Dictionary <String, String>();

            Dictionary <String, CssControl> cssItems = CssInfo.GetCssItem();

            foreach (KeyValuePair <String, CssControl> kv in cssItems)
            {
                String val = ctx.Post(kv.Key);
                if (kv.Value == CssControl.Color)
                {
                    val = getColorValue(val);
                }

                else if (kv.Value == CssControl.Px)
                {
                    if (strUtil.IsNullOrEmpty(val))
                    {
                        val = null;
                    }
                    else
                    {
                        val = strUtil.TrimEnd(val, "px").Trim();

                        int intVal = cvt.ToInt(val);
                        val = intVal + "px";
                    }
                }
                else if (kv.Value == CssControl.BackgroundUrl)
                {
                    if (strUtil.HasText(val))
                    {
                        if (val.StartsWith("http://") == false && val.StartsWith("/") == false)
                        {
                            val = "http://" + val;
                        }
                        val = String.Format("url({0})", val);
                    }
                }

                result.Add(kv.Key, val);
            }
            return(result);
        }