/// <summary>
 /// Creates a radio button.
 /// </summary>
 internal EwfCheckBox( FormValue<CommonCheckBox> formValue, string label, PostBack postBack, string listItemId = null )
 {
     radioButtonFormValue = formValue;
     radioButtonListItemId = listItemId;
     this.label = label;
     this.postBack = postBack;
 }
 /// <summary>
 /// Creates a radio button.
 /// </summary>
 internal BlockCheckBox( FormValue<CommonCheckBox> formValue, string label, PostBack postBack, string listItemId = null )
 {
     radioButtonFormValue = formValue;
     radioButtonListItemId = listItemId;
     this.label = label;
     this.postBack = postBack;
     NestedControls = new List<Control>();
 }
 /// <summary>
 /// Creates a check box. Do not pass null for label.
 /// </summary>
 public BlockCheckBox( bool isChecked, string label = "", bool highlightWhenChecked = false, PostBack postBack = null )
 {
     checkBoxFormValue = EwfCheckBox.GetFormValue( isChecked, this );
     this.label = label;
     this.highlightWhenChecked = highlightWhenChecked;
     this.postBack = postBack;
     NestedControls = new List<Control>();
 }
 private EwfHiddenField( string value )
 {
     formValue = new FormValue<string>(
         () => value,
         () => UniqueID,
         v => v,
         rawValue =>
         rawValue != null ? PostBackValueValidationResult<string>.CreateValidWithValue( rawValue ) : PostBackValueValidationResult<string>.CreateInvalid() );
 }
Example #5
0
        private void addButton_Click(object sender, EventArgs e)
        {
            FormValue <string, string> formValue = changeComboBox(groupComboBox.Text);

            controller.addButtonClick(formValue);

            dataGridViewImpurityQuality.Rows.Clear();
            DAO.getInstance().selectImpurityTable(formValue.getKey(), dataGridViewImpurityQuality);
            dataGridViewImpurityQuality.ClearSelection();
        }
Example #6
0
 private EwfHiddenField(string value)
 {
     formValue = new FormValue <string>(() => value,
                                        () => UniqueID,
                                        v => v,
                                        rawValue =>
                                        rawValue != null
                                                            ? PostBackValueValidationResult <string> .CreateValidWithValue(rawValue)
                                                            : PostBackValueValidationResult <string> .CreateInvalid());
 }
 public EwfFileUpload()
 {
     formValue = new FormValue <HttpPostedFile>(
         () => null,
         () => this.IsOnPage() ? UniqueID : "",
         v => "",
         rawValue =>
         rawValue != null
                                 ? PostBackValueValidationResult <HttpPostedFile> .CreateValid(rawValue.ContentLength > 0 ? rawValue : null)
                                 : PostBackValueValidationResult <HttpPostedFile> .CreateInvalid());
 }
 public EwfFileUpload()
 {
     formValue = new FormValue<HttpPostedFile>(
         () => null,
         () => this.IsOnPage() ? UniqueID : "",
         v => "",
         rawValue =>
         rawValue != null
             ? PostBackValueValidationResult<HttpPostedFile>.CreateValidWithValue( rawValue.ContentLength > 0 ? rawValue : null )
             : PostBackValueValidationResult<HttpPostedFile>.CreateInvalid() );
 }
        public Attachment CreateAttachment(FileInfo fileInfo, FormValue formValue)
        {
            var attachment = new Attachment
            {
                FormValue = formValue,
                FileName  = fileInfo.FullName,
                TypeId    = AttachmentTypesRepository.FromExtension(fileInfo.Extension).Id,
                FileSize  = -1 // not yet copied to the file repository
            };

            return(attachment);
        }
Example #10
0
        private static string ParseFormMessage(string formMessage, Webpage webpage, FormPosting formPosting)
        {
            Regex formRegex    = new Regex(@"\[form\]");
            Regex pageRegex    = new Regex(@"{{page.(.*)}}", RegexOptions.IgnoreCase | RegexOptions.Compiled);
            Regex messageRegex = new Regex(@"{{(.*)}}", RegexOptions.IgnoreCase | RegexOptions.Compiled);

            formMessage = formRegex.Replace(formMessage, match =>
            {
                TagBuilder list = new TagBuilder("ul");

                foreach (FormValue formValue in formPosting.FormValues)
                {
                    TagBuilder listItem = new TagBuilder("li");

                    TagBuilder title    = new TagBuilder("b");
                    title.InnerHtml    += formValue.Key + ":";
                    listItem.InnerHtml += title.ToString() + " " +
                                          formValue.GetMessageValue();

                    list.InnerHtml += listItem.ToString();
                }

                return(list.ToString());
            });

            formMessage = pageRegex.Replace(formMessage, match =>
            {
                System.Reflection.PropertyInfo propertyInfo =
                    typeof(Webpage).GetProperties().FirstOrDefault(
                        info =>
                        info.Name.Equals(match.Value.Replace("{", "").Replace("}", "").Replace("page.", ""),
                                         StringComparison.OrdinalIgnoreCase));

                return(propertyInfo == null
                    ? string.Empty
                    : propertyInfo.GetValue(webpage,
                                            null).
                       ToString());
            });
            return(messageRegex.Replace(formMessage, match =>
            {
                FormValue formValue =
                    formPosting.FormValues.FirstOrDefault(
                        value =>
                        value.Key.Equals(
                            match.Value.Replace("{", "").Replace("}", ""),
                            StringComparison.
                            OrdinalIgnoreCase));
                return formValue == null
                    ? string.Empty
                    : formValue.GetMessageValue();
            }));
        }
Example #11
0
 public bool onSaveClick(FormValue <string, string> formValue, string value)
 {
     if (!DAO.getInstance().addNote(formValue.getKey(), new FormValue <string, string> (formValue.getValue(), value)))
     {
         MessageBox.Show("Данный показатель уже существует!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     else
     {
         return(true);
     }
 }
        /// <summary>
        /// Creates a file-upload control.
        /// </summary>
        /// <param name="displaySetup"></param>
        /// <param name="validationPredicate"></param>
        /// <param name="validationErrorNotifier"></param>
        /// <param name="validationMethod">The validation method. Pass null if you’re only using this control for page modification.</param>
        public FileUpload(
            DisplaySetup displaySetup = null, Func <bool, bool> validationPredicate = null, Action validationErrorNotifier = null,
            Action <RsFile, Validator> validationMethod = null)
        {
            Labeler = new FormControlLabeler();

            var id        = new ElementId();
            var formValue = new FormValue <HttpPostedFile>(
                () => null,
                () => id.Id,
                v => "",
                rawValue => rawValue == null
                                                    ? PostBackValueValidationResult <HttpPostedFile> .CreateInvalid()
                                                    : PostBackValueValidationResult <HttpPostedFile> .CreateValid(rawValue.ContentLength > 0 ? rawValue : null));

            PageComponent = new CustomPhrasingComponent(
                new DisplayableElement(
                    context => {
                formMultipartEncodingSetter();
                return(new DisplayableElementData(
                           displaySetup,
                           () => {
                    var attributes = new List <ElementAttribute>();
                    attributes.Add(new ElementAttribute("type", "file"));
                    attributes.Add(new ElementAttribute("name", context.Id));

                    return new DisplayableElementLocalData(
                        "input",
                        new FocusabilityCondition(true),
                        isFocused => {
                        if (isFocused)
                        {
                            attributes.Add(new ElementAttribute("autofocus"));
                        }
                        return new DisplayableElementFocusDependentData(attributes: attributes);
                    });
                },
                           clientSideIdReferences: id.ToCollection().Append(Labeler.ControlId)));
            },
                    formValue: formValue).ToCollection());

            if (validationMethod != null)
            {
                Validation = formValue.CreateValidation(
                    (postBackValue, validator) => {
                    if (validationPredicate != null && !validationPredicate(postBackValue.ChangedOnPostBack))
                    {
                        return;
                    }
                    validationMethod(getRsFile(postBackValue.Value), validator);
                });
            }
        }
Example #13
0
        public async Task <IActionResult> PostFormValue([FromBody] FormValue formValue)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.FormValues.Add(formValue);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetFormValue", new { id = formValue.Id }, formValue));
        }
        /// <summary>
        /// Creates a check box.
        /// </summary>
        /// <param name="isChecked"></param>
        /// <param name="validationMethod">The validation method. Do not pass null.</param>
        /// <param name="label">Do not pass null.</param>
        /// <param name="setup">The setup object for the check box.</param>
        public BlockCheckBox(bool isChecked, Action <PostBackValue <bool>, Validator> validationMethod, string label = "", BlockCheckBoxSetup setup = null)
        {
            this.setup = setup ?? new BlockCheckBoxSetup();

            checkBoxFormValue = EwfCheckBox.GetFormValue(isChecked, this);

            this.label = label;
            action     = this.setup.Action ?? FormState.Current.DefaultAction;

            validation = checkBoxFormValue.CreateValidation(validationMethod);

            nestedControls = this.setup.NestedControlListGetter != null?this.setup.NestedControlListGetter().ToImmutableArray() : ImmutableArray <Control> .Empty;
        }
Example #15
0
        public void deleteNote(string nameTable, FormValue<string, string> primaryKey)
        {
            string sqlCommand;
            sqlCommand = string.Format("Delete {0} where {1}='{2}'", nameTable, primaryKey.getKey(), primaryKey.getValue());

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand cmd = new SqlCommand(sqlCommand, connection);
                cmd.ExecuteNonQuery();
                connection.Close();
            }
        }
        /// <summary>
        /// Creates a radio button.
        /// </summary>
        internal BlockCheckBox(
            FormValue <CommonCheckBox> formValue, string label, BlockCheckBoxSetup setup, Func <IEnumerable <string> > jsClickHandlerStatementListGetter,
            EwfValidation validation, string listItemId = null)
        {
            radioButtonFormValue  = formValue;
            radioButtonListItemId = listItemId;
            this.label            = label;
            this.setup            = setup;
            action = setup.Action ?? FormState.Current.DefaultAction;
            jsClickHandlerStatementLists.Add(jsClickHandlerStatementListGetter);

            this.validation = validation;

            nestedControls = setup.NestedControlListGetter != null?setup.NestedControlListGetter().ToImmutableArray() : ImmutableArray <Control> .Empty;
        }
        /// <summary>
        /// Creates a hidden field.
        /// </summary>
        /// <param name="value">Do not pass null.</param>
        /// <param name="id"></param>
        /// <param name="pageModificationValue"></param>
        /// <param name="validationMethod">The validation method. Pass null if you’re only using this control for page modification.</param>
        /// <param name="jsInitStatementGetter">A function that takes the field’s ID and returns the JavaScript statements that should be executed when the DOM is
        /// loaded. Do not return null.</param>
        public EwfHiddenField(
            string value, HiddenFieldId id = null, PageModificationValue <string> pageModificationValue = null,
            Action <PostBackValue <string>, Validator> validationMethod = null, Func <string, string> jsInitStatementGetter = null)
        {
            pageModificationValue = pageModificationValue ?? new PageModificationValue <string>();

            var elementId = new ElementId();
            var formValue = new FormValue <string>(
                () => value,
                () => elementId.Id,
                v => v,
                rawValue => rawValue != null ? PostBackValueValidationResult <string> .CreateValid(rawValue) : PostBackValueValidationResult <string> .CreateInvalid());

            component = new ElementComponent(
                context => {
                elementId.AddId(context.Id);
                id?.AddId(context.Id);
                return(new ElementData(
                           () => {
                    var attributes = new List <Tuple <string, string> >();
                    attributes.Add(Tuple.Create("type", "hidden"));
                    attributes.Add(Tuple.Create("name", context.Id));
                    attributes.Add(Tuple.Create("value", pageModificationValue.Value));

                    return new ElementLocalData(
                        "input",
                        focusDependentData: new ElementFocusDependentData(
                            attributes: attributes,
                            includeIdAttribute: id != null || pageModificationValue != null || jsInitStatementGetter != null,
                            jsInitStatements: StringTools.ConcatenateWithDelimiter(
                                " ",
                                pageModificationValue != null
                                                                                        ? "$( '#{0}' ).change( function() {{ {1} }} );".FormatWith(
                                    context.Id,
                                    pageModificationValue.GetJsModificationStatements("$( this ).val()"))
                                                                                        : "",
                                jsInitStatementGetter?.Invoke(context.Id) ?? "")));
                }));
            },
                formValue: formValue);

            formValue.AddPageModificationValue(pageModificationValue, v => v);

            if (validationMethod != null)
            {
                validation = formValue.CreateValidation(validationMethod);
            }
        }
Example #18
0
        // Token: 0x0600243B RID: 9275 RVA: 0x000D1710 File Offset: 0x000CF910
        protected void InitializeView(PlaceHolder placeHolder)
        {
            if (placeHolder == null)
            {
                throw new ArgumentNullException("placeHolder");
            }
            OwaQueryStringParameters owaQueryStringParameters = new OwaQueryStringParameters();

            owaQueryStringParameters.SetApplicationElement(this.lastModuleApplicationElement);
            owaQueryStringParameters.ItemClass = this.lastModuleContentClass;
            if (this.lastModuleState != null)
            {
                owaQueryStringParameters.State = this.lastModuleState;
            }
            if (this.lastModuleMappingAction != null)
            {
                owaQueryStringParameters.Action = this.lastModuleMappingAction;
            }
            if (this.lastMailFolderId != null)
            {
                owaQueryStringParameters.Id = this.lastMailFolderId;
            }
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(owaQueryStringParameters.QueryString);
            if (this.recipientBlockType == RecipientBlockType.DL)
            {
                stringBuilder.Append("&dl=1");
            }
            FormValue formValue = RequestDispatcherUtilities.DoFormsRegistryLookup(base.SessionContext, owaQueryStringParameters.ApplicationElement, owaQueryStringParameters.ItemClass, owaQueryStringParameters.Action, owaQueryStringParameters.State);

            if (formValue != null && RequestDispatcher.DoesSubPageSupportSingleDocument(formValue.Value as string))
            {
                OwaSubPage owaSubPage = (OwaSubPage)this.Page.LoadControl(Path.GetFileName(formValue.Value as string));
                Utilities.PutOwaSubPageIntoPlaceHolder(placeHolder, "b" + Utilities.HtmlEncode(this.lastModuleContainerId), owaSubPage, owaQueryStringParameters, "class=\"mainView\"", false);
                this.ChildSubPages.Add(owaSubPage);
                return;
            }
            StringBuilder stringBuilder2 = new StringBuilder();

            stringBuilder2.Append("<iframe allowtransparency id=\"");
            stringBuilder2.Append("b");
            Utilities.HtmlEncode(this.lastModuleContainerId, stringBuilder2);
            stringBuilder2.Append("\" src=\"");
            stringBuilder2.Append(stringBuilder.ToString());
            stringBuilder2.Append("\" class=\"mainView\" _cF=\"1\" frameborder=\"0\"></iframe>");
            placeHolder.Controls.Add(new LiteralControl(stringBuilder2.ToString()));
        }
Example #19
0
        public DataTable findRow(string nameTable, FormValue<string, string> value)
        {
            string sqlCommand = string.Empty;
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                sqlCommand = string.Format("Select * From {0} where UPPER(REPLACE({1},' ','')) LIKE(UPPER(REPLACE('{2}',' ','')))", nameTable, value.getKey(),  " %" + value.getValue().Trim() + "%");
                connection.Open();
                SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCommand, connection);
                SqlCommandBuilder builder = new SqlCommandBuilder(dataAdapter);

                DataTable table = new DataTable();
                dataAdapter.Fill(table);
                connection.Close();
                return table;
            }
        }
        public void DoImageToComparison()
        {
            bool flag = this.pictureBox1.Image != null;

            if (flag)
            {
                FormValue formValue = new FormValue();
                formValue.Text = "对比度";
                bool flag2 = formValue.ShowDialog() == DialogResult.OK;
                if (flag2)
                {
                    this.pictureBox1.Image = this.pictureBox1.Image.KiContrast(formValue.ResultValue);
                    this._zoombefore       = this._zoombefore.KiContrast(formValue.ResultValue);
                    this.UCCenterImg_CompressSaveFile();
                }
            }
        }
        public void DoChangeLightness()
        {
            bool flag = this.pictureBox1.Image != null;

            if (flag)
            {
                FormValue formValue = new FormValue();
                formValue.Text = "亮度";
                bool flag2 = formValue.ShowDialog() == DialogResult.OK;
                if (flag2)
                {
                    this.pictureBox1.Image = this.pictureBox1.Image.Lightness(formValue.ResultValue);
                    this._zoombefore       = this._zoombefore.Lightness(formValue.ResultValue);
                    this.UCCenterImg_CompressSaveFile();
                }
            }
        }
        /// <summary>
        /// Creates a radio button group.
        /// </summary>
        /// <param name="allowNoSelection">Pass true to allow the state in which none of the radio buttons are selected. Note that this is not recommended by the
        /// Nielsen Norman Group; see http://www.nngroup.com/articles/checkboxes-vs-radio-buttons/ for more information.</param>
        /// <param name="disableSingleButtonDetection">Pass true to allow just a single radio button to be displayed for this group. Use with caution, as this
        /// violates the HTML specification.</param>
        public RadioButtonGroup(bool allowNoSelection, bool disableSingleButtonDetection = false)
        {
            formValue = GetFormValue(allowNoSelection,
                                     () => from i in checkBoxesAndSelectionStates select i.Item1,
                                     () => from i in checkBoxesAndSelectionStates where i.Item2 select i.Item1,
                                     v => v != null ? ((Control)v).UniqueID : "",
                                     rawValue => from checkBoxAndSelectionState in checkBoxesAndSelectionStates
                                     let control = (Control)checkBoxAndSelectionState.Item1
                                                   where control.IsOnPage() && control.UniqueID == rawValue
                                                   select checkBoxAndSelectionState.Item1);

            EwfPage.Instance.AddControlTreeValidation(
                () =>
                ValidateControls(allowNoSelection,
                                 checkBoxesAndSelectionStates.All(i => !i.Item2),
                                 checkBoxesAndSelectionStates.Select(i => i.Item1),
                                 disableSingleButtonDetection));
        }
        /// <summary>
        /// Creates a radio button group.
        /// </summary>
        /// <param name="allowNoSelection">Pass true to allow the state in which none of the radio buttons are selected. Note that this is not recommended by the
        /// Nielsen Norman Group; see http://www.nngroup.com/articles/checkboxes-vs-radio-buttons/ for more information.</param>
        /// <param name="disableSingleButtonDetection">Pass true to allow just a single radio button to be displayed for this group. Use with caution, as this
        /// violates the HTML specification.</param>
        public RadioButtonGroup( bool allowNoSelection, bool disableSingleButtonDetection = false )
        {
            formValue = GetFormValue( allowNoSelection,
                                      () => from i in checkBoxesAndSelectionStates select i.Item1,
                                      () => from i in checkBoxesAndSelectionStates where i.Item2 select i.Item1,
                                      v => v != null ? ( (Control)v ).UniqueID : "",
                                      rawValue => from checkBoxAndSelectionState in checkBoxesAndSelectionStates
                                                  let control = (Control)checkBoxAndSelectionState.Item1
                                                  where control.IsOnPage() && control.UniqueID == rawValue
                                                  select checkBoxAndSelectionState.Item1 );

            EwfPage.Instance.AddControlTreeValidation(
                () =>
                ValidateControls( allowNoSelection,
                                  checkBoxesAndSelectionStates.All( i => !i.Item2 ),
                                  checkBoxesAndSelectionStates.Select( i => i.Item1 ),
                                  disableSingleButtonDetection ) );
        }
Example #24
0
        public void updateNote(string nameTable, FormValue<string, string> primaryKey, params FormValue<string, string>[] values)
        {
            string sqlCommand;
            string settingString = string.Empty;
            if (values.Length > 0) settingString += values[0].getKey() + "='" + values[0].getValue() + "'";
            for (int i = 1; i < values.Length; i++)
            {
                settingString += ", " + values[i].getKey() + "='" + values[i].getValue() + "'";
            }
            sqlCommand = string.Format("Update {0} Set {1} where {2}='{3}'", nameTable, settingString, primaryKey.getKey(), primaryKey.getValue());

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand cmd = new SqlCommand(sqlCommand, connection);
                cmd.ExecuteNonQuery();
                connection.Close();
            }
        }
        /// <summary>
        /// Creates a simple HTML editor.
        /// </summary>
        /// <param name="value">Do not pass null.</param>
        /// <param name="ckEditorConfiguration">A comma-separated list of CKEditor configuration options ("toolbar: [ [ 'Bold', 'Italic' ] ]", etc.). Use this to
        /// customize the underlying CKEditor. Do not pass null.</param>
        public WysiwygHtmlEditor( string value, string ckEditorConfiguration = "" )
        {
            this.ckEditorConfiguration = ckEditorConfiguration;

            formValue = new FormValue<string>(
                () => value,
                () => this.IsOnPage() ? UniqueID : "",
                v => v,
                rawValue => {
                    if( rawValue == null )
                        return PostBackValueValidationResult<string>.CreateInvalid();

                    // This hack prevents the NewLine that CKEditor seems to always add to the end of the textarea from causing
                    // ValueChangedOnPostBack to always return true.
                    if( rawValue.EndsWith( Environment.NewLine ) && rawValue.Remove( rawValue.Length - Environment.NewLine.Length ) == formValue.GetDurableValue() )
                        rawValue = formValue.GetDurableValue();

                    return PostBackValueValidationResult<string>.CreateValidWithValue( rawValue );
                } );
        }
 /// <summary>
 /// Creates a radio button.
 /// </summary>
 internal Checkbox(
     FormValue <ElementId> formValue, ElementId id, RadioButtonSetup setup, IReadOnlyCollection <PhrasingComponent> label, FormAction selectionChangedAction,
     Func <string> jsClickStatementGetter, EwfValidation validation, string listItemId = null)
 {
     PageComponent = getComponent(
         formValue,
         id,
         listItemId,
         setup.DisplaySetup,
         setup.IsReadOnly,
         setup.Classes,
         setup.PageModificationValue,
         label,
         setup.Action,
         selectionChangedAction,
         () => setup.IsReadOnly
                                       ? ""
                                       : (setup.PageModificationValue.Value ? "" : selectionChangedAction?.GetJsStatements() ?? "")
         .ConcatenateWithSpace(jsClickStatementGetter()));
     Validation = validation;
 }
Example #27
0
        /// <summary>
        /// Creates a simple HTML editor.
        /// </summary>
        /// <param name="value">Do not pass null.</param>
        /// <param name="ckEditorConfiguration">A comma-separated list of CKEditor configuration options ("toolbar: [ [ 'Bold', 'Italic' ] ]", etc.). Use this to
        /// customize the underlying CKEditor. Do not pass null.</param>
        public WysiwygHtmlEditor(string value, string ckEditorConfiguration = "")
        {
            this.ckEditorConfiguration = ckEditorConfiguration;

            formValue = new FormValue <string>(
                () => value,
                () => this.IsOnPage() ? UniqueID : "",
                v => v,
                rawValue => {
                if (rawValue == null)
                {
                    return(PostBackValueValidationResult <string> .CreateInvalid());
                }

                // This hack prevents the NewLine that CKEditor seems to always add to the end of the textarea from causing
                // ValueChangedOnPostBack to always return true.
                if (rawValue.EndsWith(Environment.NewLine) && rawValue.Remove(rawValue.Length - Environment.NewLine.Length) == formValue.GetDurableValue())
                {
                    rawValue = formValue.GetDurableValue();
                }

                return(PostBackValueValidationResult <string> .CreateValidWithValue(rawValue));
            });
        }
Example #28
0
        // Token: 0x060021C3 RID: 8643 RVA: 0x000C0B60 File Offset: 0x000BED60
        protected void RenderReadingPane()
        {
            OwaQueryStringParameters defaultItemParameters = this.GetDefaultItemParameters();
            string text  = null;
            string text2 = null;

            if (defaultItemParameters != null)
            {
                text = defaultItemParameters.ItemClass;
                FormValue formValue = RequestDispatcherUtilities.DoFormsRegistryLookup(base.UserContext, defaultItemParameters.ApplicationElement, defaultItemParameters.ItemClass, defaultItemParameters.Action, defaultItemParameters.State);
                if (formValue != null)
                {
                    text2 = (formValue.Value as string);
                }
            }
            bool flag  = this.ReadingPanePosition != ReadingPanePosition.Off && base.UserContext.IsFeatureEnabled(Feature.SMime) && base.UserContext.BrowserType == BrowserType.IE && text != null && ObjectClass.IsSmime(text);
            bool flag2 = this.listView.TotalCount < 1;

            if (!flag && this.ReadingPanePosition != ReadingPanePosition.Off && text2 != null && RequestDispatcher.DoesSubPageSupportSingleDocument(text2))
            {
                if (base.UserContext.IsEmbeddedReadingPaneDisabled)
                {
                    this.readingPanePlaceHolder.Controls.Add(new LiteralControl("<div id=ifRP url=\"about:blank\"></div>"));
                    this.readingPanePlaceHolder.RenderControl(new HtmlTextWriter(this.Writer));
                    return;
                }
                try
                {
                    OwaSubPage owaSubPage = (OwaSubPage)this.Page.LoadControl(Path.GetFileName(text2));
                    Utilities.PutOwaSubPageIntoPlaceHolder(this.readingPanePlaceHolder, "ifRP", owaSubPage, defaultItemParameters, null, flag2);
                    base.ChildSubPages.Add(owaSubPage);
                    this.readingPanePlaceHolder.RenderControl(new HtmlTextWriter(this.Writer));
                    return;
                }
                catch (Exception innerException)
                {
                    throw new OwaRenderingEmbeddedReadingPaneException(innerException);
                }
            }
            string s;

            if (!flag && this.ReadingPanePosition != ReadingPanePosition.Off && defaultItemParameters != null)
            {
                s = defaultItemParameters.QueryString;
            }
            else
            {
                s = base.UserContext.GetBlankPage();
            }
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("<iframe id=\"ifRP\" frameborder=\"0\" allowtransparency src=\"");
            Utilities.HtmlEncode(s, stringBuilder);
            stringBuilder.Append("\"");
            if (flag2)
            {
                stringBuilder.Append(" style=\"display:none\"");
            }
            if (flag)
            {
                stringBuilder.Append(" _Loc=\"");
                Utilities.HtmlEncode(s, stringBuilder);
                stringBuilder.Append("\"");
                stringBuilder.Append(" onload=\"");
                stringBuilder.Append("var oMmCtVer = null;");
                stringBuilder.Append("try {oMmCtVer = new ActiveXObject('OwaSMime2.MimeCtlVer');}catch (e){};");
                stringBuilder.Append("if(!oMmCtVer && this._Loc && this.src != this._Loc){this._Loc='';this.onload='';this.src=this._Loc;}\"");
            }
            stringBuilder.Append("></iframe>");
            this.readingPanePlaceHolder.Controls.Add(new LiteralControl(stringBuilder.ToString()));
            this.readingPanePlaceHolder.RenderControl(new HtmlTextWriter(this.Writer));
        }
 /// <summary>
 /// Creates a displayable element.
 /// </summary>
 public DisplayableElement(Func <ElementContext, DisplayableElementData> elementDataGetter, FormValue formValue = null)
 {
     children = new ElementComponent(context => elementDataGetter(context).BaseDataGetter(context), formValue: formValue).ToCollection();
 }
Example #30
0
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            if (!Accepts(parentElement))
            {
                return;
            }
            FormProperty property = new FormProperty();

            BpmnXMLUtil.AddXMLLocation(property, xtr);
            property.Id                = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_ID);
            property.Name              = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_NAME);
            property.Type              = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_TYPE);
            property.Variable          = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_VARIABLE);
            property.Expression        = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_EXPRESSION);
            property.DefaultExpression = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_DEFAULT);
            property.DatePattern       = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_DATEPATTERN);
            if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_REQUIRED)))
            {
                property.Required = Convert.ToBoolean(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_REQUIRED));
            }
            if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_READABLE)))
            {
                property.Readable = Convert.ToBoolean(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_READABLE));
            }
            if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_WRITABLE)))
            {
                property.Writeable = Convert.ToBoolean(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_WRITABLE));
            }

            bool readyWithFormProperty = false;

            try
            {
                while (!readyWithFormProperty && xtr.HasNext())
                {
                    //xtr.next();

                    if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_VALUE.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase))
                    {
                        FormValue value = new FormValue();
                        BpmnXMLUtil.AddXMLLocation(value, xtr);
                        value.Id   = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID);
                        value.Name = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAME);
                        property.FormValues.Add(value);
                    }
                    else if (xtr.EndElement && ElementName.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase))
                    {
                        readyWithFormProperty = true;
                    }

                    if (xtr.IsEmptyElement && ElementName.Equals(xtr.LocalName, StringComparison.OrdinalIgnoreCase))
                    {
                        readyWithFormProperty = true;
                    }
                }
            }
            catch (Exception e)
            {
                log.LogWarning(e, "Error parsing form properties child elements");
            }

            if (parentElement is UserTask)
            {
                ((UserTask)parentElement).FormProperties.Add(property);
            }
            else
            {
                ((StartEvent)parentElement).FormProperties.Add(property);
            }
        }
        private PhrasingComponent getComponent(
            FormValue formValue, ElementId id, string radioButtonListItemId, DisplaySetup displaySetup, bool isReadOnly, ElementClassSet classes,
            PageModificationValue <bool> pageModificationValue, IReadOnlyCollection <PhrasingComponent> label, FormAction action, FormAction valueChangedAction,
            Func <string> jsClickStatementGetter)
        {
            return(new CustomPhrasingComponent(
                       new DisplayableElement(
                           labelContext => new DisplayableElementData(
                               displaySetup,
                               () => new DisplayableElementLocalData("label"),
                               classes: elementClass.Add(classes ?? ElementClassSet.Empty),
                               children: new DisplayableElement(
                                   context => {
                if (!isReadOnly)
                {
                    action?.AddToPageIfNecessary();
                    valueChangedAction?.AddToPageIfNecessary();
                }

                return new DisplayableElementData(
                    null,
                    () => {
                    var attributes = new List <ElementAttribute>();
                    var radioButtonFormValue = formValue as FormValue <ElementId>;
                    attributes.Add(new ElementAttribute("type", radioButtonFormValue != null ? "radio" : "checkbox"));
                    if (radioButtonFormValue != null || !isReadOnly)
                    {
                        attributes.Add(
                            new ElementAttribute(
                                "name",
                                radioButtonFormValue != null ? ((FormValue)radioButtonFormValue).GetPostBackValueKey() : context.Id));
                    }
                    if (radioButtonFormValue != null)
                    {
                        attributes.Add(new ElementAttribute("value", radioButtonListItemId ?? context.Id));
                    }
                    if (pageModificationValue.Value)
                    {
                        attributes.Add(new ElementAttribute("checked"));
                    }
                    if (isReadOnly)
                    {
                        attributes.Add(new ElementAttribute("disabled"));
                    }

                    var jsInitStatements = StringTools.ConcatenateWithDelimiter(
                        " ",
                        !isReadOnly
                                                                                                        ? SubmitButton.GetImplicitSubmissionKeyPressStatements(action, false)
                        .Surround("$( '#{0}' ).keypress( function( e ) {{ ".FormatWith(context.Id), " } );")
                                                                                                        : "",
                        jsClickStatementGetter().Surround("$( '#{0}' ).click( function() {{ ".FormatWith(context.Id), " } );"));

                    return new DisplayableElementLocalData(
                        "input",
                        new FocusabilityCondition(!isReadOnly),
                        isFocused => {
                        if (isFocused)
                        {
                            attributes.Add(new ElementAttribute("autofocus"));
                        }
                        return new DisplayableElementFocusDependentData(
                            attributes: attributes,
                            includeIdAttribute: true,
                            jsInitStatements: jsInitStatements);
                    });
                },
                    classes: elementClass,
                    clientSideIdReferences: id.ToCollection());
            },
                                   formValue: formValue).ToCollection()
                               .Concat(label.Any() ? new GenericPhrasingContainer(label, classes: elementClass).ToCollection() : Enumerable.Empty <FlowComponent>())
                               .Materialize())).ToCollection()));
        }
        /// <summary>
        /// Creates a text box.
        /// </summary>
        /// <param name="value">Do not pass null.</param>
        /// <param name="rows">The number of rows in the text box.</param>
        /// <param name="masksCharacters">Pass true to mask characters entered in the text box. Has no effect when there is more than one row in the text box.
        /// </param>
        /// <param name="maxLength">The maximum number of characters that can be entered in this text box.</param>
        /// <param name="readOnly">Pass true to prevent the contents of the text box from being changed.</param>
        /// <param name="disableBrowserAutoComplete">If true, prevents the browser from displaying values the user previously entered. Keep in mind that there is
        /// currently an "arms race" taking place over forms auto-complete. Banks and other "high-security" organizations keep looking for ways to disable
        /// auto-complete on their login forms while browsers and password managers are always trying to preserve this functionality for their users. Because of
        /// this war, it's possible that your request to disable auto-complete will be ignored. See http://stackoverflow.com/a/23234498/35349 for more information.
        /// </param>
        /// <param name="suggestSpellCheck">By default, Firefox does not spell check single-line text boxes. By default, Firefox does spell check multi-line text
        /// boxes. Setting this parameter to a value will set the spellcheck attribute on the text box to enable/disable spell checking, if the user agent supports
        /// it.</param>
        /// <param name="postBack">The post-back that will be performed when the user hits Enter on the text box or selects an auto-complete item.</param>
        /// <param name="autoPostBack">Pass true to cause an automatic post-back when the text box loses focus.</param>
        public EwfTextBox(
            string value, int rows = 1, bool masksCharacters = false, int? maxLength = null, bool readOnly = false, bool disableBrowserAutoComplete = false,
            bool? suggestSpellCheck = null, PostBack postBack = null, bool autoPostBack = false)
        {
            this.rows = rows;
            this.masksCharacters = masksCharacters;
            this.maxLength = maxLength;
            this.readOnly = readOnly;
            this.disableBrowserAutoComplete = disableBrowserAutoComplete;
            this.suggestSpellCheck = suggestSpellCheck;

            if( value == null )
                throw new ApplicationException( "You cannot create a text box with a null value. Please use the empty string instead." );
            formValue = new FormValue<string>(
                () => value,
                () => this.IsOnPage() ? UniqueID : "",
                v => v,
                rawValue =>
                rawValue != null ? PostBackValueValidationResult<string>.CreateValidWithValue( rawValue ) : PostBackValueValidationResult<string>.CreateInvalid() );

            this.postBack = postBack;
            this.autoPostBack = autoPostBack;
        }
 /// <summary>
 /// Creates an element.
 /// </summary>
 public ElementComponent(Func <ElementContext, ElementData> elementDataGetter, FormValue formValue = null)
 {
     children = new ElementNode(context => elementDataGetter(context).NodeDataGetter(context), formValue: formValue).ToCollection();
 }
 internal void AddFormValue( FormValue formValue )
 {
     formValues.Add( formValue );
 }
        /// <summary>
        /// Creates a simple HTML editor.
        /// </summary>
        /// <param name="value">Do not pass null.</param>
        /// <param name="allowEmpty"></param>
        /// <param name="validationMethod">The validation method. Do not pass null.</param>
        /// <param name="setup">The setup object for the HTML editor.</param>
        /// <param name="maxLength"></param>
        public WysiwygHtmlEditor(
            string value, bool allowEmpty, Action <string, Validator> validationMethod, WysiwygHtmlEditorSetup setup = null, int?maxLength = null)
        {
            setup = setup ?? new WysiwygHtmlEditorSetup();

            var id = new ElementId();
            FormValue <string> formValue = null;

            formValue = new FormValue <string>(
                () => value,
                () => setup.IsReadOnly ? "" : id.Id,
                v => v,
                rawValue => {
                if (rawValue == null)
                {
                    return(PostBackValueValidationResult <string> .CreateInvalid());
                }

                // This hack prevents the NewLine that CKEditor seems to always add to the end of the textarea from causing
                // ValueChangedOnPostBack to always return true.
                if (rawValue.EndsWith(Environment.NewLine) && rawValue.Remove(rawValue.Length - Environment.NewLine.Length) == formValue.GetDurableValue())
                {
                    rawValue = formValue.GetDurableValue();
                }

                return(PostBackValueValidationResult <string> .CreateValid(rawValue));
            });

            var modificationValue = new PageModificationValue <string>();

            component = new ElementComponent(
                context => {
                id.AddId(context.Id);

                var displaySetup     = setup.DisplaySetup ?? new DisplaySetup(true);
                var jsShowStatements = getJsShowStatements(context.Id, setup.CkEditorConfiguration);
                displaySetup.AddJsShowStatements(jsShowStatements);
                displaySetup.AddJsHideStatements("CKEDITOR.instances.{0}.destroy(); $( '#{0}' ).css( 'display', 'none' );".FormatWith(context.Id));

                return(new ElementData(
                           () => {
                    var attributes = new List <Tuple <string, string> >();
                    if (setup.IsReadOnly)
                    {
                        attributes.Add(Tuple.Create("disabled", "disabled"));
                    }
                    else
                    {
                        attributes.Add(Tuple.Create("name", context.Id));
                    }
                    if (!displaySetup.ComponentsDisplayed)
                    {
                        attributes.Add(Tuple.Create("style", "display: none"));
                    }

                    return new ElementLocalData(
                        "textarea",
                        attributes: attributes,
                        includeIdAttribute: true,
                        jsInitStatements: displaySetup.ComponentsDisplayed ? jsShowStatements : "");
                },
                           children: new TextNode(() => EwfTextBox.GetTextareaValue(modificationValue.Value)).ToCollection()));
            },
                formValue: formValue);

            validation = formValue.CreateValidation(
                (postBackValue, validator) => {
                if (setup.ValidationPredicate != null && !setup.ValidationPredicate(postBackValue.ChangedOnPostBack))
                {
                    return;
                }

                var errorHandler   = new ValidationErrorHandler("HTML");
                var validatedValue = maxLength.HasValue
                                                                     ? validator.GetString(errorHandler, postBackValue.Value, allowEmpty, maxLength.Value)
                                                                     : validator.GetString(errorHandler, postBackValue.Value, allowEmpty);
                if (errorHandler.LastResult != ErrorCondition.NoError)
                {
                    setup.ValidationErrorNotifier();
                    return;
                }

                validationMethod(validatedValue, validator);
            });

            formValue.AddPageModificationValue(modificationValue, v => v);
        }
        internal static void AddCheckBoxAttributes(WebControl checkBoxElement, Control checkBox, FormValue <bool> checkBoxFormValue,
                                                   FormValue <CommonCheckBox> radioButtonFormValue, string radioButtonListItemId, PostBack postBack, bool autoPostBack,
                                                   IEnumerable <string> onClickJsMethods)
        {
            checkBoxElement.Attributes.Add("type", checkBoxFormValue != null ? "checkbox" : "radio");
            checkBoxElement.Attributes.Add("name", checkBoxFormValue != null ? checkBox.UniqueID : ((FormValue)radioButtonFormValue).GetPostBackValueKey());
            if (radioButtonFormValue != null)
            {
                checkBoxElement.Attributes.Add("value", radioButtonListItemId ?? checkBox.UniqueID);
            }
            if (checkBoxFormValue != null
                                    ? checkBoxFormValue.GetValue(AppRequestState.Instance.EwfPageRequestState.PostBackValues)
                                    : radioButtonFormValue.GetValue(AppRequestState.Instance.EwfPageRequestState.PostBackValues) == checkBox)
            {
                checkBoxElement.Attributes.Add("checked", "checked");
            }

            PostBackButton.EnsureImplicitSubmission(checkBoxElement, postBack);
            var isSelectedRadioButton = radioButtonFormValue != null &&
                                        radioButtonFormValue.GetValue(AppRequestState.Instance.EwfPageRequestState.PostBackValues) == checkBox;
            var postBackScript = autoPostBack && !isSelectedRadioButton
                                                     ? PostBackButton.GetPostBackScript(postBack ?? EwfPage.Instance.DataUpdatePostBack, includeReturnFalse : false)
                                                     : "";

            var customScript = StringTools.ConcatenateWithDelimiter("; ", onClickJsMethods.ToArray());

            checkBoxElement.AddJavaScriptEventScript(JsWritingMethods.onclick, StringTools.ConcatenateWithDelimiter("; ", postBackScript, customScript));
        }
Example #37
0
        public IHttpActionResult Put(Guid id, FilledFormDTO surveyDTO)
        {
            if (id == Guid.Empty)
            {
                return(BadRequest("id is empty"));
            }

            if (CurrentUser is OrgUser)
            {
                if (!HasAccessToEditRecords(surveyDTO.FormTemplateId, surveyDTO.ProjectId))
                {
                    return(Unauthorized());
                }
            }

            var survey = Mapper.Map <FilledForm>(surveyDTO);

            ModelState.Clear();
            Validate(survey);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                var dbForm = UnitOfWork.FilledFormsRepository.Find(id);
                dbForm.SurveyDate = survey.SurveyDate;
                UnitOfWork.FilledFormsRepository.InsertOrUpdate(dbForm);

                foreach (var val in surveyDTO.FormValues)
                {
                    var dbrecord = UnitOfWork.FormValuesRepository.Find(val.Id);
                    if (dbrecord == null)
                    {
                        dbrecord = new FormValue()
                        {
                            FilledFormId      = dbForm.Id,
                            MetricId          = val.MetricId,
                            RowDataListItemId = val.RowDataListItemId,
                            RowNumber         = val.RowNumber
                        };
                    }

                    dbrecord.NumericValue = val.NumericValue;
                    dbrecord.BoolValue    = val.BoolValue;
                    dbrecord.DateValue    = val.DateValue;
                    dbrecord.TimeValue    = val.TimeValue.HasValue ? new TimeSpan(val.TimeValue.Value.Hour, val.TimeValue.Value.Minute, 0) : (TimeSpan?)null;
                    dbrecord.TextValue    = val.TextValue;
                    dbrecord.GuidValue    = val.GuidValue;
                    dbrecord.RowNumber    = val.RowNumber;

                    if (dbrecord.Metric is DateMetric)
                    {
                        var dateMetric = dbrecord.Metric as DateMetric;
                        if (dbrecord.DateValue.HasValue && !dateMetric.HasTimeValue)
                        {
                            var localDate = TimeZone.CurrentTimeZone.ToLocalTime(dbrecord.DateValue.Value);
                            dbrecord.DateValue = new DateTime(localDate.Year, localDate.Month, localDate.Day, 0, 0, 0, DateTimeKind.Utc);
                        }
                    }

                    if (dbrecord.Metric is AttachmentMetric)
                    {
                        var deletedAttachments = val.Attachments.Where(a => a.isDeleted).ToList();
                        foreach (var item in deletedAttachments)
                        {
                            UnitOfWork.AttachmentsRepository.Delete(item.Id);
                        }

                        var fileInfos = val.TextValue == string.Empty ? new List <FileInfo>() : val.TextValue.Split(',')
                                        .Select(i => HttpContext.Current.Server.MapPath("~/Uploads/" + i)).Select(path => new DirectoryInfo(path).GetFiles().FirstOrDefault());

                        var attachments = fileInfos.Select(fileInfo => UnitOfWork.AttachmentsRepository.CreateAttachment(fileInfo, dbrecord));
                        UnitOfWork.AttachmentsRepository.InsertOrUpdate(attachments);

                        dbrecord.TextValue = string.Empty;
                    }

                    UnitOfWork.FormValuesRepository.InsertOrUpdate(dbrecord);
                }

                UnitOfWork.Save();

                var deletedFormValues = dbForm.FormValues
                                        .Where(dv => !survey.FormValues.Any(v => v.Id == dv.Id))
                                        .ToList();

                if (deletedFormValues.Any())
                {
                    foreach (var deletedFormValue in deletedFormValues)
                    {
                        UnitOfWork.FormValuesRepository.Delete(deletedFormValue);
                    }

                    UnitOfWork.Save();
                }

                var tempAttachments = dbForm.FormValues
                                      .SelectMany(v => v.Attachments)
                                      .Where(a => a.IsTemp)
                                      .ToList();

                if (tempAttachments.Any())
                {
                    foreach (var attachment in tempAttachments)
                    {
                        UnitOfWork.AttachmentsRepository.StoreFile(attachment);
                    }

                    UnitOfWork.Save();
                }

                MemoryCacher.DeleteStartingWith(CACHE_KEY);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
 /// <summary>
 /// Creates a check box. Do not pass null for label.
 /// </summary>
 public EwfCheckBox( bool isChecked, string label = "", PostBack postBack = null )
 {
     checkBoxFormValue = GetFormValue( isChecked, this );
     this.label = label;
     this.postBack = postBack;
 }
        internal static void AddCheckBoxAttributes( WebControl checkBoxElement, Control checkBox, FormValue<bool> checkBoxFormValue,
            FormValue<CommonCheckBox> radioButtonFormValue, string radioButtonListItemId, PostBack postBack, bool autoPostBack,
            IEnumerable<string> onClickJsMethods)
        {
            checkBoxElement.Attributes.Add( "type", checkBoxFormValue != null ? "checkbox" : "radio" );
            checkBoxElement.Attributes.Add( "name", checkBoxFormValue != null ? checkBox.UniqueID : ( (FormValue)radioButtonFormValue ).GetPostBackValueKey() );
            if( radioButtonFormValue != null )
                checkBoxElement.Attributes.Add( "value", radioButtonListItemId ?? checkBox.UniqueID );
            if( checkBoxFormValue != null
                    ? checkBoxFormValue.GetValue( AppRequestState.Instance.EwfPageRequestState.PostBackValues )
                    : radioButtonFormValue.GetValue( AppRequestState.Instance.EwfPageRequestState.PostBackValues ) == checkBox )
                checkBoxElement.Attributes.Add( "checked", "checked" );

            PostBackButton.EnsureImplicitSubmission( checkBoxElement, postBack );
            var isSelectedRadioButton = radioButtonFormValue != null &&
                                        radioButtonFormValue.GetValue( AppRequestState.Instance.EwfPageRequestState.PostBackValues ) == checkBox;
            var postBackScript = autoPostBack && !isSelectedRadioButton
                                     ? PostBackButton.GetPostBackScript( postBack ?? EwfPage.Instance.DataUpdatePostBack, includeReturnFalse: false )
                                     : "";
            var customScript = StringTools.ConcatenateWithDelimiter( "; ", onClickJsMethods.ToArray() );
            checkBoxElement.AddJavaScriptEventScript( JsWritingMethods.onclick, StringTools.ConcatenateWithDelimiter( "; ", postBackScript, customScript ) );
        }
 /// <summary>
 /// Creates a check box. Do not pass null for label.
 /// </summary>
 public EwfCheckBox(bool isChecked, string label = "", PostBack postBack = null)
 {
     checkBoxFormValue = GetFormValue(isChecked, this);
     this.label        = label;
     this.postBack     = postBack;
 }
 /// <summary>
 /// Creates a check box. Do not pass null for label.
 /// </summary>
 public EwfCheckBox(bool isChecked, string label = "", FormAction action = null)
 {
     checkBoxFormValue = GetFormValue(isChecked, this);
     this.label        = label;
     this.action       = action ?? FormState.Current.DefaultAction;
 }