Пример #1
0
        void TestBox_OnAdminRequest(AdminInterface admin, string sprocketPath, string[] pathSections, HandleFlag handled)
        {
            //admin.AddMainMenuLink(new AdminMenuLink("Test Box", WebUtility.MakePath("admin/testbox"), 1000));
            if (sprocketPath != "admin/testbox")
            {
                return;
            }
            handled.Set();
            admin.AddInterfaceScript(new RankedString(ResourceLoader.LoadTextResource(typeof(AjaxForm).Assembly, "Sprocket.Web.Controls.AjaxForm.js"), 0));
            admin.AddHeadSection(new RankedString(CSS, 0));
            admin.ContentHeading = "Test Box";
            admin.AddContentSection(new RankedString("blah", -1000));

            AjaxFormFieldBlock b = new AjaxFormFieldBlock("UserDetails", "Main User Details");

            b.Add(new AjaxFormStandardField(
                      "Username",
                      "Username",
                      "<input type=\"text\" id=\"Username\" />",
                      null,
                      "function(value) { return value.length == 0 ? 'Please enter a username' : false }",
                      true, 1));
            b.Add(new AjaxFormStandardField("First Name", "FirstName", "<input type=\"text\" />", null, "", true, 0));

            AjaxFormFieldBlock b2 = new AjaxFormFieldBlock("RandomCrap", "Random Crap");

            b2.Add(new AjaxFormField("stuff", null, null, -1));

            AjaxFormFieldBlockList bl = new AjaxFormFieldBlockList();

            bl.Add(b);
            bl.Add(b2);

            admin.AddContentSection(new RankedString(bl, 1001));
        }
Пример #2
0
        void TestBox_OnAdminRequest(AdminInterface admin, string sprocketPath, string[] pathSections, HandleFlag handled)
        {
            //admin.AddMainMenuLink(new AdminMenuLink("Test Box", WebUtility.MakePath("admin/testbox"), 1000));
            if (sprocketPath != "admin/testbox") return;
            handled.Set();
            admin.AddInterfaceScript(new RankedString(ResourceLoader.LoadTextResource(typeof(AjaxForm).Assembly, "Sprocket.Web.Controls.AjaxForm.js"), 0));
            admin.AddHeadSection(new RankedString(CSS, 0));
            admin.ContentHeading = "Test Box";
            admin.AddContentSection(new RankedString("blah", -1000));

            AjaxFormFieldBlock b = new AjaxFormFieldBlock("UserDetails", "Main User Details");
            b.Add(new AjaxFormStandardField(
                "Username",
                "Username",
                "<input type=\"text\" id=\"Username\" />",
                null,
                "function(value) { return value.length == 0 ? 'Please enter a username' : false }",
                true, 1));
            b.Add(new AjaxFormStandardField("First Name", "FirstName", "<input type=\"text\" />", null, "", true, 0));

            AjaxFormFieldBlock b2 = new AjaxFormFieldBlock("RandomCrap", "Random Crap");
            b2.Add(new AjaxFormField("stuff", null, null, -1));

            AjaxFormFieldBlockList bl = new AjaxFormFieldBlockList();
            bl.Add(b);
            bl.Add(b2);

            admin.AddContentSection(new RankedString(bl, 1001));
        }