/// <summary>
        /// Fixed:
        /// </summary>
        public static string Index(SiteSettings ss)
        {
            var invalid = GroupValidators.OnEntry(ss);

            switch (invalid)
            {
            case Error.Types.None: break;

            default: return(HtmlTemplates.Error(invalid));
            }
            var hb       = new HtmlBuilder();
            var view     = Views.GetBySession(ss);
            var gridData = GetGridData(ss, view);
            var viewMode = ViewModes.GetBySession(ss.SiteId);

            return(hb.Template(
                       ss: ss,
                       verType: Versions.VerTypes.Latest,
                       methodType: BaseModel.MethodTypes.Index,
                       referenceType: "Groups",
                       script: Libraries.Scripts.JavaScripts.ViewMode(viewMode),
                       title: Displays.Groups() + " - " + Displays.List(),
                       action: () =>
            {
                hb
                .Form(
                    attributes: new HtmlAttributes()
                    .Id("GroupForm")
                    .Class("main-form")
                    .Action(Locations.Action("Groups")),
                    action: () => hb
                    .ViewFilters(ss: ss, view: view)
                    .Aggregations(
                        ss: ss,
                        aggregations: gridData.Aggregations)
                    .Div(id: "ViewModeContainer", action: () => hb
                         .Grid(
                             ss: ss,
                             gridData: gridData,
                             view: view))
                    .MainCommands(
                        ss: ss,
                        siteId: ss.SiteId,
                        verType: Versions.VerTypes.Latest)
                    .Div(css: "margin-bottom")
                    .Hidden(controlId: "TableName", value: "Groups")
                    .Hidden(controlId: "BaseUrl", value: Locations.BaseUrl())
                    .Hidden(
                        controlId: "GridOffset",
                        value: Parameters.General.GridPageSize.ToString()))
                .Div(attributes: new HtmlAttributes()
                     .Id("ImportSettingsDialog")
                     .Class("dialog")
                     .Title(Displays.Import()))
                .Div(attributes: new HtmlAttributes()
                     .Id("ExportSettingsDialog")
                     .Class("dialog")
                     .Title(Displays.ExportSettings()));
            }).ToString());
        }
示例#2
0
        private static string ViewModeTemplate(
            this HtmlBuilder hb,
            SiteSettings ss,
            GroupCollection groupCollection,
            View view,
            string viewMode,
            Action viewModeBody)
        {
            var invalid = GroupValidators.OnEntry(ss);

            switch (invalid)
            {
            case Error.Types.None: break;

            default: return(HtmlTemplates.Error(invalid));
            }
            ss.SetColumnAccessControls();
            return(hb.Template(
                       ss: ss,
                       verType: Versions.VerTypes.Latest,
                       methodType: BaseModel.MethodTypes.Index,
                       siteId: ss.SiteId,
                       parentId: ss.ParentId,
                       referenceType: "Groups",
                       script: Libraries.Scripts.JavaScripts.ViewMode(viewMode),
                       userScript: ss.GridScript,
                       userStyle: ss.GridStyle,
                       action: () => hb
                       .Form(
                           attributes: new HtmlAttributes()
                           .Id("GroupsForm")
                           .Class("main-form")
                           .Action(Locations.ItemAction(ss.SiteId)),
                           action: () => hb
                           .ViewSelector(ss: ss, view: view)
                           .ViewFilters(ss: ss, view: view)
                           .Aggregations(
                               ss: ss,
                               aggregations: groupCollection.Aggregations)
                           .Div(id: "ViewModeContainer", action: () => viewModeBody())
                           .MainCommands(
                               ss: ss,
                               siteId: ss.SiteId,
                               verType: Versions.VerTypes.Latest,
                               bulkMoveButton: true,
                               bulkDeleteButton: true,
                               importButton: true,
                               exportButton: true)
                           .Div(css: "margin-bottom")
                           .Hidden(controlId: "TableName", value: "Groups")
                           .Hidden(controlId: "BaseUrl", value: Locations.BaseUrl()))
                       .MoveDialog(bulk: true)
                       .Div(attributes: new HtmlAttributes()
                            .Id("ExportSettingsDialog")
                            .Class("dialog")
                            .Title(Displays.ExportSettings())))
                   .ToString());
        }