Exemple #1
0
        protected static bool TryGetFunctionCategory(string category, out FunctionCategories mask)
        {
            Contracts.AssertNonEmpty(category);

            foreach (var cat in Enum.GetValues(typeof(FunctionCategories)).Cast <FunctionCategories>())
            {
                if (category.Equals(cat.ToString(), StringComparison.OrdinalIgnoreCase))
                {
                    mask = cat;
                    return(true);
                }
            }

            mask = default(FunctionCategories);
            return(false);
        }
Exemple #2
0
 public IsBlankFunctionBase(string name, TexlStrings.StringGetter description, FunctionCategories functionCategories, DType returnType, BigInteger maskLambdas, int arityMin, int arityMax)
     : base(name, description, functionCategories, returnType, maskLambdas, arityMin, arityMax)
 {
 }
Exemple #3
0
 public MathOneArgTableFunction(string name, TexlStrings.StringGetter description, FunctionCategories fc)
     : base(name, description, fc, DType.EmptyTable, 0, 1, 1, DType.EmptyTable)
 {
 }
Exemple #4
0
 public ExtractDateTimeFunctionBase(string name, TexlStrings.StringGetter description, FunctionCategories fc, DType returnType, BigInteger maskLambdas, int arityMin, int arityMax, params DType[] paramTypes)
     : base(name, description, fc, returnType, maskLambdas, arityMin, arityMax, paramTypes)
 {
     Contracts.Assert(arityMin == 1);
     Contracts.Assert(arityMax == 1);
     Contracts.Assert(paramTypes[0] == DType.DateTime);
 }
Exemple #5
0
 public MathOneArgFunction(string name, TexlStrings.StringGetter description, FunctionCategories fc)
     : base(name, description, fc, DType.Number, 0, 1, 1, DType.Number)
 {
 }
Exemple #6
0
        private bool GetCategories(ref string sErr)
        {
            try
            {
                //so, we will use the FunctionCategories class in the session that was loaded at login, and build the list items for the commands tab.

                //not by a web method yet, baby steps ....

                FunctionCategories cats = ui.GetTaskFunctionCategories();
                if (cats == null)
                {
                    ui.RaiseError(Page, "Error: Task Function Categories class is not in the session.", false, "");
                }
                else
                {
                    string sCatHTML = "";
                    string sFunHTML = "";

                    foreach (Category cat in cats.Values)
                    {
                        sCatHTML += "<li class=\"ui-widget-content ui-corner-all command_item category\"";
                        sCatHTML += " id=\"cat_" + cat.Name + "\"";
                        sCatHTML += " name=\"" + cat.Name + "\">";
                        sCatHTML += "<div>";
                        sCatHTML += "<img class=\"category_icon\" src=\"../images/" + cat.Icon + "\" alt=\"\" />";
                        sCatHTML += "<span>" + cat.Label + "</span>";
                        sCatHTML += "</div>";
                        sCatHTML += "<div id=\"help_text_" + cat.Name + "\" class=\"hidden\">";
                        sCatHTML += cat.Description;
                        sCatHTML += "</div>";
                        sCatHTML += "</li>";


                        sFunHTML += "<div class=\"functions hidden\" id=\"cat_" + cat.Name + "_functions\">";
                        //now, let's work out the functions.
                        //we can just draw them all... they are hidden and will display on the client as clicked
                        foreach (Function fn in cat.Functions.Values)
                        {
                            sFunHTML += "<div class=\"ui-widget-content ui-corner-all command_item function\"";
                            sFunHTML += " id=\"fn_" + fn.Name + "\"";
                            sFunHTML += " name=\"" + fn.Name + "\">";
                            sFunHTML += "<img class=\"function_icon\" src=\"../images/" + fn.Icon + "\" alt=\"\" />";
                            sFunHTML += "<span>" + fn.Label + "</span>";
                            sFunHTML += "<div id=\"help_text_" + fn.Name + "\" class=\"hidden\">";
                            sFunHTML += fn.Description;
                            sFunHTML += "</div>";
                            sFunHTML += "</div>";
                        }
                        sFunHTML += "</div>";
                    }

                    ltCategories.Text = sCatHTML;
                    ltFunctions.Text  = sFunHTML;
                }

                return(true);
            }
            catch (Exception ex)
            {
                sErr = ex.Message;
                return(false);
            }
        }
Exemple #7
0
Fichier : UI.cs Projet : you8/cato
        public void SetTaskCommands(ref string sErr)
        {
            //load the task_commands.xml file into the session.  If it doesn't exist, we can't proceed.
            try
            {
                XDocument xCommands = XDocument.Load(HttpContext.Current.Server.MapPath("~/pages/luCommands.xml"));

                if (xCommands == null)
                {
                    sErr = "Task Commands XML file is missing or unreadable.";
                }
                else
                {
                    //we load two classes here...
                    //first, the category/function hierarchy
                    FunctionCategories cats = new FunctionCategories(xCommands);
                    SetSessionObject("function_categories", cats, "Security");

                    //then the flat list of all functions for fastest lookups
                    Functions funcs = new Functions(cats);
                    SetSessionObject("functions", funcs, "Security");
                }
            } catch (Exception ex) {
                sErr = "Unable to load Task Commands XML." + ex.Message;
            }
        }
 public FunctionWithTableInput(string name, TexlStrings.StringGetter description, FunctionCategories fc, DType returnType, BigInteger maskLambdas, int arityMin, int arityMax, params DType[] paramTypes)
     : this(DPath.Root, name, description, fc, returnType, maskLambdas, arityMin, arityMax, paramTypes)
 {
 }
Exemple #9
0
 public StatisticalFunction(string name, TexlStrings.StringGetter description, FunctionCategories fc)
     : base(name, description, fc, DType.Number, 0, 1, int.MaxValue, DType.Number)
 {
 }
Exemple #10
0
 public FilterFunctionBase(string name, TexlStrings.StringGetter description, FunctionCategories fc, DType returnType, BigInteger maskLambdas, int arityMin, int arityMax, params DType[] paramTypes)
     : base(name, description, fc, returnType, maskLambdas, arityMin, arityMax, paramTypes)
 {
 }
Exemple #11
0
 public BuiltinFunction(string name, string localeSpecificName, TexlStrings.StringGetter description, FunctionCategories functionCategories, DType returnType, BigInteger maskLambdas, int arityMin, int arityMax, params DType[] paramTypes)
     : this(DPath.Root, name, localeSpecificName, description, functionCategories, returnType, maskLambdas, arityMin, arityMax, paramTypes)
 {
 }
Exemple #12
0
 public BuiltinFunction(DPath theNamespace, string name, TexlStrings.StringGetter description, FunctionCategories functionCategories, DType returnType, BigInteger maskLambdas, int arityMin, int arityMax, params DType[] paramTypes)
     : this(theNamespace, name, /*localeSpecificName*/ string.Empty, description, functionCategories, returnType, maskLambdas, arityMin, arityMax, paramTypes)
 {
 }
Exemple #13
0
 public StringOneArgFunction(string name, TexlStrings.StringGetter description, FunctionCategories functionCategories, DType returnType)
     : base(name, description, functionCategories, returnType, 0, 1, 1, DType.String)
 {
 }
 public StatisticalTableFunction(string name, TexlStrings.StringGetter description, FunctionCategories fc)
     : base(name, description, fc, DType.Number, 0x02, 2, 2, DType.EmptyTable, DType.Number)
 {
     ScopeInfo = new FunctionScopeInfo(this, usesAllFieldsInScope: false, acceptsLiteralPredicates: false);
 }