public CarrotGridImageColumn()
     : base()
 {
     this.ImagePairs       = new List <CarrotImageColumnData>();
     this.DefaultImagePath = HttpUtility.HtmlEncode(CarrotWeb.GetWebResourceUrl(this.GetType(), IconResourcePaperclip));
     this.Mode             = CarrotGridColumnType.ImageEnum;
 }
        public CarrotGridBooleanImageColumn()
            : base()
        {
            this.ImageAttributes = null;

            this.ImagePathTrue      = HttpUtility.HtmlEncode(CarrotWeb.GetWebResourceUrl(this.GetType(), IconResourceAffirm));
            this.ImagePathFalse     = HttpUtility.HtmlEncode(CarrotWeb.GetWebResourceUrl(this.GetType(), IconResourceNegative));
            this.AlternateTextTrue  = "True";
            this.AlternateTextFalse = "False";

            this.Mode = CarrotGridColumnType.BooleanImage;
        }
예제 #3
0
        public Captcha2()
        {
            this.AltValidationFailText = "Failed to validate image";
            this.Instructions          = "Select the name of the item shown in the image above from the list below.";

            this.ImageOptions = new Dictionary <string, string>();
            string imgPfx = "Carrotware.Web.UI.Components.captcha2";

            this.ImageOptions.Add(CarrotWeb.GetWebResourceUrl(this.GetType(), String.Format("{0}.bouquet.png", imgPfx)), "Bouquet");
            this.ImageOptions.Add(CarrotWeb.GetWebResourceUrl(this.GetType(), String.Format("{0}.pen.png", imgPfx)), "Pen");
            this.ImageOptions.Add(CarrotWeb.GetWebResourceUrl(this.GetType(), String.Format("{0}.pepper.png", imgPfx)), "Pepper");
            this.ImageOptions.Add(CarrotWeb.GetWebResourceUrl(this.GetType(), String.Format("{0}.scissors.png", imgPfx)), "Scissors");
            this.ImageOptions.Add(CarrotWeb.GetWebResourceUrl(this.GetType(), String.Format("{0}.snowflake.png", imgPfx)), "Snowflake");
            this.ImageOptions.Add(CarrotWeb.GetWebResourceUrl(this.GetType(), String.Format("{0}.web.png", imgPfx)), "Web");
        }
예제 #4
0
        public CarrotWebGrid <T> AddColumn(Expression <Func <T, Object> > property, ICarrotGridColumn column)
        {
            MemberExpression memberExpression = property.Body as MemberExpression ??
                                                ((UnaryExpression)property.Body).Operand as MemberExpression;

            if (column.Mode != CarrotGridColumnType.Template)
            {
                //string columnName = memberExpression.Member.Name;
                string columnName = ReflectionUtilities.BuildProp(property);

                if (column is ICarrotGridColumnExt)
                {
                    var col = (ICarrotGridColumnExt)column;
                    col.ColumnName = columnName;
                    if (!this.UseDataPage)
                    {
                        col.Sortable = false;
                    }

                    if (String.IsNullOrEmpty(column.HeaderText) && column.HasHeadingText)
                    {
                        column.HeaderText = col.ColumnName.Replace(".", " ").Replace("_", " ");

                        string displayName = CarrotWeb.DisplayNameFor <T>(property);
                        if (!String.IsNullOrEmpty(displayName))
                        {
                            column.HeaderText = displayName;
                        }
                    }
                    if (!column.HasHeadingText && !col.Sortable)
                    {
                        column.HeaderText = "  ";
                    }
                }
            }

            column.Order = this.Columns.Count();

            this.Columns.Add(column);

            return(this);
        }
예제 #5
0
 public static string GetWebResourceUrl(Type type, string resource)
 {
     return(CarrotWeb.GetWebResourceUrl(type, resource));
 }
 public static string GetWebResourceUrl(string resource)
 {
     return(CarrotWeb.GetWebResourceUrl(typeof(jquerybasic), resource));
 }
예제 #7
0
        public override string GetHtml()
        {
            StringBuilder sb = new StringBuilder();

            string sJQFile = String.Empty;
            string jqVer   = JQVersion;

            if (!String.IsNullOrEmpty(jqVer) && jqVer.Length > 2)
            {
                if (jqVer.LastIndexOf(".") != jqVer.IndexOf("."))
                {
                    jqVer = jqVer.Substring(0, jqVer.LastIndexOf("."));
                }
            }

            switch (jqVer)
            {
            case "2":
            case "2.0":
            case "1.11":
                jqVer   = "1.11.3";
                sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Components.jquery-1-11-3.js");
                break;

            case "1.12":
                jqVer   = "1.12.0";
                sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Components.jquery-1-12-0.js");
                break;

            case "1.10":
                jqVer   = "1.10.2";
                sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Components.jquery-1-10-2.js");
                break;

            case "1.9":
                jqVer   = "1.9.1";
                sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Components.jquery-1-9-1.js");
                break;

            case "1.8":
                jqVer   = "1.8.3";
                sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Components.jquery-1-8-3.js");
                break;

            case "1.7":
                jqVer   = "1.7.2";
                sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Components.jquery-1-7-2.js");
                break;

            case "1":
            case "1.3":
            case "1.4":
            case "1.5":
            case "1.6":
                jqVer   = "1.6.4";
                sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Components.jquery-1-6-4.js");
                break;

            default:
                jqVer   = "1.11.3";
                sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Components.jquery-1-11-3.js");
                break;
            }

            sb.AppendLine("<!-- JQuery v. " + jqVer + " --> <script src=\"" + sJQFile + "\" type=\"text/javascript\"></script> ");

            if (this.UseJqueryMigrate)
            {
                string sJQFileMig = String.Empty;

                if (jqVer.StartsWith("1.9") || jqVer.StartsWith("1.10") || jqVer.StartsWith("1.11"))
                {
                    sJQFileMig = GetWebResourceUrl("Carrotware.Web.UI.Components.jquery-1-2-1-mig.js");
                }

                if (jqVer.StartsWith("1.12") || jqVer.StartsWith("1.13"))
                {
                    sJQFileMig = GetWebResourceUrl("Carrotware.Web.UI.Components.jquery-1-3-0-mig.js");
                }

                if (!String.IsNullOrEmpty(sJQFileMig))
                {
                    sb.AppendLine("<!-- jQuery Migrate Plugin --> <script src=\"" + sJQFileMig + "\" type=\"text/javascript\"></script> ");
                }
            }

            string sAjax = GetWebResourceUrl("Carrotware.Web.UI.Components.unobtrusive-ajax.js");

            sb.AppendLine("<!-- Unobtrusive Ajax --> <script src=\"" + sAjax + "\" type=\"text/javascript\"></script> ");

            string key = CarrotWeb.DateKey();

            sb.AppendLine("<!-- Carrot Helpers --> <script src=\"/carrotwarehelper.ashx?ts=" + key + "\" type=\"text/javascript\"></script> ");

            return(sb.ToString().Trim());
        }