Ejemplo n.º 1
0
        /// <summary>
        /// Fixed:
        /// </summary>
        public static string Index(SiteSettings ss)
        {
            var invalid = DeptValidators.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: "Depts",
                       script: Libraries.Scripts.JavaScripts.ViewMode(viewMode),
                       title: Displays.Depts() + " - " + Displays.List(),
                       action: () =>
            {
                hb
                .Form(
                    attributes: new HtmlAttributes()
                    .Id("DeptForm")
                    .Class("main-form")
                    .Action(Locations.Action("Depts")),
                    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: "Depts")
                    .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());
        }
Ejemplo n.º 2
0
        private static string ViewModeTemplate(
            this HtmlBuilder hb,
            SiteSettings ss,
            DeptCollection deptCollection,
            View view,
            string viewMode,
            Action viewModeBody)
        {
            var invalid = DeptValidators.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: "Depts",
                       script: Libraries.Scripts.JavaScripts.ViewMode(viewMode),
                       userScript: ss.GridScript,
                       userStyle: ss.GridStyle,
                       action: () => hb
                       .Form(
                           attributes: new HtmlAttributes()
                           .Id("DeptsForm")
                           .Class("main-form")
                           .Action(Locations.ItemAction(ss.SiteId)),
                           action: () => hb
                           .ViewSelector(ss: ss, view: view)
                           .ViewFilters(ss: ss, view: view)
                           .Aggregations(
                               ss: ss,
                               aggregations: deptCollection.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: "Depts")
                           .Hidden(controlId: "BaseUrl", value: Locations.BaseUrl()))
                       .MoveDialog(bulk: true)
                       .Div(attributes: new HtmlAttributes()
                            .Id("ExportSettingsDialog")
                            .Class("dialog")
                            .Title(Displays.ExportSettings())))
                   .ToString());
        }