/// <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());
        }
Exemple #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());
        }
Exemple #3
0
        private static string ViewModeTemplate(
            this HtmlBuilder hb,
            SiteSettings ss,
            GridData gridData,
            View view,
            string viewMode,
            Action viewModeBody)
        {
            var invalid = GroupValidators.OnEntry(ss);

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

            default: return(HtmlTemplates.Error(invalid));
            }
            return(hb.Template(
                       ss: ss,
                       verType: Versions.VerTypes.Latest,
                       methodType: BaseModel.MethodTypes.Index,
                       siteId: ss.SiteId,
                       parentId: ss.ParentId,
                       referenceType: "Groups",
                       script: JavaScripts.ViewMode(viewMode),
                       userScript: ss.ViewModeScripts(Routes.Action()),
                       userStyle: ss.ViewModeStyles(Routes.Action()),
                       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: gridData.Aggregations)
                           .Div(id: "ViewModeContainer", action: () => viewModeBody())
                           .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()))
                       .MoveDialog(bulk: true)
                       .Div(attributes: new HtmlAttributes()
                            .Id("ExportSelectorDialog")
                            .Class("dialog")
                            .Title(Displays.Export())))
                   .ToString());
        }
Exemple #4
0
        /// <summary>
        /// Fixed:
        /// </summary>
        public static string Index(SiteSettings ss)
        {
            var hb              = new HtmlBuilder();
            var view            = Views.GetBySession(ss);
            var groupCollection = GroupCollection(ss, view);

            return(hb.Template(
                       ss: ss,
                       verType: Versions.VerTypes.Latest,
                       methodType: BaseModel.MethodTypes.Index,
                       referenceType: "Groups",
                       title: Displays.Groups() + " - " + Displays.List(),
                       action: () =>
            {
                hb
                .Form(
                    attributes: new HtmlAttributes()
                    .Id("GroupForm")
                    .Class("main-form")
                    .Action(Locations.Action("Groups")),
                    action: () => hb
                    .Aggregations(
                        ss: ss,
                        aggregations: groupCollection.Aggregations)
                    .Div(id: "ViewModeContainer", action: () => hb
                         .Grid(
                             ss: ss,
                             groupCollection: groupCollection,
                             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());
        }
Exemple #5
0
        /// <summary>
        /// Fixed:
        /// </summary>
        private static HtmlBuilder Editor(
            this HtmlBuilder hb, Context context, SiteSettings ss, TenantModel tenantModel)
        {
            var commentsColumn = ss.GetColumn(context: context, columnName: "Comments");
            var commentsColumnPermissionType = commentsColumn
                                               .ColumnPermissionType(context: context);
            var showComments = false;
            var tabsCss      = showComments ? null : "max";

            return(hb.Div(id: "Editor", action: () => hb
                          .Form(
                              attributes: new HtmlAttributes()
                              .Id("TenantForm")
                              .Class("main-form confirm-reload")
                              .Action(Locations.Action(
                                          context: context,
                                          controller: "Tenants",
                                          id: tenantModel.TenantId)),
                              action: () => hb
                              .RecordHeader(
                                  context: context,
                                  ss: ss,
                                  baseModel: tenantModel,
                                  tableName: "Tenants")
                              .Div(
                                  id: "EditorComments", action: () => hb
                                  .Comments(
                                      context: context,
                                      ss: ss,
                                      comments: tenantModel.Comments,
                                      column: commentsColumn,
                                      verType: tenantModel.VerType,
                                      columnPermissionType: commentsColumnPermissionType),
                                  _using: showComments)
                              .Div(id: "EditorTabsContainer", css: tabsCss, action: () => hb
                                   .EditorTabs(
                                       context: context,
                                       tenantModel: tenantModel)
                                   .FieldSetGeneral(context: context, ss: ss, tenantModel: tenantModel)
                                   .FieldSet(
                                       attributes: new HtmlAttributes()
                                       .Id("FieldSetHistories")
                                       .DataAction("Histories")
                                       .DataMethod("post"),
                                       _using: tenantModel.MethodType != BaseModel.MethodTypes.New)
                                   .MainCommands(
                                       context: context,
                                       ss: ss,
                                       siteId: 0,
                                       verType: tenantModel.VerType,
                                       referenceId: tenantModel.TenantId,
                                       updateButton: true,
                                       mailButton: true,
                                       deleteButton: true,
                                       extensions: () => hb
                                       .MainCommandExtensions(
                                           context: context,
                                           tenantModel: tenantModel,
                                           ss: ss)))
                              .Hidden(
                                  controlId: "BaseUrl",
                                  value: Locations.BaseUrl(context: context))
                              .Hidden(
                                  controlId: "MethodType",
                                  value: tenantModel.MethodType.ToString().ToLower())
                              .Hidden(
                                  controlId: "Tenants_Timestamp",
                                  css: "always-send",
                                  value: tenantModel.Timestamp)
                              .Hidden(
                                  controlId: "SwitchTargets",
                                  css: "always-send",
                                  value: tenantModel.SwitchTargets?.Join(),
                                  _using: !context.Ajax))
                          .OutgoingMailsForm(
                              context: context,
                              ss: ss,
                              referenceType: "Tenants",
                              referenceId: tenantModel.TenantId,
                              referenceVer: tenantModel.Ver)
                          .CopyDialog(
                              context: context,
                              referenceType: "Tenants",
                              id: tenantModel.TenantId)
                          .OutgoingMailDialog()
                          .EditorExtensions(
                              context: context,
                              tenantModel: tenantModel,
                              ss: ss)));
        }
        /// <summary>
        /// Fixed:
        /// </summary>
        private static HtmlBuilder Editor(
            this HtmlBuilder hb, SiteSettings ss, GroupModel groupModel)
        {
            var commentsColumn = ss.GetColumn("Comments");
            var commentsColumnPermissionType = commentsColumn.ColumnPermissionType();
            var showComments = ss.ShowComments(commentsColumnPermissionType);
            var tabsCss      = showComments ? null : "max";

            return(hb.Div(id: "Editor", action: () => hb
                          .Form(
                              attributes: new HtmlAttributes()
                              .Id("GroupForm")
                              .Class("main-form confirm-reload")
                              .Action(groupModel.GroupId != 0
                            ? Locations.Action("Groups", groupModel.GroupId)
                            : Locations.Action("Groups")),
                              action: () => hb
                              .RecordHeader(
                                  ss: ss,
                                  baseModel: groupModel,
                                  tableName: "Groups")
                              .Div(
                                  id: "EditorComments", action: () => hb
                                  .Comments(
                                      comments: groupModel.Comments,
                                      column: commentsColumn,
                                      verType: groupModel.VerType,
                                      columnPermissionType: commentsColumnPermissionType),
                                  _using: showComments)
                              .Div(id: "EditorTabsContainer", css: tabsCss, action: () => hb
                                   .EditorTabs(groupModel: groupModel)
                                   .FieldSetGeneral(
                                       ss: ss,
                                       groupModel: groupModel)
                                   .FieldSetMembers(groupModel: groupModel)
                                   .FieldSet(
                                       attributes: new HtmlAttributes()
                                       .Id("FieldSetHistories")
                                       .DataAction("Histories")
                                       .DataMethod("post"),
                                       _using: groupModel.MethodType != BaseModel.MethodTypes.New)
                                   .MainCommands(
                                       ss: ss,
                                       siteId: 0,
                                       verType: groupModel.VerType,
                                       referenceId: groupModel.GroupId,
                                       updateButton: true,
                                       mailButton: true,
                                       deleteButton: true,
                                       extensions: () => hb
                                       .MainCommandExtensions(
                                           groupModel: groupModel,
                                           ss: ss)))
                              .Hidden(controlId: "BaseUrl", value: Locations.BaseUrl())
                              .Hidden(
                                  controlId: "MethodType",
                                  value: groupModel.MethodType.ToString().ToLower())
                              .Hidden(
                                  controlId: "Groups_Timestamp",
                                  css: "always-send",
                                  value: groupModel.Timestamp)
                              .Hidden(
                                  controlId: "SwitchTargets",
                                  css: "always-send",
                                  value: groupModel.SwitchTargets?.Join(),
                                  _using: !Request.IsAjax()))
                          .OutgoingMailsForm("Groups", groupModel.GroupId, groupModel.Ver)
                          .CopyDialog("Groups", groupModel.GroupId)
                          .OutgoingMailDialog()
                          .EditorExtensions(groupModel: groupModel, ss: ss)));
        }
Exemple #7
0
        /// <summary>
        /// Fixed:
        /// </summary>
        private static HtmlBuilder Editor(
            this HtmlBuilder hb,
            IContext context,
            SiteSettings ss,
            WikiModel wikiModel)
        {
            var commentsColumn = ss.GetColumn(
                context: context,
                columnName: "Comments");
            var commentsColumnPermissionType = commentsColumn
                                               .ColumnPermissionType(context: context);
            var showComments = ss.ShowComments(commentsColumnPermissionType);
            var tabsCss      = showComments ? null : "max";

            return(hb.Div(id: "Editor", action: () => hb
                          .Form(
                              attributes: new HtmlAttributes()
                              .Id("WikiForm")
                              .Class("main-form")
                              .Action(Locations.ItemAction(
                                          context: context,
                                          id: wikiModel.WikiId != 0
                                ? wikiModel.WikiId
                                : wikiModel.SiteId)),
                              action: () => hb
                              .RecordHeader(
                                  context: context,
                                  ss: ss,
                                  baseModel: wikiModel,
                                  tableName: "Wikis")
                              .Div(
                                  id: "EditorComments", action: () => hb
                                  .Comments(
                                      context: context,
                                      ss: ss,
                                      comments: wikiModel.Comments,
                                      column: commentsColumn,
                                      verType: wikiModel.VerType,
                                      columnPermissionType: commentsColumnPermissionType),
                                  _using: showComments)
                              .Div(id: "EditorTabsContainer", css: tabsCss, action: () => hb
                                   .EditorTabs(
                                       context: context,
                                       ss: ss,
                                       wikiModel: wikiModel)
                                   .FieldSetGeneral(
                                       context: context,
                                       ss: ss,
                                       wikiModel: wikiModel)
                                   .FieldSet(
                                       attributes: new HtmlAttributes()
                                       .Id("FieldSetHistories")
                                       .DataAction("Histories")
                                       .DataMethod("post"),
                                       _using: wikiModel.MethodType != BaseModel.MethodTypes.New)
                                   .FieldSet(
                                       attributes: new HtmlAttributes()
                                       .Id("FieldSetRecordAccessControl")
                                       .DataAction("Permissions")
                                       .DataMethod("post"),
                                       _using: context.CanManagePermission(ss: ss))
                                   .MainCommands(
                                       context: context,
                                       ss: ss,
                                       siteId: wikiModel.SiteId,
                                       verType: wikiModel.VerType,
                                       referenceId: wikiModel.WikiId,
                                       updateButton: true,
                                       copyButton: false,
                                       moveButton: false,
                                       mailButton: true,
                                       deleteButton: true))
                              .Hidden(
                                  controlId: "BaseUrl",
                                  value: Locations.BaseUrl(context: context))
                              .Hidden(
                                  controlId: "MethodType",
                                  value: "edit")
                              .Hidden(
                                  controlId: "Wikis_Timestamp",
                                  css: "always-send",
                                  value: wikiModel.Timestamp)
                              .Hidden(
                                  controlId: "SwitchTargets",
                                  css: "always-send",
                                  value: wikiModel.WikiId.ToString(),
                                  _using: !context.Ajax || context.Action == "create"))
                          .OutgoingMailsForm(
                              context: context,
                              ss: ss,
                              referenceType: "Wikis",
                              referenceId: wikiModel.WikiId,
                              referenceVer: wikiModel.Ver)
                          .CopyDialog(
                              context: context,
                              referenceType: "items",
                              id: wikiModel.WikiId)
                          .MoveDialog(context: context)
                          .OutgoingMailDialog()));
        }