Exemplo n.º 1
0
        public static HtmlBuilder Comments(
            this HtmlBuilder hb,
            Context context,
            SiteSettings ss,
            Comments comments,
            Column column,
            Versions.VerTypes verType,
            Permissions.ColumnPermissionTypes columnPermissionType)
        {
            var readOnly = verType != Versions.VerTypes.Latest ||
                           !context.CanUpdate(ss: ss) ||
                           column?.EditorReadOnly == true ||
                           columnPermissionType != Permissions.ColumnPermissionTypes.Update;

            return(hb
                   .TextArea(
                       context: context,
                       ss: ss,
                       title: column?.Description,
                       labelText: column?.LabelText,
                       allowImage: column?.AllowImage == true,
                       mobile: context.Mobile == true,
                       _using: !readOnly)
                   .Div(id: "CommentList", action: () => comments
                        .ForEach(comment => hb
                                 .Comment(
                                     context: context,
                                     ss: ss,
                                     column: column,
                                     comment: comment,
                                     readOnly: readOnly))));
        }
Exemplo n.º 2
0
        public static HtmlBuilder Notes(
            this HtmlBuilder hb,
            Context context,
            SiteSettings ss,
            Versions.VerTypes verType)
        {
            var notes = new Dictionary <string, string>();

            if (!context.Publish && !context.CanUpdate(ss: ss))
            {
                notes.Add("readonly", Displays.CanNotUpdate(context: context));
            }
            if (!context.Publish && verType == Versions.VerTypes.History)
            {
                notes.Add("history", Displays.ReadOnlyBecausePreviousVer(context: context));
            }
            if (notes.Any())
            {
                hb.Div(id: "Notes", action: () =>
                       notes.ForEach(part => hb
                                     .P(css: part.Key, action: () => hb
                                        .Text(text: part.Value))));
            }
            return(hb);
        }
Exemplo n.º 3
0
 public static HtmlBuilder Comments(
     this HtmlBuilder hb,
     Comments comments,
     Column column,
     Versions.VerTypes verType,
     Permissions.ColumnPermissionTypes columnPermissionType)
 {
     return(hb
            .TextArea(
                labelText: column?.LabelText,
                allowImage: column.AllowImage == true,
                mobile: column.SiteSettings.Mobile,
                _using:
                verType == Versions.VerTypes.Latest &&
                column.SiteSettings.CanUpdate() &&
                column?.EditorReadOnly != true &&
                columnPermissionType == Permissions.ColumnPermissionTypes.Update)
            .Div(id: "CommentList", action: () => comments
                 .ForEach(comment => hb
                          .Comment(
                              ss: column.SiteSettings,
                              column: column,
                              comment: comment,
                              verType: verType))));
 }
Exemplo n.º 4
0
 public static HtmlBuilder Template(
     this HtmlBuilder hb,
     Context context,
     SiteSettings ss,
     View view,
     Versions.VerTypes verType,
     BaseModel.MethodTypes methodType,
     long siteId              = 0,
     long parentId            = 0,
     string referenceType     = null,
     string siteReferenceType = null,
     string title             = null,
     string body              = null,
     bool useBreadcrumb       = true,
     bool useTitle            = true,
     bool useSearch           = true,
     bool useNavigationMenu   = true,
     string script            = null,
     string userScript        = null,
     string userStyle         = null,
     Action action            = null)
 {
     return(hb.Container(
                context: context,
                ss: ss,
                body: body,
                action: () => hb
                .MainContainer(
                    context: context,
                    ss: ss,
                    view: view,
                    verType: verType,
                    methodType: methodType,
                    siteId: siteId,
                    parentId: parentId,
                    referenceType: referenceType,
                    siteReferenceType: siteReferenceType,
                    title: title,
                    useBreadcrumb: useBreadcrumb,
                    useTitle: useTitle,
                    useSearch: useSearch,
                    useNavigationMenu: useNavigationMenu,
                    action: action)
                .HiddenData(
                    context: context,
                    ss: ss)
                .VideoDialog(
                    context: context,
                    ss: ss)
                .Styles(
                    context: context,
                    ss: ss,
                    userStyle: userStyle)
                .Scripts(
                    context: context,
                    ss: ss,
                    script: script,
                    userScript: userScript)));
 }
Exemplo n.º 5
0
 public static HtmlBuilder Comment(
     this HtmlBuilder hb, Comment comment, Versions.VerTypes verType)
 {
     return(comment.Html(
                hb: hb,
                controlId: "Comment" + comment.CommentId,
                action: () => hb
                .DeleteComment(comment: comment, verType: verType)));
 }
Exemplo n.º 6
0
 public CompletionTime(DataRow dataRow, string name)
 {
     Value        = dataRow.DateTime(name);
     DisplayValue = Value.ToLocal().AddDays(-1);
     Status       = new Status(dataRow, "Status");
     UpdatedTime  = dataRow.DateTime("UpdatedTime");
     VerType      = dataRow.Bool("IsHistory")
         ? Versions.VerTypes.History
         : Versions.VerTypes.Latest;
 }
Exemplo n.º 7
0
 public CompletionTime(DataRow dataRow, ColumnNameInfo column)
 {
     Value        = dataRow.DateTime(Rds.DataColumnName(column, "CompletionTime"));
     DisplayValue = Value.ToLocal().AddDays(-1);
     Status       = new Status(dataRow, column);
     UpdatedTime  = dataRow.DateTime(Rds.DataColumnName(column, "UpdatedTime"));
     VerType      = dataRow.Bool(Rds.DataColumnName(column, "IsHistory"))
         ? Versions.VerTypes.History
         : Versions.VerTypes.Latest;
 }
Exemplo n.º 8
0
 public static ResponseCollection PrependComment(
     this ResponseCollection res,
     Comments comments,
     Versions.VerTypes verType)
 {
     return(Forms.Data("Comments").Trim() != string.Empty
         ? res
            .Val("#Comments", string.Empty)
            .Focus("#Comments")
            .Prepend("#CommentList", new HtmlBuilder()
                     .Comment(comment: comments[0], verType: verType))
         : res);
 }
Exemplo n.º 9
0
 public CompletionTime(DataRow dataRow, string name)
 {
     Value        = dataRow.DateTime(name);
     DisplayValue = Value.ToLocal().AddDays(-1);
     Status       = new Status(dataRow, "Status");
     UpdatedTime  = dataRow["UpdatedTime"].ToDateTime();
     if (dataRow.Table.Columns.Contains("IsHistory"))
     {
         VerType = dataRow["IsHistory"].ToBool()
             ? Versions.VerTypes.History
             : Versions.VerTypes.Latest;
     }
 }
Exemplo n.º 10
0
 public CompletionTime(SiteSettings ss, DataRow dataRow, ColumnNameInfo column = null)
 {
     column       = column ?? new ColumnNameInfo("CompletionTime");
     Value        = dataRow.DateTime(Rds.DataColumnName(column, "CompletionTime"));
     DisplayValue = Value
                    .ToLocal()
                    .AddDifferenceOfDates(ss.GetColumn("CompletionTime")?.EditorFormat, minus: true);
     Status      = new Status(dataRow, column);
     UpdatedTime = dataRow.DateTime(Rds.DataColumnName(column, "UpdatedTime"));
     VerType     = dataRow.Bool(Rds.DataColumnName(column, "IsHistory"))
         ? Versions.VerTypes.History
         : Versions.VerTypes.Latest;
 }
Exemplo n.º 11
0
 private static HtmlBuilder EditComment(
     this HtmlBuilder hb, Comment comment, Versions.VerTypes verType)
 {
     return(verType == Versions.VerTypes.Latest && comment.Creator == Sessions.UserId()
         ? hb.P(
                attributes: new HtmlAttributes()
                .Id("EditComment," + comment.CommentId)
                .Class("button edit")
                .OnClick("$p.editComment($(this));"),
                action: () => hb
                .Icon(iconCss: "ui-icon ui-icon-pencil"))
         : hb);
 }
 public static HtmlBuilder MainContainer(
     this HtmlBuilder hb,
     Context context,
     SiteSettings ss,
     View view,
     Versions.VerTypes verType,
     BaseModel.MethodTypes methodType,
     long siteId,
     long parentId,
     string referenceType,
     string siteReferenceType,
     string title,
     Error.Types errorType  = General.Error.Types.None,
     string[] messageData   = null,
     bool useBreadcrumb     = true,
     bool useTitle          = true,
     bool useSearch         = true,
     bool useNavigationMenu = true,
     ServerScriptModelRow serverScriptModelRow = null,
     Action action = null)
 {
     return(hb.Div(id: "MainContainer", action: () => hb
                   .Header(
                       context: context,
                       ss: ss,
                       siteId: siteId,
                       referenceType: referenceType,
                       errorType: errorType,
                       useNavigationMenu: useNavigationMenu,
                       useSearch: useSearch,
                       serverScriptModelRow: serverScriptModelRow)
                   .Content(
                       context: context,
                       ss: ss,
                       view: view,
                       errorType: errorType,
                       messageData: messageData,
                       siteId: siteId,
                       title: title,
                       useBreadcrumb: useBreadcrumb,
                       useTitle: useTitle,
                       action: action)
                   .Div(id: "BottomMargin")
                   .Footer()
                   .BackUrl(
                       context: context,
                       siteId: siteId,
                       parentId: parentId,
                       referenceType: referenceType,
                       siteReferenceType: siteReferenceType)));
 }
Exemplo n.º 13
0
 public static HtmlBuilder Comment(
     this HtmlBuilder hb,
     SiteSettings ss,
     Comment comment,
     Versions.VerTypes verType)
 {
     return(comment.Html(
                hb: hb,
                allowEditing: ss.AllowEditingComments == true,
                verType: verType,
                controlId: "Comment" + comment.CommentId,
                action: () => hb
                .DeleteComment(comment: comment, verType: verType)));
 }
Exemplo n.º 14
0
 public ProgressRate(DataRow dataRow, ColumnNameInfo column)
 {
     CreatedTime    = dataRow.DateTime(Rds.DataColumnName(column, "CreatedTime"));
     StartTime      = dataRow.DateTime(Rds.DataColumnName(column, "StartTime"));
     CompletionTime = dataRow.DateTime(Rds.DataColumnName(column, "CompletionTime"));
     Value          = dataRow.Decimal(Rds.DataColumnName(column, "ProgressRate"));
     UpdatedTime    = dataRow.DateTime(Rds.DataColumnName(column, "UpdatedTime"));
     if (dataRow.Table.Columns.Contains(Rds.DataColumnName(column, "IsHistory")))
     {
         VerType = dataRow.Bool(Rds.DataColumnName(column, "IsHistory"))
             ? Versions.VerTypes.History
             : Versions.VerTypes.Latest;
     }
 }
Exemplo n.º 15
0
 private static HtmlBuilder DeleteComment(
     this HtmlBuilder hb, Comment comment, Versions.VerTypes verType)
 {
     return(verType == Versions.VerTypes.Latest
         ? hb.P(
                attributes: new HtmlAttributes()
                .Id("DeleteComment," + comment.CommentId)
                .Class("button delete")
                .OnClick("$p.send($(this));")
                .DataAction("DeleteComment")
                .DataMethod("delete")
                .DataConfirm("ConfirmDelete"),
                action: () => hb
                .Icon(iconCss: "ui-icon ui-icon-closethick"))
         : hb);
 }
Exemplo n.º 16
0
 public static HtmlBuilder Comments(
     this HtmlBuilder hb,
     Comments comments,
     Column column,
     Versions.VerTypes verType,
     Permissions.ColumnPermissionTypes columnPermissionType)
 {
     return(hb
            .TextArea(
                labelText: column?.LabelText,
                _using: verType == Versions.VerTypes.Latest &&
                column?.EditorReadOnly != true &&
                columnPermissionType == Permissions.ColumnPermissionTypes.Update)
            .Div(id: "CommentList", action: () => comments
                 .ForEach(comment => hb
                          .Comment(comment, verType))));
 }
Exemplo n.º 17
0
 public static ResponseCollection PrependComment(
     this ResponseCollection res,
     SiteSettings ss,
     Column column,
     Comments comments,
     Versions.VerTypes verType)
 {
     return(Forms.Data("Comments").Trim() != string.Empty
         ? res
            .Val("#Comments", string.Empty)
            .Focus("#Comments")
            .Prepend("#CommentList", new HtmlBuilder()
                     .Comment(
                         ss: ss,
                         column: column,
                         comment: comments[0],
                         readOnly: false))
         : res);
 }
Exemplo n.º 18
0
 public static HtmlBuilder MainContainer(
     this HtmlBuilder hb,
     SiteSettings ss,
     Versions.VerTypes verType,
     BaseModel.MethodTypes methodType,
     long siteId,
     long parentId,
     string referenceType,
     string siteReferenceType,
     string title,
     Error.Types errorType  = General.Error.Types.None,
     bool useBreadcrumb     = true,
     bool useTitle          = true,
     bool useSearch         = true,
     bool useNavigationMenu = true,
     string userStyle       = null,
     Action action          = null)
 {
     return(hb.Div(id: "MainContainer", action: () => hb
                   .Header(
                       ss: ss,
                       siteId: siteId,
                       referenceType: referenceType,
                       errorType: errorType,
                       useNavigationMenu: useNavigationMenu,
                       useSearch: useSearch)
                   .Content(
                       ss: ss,
                       errorType: errorType,
                       siteId: siteId,
                       title: title,
                       useBreadcrumb: useBreadcrumb,
                       useTitle: useTitle,
                       action: action)
                   .Div(id: "BottomMargin both")
                   .Footer()
                   .BackUrl(
                       siteId: siteId,
                       parentId: parentId,
                       referenceType: referenceType,
                       siteReferenceType: siteReferenceType)
                   .Styles(style: userStyle)));
 }
Exemplo n.º 19
0
 public ProgressRate(
     DataRow dataRow,
     string createdTimeColumnName    = "CreatedTime",
     string startTimeColumnName      = "StartTime",
     string completionTimeColumnName = "CompletionTime",
     string progressRateColumnName   = "ProgressRate")
 {
     CreatedTime    = dataRow.DateTime(createdTimeColumnName);
     StartTime      = dataRow.DateTime(startTimeColumnName);
     CompletionTime = dataRow.DateTime(completionTimeColumnName);
     Value          = dataRow.Decimal(progressRateColumnName);
     UpdatedTime    = dataRow["UpdatedTime"].ToDateTime();
     if (dataRow.Table.Columns.Contains("IsHistory"))
     {
         VerType = dataRow["IsHistory"].ToBool()
             ? Versions.VerTypes.History
             : Versions.VerTypes.Latest;
     }
 }
Exemplo n.º 20
0
 public static HtmlBuilder Template(
     this HtmlBuilder hb,
     SiteSettings ss,
     Versions.VerTypes verType,
     BaseModel.MethodTypes methodType,
     long siteId              = 0,
     long parentId            = 0,
     string referenceType     = null,
     string siteReferenceType = null,
     string title             = null,
     bool useBreadcrumb       = true,
     bool useTitle            = true,
     bool useSearch           = true,
     bool useNavigationMenu   = true,
     string script            = null,
     string userScript        = null,
     string userStyle         = null,
     Action action            = null)
 {
     return(hb
            .MainContainer(
                ss: ss,
                verType: verType,
                methodType: methodType,
                siteId: siteId,
                parentId: parentId,
                referenceType: referenceType,
                siteReferenceType: siteReferenceType,
                title: title,
                useBreadcrumb: useBreadcrumb,
                useTitle: useTitle,
                useSearch: useSearch,
                useNavigationMenu: useNavigationMenu,
                userStyle: userStyle,
                action: action)
            .HiddenData()
            .Scripts(
                script: script,
                userScript: userScript,
                referenceType: referenceType));
 }
        public static HtmlBuilder Comments(
            this HtmlBuilder hb,
            Context context,
            SiteSettings ss,
            Comments comments,
            Column column,
            Versions.VerTypes verType,
            Permissions.ColumnPermissionTypes columnPermissionType)
        {
            var readOnly = verType != Versions.VerTypes.Latest ||
                           !context.CanUpdate(ss: ss) ||
                           column?.GetEditorReadOnly() == true ||
                           columnPermissionType != Permissions.ColumnPermissionTypes.Update;
            var css = column.TextAlign == SiteSettings.TextAlignTypes.Right
                ? " right-align "
                : string.Empty;

            return(hb
                   .TextArea(
                       context: context,
                       ss: ss,
                       css: css,
                       title: column?.Description,
                       labelText: column?.LabelText,
                       allowImage: column?.AllowImage == true,
                       mobile: context.Mobile == true,
                       _using: !readOnly,
                       validateMaxLength: column.MaxLength.ToInt(),
                       validateRegex: column.ClientRegexValidation,
                       validateRegexErrorMessage: column.RegexValidationMessage)
                   .Div(id: "CommentList", css: css, action: () => comments
                        .ForEach(comment => hb
                                 .Comment(
                                     context: context,
                                     ss: ss,
                                     column: column,
                                     comment: comment,
                                     readOnly: readOnly))));
        }
Exemplo n.º 22
0
        public static HtmlBuilder MainCommands(
            this HtmlBuilder hb,
            SiteSettings ss,
            long siteId,
            Versions.VerTypes verType,
            long referenceId  = 0,
            bool backButton   = true,
            bool updateButton = false,
            bool copyButton   = false,
            bool moveButton   = false,
            bool mailButton   = false,
            bool deleteButton = false,
            Action extensions = null)
        {
            return(hb.Div(id: "MainCommandsContainer", action: () => hb
                          .Div(id: "MainCommands", action: () =>
            {
                if (backButton)
                {
                    hb.Button(
                        controlId: "GoBack",
                        text: Displays.GoBack(),
                        controlCss: "button-icon",
                        accessKey: "q",
                        onClick: "$p.back();",
                        icon: "ui-icon-circle-arrow-w");
                }
                if (Routes.Action() == "new")
                {
                    hb.Button(
                        text: Displays.Create(),
                        controlCss: "button-icon validate",
                        accessKey: "s",
                        onClick: "$p.send($(this));",
                        icon: "ui-icon-disk",
                        action: "Create",
                        method: "post");
                }
                else if (ss.CanRead() && verType == Versions.VerTypes.Latest)
                {
                    hb
                    .Button(
                        text: Displays.Update(),
                        controlCss: "button-icon validate",
                        accessKey: "s",
                        onClick: "$p.send($(this));",
                        icon: "ui-icon-disk",
                        action: "Update",
                        method: "put",
                        _using: updateButton && ss.CanUpdate())
                    .Button(
                        text: Displays.Copy(),
                        controlCss: "button-icon open-dialog",
                        accessKey: "c",
                        onClick: "$p.openDialog($(this));",
                        icon: "ui-icon-copy",
                        selector: "#CopyDialog",
                        _using: copyButton && ss.CanCreate())
                    .Button(
                        text: Displays.Move(),
                        controlCss: "button-icon open-dialog",
                        accessKey: "o",
                        onClick: "$p.moveTargets($(this));",
                        icon: "ui-icon-transferthick-e-w",
                        selector: "#MoveDialog",
                        action: "MoveTargets",
                        method: "get",
                        _using: moveButton && ss.CanUpdate())
                    .Button(
                        controlId: "EditOutgoingMail",
                        text: Displays.Mail(),
                        controlCss: "button-icon",
                        onClick: "$p.openOutgoingMailDialog($(this));",
                        icon: "ui-icon-mail-closed",
                        action: "Edit",
                        method: "put",
                        accessKey: "m",
                        _using: mailButton && ss.CanSendMail())
                    .Button(
                        text: Displays.Delete(),
                        controlCss: "button-icon",
                        accessKey: "r",
                        onClick: "$p.send($(this));",
                        icon: "ui-icon-trash",
                        action: "Delete",
                        method: "delete",
                        confirm: "ConfirmDelete",
                        _using: deleteButton && ss.CanDelete() && !ss.IsSite())
                    .Button(
                        text: Displays.DeleteSite(),
                        controlCss: "button-icon",
                        accessKey: "r",
                        onClick: "$p.openDeleteSiteDialog($(this));",
                        icon: "ui-icon-trash",
                        _using: deleteButton && ss.CanDelete() && ss.IsSite());
                    if (Routes.Controller() == "items" && ss.ReferenceType != "Sites")
                    {
                        switch (Routes.Action())
                        {
                        case "index":
                            hb
                            .Button(
                                text: Displays.BulkMove(),
                                controlCss: "button-icon open-dialog",
                                accessKey: "o",
                                onClick: "$p.moveTargets($(this));",
                                icon: "ui-icon-transferthick-e-w",
                                selector: "#MoveDialog",
                                action: "MoveTargets",
                                method: "get",
                                _using: ss.CanUpdate())
                            .Button(
                                text: Displays.BulkDelete(),
                                controlCss: "button-icon",
                                accessKey: "r",
                                onClick: "$p.send($(this));",
                                icon: "ui-icon-trash",
                                action: "BulkDelete",
                                method: "delete",
                                confirm: "ConfirmDelete",
                                _using: ss.CanDelete())
                            .Button(
                                controlId: "EditImportSettings",
                                text: Displays.Import(),
                                controlCss: "button-icon",
                                accessKey: "w",
                                onClick: "$p.openImportSettingsDialog($(this));",
                                icon: "ui-icon-arrowreturnthick-1-e",
                                selector: "#ImportSettingsDialog",
                                _using: ss.CanImport())
                            .Button(
                                text: Displays.Export(),
                                controlCss: "button-icon",
                                accessKey: "x",
                                onClick: "$p.openExportSelectorDialog($(this));",
                                icon: "ui-icon-arrowreturnthick-1-w",
                                action: "OpenExportSelectorDialog",
                                method: "post",
                                _using: ss.CanExport());
                            break;

                        case "crosstab":
                            hb.Button(
                                text: Displays.Export(),
                                controlCss: "button-icon",
                                accessKey: "x",
                                onClick: "$p.exportCrosstab();",
                                icon: "ui-icon-arrowreturnthick-1-w",
                                _using: ss.CanExport());
                            break;
                        }
                    }
                }
                extensions?.Invoke();
            })));
        }
Exemplo n.º 23
0
        public static HtmlBuilder MainCommands(
            this HtmlBuilder hb,
            Context context,
            SiteSettings ss,
            Versions.VerTypes verType,
            bool backButton   = true,
            bool updateButton = false,
            bool copyButton   = false,
            bool moveButton   = false,
            bool mailButton   = false,
            bool deleteButton = false,
            Action extensions = null)
        {
            return(hb.Div(id: "MainCommandsContainer", action: () => hb
                          .Div(id: "MainCommands", action: () =>
            {
                if (backButton)
                {
                    hb.Button(
                        controlId: "GoBack",
                        text: Displays.GoBack(context: context),
                        controlCss: "button-icon",
                        accessKey: "q",
                        onClick: "$p.back();",
                        icon: "ui-icon-circle-arrow-w");
                }
                if (context.Action == "new")
                {
                    switch (context.Controller)
                    {
                    case "registrations":
                        hb.Button(
                            controlId: "RegistrationId",
                            controlCss: "button-icon validate",
                            text: Displays.Invite(context: context),
                            onClick: "$p.send($(this));",
                            icon: "ui-icon-mail-closed",
                            action: "Create",
                            method: "post");
                        break;

                    default:
                        hb.Button(
                            text: Displays.Create(context: context),
                            controlCss: "button-icon validate",
                            accessKey: "s",
                            onClick: "$p.send($(this));",
                            icon: "ui-icon-disk",
                            action: "Create",
                            method: "post");
                        break;
                    }
                }
                else if (verType == Versions.VerTypes.Latest)
                {
                    switch (context.Controller)
                    {
                    case "users":
                        hb.Common(
                            context: context,
                            ss: ss,
                            updateButton: updateButton,
                            copyButton: copyButton,
                            moveButton: moveButton,
                            mailButton: mailButton,
                            deleteButton: deleteButton);
                        switch (context.Action)
                        {
                        case "index":
                            hb
                            .Button(
                                text: Displays.BulkDelete(context: context),
                                controlCss: "button-icon",
                                accessKey: "r",
                                onClick: "$p.send($(this));",
                                icon: "ui-icon-trash",
                                action: "BulkDelete",
                                method: "delete",
                                confirm: "ConfirmDelete",
                                _using: context.CanDelete(ss: ss))
                            .Button(
                                controlId: "EditImportSettings",
                                text: Displays.Import(context: context),
                                controlCss: "button-icon",
                                accessKey: "w",
                                onClick: "$p.openImportSettingsDialog($(this));",
                                icon: "ui-icon-arrowreturnthick-1-e",
                                selector: "#ImportSettingsDialog",
                                _using: context.CanImport(ss: ss))
                            .Button(
                                text: Displays.Export(context: context),
                                controlCss: "button-icon",
                                accessKey: "x",
                                onClick: "$p.openExportSelectorDialog($(this));",
                                icon: "ui-icon-arrowreturnthick-1-w",
                                action: "OpenExportSelectorDialog",
                                method: "post",
                                _using: context.CanExport(ss: ss));
                            break;
                        }
                        break;

                    case "registrations":
                        switch (context.Action)
                        {
                        case "login":
                            hb.Button(
                                controlId: "RegistrationId",
                                controlCss: "button-icon validate",
                                text: Displays.ApprovalRequest(context: context),
                                onClick: "$p.send($(this));",
                                icon: "ui-icon-mail-closed",
                                action: "ApprovalRequest",
                                method: "post");
                            break;

                        case "edit":
                            hb
                            .Button(
                                controlId: "RegistrationApproval",
                                text: Displays.Approval(context: context),
                                controlCss: "button-icon",
                                onClick: "$p.send($(this));",
                                icon: "ui-icon-mail-closed",
                                action: "Approval",
                                method: "put",
                                _using: Permissions.PrivilegedUsers(loginId: context.LoginId))
                            .Button(
                                text: Displays.Delete(context: context),
                                controlCss: "button-icon",
                                accessKey: "r",
                                onClick: "$p.send($(this));",
                                icon: "ui-icon-trash",
                                action: "Delete",
                                method: "delete",
                                confirm: "ConfirmDelete",
                                _using: deleteButton &&
                                context.CanDelete(ss: ss) &&
                                !ss.IsSite(context: context));
                            break;

                        case "index":
                            hb.Button(
                                text: Displays.BulkDelete(context: context),
                                controlCss: "button-icon",
                                accessKey: "r",
                                onClick: "$p.send($(this));",
                                icon: "ui-icon-trash",
                                action: "BulkDelete",
                                method: "delete",
                                confirm: "ConfirmDelete",
                                _using: context.CanDelete(ss: ss));
                            break;
                        }
                        break;

                    case "items":
                        hb.Common(
                            context: context,
                            ss: ss,
                            updateButton: updateButton,
                            copyButton: copyButton,
                            moveButton: moveButton,
                            mailButton: mailButton,
                            deleteButton: deleteButton);
                        if (context.Forms.Bool("EditOnGrid"))
                        {
                            hb
                            .Button(
                                text: Displays.Update(context: context),
                                controlCss: "button-icon validate",
                                accessKey: "s",
                                onClick: "$p.send($(this));",
                                icon: "ui-icon-disk",
                                action: "UpdateByGrid",
                                method: "post",
                                _using: context.CanRead(ss: ss))
                            .Button(
                                text: Displays.ListMode(context: context),
                                controlCss: "button-icon",
                                onClick: "$p.editOnGrid($(this),0);",
                                icon: "ui-icon-arrowreturnthick-1-w",
                                action: "Index",
                                method: "post",
                                _using: context.CanRead(ss: ss));
                        }
                        else if (ss.ReferenceType != "Sites")
                        {
                            switch (context.Action)
                            {
                            case "index":
                                hb
                                .Button(
                                    text: Displays.BulkMove(context: context),
                                    controlCss: "button-icon open-dialog",
                                    accessKey: "o",
                                    onClick: "$p.moveTargets($(this));",
                                    icon: "ui-icon-transferthick-e-w",
                                    selector: "#MoveDialog",
                                    action: "MoveTargets",
                                    method: "get",
                                    _using: ss.MoveTargets?.Any() == true &&
                                    context.CanUpdate(ss: ss) &&
                                    !ss.GridColumnsHasSources())
                                .Button(
                                    text: Displays.BulkDelete(context: context),
                                    controlCss: "button-icon",
                                    accessKey: "r",
                                    onClick: "$p.send($(this));",
                                    icon: "ui-icon-trash",
                                    action: "BulkDelete",
                                    method: "delete",
                                    confirm: "ConfirmDelete",
                                    _using: context.CanDelete(ss: ss) &&
                                    !ss.GridColumnsHasSources())
                                .Button(
                                    controlId: "EditImportSettings",
                                    text: Displays.Import(context: context),
                                    controlCss: "button-icon",
                                    accessKey: "w",
                                    onClick: "$p.openImportSettingsDialog($(this));",
                                    icon: "ui-icon-arrowreturnthick-1-e",
                                    selector: "#ImportSettingsDialog",
                                    _using: context.CanImport(ss: ss))
                                .Button(
                                    text: Displays.Export(context: context),
                                    controlCss: "button-icon",
                                    accessKey: "x",
                                    onClick: "$p.openExportSelectorDialog($(this));",
                                    icon: "ui-icon-arrowreturnthick-1-w",
                                    action: "OpenExportSelectorDialog",
                                    method: "post",
                                    _using: context.CanExport(ss: ss))
                                .Button(
                                    text: Displays.BulkUpdate(context: context),
                                    controlCss: "button-icon",
                                    accessKey: "s",
                                    onClick: "$p.openBulkUpdateSelectorDialog($(this));",
                                    icon: "ui-icon-disk",
                                    action: "OpenBulkUpdateSelectorDialog",
                                    method: "post",
                                    _using: context.CanUpdate(ss: ss) &&
                                    ss.GetAllowBulkUpdateColumns(context, ss).Any())
                                .Button(
                                    text: Displays.EditMode(context: context),
                                    controlCss: "button-icon",
                                    onClick: "$p.editOnGrid($(this),1);",
                                    icon: "ui-icon-arrowreturnthick-1-w",
                                    action: "Index",
                                    method: "post",
                                    _using: ss.GridEditorType == SiteSettings.GridEditorTypes.Grid &&
                                    context.CanUpdate(ss: ss) &&
                                    !ss.GridColumnsHasSources() &&
                                    ss.IntegratedSites?.Any() != true);
                                break;

                            case "crosstab":
                                hb.Button(
                                    text: Displays.Export(context: context),
                                    controlCss: "button-icon",
                                    accessKey: "x",
                                    onClick: "$p.exportCrosstab();",
                                    icon: "ui-icon-arrowreturnthick-1-w",
                                    _using: context.CanExport(ss: ss));
                                break;
                            }
                        }
                        break;

                    default:
                        hb.Common(
                            context: context,
                            ss: ss,
                            updateButton: updateButton,
                            copyButton: copyButton,
                            moveButton: moveButton,
                            mailButton: mailButton,
                            deleteButton: deleteButton);
                        break;
                    }
                    extensions?.Invoke();
                }
            })));
        }