Example #1
0
        /// <summary>
        /// Fixed:
        /// </summary>
        public void SetByForm(Context context)
        {
            var ss = SiteSettingsUtilities.OutgoingMailsSiteSettings(context: context);

            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "OutgoingMails_To": To = Forms.List(controlId).Join(";"); break;

                case "OutgoingMails_Cc": Cc = Forms.List(controlId).Join(";"); break;

                case "OutgoingMails_Bcc": Bcc = Forms.List(controlId).Join(";"); break;

                case "OutgoingMails_Title": Title = new Title(OutgoingMailId, Forms.Data(controlId)); break;

                case "OutgoingMails_Body": Body = Forms.Data(controlId).ToString(); break;

                case "OutgoingMails_SentTime": SentTime = new Time(Forms.Data(controlId).ToDateTime(), byForm: true); break;

                case "OutgoingMails_DestinationSearchRange": DestinationSearchRange = Forms.Data(controlId).ToString(); break;

                case "OutgoingMails_DestinationSearchText": DestinationSearchText = Forms.Data(controlId).ToString(); break;

                case "OutgoingMails_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments":
                    Comments.Prepend(
                        context: context,
                        ss: new SiteSettings(),
                        body: Forms.Data("Comments"));
                    break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            context: context,
                            ss: ss,
                            commentId: controlId.Substring("Comment".Length).ToInt(),
                            body: Forms.Data(controlId));
                    }
                    break;
                }
            });
        }
        /// <summary>
        /// Fixed:
        /// </summary>
        private static HtmlBuilder Editor(
            this HtmlBuilder hb,
            Context context,
            SiteSettings ss,
            OutgoingMailModel outgoingMailModel)
        {
            var outgoingMailSs = SiteSettingsUtilities
                                 .OutgoingMailsSiteSettings(context: context);
            var titleColumn = outgoingMailSs.GetColumn(
                context: context,
                columnName: "Title");
            var bodyColumn = outgoingMailSs.GetColumn(
                context: context,
                columnName: "Body");

            return(hb
                   .FieldBasket(
                       controlId: "OutgoingMails_To",
                       fieldCss: "field-wide",
                       controlCss: "control-basket cf",
                       labelAction: () => hb
                       .Text(text: Displays.OutgoingMails_To(context: context)))
                   .FieldBasket(
                       controlId: "OutgoingMails_Cc",
                       fieldCss: "field-wide",
                       controlCss: "control-basket cf",
                       labelAction: () => hb
                       .Text(text: Displays.OutgoingMails_Cc(context: context)))
                   .FieldBasket(
                       controlId: "OutgoingMails_Bcc",
                       fieldCss: "field-wide",
                       controlCss: "control-basket cf",
                       labelAction: () => hb
                       .Text(text: Displays.OutgoingMails_Bcc(context: context)))
                   .FieldTextBox(
                       controlId: "OutgoingMails_Title",
                       fieldCss: "field-wide",
                       controlCss: " always-send",
                       labelText: Displays.OutgoingMails_Title(context: context),
                       text: ReplyTitle(outgoingMailModel),
                       validateRequired: titleColumn.ValidateRequired ?? false,
                       validateMaxLength: titleColumn.ValidateMaxLength ?? 0)
                   .FieldTextBox(
                       textType: HtmlTypes.TextTypes.MultiLine,
                       controlId: "OutgoingMails_Body",
                       fieldCss: "field-wide",
                       controlCss: " always-send h300",
                       labelText: Displays.OutgoingMails_Body(context: context),
                       text: ReplyBody(
                           context: context,
                           outgoingMailModel: outgoingMailModel),
                       validateRequired: bodyColumn.ValidateRequired ?? false,
                       validateMaxLength: bodyColumn.ValidateMaxLength ?? 0)
                   .P(css: "message-dialog")
                   .Div(css: "command-center", action: () => hb
                        .Button(
                            controlId: "OutgoingMails_Send",
                            controlCss: "button-icon validate",
                            text: Displays.Send(context: context),
                            onClick: "$p.sendMail($(this));",
                            icon: "ui-icon-mail-closed",
                            action: "Send",
                            method: "post",
                            confirm: "ConfirmSendMail")
                        .Button(
                            controlId: "OutgoingMails_Cancel",
                            controlCss: "button-icon",
                            text: Displays.Cancel(context: context),
                            onClick: "$p.closeDialog($(this));",
                            icon: "ui-icon-cancel"))
                   .Hidden(
                       controlId: "OutgoingMails_Location",
                       value: Locations.OutGoingMailAbsoluteUri(context: context))
                   .Hidden(
                       controlId: "OutgoingMails_Reply",
                       value: outgoingMailModel.AccessStatus == Databases.AccessStatuses.Selected
                        ? "1"
                        : "0")
                   .Hidden(
                       controlId: "To",
                       value: MailDefault(
                           context: context,
                           ss: ss,
                           outgoingMailModel: outgoingMailModel,
                           mailDefault: ss.MailToDefault,
                           type: "to"))
                   .Hidden(
                       controlId: "Cc",
                       value: MailDefault(
                           context: context,
                           ss: ss,
                           outgoingMailModel: outgoingMailModel,
                           mailDefault: ss.MailCcDefault,
                           type: "cc"))
                   .Hidden(
                       controlId: "Bcc",
                       value: MailDefault(
                           context: context,
                           ss: ss,
                           outgoingMailModel: outgoingMailModel,
                           mailDefault: ss.MailBccDefault,
                           type: "bcc")));
        }