Inheritance: System.Web.UI.WebControls.CheckBox, IRockControl
コード例 #1
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a drop down list of defined types (the one that gets selected is
            // used to build a list of defined values) 
            var ddl = new RockDropDownList();
            controls.Add( ddl );
            ddl.AutoPostBack = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Defined Type";
            ddl.Help = "The Defined Type to select values from.";

            Rock.Model.DefinedTypeService definedTypeService = new Model.DefinedTypeService( new RockContext() );
            ddl.Items.Add( new ListItem() );
            foreach ( var definedType in definedTypeService.Queryable().OrderBy( d => d.Name ) )
            {
                ddl.Items.Add( new ListItem( definedType.Name, definedType.Guid.ToString() ) );
            }

            // option to show descriptions instead of values
            var cbDescription = new RockCheckBox();
            controls.Add( cbDescription );
            cbDescription.AutoPostBack = true;
            cbDescription.CheckedChanged += OnQualifierUpdated;
            cbDescription.Label = "Display Descriptions";
            cbDescription.Text = "Yes";
            cbDescription.Help = "When set, the defined value descriptions will be displayed instead of the values.";
            return controls;
        }
コード例 #2
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override System.Collections.Generic.List<System.Web.UI.Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            var textbox = new RockTextBox();
            controls.Add( textbox );
            textbox.Label = "Date Format";
            textbox.Help = "The format string to use for date (default is system short date).";

            var cbDisplayDiff = new RockCheckBox();
            controls.Add( cbDisplayDiff );
            cbDisplayDiff.Label = "Display as Elapsed Time";
            cbDisplayDiff.Text = "Yes";
            cbDisplayDiff.Help = "Display value as an elapsed time.";

            var cbDisplayCurrent = new RockCheckBox();
            controls.Add( cbDisplayCurrent );
            cbDisplayCurrent.AutoPostBack = true;
            cbDisplayCurrent.CheckedChanged += OnQualifierUpdated;
            cbDisplayCurrent.Label = "Display Current Option";
            cbDisplayCurrent.Text = "Yes";
            cbDisplayCurrent.Help = "Include option to specify value as the current date.";

            return controls;
        }
コード例 #3
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a drop down list of enity types (the one that gets selected is
            // used to build a list of attributes) 
            var etp = new EntityTypePicker();
            controls.Add( etp );
            etp.AutoPostBack = true;
            etp.SelectedIndexChanged += OnQualifierUpdated;
            etp.Label = "Entity Type";
            etp.Help = "The Entity Type to select attributes for.";

            var entityTypeList = new Model.EntityTypeService( new RockContext() ).GetEntities().ToList();
            etp.EntityTypes = entityTypeList;

            // Add checkbox for deciding if the defined values list is renedered as a drop
            // down list or a checkbox list.
            var cb = new RockCheckBox();
            controls.Add( cb );
            cb.AutoPostBack = true;
            cb.CheckedChanged += OnQualifierUpdated;
            cb.Label = "Allow Multiple Values";
            cb.Text = "Yes";
            cb.Help = "When set, allows multiple attributes to be selected.";
            return controls;
        }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewFamilyContactInfoRow" /> class.
 /// </summary>
 public NewFamilyContactInfoRow()
     : base()
 {
     _pnbHomePhone = new PhoneNumberBox();
     _pnbCellPhone = new PhoneNumberBox();
     _cbIsMessagingEnabled = new RockCheckBox();
     _ebEmail = new EmailBox();
 }
コード例 #5
0
ファイル: ImageFieldType.cs プロジェクト: NewSpring/Rock
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            List<Control> controls = base.ConfigurationControls();

            var cbFormatAsLink = new RockCheckBox();
            cbFormatAsLink.Label = "Format as Link";
            cbFormatAsLink.Help = "Enable this to navigate to a full size image when the image is clicked";
            cbFormatAsLink.Text = "Yes";
            controls.Add( cbFormatAsLink );

            return controls;
        }
コード例 #6
0
ファイル: EntityTypeFieldType.cs プロジェクト: NewSpring/Rock
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            List<Control> controls = new List<Control>();

            var cb = new RockCheckBox();
            controls.Add( cb );
            cb.Label = "Include Global Attributes Option";
            cb.Text = "Yes";
            cb.Help = "Should the 'Global Attributes' entity option be included.";
            cb.CheckedChanged += OnQualifierUpdated;

            return controls;
        }
コード例 #7
0
ファイル: TextFieldType.cs プロジェクト: NewSpring/Rock
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // Add checkbox for deciding if the textbox is used for storing a password
            var cb = new RockCheckBox();
            controls.Add( cb );
            cb.AutoPostBack = true;
            cb.CheckedChanged += OnQualifierUpdated;
            cb.Label = "Password Field";
            cb.Text = "Yes";
            cb.Help = "When set, edit field will be masked.";
            return controls;
        }
コード例 #8
0
ファイル: CampusFieldType.cs プロジェクト: NewSpring/Rock
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // Add checkbox for deciding if the list should include inactive items
            var cb = new RockCheckBox();
            controls.Add( cb );
            cb.AutoPostBack = true;
            cb.CheckedChanged += OnQualifierUpdated;
            cb.Label = "Include Inactive";
            cb.Text = "Yes";
            cb.Help = "When set, inactive campuses will be included in the list.";

            return controls;
        }
コード例 #9
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls( Type entityType, FilterField filterControl )
        {
            var pGroupPicker = new GroupPicker();
            pGroupPicker.AllowMultiSelect = true;
            pGroupPicker.ID = filterControl.ID + "_pGroupPicker";
            pGroupPicker.AddCssClass( "js-group-picker" );
            filterControl.Controls.Add( pGroupPicker );

            var cbChildGroups = new RockCheckBox();
            cbChildGroups.ID = filterControl.ID + "_cbChildGroups";
            cbChildGroups.AddCssClass( "js-child-groups" );
            cbChildGroups.Text = "Include Child Groups";
            filterControl.Controls.Add( cbChildGroups );

            var ddlIntegerCompare = ComparisonHelper.ComparisonControl( ComparisonHelper.NumericFilterComparisonTypes );
            ddlIntegerCompare.Label = "Attendance Count";
            ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare";
            ddlIntegerCompare.AddCssClass( "js-filter-compare" );
            filterControl.Controls.Add( ddlIntegerCompare );

            var tbAttendedCount = new RockTextBox();
            tbAttendedCount.ID = filterControl.ID + "_2";
            tbAttendedCount.Label = "&nbsp;"; // give it whitespace label so it lines up nicely
            tbAttendedCount.AddCssClass( "js-attended-count" );
            filterControl.Controls.Add( tbAttendedCount );

            var slidingDateRangePicker = new SlidingDateRangePicker();
            slidingDateRangePicker.Label = "Date Range";
            slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker";
            slidingDateRangePicker.AddCssClass( "js-sliding-date-range" );
            filterControl.Controls.Add( slidingDateRangePicker );

            var controls = new Control[5] { pGroupPicker, cbChildGroups, ddlIntegerCompare, tbAttendedCount, slidingDateRangePicker };

            // convert pipe to comma delimited
            var defaultDelimitedValues = slidingDateRangePicker.DelimitedValues.Replace( "|", "," );
            var defaultCount = 4;

            // set the default values in case this is a newly added filter
            SetSelection(
                entityType,
                controls,
                string.Format( "{0}|{1}|{2}|{3}|false", string.Empty, ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString(), defaultCount, defaultDelimitedValues ) );

            return controls;
        }
コード例 #10
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            var tbKeyPrompt = new RockTextBox();
            controls.Insert(0, tbKeyPrompt );
            tbKeyPrompt.AutoPostBack = true;
            tbKeyPrompt.TextChanged += OnQualifierUpdated;
            tbKeyPrompt.Label = "Key Prompt";
            tbKeyPrompt.Help = "The text to display as a prompt in the key textbox.";

            var cbDisplayValueFirst = new RockCheckBox();
            controls.Insert( 4, cbDisplayValueFirst );
            cbDisplayValueFirst.Label = "Display Value First";
            cbDisplayValueFirst.Help = "Reverses the display order of the key and the value.";

            return controls;
        }
コード例 #11
0
ファイル: MergePersonField.cs プロジェクト: waldo2590/Rock
            /// <summary>
            /// When implemented by a class, defines the <see cref="T:System.Web.UI.Control" /> object that child controls and templates belong to. These child controls are in turn defined within an inline template.
            /// </summary>
            /// <param name="container">The <see cref="T:System.Web.UI.Control" /> object to contain the instances of controls from the inline template.</param>
            public void InstantiateIn(Control container)
            {
                DataControlFieldCell cell = container as DataControlFieldCell;

                this.MergePersonField = cell.ContainingField as MergePersonField;

                Panel selectionControlContainer = new Panel {
                    ID = $"selectionControlContainer_{MergePersonField.PersonId}", CssClass = "js-selection-control-container selection-control-container",
                };

                cell.Controls.Add(selectionControlContainer);

                RockCheckBox selectionControlCheckbox = new RockCheckBox
                {
                    ID       = $"selectionControlCheckbox_{MergePersonField.PersonId}",
                    CssClass = "js-selection-control selection-control"
                };

                selectionControlCheckbox.Attributes["data-person-id"] = MergePersonField.PersonId.ToString();
                selectionControlContainer.Controls.Add(selectionControlCheckbox);

                RockRadioButton selectionControlRadioButton = new RockRadioButton
                {
                    ID       = $"selectionControlRadioButton_{MergePersonField.PersonId}",
                    CssClass = "js-selection-control selection-control"
                };

                selectionControlRadioButton.Attributes["data-person-id"] = MergePersonField.PersonId.ToString();
                selectionControlContainer.Controls.Add(selectionControlRadioButton);

                Literal contentHtmlLiteral = new Literal {
                    ID = $"contentHtmlLiteral_{MergePersonField.PersonId}"
                };

                cell.Controls.Add(contentHtmlLiteral);

                cell.CssClass = "js-merge-field-cell merge-field-cell";

                cell.DataBinding += cell_DataBinding;
                cell.Load        += cell_Load;
            }
コード例 #12
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            _cbShowInactiveGroups = new RockCheckBox();
            _cbShowInactiveGroups.ContainerCssClass      = "pull-right";
            _cbShowInactiveGroups.SelectedIconCssClass   = "fa fa-check-square-o";
            _cbShowInactiveGroups.UnSelectedIconCssClass = "fa fa-square-o";
            _cbShowInactiveGroups.ID              = this.ID + "_cbShowInactiveGroups";
            _cbShowInactiveGroups.Text            = "Show Inactive";
            _cbShowInactiveGroups.AutoPostBack    = true;
            _cbShowInactiveGroups.CheckedChanged += _cbShowInactiveGroups_CheckedChanged;
            this.Controls.Add(_cbShowInactiveGroups);

            _btnSelectAll          = new HyperLink();
            _btnSelectAll.ID       = "_btnSelectAll";
            _btnSelectAll.CssClass = "btn btn-default btn-xs js-select-all pull-right margin-l-sm";
            _btnSelectAll.Text     = "Select All";

            this.Controls.Add(_btnSelectAll);
        }
コード例 #13
0
ファイル: MergePersonField.cs プロジェクト: waldo2590/Rock
            /// <summary>
            /// Handles the DataBinding event of the cell control.
            /// </summary>
            /// <param name="sender">The source of the event.</param>
            /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
            private void cell_DataBinding(object sender, EventArgs e)
            {
                DataControlFieldCell cell = sender as DataControlFieldCell;
                var row = cell.DataItemContainer as GridViewRow;

                Literal         contentHtmlLiteral          = cell.FindControl($"contentHtmlLiteral_{MergePersonField.PersonId}") as Literal;
                Panel           selectionControlContainer   = cell.FindControl($"selectionControlContainer_{MergePersonField.PersonId}") as Panel;
                RockCheckBox    selectionControlCheckbox    = selectionControlContainer.FindControl($"selectionControlCheckbox_{MergePersonField.PersonId}") as RockCheckBox;
                RockRadioButton selectionControlRadioButton = selectionControlContainer.FindControl($"selectionControlRadioButton_{MergePersonField.PersonId}") as RockRadioButton;

                MergePersonFieldRowEventArgs mergePersonFieldRowEventArgs = new MergePersonFieldRowEventArgs(row, MergePersonField);

                MergePersonField.HandleOnDataBound(sender, mergePersonFieldRowEventArgs);

                if (mergePersonFieldRowEventArgs.ContentDisplayType == ContentDisplayType.ContentWrapper)
                {
                    contentHtmlLiteral.Visible       = true;
                    contentHtmlLiteral.Text          = $"<div class='merge-property-value'>{mergePersonFieldRowEventArgs.ContentHTML}</div>";
                    selectionControlCheckbox.Text    = null;
                    selectionControlRadioButton.Text = null;
                }
                else
                {
                    contentHtmlLiteral.Visible       = false;
                    selectionControlCheckbox.Text    = mergePersonFieldRowEventArgs.ContentHTML;
                    selectionControlRadioButton.Text = mergePersonFieldRowEventArgs.ContentHTML;
                }

                selectionControlCheckbox.Visible = mergePersonFieldRowEventArgs.SelectionControlType == SelectionControlType.Checkbox;
                selectionControlCheckbox.Checked = mergePersonFieldRowEventArgs.Selected;

                selectionControlRadioButton.Visible = mergePersonFieldRowEventArgs.SelectionControlType == SelectionControlType.RadioButton;
                selectionControlRadioButton.Checked = mergePersonFieldRowEventArgs.Selected;

                selectionControlRadioButton.GroupName = $"selectionControlRadioButtonGroup_{row.RowIndex}";
            }
コード例 #14
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            var ddl = new RockDropDownList();
            controls.Add( ddl );
            ddl.AutoPostBack = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Toolbar Type";
            ddl.Help = "The type of toolbar to display on editor.";
            ddl.Items.Add( "Light" );
            ddl.Items.Add( "Full" );

            var tbDocumentRoot = new RockTextBox();
            controls.Add(tbDocumentRoot);
            tbDocumentRoot.AutoPostBack = true;
            tbDocumentRoot.TextChanged += OnQualifierUpdated;
            tbDocumentRoot.Label = "Document Root Folder";
            tbDocumentRoot.Help = "The folder to use as the root when browsing or uploading documents ( e.g. ~/Content ).";

            var tbImageRoot = new RockTextBox();
            controls.Add( tbImageRoot );
            tbImageRoot.AutoPostBack = true;
            tbImageRoot.TextChanged += OnQualifierUpdated;
            tbImageRoot.Label = "Image Root Folder";
            tbImageRoot.Help = "The folder to use as the root when browsing or uploading images ( e.g. ~/Content ).";

            var cbUserSpecificFolder = new RockCheckBox();
            controls.Add( cbUserSpecificFolder );
            cbUserSpecificFolder.AutoPostBack = true;
            cbUserSpecificFolder.CheckedChanged += OnQualifierUpdated;
            cbUserSpecificFolder.Label = "User Specific Folders";
            cbUserSpecificFolder.Text = "Yes";
            cbUserSpecificFolder.Help = "Should the root folders be specific to current user?";
            return controls;
        }
コード例 #15
0
ファイル: MemoFieldType.cs プロジェクト: azturner/Rock
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // Add nuber box for selecting the number of rows
            var nb = new NumberBox();
            controls.Add( nb );
            nb.AutoPostBack = true;
            nb.TextChanged += OnQualifierUpdated;
            nb.NumberType = ValidationDataType.Integer;
            nb.Label = "Rows";
            nb.Help = "The number of rows to display (default is 3).";

            // Allow HTML
            var cb = new RockCheckBox();
            controls.Add( cb );
            cb.AutoPostBack = true;
            cb.CheckedChanged += OnQualifierUpdated;
            cb.Label = "Allow HTML";
            cb.Text = "Yes";
            cb.Help = "Controls whether server shold prevent HTML from being entered in this field or not.";

            return controls;
        }
コード例 #16
0
        /// <summary>
        /// Updates the entity type controls.
        /// </summary>
        private void UpdateEntityTypeControls()
        {
            var metricService = new MetricService( new RockContext() );
            var metric = metricService.Get( this.MetricId ?? 0 );
            _phEntityTypeEntityIdValue.Controls.Clear();

            string fieldTypeName = null;
            Control entityTypeEditControl = null;
            if ( metric != null )
            {
                var entityType = EntityTypeCache.Read( metric.EntityTypeId ?? 0 );
                if ( entityType != null && entityType.SingleValueFieldType != null )
                {
                    fieldTypeName = entityType.SingleValueFieldType.Name;
                    entityTypeEditControl = entityType.SingleValueFieldType.Field.EditControl( new Dictionary<string, Field.ConfigurationValue>(), string.Format( "{0}_{1}_Picker", this.ID, fieldTypeName ) );
                }
            }

            // only set the _entityTypeEditControl is needs to be
            if ( _entityTypeEditControl == null || !_entityTypeEditControl.GetType().Equals( entityTypeEditControl.GetType() ) || _entityTypeEditControl.ID != entityTypeEditControl.ID )
            {
                _entityTypeEditControl = entityTypeEditControl;
            }

            if ( _entityTypeEditControl != null )
            {
                var rockControlWrapper = new RockControlWrapper();
                rockControlWrapper.Label = string.Format( "{0} filter", fieldTypeName );
                rockControlWrapper.Help = string.Format(
                    "Either select a specific {0}, or select 'Get from page context' to determine the {0} based on the page context. Leave {0} blank to show values for all {1}",
                    fieldTypeName,
                    fieldTypeName.Pluralize() );

                rockControlWrapper.ID = string.Format( "{0}_{1}", this.ID, "rockControlWrapper" );
                _phEntityTypeEntityIdValue.Controls.Add( rockControlWrapper );

                if ( _rblSelectOrContext == null )
                {
                    _rblSelectOrContext = new RockRadioButtonList();
                    _rblSelectOrContext.ID = string.Format( "{0}_{1}", this.ID, "rblSelectOrContext" );
                    _rblSelectOrContext.RepeatDirection = RepeatDirection.Horizontal;
                    _rblSelectOrContext.Items.Add( new ListItem( "Select " + fieldTypeName, "0" ) );
                    _rblSelectOrContext.Items.Add( new ListItem( "Get from page context", "1" ) );
                    _rblSelectOrContext.AutoPostBack = true;
                    _rblSelectOrContext.SelectedIndexChanged += rblSelectOrContext_SelectedIndexChanged;
                }
                else
                {
                    _rblSelectOrContext.Items[0].Text = "Select " + fieldTypeName;
                }

                rockControlWrapper.Controls.Add( _rblSelectOrContext );
                if ( string.IsNullOrEmpty( _rblSelectOrContext.SelectedValue ) )
                {
                    // might have to get the SelectedValue since we re-created the control after Load()
                    _rblSelectOrContext.SelectedValue = this.Page.Request.Params[_rblSelectOrContext.UniqueID];
                }

                if ( string.IsNullOrEmpty( _rblSelectOrContext.SelectedValue ) )
                {
                    // if not set from either what it was, or from PageContext, default it to "Get from page context"
                    _rblSelectOrContext.SelectedValue = "1";
                }

                _entityTypeEditControl.Visible = _rblSelectOrContext.SelectedValue.AsIntegerOrNull() == 0;
                rockControlWrapper.Controls.Add( _entityTypeEditControl );
                if ( _cbCombine == null )
                {
                    _cbCombine = new RockCheckBox();
                    _cbCombine.ID = string.Format( "{0}_{1}", this.ID, "cbCombine" );
                }

                _cbCombine.Text = "Combine multiple values to one line when showing values for multiple " + fieldTypeName.Pluralize();

                rockControlWrapper.Controls.Add( _cbCombine );
            }
        }
コード例 #17
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            if ( !_controlsLoaded )
            {
                Controls.Clear();

                _hfExistingKeyNames = new HtmlInputHidden();
                _hfExistingKeyNames.AddCssClass( "js-existing-key-names" );
                _hfExistingKeyNames.ID = this.ID + "_hfExistingKeyNames";
                Controls.Add( _hfExistingKeyNames );

                _lAttributeActionTitle = new Literal();
                _lAttributeActionTitle.ID = "lAttributeActionTitle";
                Controls.Add( _lAttributeActionTitle );

                _validationSummary = new ValidationSummary();
                _validationSummary.ID = "valiationSummary";
                _validationSummary.CssClass = "alert alert-danger";
                _validationSummary.HeaderText = "Please Correct the Following";
                Controls.Add( _validationSummary );

                _tbName = new RockTextBox();
                _tbName.ID = "tbName";
                _tbName.Label = "Name";
                _tbName.Required = true;
                Controls.Add( _tbName );

                _tbDescription = new RockTextBox();
                _tbDescription.Label = "Description";
                _tbDescription.ID = "tbDescription";
                _tbDescription.TextMode = TextBoxMode.MultiLine;
                _tbDescription.Rows = 3;
                Controls.Add( _tbDescription );

                _cpCategories = new CategoryPicker();
                _cpCategories.ID = "cpCategories_" + this.ID.ToString();
                _cpCategories.Label = "Categories";
                _cpCategories.AllowMultiSelect = true;
                _cpCategories.EntityTypeId = EntityTypeCache.Read( typeof( Rock.Model.Attribute ) ).Id;
                _cpCategories.EntityTypeQualifierColumn = "EntityTypeId";
                Controls.Add( _cpCategories );

                _tbKey = new RockTextBox();
                _tbKey.ID = "tbKey";
                _tbKey.Label = "Key";
                _tbKey.Required = true;
                Controls.Add( _tbKey );

                _cvKey = new CustomValidator();
                _cvKey.ID = "cvKey";
                _cvKey.ControlToValidate = _tbKey.ID;
                _cvKey.ClientValidationFunction = "validateKey";
                _cvKey.ServerValidate += cvKey_ServerValidate;
                _cvKey.Display = ValidatorDisplay.Dynamic;
                _cvKey.CssClass = "validation-error help-inline";
                _cvKey.ErrorMessage = "There is already an existing property with the key value you entered or the key has illegal characters. Please select a different key value and use only letters, numbers and underscores.";
                Controls.Add( _cvKey );

                _tbIconCssClass = new RockTextBox();
                _tbIconCssClass.ID = "_tbIconCssClass";
                _tbIconCssClass.Label = "Icon CSS Class";
                Controls.Add( _tbIconCssClass );

                _cbRequired = new RockCheckBox();
                _cbRequired.ID ="cbRequired";
                _cbRequired.Label = "Required";
                _cbRequired.Text = "Require a value";
                Controls.Add( _cbRequired );

                _cbShowInGrid = new RockCheckBox();
                _cbShowInGrid.ID = "cbShowInGrid";
                _cbShowInGrid.Label = "Show in Grid";
                _cbShowInGrid.Text = "Yes";
                _cbShowInGrid.Help = "If selected, this attribute will be included in a grid.";
                Controls.Add( _cbShowInGrid );

                _cbAllowSearch = new RockCheckBox();
                _cbAllowSearch.ID = "cbAllowSearch";
                _cbAllowSearch.Label = "Allow Search";
                _cbAllowSearch.Text = "Yes";
                _cbAllowSearch.Help = "If selected, this attribute can be search on.";
                _cbAllowSearch.Visible = false;  // Default is to not show this option
                Controls.Add( _cbAllowSearch );

                _ddlFieldType = new RockDropDownList();
                _ddlFieldType.ID = "ddlFieldType";
                _ddlFieldType.Label = "Field Type";
                _ddlFieldType.AutoPostBack = true;
                _ddlFieldType.SelectedIndexChanged += _ddlFieldType_SelectedIndexChanged;
                _ddlFieldType.DataValueField = "Id";
                _ddlFieldType.DataTextField = "Name";
                Controls.Add( _ddlFieldType );

                _phQualifiers = new PlaceHolder();
                _phQualifiers.ID = "phQualifiers";
                _phQualifiers.EnableViewState = false;
                Controls.Add( _phQualifiers );

                _phDefaultValue = new PlaceHolder();
                _phDefaultValue.ID = "phDefaultValue";
                _phDefaultValue.EnableViewState = false;
                Controls.Add( _phDefaultValue );

                _btnSave = new LinkButton();
                _btnSave.ID = "btnSave";
                _btnSave.Text = "OK";
                _btnSave.CssClass = "btn btn-primary";
                _btnSave.Click += btnSave_Click;
                Controls.Add( _btnSave );

                _btnCancel = new LinkButton();
                _btnCancel.ID = "btnCancel";
                _btnCancel.Text = "Cancel";
                _btnCancel.CssClass = "btn btn-link";
                _btnCancel.CausesValidation = false;
                _btnCancel.Click += btnCancel_Click;
                Controls.Add( _btnCancel );

                _controlsLoaded = true;
            }
        }
コード例 #18
0
ファイル: AttributeEditor.cs プロジェクト: timothybaloyi/Rock
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (!_controlsLoaded)
            {
                Controls.Clear();

                _hfExistingKeyNames = new HtmlInputHidden();
                _hfExistingKeyNames.AddCssClass("js-existing-key-names");
                _hfExistingKeyNames.ID = this.ID + "_hfExistingKeyNames";
                Controls.Add(_hfExistingKeyNames);

                _lAttributeActionTitle    = new Literal();
                _lAttributeActionTitle.ID = "lAttributeActionTitle";
                Controls.Add(_lAttributeActionTitle);

                _validationSummary            = new ValidationSummary();
                _validationSummary.ID         = "valiationSummary";
                _validationSummary.CssClass   = "alert alert-danger";
                _validationSummary.HeaderText = "Please Correct the Following";
                Controls.Add(_validationSummary);

                _tbName          = new RockTextBox();
                _tbName.ID       = "tbName";
                _tbName.Label    = "Name";
                _tbName.Required = true;
                Controls.Add(_tbName);

                _tbDescription          = new RockTextBox();
                _tbDescription.Label    = "Description";
                _tbDescription.ID       = "tbDescription";
                _tbDescription.TextMode = TextBoxMode.MultiLine;
                _tbDescription.Rows     = 3;
                Controls.Add(_tbDescription);

                _cpCategories                           = new CategoryPicker();
                _cpCategories.ID                        = "cpCategories_" + this.ID.ToString();
                _cpCategories.Label                     = "Categories";
                _cpCategories.AllowMultiSelect          = true;
                _cpCategories.EntityTypeId              = EntityTypeCache.Read(typeof(Rock.Model.Attribute)).Id;
                _cpCategories.EntityTypeQualifierColumn = "EntityTypeId";
                Controls.Add(_cpCategories);

                _tbKey          = new RockTextBox();
                _tbKey.ID       = "tbKey";
                _tbKey.Label    = "Key";
                _tbKey.Required = true;
                Controls.Add(_tbKey);

                _cvKey    = new CustomValidator();
                _cvKey.ID = "cvKey";
                _cvKey.ControlToValidate        = _tbKey.ID;
                _cvKey.ClientValidationFunction = "validateKey";
                _cvKey.ServerValidate          += cvKey_ServerValidate;
                _cvKey.Display      = ValidatorDisplay.Dynamic;
                _cvKey.CssClass     = "validation-error help-inline";
                _cvKey.ErrorMessage = "There is already an existing property with the key value you entered or the key has illegal characters. Please select a different key value and use only letters, numbers and underscores.";
                Controls.Add(_cvKey);

                _tbIconCssClass       = new RockTextBox();
                _tbIconCssClass.ID    = "_tbIconCssClass";
                _tbIconCssClass.Label = "Icon CSS Class";
                Controls.Add(_tbIconCssClass);

                _cbRequired       = new RockCheckBox();
                _cbRequired.ID    = "cbRequired";
                _cbRequired.Label = "Required";
                _cbRequired.Text  = "Require a value";
                Controls.Add(_cbRequired);

                _cbShowInGrid       = new RockCheckBox();
                _cbShowInGrid.ID    = "cbShowInGrid";
                _cbShowInGrid.Label = "Show in Grid";
                _cbShowInGrid.Text  = "Yes";
                _cbShowInGrid.Help  = "If selected, this attribute will be included in a grid.";
                Controls.Add(_cbShowInGrid);

                _cbAllowSearch         = new RockCheckBox();
                _cbAllowSearch.ID      = "cbAllowSearch";
                _cbAllowSearch.Label   = "Allow Search";
                _cbAllowSearch.Text    = "Yes";
                _cbAllowSearch.Help    = "If selected, this attribute can be search on.";
                _cbAllowSearch.Visible = false;  // Default is to not show this option
                Controls.Add(_cbAllowSearch);

                _ddlFieldType                       = new RockDropDownList();
                _ddlFieldType.ID                    = "ddlFieldType";
                _ddlFieldType.Label                 = "Field Type";
                _ddlFieldType.AutoPostBack          = true;
                _ddlFieldType.SelectedIndexChanged += _ddlFieldType_SelectedIndexChanged;
                _ddlFieldType.DataValueField        = "Id";
                _ddlFieldType.DataTextField         = "Name";
                Controls.Add(_ddlFieldType);

                _phQualifiers    = new PlaceHolder();
                _phQualifiers.ID = "phQualifiers";
                _phQualifiers.EnableViewState = false;
                Controls.Add(_phQualifiers);

                _phDefaultValue    = new PlaceHolder();
                _phDefaultValue.ID = "phDefaultValue";
                _phDefaultValue.EnableViewState = false;
                Controls.Add(_phDefaultValue);

                _btnSave          = new LinkButton();
                _btnSave.ID       = "btnSave";
                _btnSave.Text     = "OK";
                _btnSave.CssClass = "btn btn-primary";
                _btnSave.Click   += btnSave_Click;
                Controls.Add(_btnSave);

                _btnCancel                  = new LinkButton();
                _btnCancel.ID               = "btnCancel";
                _btnCancel.Text             = "Cancel";
                _btnCancel.CssClass         = "btn btn-link";
                _btnCancel.CausesValidation = false;
                _btnCancel.Click           += btnCancel_Click;
                Controls.Add(_btnCancel);

                _controlsLoaded = true;
            }
        }
コード例 #19
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (!_controlsLoaded)
            {
                Controls.Clear();

                _tbName          = new RockTextBox();
                _tbName.ID       = this.ID + "_tbName";
                _tbName.Label    = "Registration Instance Name";
                _tbName.Help     = "The name will be used to describe the registration on the registration screens and emails.";
                _tbName.Required = true;
                Controls.Add(_tbName);

                _cbIsActive       = new RockCheckBox();
                _cbIsActive.ID    = this.ID + "_cbIsActive";
                _cbIsActive.Label = "Active";
                _cbIsActive.Text  = "Yes";
                Controls.Add(_cbIsActive);

                _tbUrlSlug         = new RockTextBox();
                _tbUrlSlug.ID      = this.ID + "_tbUrlSlug";
                _tbUrlSlug.Label   = "URL Slug";
                _tbUrlSlug.Visible = false;
                Controls.Add(_tbUrlSlug);


                _ceDetails              = new CodeEditor();
                _ceDetails.ID           = this.ID + "_ceDetails";
                _ceDetails.Label        = "Details";
                _ceDetails.EditorMode   = CodeEditorMode.Html;
                _ceDetails.EditorTheme  = CodeEditorTheme.Rock;
                _ceDetails.EditorHeight = "100";
                _ceDetails.Visible      = false; // hiding this out for now. Struggling where we'd even use this, but instead of removing it we'll just comment it out for now.
                Controls.Add(_ceDetails);


                _dtpStart       = new DateTimePicker();
                _dtpStart.ID    = this.ID + "_dtpStart";
                _dtpStart.Label = "Registration Starts";
                Controls.Add(_dtpStart);

                _dtpEnd       = new DateTimePicker();
                _dtpEnd.ID    = this.ID + "_dtpEnd";
                _dtpEnd.Label = "Registration Ends";
                Controls.Add(_dtpEnd);

                _nbMaxAttendees            = new NumberBox();
                _nbMaxAttendees.ID         = this.ID + "_nbMaxAttendees";
                _nbMaxAttendees.Label      = "Maximum Attendees";
                _nbMaxAttendees.NumberType = ValidationDataType.Integer;
                Controls.Add(_nbMaxAttendees);

                _wtpRegistrationWorkflow       = new WorkflowTypePicker();
                _wtpRegistrationWorkflow.ID    = this.ID + "_wtpRegistrationWorkflow";
                _wtpRegistrationWorkflow.Label = "Registration Workflow";
                _wtpRegistrationWorkflow.Help  = "An optional workflow type to launch when a new registration is completed.";
                Controls.Add(_wtpRegistrationWorkflow);

                _cbCost       = new CurrencyBox();
                _cbCost.ID    = this.ID + "_cbCost";
                _cbCost.Label = "Cost";
                _cbCost.Help  = "The cost per registrant";
                Controls.Add(_cbCost);

                _cbMinimumInitialPayment       = new CurrencyBox();
                _cbMinimumInitialPayment.ID    = this.ID + "_cbMinimumInitialPayment";
                _cbMinimumInitialPayment.Label = "Minimum Initial Payment";
                _cbMinimumInitialPayment.Help  = "The minimum amount required per registrant. Leave value blank if full amount is required.";
                Controls.Add(_cbMinimumInitialPayment);

                _cbDefaultPaymentAmount       = new CurrencyBox();
                _cbDefaultPaymentAmount.ID    = this.ID + "_cbDefaultPaymentAmount";
                _cbDefaultPaymentAmount.Label = "Default Payment Amount";
                _cbDefaultPaymentAmount.Help  = "The default payment amount per registrant. Leave value blank to default to the full amount. NOTE: This requires that a Minimum Initial Payment is defined.";
                Controls.Add(_cbDefaultPaymentAmount);

                _apAccount          = new AccountPicker();
                _apAccount.ID       = this.ID + "_apAccount";
                _apAccount.Label    = "Account";
                _apAccount.Required = true;
                Controls.Add(_apAccount);

                _ppContact                     = new PersonPicker();
                _ppContact.ID                  = this.ID + "_ppContact";
                _ppContact.Label               = "Contact";
                _ppContact.SelectPerson       += _ppContact_SelectPerson;
                _ppContact.EnableSelfSelection = true;
                Controls.Add(_ppContact);

                _pnContactPhone       = new PhoneNumberBox();
                _pnContactPhone.ID    = this.ID + "_pnContactPhone";
                _pnContactPhone.Label = "Contact Phone";
                Controls.Add(_pnContactPhone);

                _ebContactEmail       = new EmailBox();
                _ebContactEmail.ID    = this.ID + "_ebContactEmail";
                _ebContactEmail.Label = "Contact Email";
                Controls.Add(_ebContactEmail);

                _dtpSendReminder       = new DateTimePicker();
                _dtpSendReminder.ID    = this.ID + "_dtpSendReminder";
                _dtpSendReminder.Label = "Send Reminder Date";
                Controls.Add(_dtpSendReminder);

                _cbReminderSent       = new RockCheckBox();
                _cbReminderSent.ID    = this.ID + "_cbReminderSent";
                _cbReminderSent.Label = "Reminder Sent";
                _cbReminderSent.Text  = "Yes";
                Controls.Add(_cbReminderSent);

                _htmlRegistrationInstructions         = new HtmlEditor();
                _htmlRegistrationInstructions.ID      = this.ID + "_htmlRegistrationInstructions";
                _htmlRegistrationInstructions.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlRegistrationInstructions.Label   = "Registration Instructions";
                _htmlRegistrationInstructions.Help    = "These instructions will appear at the beginning of the registration process when selecting how many registrants for the registration. These instructions can be provided on the registration template also. Any instructions here will override the instructions on the template.";
                _htmlRegistrationInstructions.Height  = 200;
                Controls.Add(_htmlRegistrationInstructions);

                _htmlAdditionalReminderDetails         = new HtmlEditor();
                _htmlAdditionalReminderDetails.ID      = this.ID + "_htmlAdditionalReminderDetails";
                _htmlAdditionalReminderDetails.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlAdditionalReminderDetails.Label   = "Additional Reminder Details";
                _htmlAdditionalReminderDetails.Help    = "These confirmation details will be appended to those from the registration template when displayed at the end of the registration process.";
                _htmlAdditionalReminderDetails.Height  = 200;
                Controls.Add(_htmlAdditionalReminderDetails);

                _htmlAdditionalConfirmationDetails         = new HtmlEditor();
                _htmlAdditionalConfirmationDetails.ID      = this.ID + "_htmlAdditionalConfirmationDetails";
                _htmlAdditionalConfirmationDetails.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlAdditionalConfirmationDetails.Label   = "Additional Confirmation Details";
                _htmlAdditionalConfirmationDetails.Help    = "These confirmation details will be appended to those from the registration template when displayed at the end of the registration process.";
                _htmlAdditionalConfirmationDetails.Height  = 200;
                Controls.Add(_htmlAdditionalConfirmationDetails);

                _controlsLoaded = true;
            }
        }
コード例 #20
0
ファイル: ReportDetail.ascx.cs プロジェクト: Ganon11/Rock
        /// <summary>
        /// Adds the field panel widget.
        /// </summary>
        /// <param name="reportFieldGuid">The report field unique identifier.</param>
        /// <param name="reportFieldType">Type of the report field.</param>
        /// <param name="fieldSelection">The field selection.</param>
        /// <param name="showExpanded">if set to <c>true</c> [show expanded].</param>
        /// <param name="setReportFieldValues">if set to <c>true</c> [set report field values].</param>
        /// <param name="reportField">The report field.</param>
        private void AddFieldPanelWidget( Guid reportFieldGuid, ReportFieldType reportFieldType, string fieldSelection, bool showExpanded, bool setReportFieldValues = false, ReportField reportField = null )
        {
            PanelWidget panelWidget = new PanelWidget();
            panelWidget.ID = string.Format( "reportFieldWidget_{0}", reportFieldGuid.ToString( "N" ) );

            panelWidget.ShowDeleteButton = true;
            panelWidget.DeleteClick += FieldsPanelWidget_DeleteClick;
            panelWidget.ShowReorderIcon = true;
            panelWidget.Expanded = showExpanded;

            Label lbFields = new Label();
            lbFields.Text = "Field Type";

            RockDropDownList ddlFields = new RockDropDownList();
            panelWidget.Controls.Add( ddlFields );
            ddlFields.ID = panelWidget.ID + "_ddlFields";
            ddlFields.AutoPostBack = true;
            ddlFields.SelectedIndexChanged += ddlFields_SelectedIndexChanged;

            panelWidget.HeaderControls = new Control[2] { lbFields, ddlFields };
            this.LoadFieldsDropDown( ddlFields );

            RockCheckBox showInGridCheckBox = new RockCheckBox();
            showInGridCheckBox.ID = panelWidget.ID + "_showInGridCheckBox";
            showInGridCheckBox.Text = "Show in Grid";

            panelWidget.Controls.Add( showInGridCheckBox );

            RockTextBox columnHeaderTextTextBox = new RockTextBox();
            columnHeaderTextTextBox.ID = panelWidget.ID + "_columnHeaderTextTextBox";
            columnHeaderTextTextBox.Label = "Column Label";
            columnHeaderTextTextBox.CssClass = "js-column-header-textbox";
            panelWidget.Controls.Add( columnHeaderTextTextBox );

            phReportFields.Controls.Add( panelWidget );

            CreateFieldTypeSpecificControls( reportFieldType, fieldSelection, panelWidget );

            if ( setReportFieldValues )
            {
                PopulateFieldPanelWidget( panelWidget, reportField, reportFieldType, fieldSelection );
            }
        }
コード例 #21
0
        /// <summary>
        /// Sets the phone number.
        /// </summary>
        /// <param name="rockContext">The rock context.</param>
        /// <param name="person">The person.</param>
        /// <param name="pnbNumber">The PNB number.</param>
        /// <param name="cbSms">The cb SMS.</param>
        /// <param name="phoneTypeGuid">The phone type unique identifier.</param>
        /// <param name="changes">The changes.</param>
        private void SetPhoneNumber( RockContext rockContext, Person person, PhoneNumberBox pnbNumber, RockCheckBox cbSms, Guid phoneTypeGuid, List<string> changes )
        {
            var phoneType = DefinedValueCache.Read( phoneTypeGuid );
            if ( phoneType != null )
            {
                var phoneNumber = person.PhoneNumbers.FirstOrDefault( n => n.NumberTypeValueId == phoneType.Id );
                string oldPhoneNumber = string.Empty;
                if ( phoneNumber == null )
                {
                    phoneNumber = new PhoneNumber { NumberTypeValueId = phoneType.Id };
                }
                else
                {
                    oldPhoneNumber = phoneNumber.NumberFormattedWithCountryCode;
                }

                phoneNumber.CountryCode = PhoneNumber.CleanNumber( pnbNumber.CountryCode );
                phoneNumber.Number = PhoneNumber.CleanNumber( pnbNumber.Number );

                if ( string.IsNullOrWhiteSpace( phoneNumber.Number ) )
                {
                    if ( phoneNumber.Id > 0 )
                    {
                        new PhoneNumberService( rockContext ).Delete( phoneNumber );
                        person.PhoneNumbers.Remove( phoneNumber );
                    }
                }
                else
                {
                    if ( phoneNumber.Id <= 0)
                    {
                        person.PhoneNumbers.Add( phoneNumber );
                    }
                    if ( cbSms != null && cbSms.Checked )
                    {
                        phoneNumber.IsMessagingEnabled = true;
                        person.PhoneNumbers
                            .Where( n => n.NumberTypeValueId != phoneType.Id )
                            .ToList()
                            .ForEach( n => n.IsMessagingEnabled = false );
                    }
                }

                History.EvaluateChange( changes,
                    string.Format( "{0} Phone", phoneType.Value ),
                    oldPhoneNumber, phoneNumber.NumberFormattedWithCountryCode );
            }
        }
コード例 #22
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (!_controlsLoaded)
            {
                Controls.Clear();

                _tbName          = new RockTextBox();
                _tbName.ID       = this.ID + "_tbName";
                _tbName.Label    = "Registration Instance Name";
                _tbName.Help     = "The name will be used to describe the registration on the registration screens and emails.";
                _tbName.Required = true;
                Controls.Add(_tbName);

                _cbIsActive       = new RockCheckBox();
                _cbIsActive.ID    = this.ID + "_cbIsActive";
                _cbIsActive.Label = "Active";
                _cbIsActive.Text  = "Yes";
                Controls.Add(_cbIsActive);

                _tbUrlSlug         = new RockTextBox();
                _tbUrlSlug.ID      = this.ID + "_tbUrlSlug";
                _tbUrlSlug.Label   = "URL Slug";
                _tbUrlSlug.Visible = false;
                Controls.Add(_tbUrlSlug);


                _ceDetails              = new CodeEditor();
                _ceDetails.ID           = this.ID + "_ceDetails";
                _ceDetails.Label        = "Details";
                _ceDetails.EditorMode   = CodeEditorMode.Html;
                _ceDetails.EditorTheme  = CodeEditorTheme.Rock;
                _ceDetails.EditorHeight = "100";
                _ceDetails.Visible      = false; // hiding this out for now. Struggling where we'd even use this, but instead of removing it we'll just comment it out for now.
                Controls.Add(_ceDetails);


                _dtpStart       = new DateTimePicker();
                _dtpStart.ID    = this.ID + "_dtpStart";
                _dtpStart.Label = "Registration Starts";
                Controls.Add(_dtpStart);

                _dtpEnd       = new DateTimePicker();
                _dtpEnd.ID    = this.ID + "_dtpEnd";
                _dtpEnd.Label = "Registration Ends";
                Controls.Add(_dtpEnd);

                _nbMaxAttendees            = new NumberBox();
                _nbMaxAttendees.ID         = this.ID + "_nbMaxAttendees";
                _nbMaxAttendees.Label      = "Maximum Attendees";
                _nbMaxAttendees.NumberType = ValidationDataType.Integer;
                Controls.Add(_nbMaxAttendees);

                _apAccount          = new AccountPicker();
                _apAccount.ID       = this.ID + "_apAccount";
                _apAccount.Label    = "Account";
                _apAccount.Required = true;
                Controls.Add(_apAccount);

                _ppContact                     = new PersonPicker();
                _ppContact.ID                  = this.ID + "_ppContact";
                _ppContact.Label               = "Contact";
                _ppContact.SelectPerson       += _ppContact_SelectPerson;
                _ppContact.EnableSelfSelection = true;
                Controls.Add(_ppContact);

                _pnContactPhone       = new PhoneNumberBox();
                _pnContactPhone.ID    = this.ID + "_pnContactPhone";
                _pnContactPhone.Label = "Contact Phone";
                Controls.Add(_pnContactPhone);

                _ebContactEmail       = new EmailBox();
                _ebContactEmail.ID    = this.ID + "_ebContactEmail";
                _ebContactEmail.Label = "Contact Email";
                Controls.Add(_ebContactEmail);

                _dtpSendReminder       = new DateTimePicker();
                _dtpSendReminder.ID    = this.ID + "_dtpSendReminder";
                _dtpSendReminder.Label = "Send Reminder Date";
                Controls.Add(_dtpSendReminder);

                _cbReminderSent       = new RockCheckBox();
                _cbReminderSent.ID    = this.ID + "_cbReminderSent";
                _cbReminderSent.Label = "Reminder Sent";
                _cbReminderSent.Text  = "Yes";
                Controls.Add(_cbReminderSent);

                _htmlAdditionalReminderDetails         = new HtmlEditor();
                _htmlAdditionalReminderDetails.ID      = this.ID + "_htmlAdditionalReminderDetails";
                _htmlAdditionalReminderDetails.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlAdditionalReminderDetails.Label   = "Additional Reminder Details";
                _htmlAdditionalReminderDetails.Help    = "These confirmation details will be appended to those from the registration template when displayed at the end of the registration process.";
                _htmlAdditionalReminderDetails.Height  = 200;
                Controls.Add(_htmlAdditionalReminderDetails);

                _htmlAdditionalConfirmationDetails         = new HtmlEditor();
                _htmlAdditionalConfirmationDetails.ID      = this.ID + "_htmlAdditionalConfirmationDetails";
                _htmlAdditionalConfirmationDetails.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlAdditionalConfirmationDetails.Label   = "Additional Confirmation Details";
                _htmlAdditionalConfirmationDetails.Help    = "These confirmation details will be appended to those from the registration template when displayed at the end of the registration process.";
                _htmlAdditionalConfirmationDetails.Height  = 200;
                Controls.Add(_htmlAdditionalConfirmationDetails);

                _controlsLoaded = true;
            }
        }
コード例 #23
0
        /// <summary>
        /// Creates the fee field.
        /// </summary>
        /// <param name="fee">The fee.</param>
        /// <param name="setValues">if set to <c>true</c> [set values].</param>
        /// <param name="feeValues">The fee values.</param>
        private void CreateFeeField( RegistrationTemplateFee fee, bool setValues, List<FeeInfo> feeValues )
        {
            if ( fee.FeeType == RegistrationFeeType.Single )
            {
                string label = fee.Name;
                var cost = fee.CostValue.AsDecimalOrNull();
                if ( cost.HasValue && cost.Value != 0.0M )
                {
                    label = string.Format( "{0} ({1})", fee.Name, cost.Value.ToString("C2"));
                }

                if ( fee.AllowMultiple )
                {
                    // Single Option, Multi Quantity
                    var numUpDown = new NumberUpDown();
                    numUpDown.ID = "fee_" + fee.Id.ToString();
                    numUpDown.Label = label;
                    numUpDown.Minimum = 0;
                    phFees.Controls.Add( numUpDown );

                    if ( setValues && feeValues != null && feeValues.Any() )
                    {
                        numUpDown.Value = feeValues.First().Quantity;
                    }
                }
                else
                {
                    // Single Option, Single Quantity
                    var cb = new RockCheckBox();
                    cb.ID = "fee_" + fee.Id.ToString();
                    cb.Label = label;
                    cb.SelectedIconCssClass = "fa fa-check-square-o fa-lg";
                    cb.UnSelectedIconCssClass = "fa fa-square-o fa-lg";
                    phFees.Controls.Add( cb );

                    if ( setValues && feeValues != null && feeValues.Any() )
                    {
                        cb.Checked = feeValues.First().Quantity > 0;
                    }
                }
            }
            else
            {
                // Parse the options to get name and cost for each
                var options = new Dictionary<string, string>();
                string[] nameValues = fee.CostValue.Split( new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries );
                foreach ( string nameValue in nameValues )
                {
                    string[] nameAndValue = nameValue.Split( new char[] { '^' }, StringSplitOptions.RemoveEmptyEntries );
                    if ( nameAndValue.Length == 1)
                    {
                        options.AddOrIgnore( nameAndValue[0], nameAndValue[0] );
                    }
                    if ( nameAndValue.Length == 2 )
                    {
                        options.AddOrIgnore( nameAndValue[0], string.Format( "{0} ({1:C2})", nameAndValue[0], nameAndValue[1].AsDecimal() ) );
                    }
                }

                if ( fee.AllowMultiple )
                {
                    HtmlGenericControl feeAllowMultiple = new HtmlGenericControl( "div" );
                    phFees.Controls.Add( feeAllowMultiple );

                    feeAllowMultiple.AddCssClass( "feetype-allowmultiples" );

                    Label titleLabel = new Label();
                    feeAllowMultiple.Controls.Add( titleLabel );
                    titleLabel.CssClass = "control-label";
                    titleLabel.Text = fee.Name;

                    foreach( var optionKeyVal in options )
                    {
                        var numUpDown = new NumberUpDown();
                        numUpDown.ID = string.Format( "fee_{0}_{1}", fee.Id, optionKeyVal.Key );
                        numUpDown.Label = string.Format( "{0}", optionKeyVal.Value );
                        numUpDown.Minimum = 0;
                        numUpDown.CssClass = "fee-allowmultiple";
                        feeAllowMultiple.Controls.Add( numUpDown );

                        if ( setValues && feeValues != null && feeValues.Any() )
                        {
                            numUpDown.Value = feeValues
                                .Where( f => f.Option == optionKeyVal.Key )
                                .Select( f => f.Quantity )
                                .FirstOrDefault();
                        }
                    }
                }
                else
                {
                    // Multi Option, Single Quantity
                    var ddl = new RockDropDownList();
                    ddl.ID = "fee_" + fee.Id.ToString();
                    ddl.AddCssClass( "input-width-md" );
                    ddl.Label = fee.Name;
                    ddl.DataValueField = "Key";
                    ddl.DataTextField = "Value";
                    ddl.DataSource = options;
                    ddl.DataBind();
                    ddl.Items.Insert( 0, "");
                    phFees.Controls.Add( ddl );

                    if ( setValues && feeValues != null && feeValues.Any() )
                    {
                        ddl.SetValue( feeValues
                            .Where( f => f.Quantity > 0 )
                            .Select( f => f.Option )
                            .FirstOrDefault() );
                    }
                }
            }
        }
コード例 #24
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfFormGuid    = new HiddenField();
            _hfFormGuid.ID = this.ID + "_hfFormGuid";
            Controls.Add(_hfFormGuid);

            _ddlNotificationSystemEmail = new RockDropDownList();
            _ddlNotificationSystemEmail.EnableViewState = false;
            _ddlNotificationSystemEmail.DataValueField  = "Id";
            _ddlNotificationSystemEmail.DataTextField   = "Title";
            _ddlNotificationSystemEmail.Label           = "Notification Email";
            _ddlNotificationSystemEmail.Help            = "An optional system email that should be sent to the person or people assigned to this activity (Any System Email with a category of 'Workflow').";
            _ddlNotificationSystemEmail.ID = this.ID + "_ddlNotificationSystemEmail";
            Controls.Add(_ddlNotificationSystemEmail);

            var systemEmailCategory = CategoryCache.Get(Rock.SystemGuid.Category.SYSTEM_EMAIL_WORKFLOW.AsGuid());

            if (systemEmailCategory != null)
            {
                using (var rockContext = new RockContext())
                {
                    _ddlNotificationSystemEmail.DataSource = new SystemEmailService(rockContext).Queryable()
                                                             .Where(e => e.CategoryId == systemEmailCategory.Id)
                                                             .OrderBy(e => e.Title)
                                                             .Select(a => new { a.Id, a.Title })
                                                             .ToList();
                    _ddlNotificationSystemEmail.DataBind();
                }
            }

            _ddlNotificationSystemEmail.Items.Insert(0, new ListItem("None", "0"));

            _cbIncludeActions       = new RockCheckBox();
            _cbIncludeActions.Label = "Include Actions in Email";
            _cbIncludeActions.Text  = "Yes";
            _cbIncludeActions.Help  = "Should the email include the option for recipient to select an action directly from within the email? Note: This only applies if none of the the form fields are required. The workflow will be persisted immediately prior to sending the email.";
            _cbIncludeActions.ID    = this.ID + "_cbIncludeActions";
            Controls.Add(_cbIncludeActions);

            _ceHeaderText              = new CodeEditor();
            _ceHeaderText.Label        = "Form Header";
            _ceHeaderText.Help         = "Text to display to user above the form fields. <span class='tip tip-lava'></span> <span class='tip tip-html'>";
            _ceHeaderText.ID           = this.ID + "_tbHeaderText";
            _ceHeaderText.EditorMode   = CodeEditorMode.Html;
            _ceHeaderText.EditorTheme  = CodeEditorTheme.Rock;
            _ceHeaderText.EditorHeight = "200";
            Controls.Add(_ceHeaderText);

            _ceFooterText              = new CodeEditor();
            _ceFooterText.Label        = "Form Footer";
            _ceFooterText.Help         = "Text to display to user below the form fields. <span class='tip tip-lava'></span> <span class='tip tip-html'>";
            _ceFooterText.ID           = this.ID + "_tbFooterText";
            _ceFooterText.EditorMode   = CodeEditorMode.Html;
            _ceFooterText.EditorTheme  = CodeEditorTheme.Rock;
            _ceFooterText.EditorHeight = "200";
            Controls.Add(_ceFooterText);

            _falActions    = new WorkflowFormActionList();
            _falActions.ID = this.ID + "_falActions";
            Controls.Add(_falActions);

            _ddlActionAttribute = new RockDropDownList();
            _ddlActionAttribute.EnableViewState = false;
            _ddlActionAttribute.ID    = this.ID + "_ddlActionAttribute";
            _ddlActionAttribute.Label = "Command Selected Attribute";
            _ddlActionAttribute.Help  = "Optional text attribute that should be updated with the selected command label.";
            Controls.Add(_ddlActionAttribute);

            _cbAllowNotes       = new RockCheckBox();
            _cbAllowNotes.Label = "Enable Note Entry";
            _cbAllowNotes.Text  = "Yes";
            _cbAllowNotes.Help  = "Should this form include an area for viewing and editing notes related to the workflow?";
            _cbAllowNotes.ID    = this.ID + "_cbAllowNotes";
            Controls.Add(_cbAllowNotes);
        }
コード例 #25
0
ファイル: FilterField.cs プロジェクト: NewSpring/Rock
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            ddlFilterType = new RockDropDownList();
            Controls.Add( ddlFilterType );
            ddlFilterType.ID = this.ID + "_ddlFilter";

            var component = Rock.Reporting.DataFilterContainer.GetComponent( FilterEntityTypeName );
            if ( component != null )
            {
                component.Options = FilterOptions;
                filterControls = component.CreateChildControls( FilteredEntityType, this, this.FilterMode );
            }
            else
            {
                filterControls = new Control[0];
            }

            ddlFilterType.AutoPostBack = true;
            ddlFilterType.SelectedIndexChanged += ddlFilterType_SelectedIndexChanged;

            ddlFilterType.Items.Clear();

            foreach ( var section in AuthorizedComponents )
            {
                foreach ( var item in section.Value )
                {
                    if ( !this.ExcludedFilterTypes.Any( a => a == item.Key ) )
                    {
                        ListItem li = new ListItem( item.Value, item.Key );

                        if ( !string.IsNullOrWhiteSpace( section.Key ) )
                        {
                            li.Attributes.Add( "optiongroup", section.Key );
                        }

                        var filterComponent = Rock.Reporting.DataFilterContainer.GetComponent( item.Key );
                        if ( filterComponent != null )
                        {
                            string description = Reflection.GetDescription( filterComponent.GetType() );
                            if ( !string.IsNullOrWhiteSpace( description ) )
                            {
                                li.Attributes.Add( "title", description );
                            }
                        }

                        li.Selected = item.Key == FilterEntityTypeName;
                        ddlFilterType.Items.Add( li );
                    }
                }
            }

            hfExpanded = new HiddenField();
            Controls.Add( hfExpanded );
            hfExpanded.ID = this.ID + "_hfExpanded";
            hfExpanded.Value = "True";

            lbDelete = new LinkButton();
            Controls.Add( lbDelete );
            lbDelete.ID = this.ID + "_lbDelete";
            lbDelete.CssClass = "btn btn-xs btn-danger ";
            lbDelete.Click += lbDelete_Click;
            lbDelete.CausesValidation = false;

            var iDelete = new HtmlGenericControl( "i" );
            lbDelete.Controls.Add( iDelete );
            iDelete.AddCssClass( "fa fa-times" );

            cbIncludeFilter = new RockCheckBox();
            cbIncludeFilter.ContainerCssClass = "filterfield-checkbox";
            Controls.Add( cbIncludeFilter );
            cbIncludeFilter.ID = this.ID + "_cbIncludeFilter";
        }
コード例 #26
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfExpanded = new HiddenFieldWithClass();
            Controls.Add(_hfExpanded);
            _hfExpanded.ID       = this.ID + "_hfExpanded";
            _hfExpanded.CssClass = "filter-expanded";
            _hfExpanded.Value    = "False";

            _hfActionTypeGuid = new HiddenField();
            Controls.Add(_hfActionTypeGuid);
            _hfActionTypeGuid.ID = this.ID + "_hfActionTypeGuid";

            _lblActionTypeName = new Label();
            Controls.Add(_lblActionTypeName);
            _lblActionTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActionTypeName.ID           = this.ID + "_lblActionTypeName";

            _lbDeleteActionType = new LinkButton();
            Controls.Add(_lbDeleteActionType);
            _lbDeleteActionType.CausesValidation = false;
            _lbDeleteActionType.ID       = this.ID + "_lbDeleteActionType";
            _lbDeleteActionType.CssClass = "btn btn-xs btn-danger js-action-delete";
            _lbDeleteActionType.Click   += lbDeleteActionType_Click;

            var iDelete = new HtmlGenericControl("i");

            _lbDeleteActionType.Controls.Add(iDelete);
            iDelete.AddCssClass("fa fa-times");

            _ddlCriteriaAttribute = new RockDropDownList();
            Controls.Add(_ddlCriteriaAttribute);
            _ddlCriteriaAttribute.ID       = this.ID + "_ddlCriteriaAttribute";
            _ddlCriteriaAttribute.CssClass = "js-conditional-run-criteria";
            _ddlCriteriaAttribute.Label    = "Run If";
            _ddlCriteriaAttribute.Help     = "Optional criteria to prevent the action from running.  If the criteria is not met, this action will be skipped when this activity is processed.";

            _ddlCriteriaComparisonType = new RockDropDownList();
            Controls.Add(_ddlCriteriaComparisonType);
            _ddlCriteriaComparisonType.ID       = this.ID + "_ddlCriteriaComparisonType";
            _ddlCriteriaComparisonType.CssClass = "js-action-criteria-comparison";
            _ddlCriteriaComparisonType.BindToEnum <ComparisonType>();
            _ddlCriteriaComparisonType.Label = "&nbsp;";

            _tbddlCriteriaValue = new RockTextOrDropDownList();
            Controls.Add(_tbddlCriteriaValue);
            _tbddlCriteriaValue.ID                 = this.ID + "_tbddlCriteriaValue";
            _tbddlCriteriaValue.TextBox.Label      = "Text Value";
            _tbddlCriteriaValue.DropDownList.Label = "Attribute Value";

            _tbActionTypeName = new RockTextBox();
            Controls.Add(_tbActionTypeName);
            _tbActionTypeName.ID                   = this.ID + "_tbActionTypeName";
            _tbActionTypeName.Label                = "Name";
            _tbActionTypeName.Required             = true;
            _tbActionTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActionTypeName.ID);

            _ddlEntityType = new RockDropDownList();
            Controls.Add(_ddlEntityType);
            _ddlEntityType.ID    = this.ID + "_ddlEntityType";
            _ddlEntityType.Label = "Action Type";

            // make it autopostback since Attributes are dependant on which EntityType is selected
            _ddlEntityType.AutoPostBack          = true;
            _ddlEntityType.SelectedIndexChanged += ddlEntityType_SelectedIndexChanged;

            foreach (var item in ActionContainer.Instance.Components.Values.OrderBy(a => a.Value.EntityType.FriendlyName))
            {
                var type = item.Value.GetType();
                if (type != null)
                {
                    var entityType = EntityTypeCache.Read(type);
                    var li         = new ListItem(entityType.FriendlyName, entityType.Id.ToString());

                    // Get description
                    string description    = string.Empty;
                    var    descAttributes = type.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
                    if (descAttributes != null)
                    {
                        foreach (System.ComponentModel.DescriptionAttribute descAttribute in descAttributes)
                        {
                            description = descAttribute.Description;
                        }
                    }
                    if (!string.IsNullOrWhiteSpace(description))
                    {
                        li.Attributes.Add("title", description);
                    }

                    _ddlEntityType.Items.Add(li);
                }
            }

            _cbIsActionCompletedOnSuccess = new RockCheckBox {
                Text = "Action is Completed on Success"
            };
            Controls.Add(_cbIsActionCompletedOnSuccess);
            _cbIsActionCompletedOnSuccess.ID = this.ID + "_cbIsActionCompletedOnSuccess";

            _cbIsActivityCompletedOnSuccess = new RockCheckBox {
                Text = "Activity is Completed on Success"
            };
            Controls.Add(_cbIsActivityCompletedOnSuccess);
            _cbIsActivityCompletedOnSuccess.ID = this.ID + "_cbIsActivityCompletedOnSuccess";

            _formEditor = new WorkflowFormEditor();
            Controls.Add(_formEditor);
            _formEditor.ID = this.ID + "_formEditor";

            _phActionAttributes = new PlaceHolder();
            Controls.Add(_phActionAttributes);
            _phActionAttributes.ID = this.ID + "_phActionAttributes";
        }
コード例 #27
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfActionTypeGuid = new HiddenField();
            _hfActionTypeGuid.ID = this.ID + "_hfActionTypeGuid";

            _lblActionTypeName = new Label();
            _lblActionTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActionTypeName.ID = this.ID + "_lblActionTypeName";

            _lbDeleteActionType = new LinkButton();
            _lbDeleteActionType.CausesValidation = false;
            _lbDeleteActionType.ID = this.ID + "_lbDeleteActionType";
            _lbDeleteActionType.CssClass = "btn btn-xs btn-danger";
            _lbDeleteActionType.Click += lbDeleteActionType_Click;

            var iDelete = new HtmlGenericControl( "i" );
            _lbDeleteActionType.Controls.Add( iDelete );
            iDelete.AddCssClass( "fa fa-times" );

            _tbActionTypeName = new DataTextBox();
            _tbActionTypeName.ID = this.ID + "_tbActionTypeName";
            _tbActionTypeName.Label = "Name";

            _ddlEntityType = new RockDropDownList();
            _ddlEntityType.ID = this.ID + "_ddlEntityType";
            _ddlEntityType.Label = "Action Type";

            // make it autopostback since Attributes are dependant on which EntityType is selected
            _ddlEntityType.AutoPostBack = true;
            _ddlEntityType.SelectedIndexChanged += ddlEntityType_SelectedIndexChanged;

            foreach ( var item in WorkflowActionContainer.Instance.Components.Values.OrderBy( a => a.Value.EntityType.FriendlyName ) )
            {
                var type = item.Value.GetType();
                if (type != null)
                {
                    var entityType = EntityTypeCache.Read( type );
                    var li = new ListItem( entityType.FriendlyName, entityType.Id.ToString() );

                    // Get description
                    string description = string.Empty;
                    var descAttributes = type.GetCustomAttributes( typeof( System.ComponentModel.DescriptionAttribute ), false );
                    if ( descAttributes != null )
                    {
                        foreach ( System.ComponentModel.DescriptionAttribute descAttribute in descAttributes )
                        {
                            description = descAttribute.Description;
                        }
                    }
                    if ( !string.IsNullOrWhiteSpace( description ) )
                    {
                        li.Attributes.Add( "title", description );
                    }

                    _ddlEntityType.Items.Add( li );
                }
            }

            // set label when they exit the edit field
            _tbActionTypeName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblActionTypeName.ID );
            _tbActionTypeName.SourceTypeName = "Rock.Model.WorkflowActionType, Rock";
            _tbActionTypeName.PropertyName = "Name";

            _cbIsActionCompletedOnSuccess = new RockCheckBox { Label = "Action is Completed on Success" };
            _cbIsActionCompletedOnSuccess.ID = this.ID + "_cbIsActionCompletedOnSuccess";

            _cbIsActivityCompletedOnSuccess = new RockCheckBox { Label = "Activity is Completed on Success" };
            _cbIsActivityCompletedOnSuccess.ID = this.ID + "_cbIsActivityCompletedOnSuccess";

            _phActionAttributes = new PlaceHolder();
            _phActionAttributes.ID = this.ID + "_phActionAttributes";

            Controls.Add( _hfActionTypeGuid );
            Controls.Add( _lblActionTypeName );
            Controls.Add( _tbActionTypeName );
            Controls.Add( _ddlEntityType );
            Controls.Add( _cbIsActionCompletedOnSuccess );
            Controls.Add( _cbIsActivityCompletedOnSuccess );
            Controls.Add( _phActionAttributes );
            Controls.Add( _lbDeleteActionType );
        }
コード例 #28
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfActivityTypeGuid = new HiddenField();
            _hfActivityTypeGuid.ID = this.ID + "_hfActivityTypeGuid";

            _lblActivityTypeName = new Label();
            _lblActivityTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeName.ID = this.ID + "_lblActivityTypeName";
            _lblActivityTypeDescription = new Label();
            _lblActivityTypeDescription.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeDescription.ID = this.ID + "_lblActivityTypeDescription";

            _lblInactive = new Label();
            _lblInactive.ClientIDMode = ClientIDMode.Static;
            _lblInactive.ID = this.ID + "_lblInactive";
            _lblInactive.CssClass = "label label-important pull-right";
            _lblInactive.Text = "Inactive";

            _lbDeleteActivityType = new LinkButton();
            _lbDeleteActivityType.CausesValidation = false;
            _lbDeleteActivityType.ID = this.ID + "_lbDeleteActivityType";
            _lbDeleteActivityType.CssClass = "btn btn-xs btn-danger";
            _lbDeleteActivityType.Click += lbDeleteActivityType_Click;
            _lbDeleteActivityType.Controls.Add( new LiteralControl { Text = "<i class='fa fa-times'></i>" } );

            _cbActivityTypeIsActive = new RockCheckBox { Label = "Active" };
            _cbActivityTypeIsActive.ID = this.ID + "_cbActivityTypeIsActive";
            string checkboxScriptFormat = @"
javascript: 
    if ($(this).is(':checked')) {{ 
        $('#{0}').hide(); 
        $('#{1}').removeClass('workflow-activity-inactive'); 
    }} 
    else {{ 
        $('#{0}').show(); 
        $('#{1}').addClass('workflow-activity-inactive'); 
    }}
";

            _cbActivityTypeIsActive.InputAttributes.Add( "onclick", string.Format( checkboxScriptFormat, _lblInactive.ID, this.ID + "_section" ) );

            _tbActivityTypeName = new DataTextBox();
            _tbActivityTypeName.ID = this.ID + "_tbActivityTypeName";
            _tbActivityTypeName.Label = "Name";

            // set label when they exit the edit field
            _tbActivityTypeName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblActivityTypeName.ID );
            _tbActivityTypeName.SourceTypeName = "Rock.Model.WorkflowActivityType, Rock";
            _tbActivityTypeName.PropertyName = "Name";

            _tbActivityTypeDescription = new DataTextBox();
            _tbActivityTypeDescription.ID = this.ID + "_tbActivityTypeDescription";
            _tbActivityTypeDescription.Label = "Description";
            _tbActivityTypeDescription.TextMode = TextBoxMode.MultiLine;
            _tbActivityTypeDescription.Rows = 4;

            // set label when they exit the edit field
            _tbActivityTypeDescription.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblActivityTypeDescription.ID );
            _tbActivityTypeDescription.SourceTypeName = "Rock.Model.WorkflowActivityType, Rock";
            _tbActivityTypeDescription.PropertyName = "Description";

            _cbActivityTypeIsActivatedWithWorkflow = new RockCheckBox { Label = "Activated with Workflow" };
            _cbActivityTypeIsActivatedWithWorkflow.ID = this.ID + "_cbActivityTypeIsActivatedWithWorkflow";

            _lbAddActionType = new LinkButton();
            _lbAddActionType.ID = this.ID + "_lbAddAction";
            _lbAddActionType.CssClass = "btn btn-xs btn-action";
            _lbAddActionType.Click += lbAddActionType_Click;
            _lbAddActionType.CausesValidation = false;
            _lbAddActionType.Controls.Add( new LiteralControl { Text = "<i class='fa fa-plus'></i> Add Action" } );

            Controls.Add( _hfActivityTypeGuid );
            Controls.Add( _lblActivityTypeName );
            Controls.Add( _lblActivityTypeDescription );
            Controls.Add( _lblInactive );
            Controls.Add( _tbActivityTypeName );
            Controls.Add( _tbActivityTypeDescription );
            Controls.Add( _cbActivityTypeIsActive );
            Controls.Add( _cbActivityTypeIsActivatedWithWorkflow );
            Controls.Add( _lbDeleteActivityType );
            Controls.Add( _lbAddActionType );
        }
コード例 #29
0
        /// <summary>
        /// Updates the entity type controls.
        /// </summary>
        private void UpdateEntityTypeControls()
        {
            var metricService = new MetricService(new RockContext());
            var metric        = metricService.Get(this.MetricId ?? 0);

            _phEntityTypeEntityIdValue.Controls.Clear();

            string  fieldTypeName         = null;
            Control entityTypeEditControl = null;

            if (metric != null)
            {
                var entityType = EntityTypeCache.Read(metric.EntityTypeId ?? 0);
                if (entityType != null && entityType.SingleValueFieldType != null)
                {
                    fieldTypeName         = entityType.SingleValueFieldType.Name;
                    entityTypeEditControl = entityType.SingleValueFieldType.Field.EditControl(new Dictionary <string, Field.ConfigurationValue>(), string.Format("{0}_{1}_Picker", this.ID, fieldTypeName));
                }
            }

            // only set the _entityTypeEditControl is needs to be
            if (_entityTypeEditControl == null || !_entityTypeEditControl.GetType().Equals(entityTypeEditControl.GetType()) || _entityTypeEditControl.ID != entityTypeEditControl.ID)
            {
                _entityTypeEditControl = entityTypeEditControl;
            }

            if (_entityTypeEditControl != null)
            {
                var rockControlWrapper = new RockControlWrapper();
                rockControlWrapper.Label = string.Format("{0} filter", fieldTypeName);
                rockControlWrapper.Help  = string.Format(
                    "Either select a specific {0}, or select 'Get from page context' to determine the {0} based on the page context. Leave {0} blank to show values for all {1}",
                    fieldTypeName,
                    fieldTypeName.Pluralize());

                rockControlWrapper.ID = string.Format("{0}_{1}", this.ID, "rockControlWrapper");
                _phEntityTypeEntityIdValue.Controls.Add(rockControlWrapper);

                if (_rblSelectOrContext == null)
                {
                    _rblSelectOrContext    = new RockRadioButtonList();
                    _rblSelectOrContext.ID = string.Format("{0}_{1}", this.ID, "rblSelectOrContext");
                    _rblSelectOrContext.RepeatDirection = RepeatDirection.Horizontal;
                    _rblSelectOrContext.Items.Add(new ListItem("Select " + fieldTypeName, "0"));
                    _rblSelectOrContext.Items.Add(new ListItem("Get from page context", "1"));
                    _rblSelectOrContext.AutoPostBack          = true;
                    _rblSelectOrContext.SelectedIndexChanged += rblSelectOrContext_SelectedIndexChanged;
                }
                else
                {
                    _rblSelectOrContext.Items[0].Text = "Select " + fieldTypeName;
                }

                rockControlWrapper.Controls.Add(_rblSelectOrContext);
                if (string.IsNullOrEmpty(_rblSelectOrContext.SelectedValue))
                {
                    // might have to get the SelectedValue since we re-created the control after Load()
                    _rblSelectOrContext.SelectedValue = this.Page.Request.Params[_rblSelectOrContext.UniqueID];
                }

                if (string.IsNullOrEmpty(_rblSelectOrContext.SelectedValue))
                {
                    // if not set from either what it was, or from PageContext, default it to "Get from page context"
                    _rblSelectOrContext.SelectedValue = "1";
                }

                _entityTypeEditControl.Visible = _rblSelectOrContext.SelectedValue.AsIntegerOrNull() == 0;
                rockControlWrapper.Controls.Add(_entityTypeEditControl);
                if (_cbCombine == null)
                {
                    _cbCombine    = new RockCheckBox();
                    _cbCombine.ID = string.Format("{0}_{1}", this.ID, "cbCombine");
                }

                _cbCombine.Text = "Combine multiple values to one line when showing values for multiple " + fieldTypeName.Pluralize();

                rockControlWrapper.Controls.Add(_cbCombine);
            }
        }
コード例 #30
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfExpanded = new HiddenFieldWithClass();
            Controls.Add( _hfExpanded );
            _hfExpanded.ID = this.ID + "_hfExpanded";
            _hfExpanded.CssClass = "filter-expanded";
            _hfExpanded.Value = "False";

            _hfActionTypeGuid = new HiddenField();
            Controls.Add( _hfActionTypeGuid );
            _hfActionTypeGuid.ID = this.ID + "_hfActionTypeGuid";

            _lblActionTypeName = new Label();
            Controls.Add( _lblActionTypeName );
            _lblActionTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActionTypeName.ID = this.ID + "_lblActionTypeName";

            _lbDeleteActionType = new LinkButton();
            Controls.Add( _lbDeleteActionType );
            _lbDeleteActionType.CausesValidation = false;
            _lbDeleteActionType.ID = this.ID + "_lbDeleteActionType";
            _lbDeleteActionType.CssClass = "btn btn-xs btn-danger js-action-delete";
            _lbDeleteActionType.Click += lbDeleteActionType_Click;

            var iDelete = new HtmlGenericControl( "i" );
            _lbDeleteActionType.Controls.Add( iDelete );
            iDelete.AddCssClass( "fa fa-times" );

            _ddlCriteriaAttribute = new RockDropDownList();
            Controls.Add( _ddlCriteriaAttribute );
            _ddlCriteriaAttribute.ID = this.ID + "_ddlCriteriaAttribute";
            _ddlCriteriaAttribute.CssClass = "js-conditional-run-criteria";
            _ddlCriteriaAttribute.Label = "Run If";
            _ddlCriteriaAttribute.Help = "Optional criteria to prevent the action from running.  If the criteria is not met, this action will be skipped when this activity is processed.";

            _ddlCriteriaComparisonType = new RockDropDownList();
            Controls.Add( _ddlCriteriaComparisonType );
            _ddlCriteriaComparisonType.ID = this.ID + "_ddlCriteriaComparisonType";
            _ddlCriteriaComparisonType.CssClass = "js-action-criteria-comparison";
            _ddlCriteriaComparisonType.BindToEnum<ComparisonType>();
            _ddlCriteriaComparisonType.Label = "&nbsp;";

            _tbddlCriteriaValue = new RockTextOrDropDownList();
            Controls.Add( _tbddlCriteriaValue );
            _tbddlCriteriaValue.ID = this.ID + "_tbddlCriteriaValue";
            _tbddlCriteriaValue.TextBox.Label = "Text Value";
            _tbddlCriteriaValue.DropDownList.Label = "Attribute Value";

            _tbActionTypeName = new RockTextBox();
            Controls.Add( _tbActionTypeName );
            _tbActionTypeName.ID = this.ID + "_tbActionTypeName";
            _tbActionTypeName.Label = "Name";
            _tbActionTypeName.Required = true;
            _tbActionTypeName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblActionTypeName.ID );

            _ddlEntityType = new RockDropDownList();
            Controls.Add( _ddlEntityType );
            _ddlEntityType.ID = this.ID + "_ddlEntityType";
            _ddlEntityType.Label = "Action Type";

            // make it autopostback since Attributes are dependant on which EntityType is selected
            _ddlEntityType.AutoPostBack = true;
            _ddlEntityType.SelectedIndexChanged += ddlEntityType_SelectedIndexChanged;

            foreach ( var item in ActionContainer.Instance.Components.Values.OrderBy( a => a.Value.EntityType.FriendlyName ) )
            {
                var type = item.Value.GetType();
                if (type != null)
                {
                    var entityType = EntityTypeCache.Read( type );
                    var li = new ListItem( entityType.FriendlyName, entityType.Id.ToString() );

                    // Get description
                    string description = string.Empty;
                    var descAttributes = type.GetCustomAttributes( typeof( System.ComponentModel.DescriptionAttribute ), false );
                    if ( descAttributes != null )
                    {
                        foreach ( System.ComponentModel.DescriptionAttribute descAttribute in descAttributes )
                        {
                            description = descAttribute.Description;
                        }
                    }
                    if ( !string.IsNullOrWhiteSpace( description ) )
                    {
                        li.Attributes.Add( "title", description );
                    }

                    _ddlEntityType.Items.Add( li );
                }
            }

            _cbIsActionCompletedOnSuccess = new RockCheckBox { Text = "Action is Completed on Success" };
            Controls.Add( _cbIsActionCompletedOnSuccess );
            _cbIsActionCompletedOnSuccess.ID = this.ID + "_cbIsActionCompletedOnSuccess";

            _cbIsActivityCompletedOnSuccess = new RockCheckBox { Text = "Activity is Completed on Success" };
            Controls.Add( _cbIsActivityCompletedOnSuccess );
            _cbIsActivityCompletedOnSuccess.ID = this.ID + "_cbIsActivityCompletedOnSuccess";

            _formEditor = new WorkflowFormEditor();
            Controls.Add( _formEditor );
            _formEditor.ID = this.ID + "_formEditor";

            _phActionAttributes = new PlaceHolder();
            Controls.Add( _phActionAttributes );
            _phActionAttributes.ID = this.ID + "_phActionAttributes";
        }
コード例 #31
0
ファイル: ScheduleBuilder.cs プロジェクト: Ganon11/Rock
        /// <summary>
        /// Initializes a new instance of the <see cref="ScheduleBuilder"/> class.
        /// </summary>
        public ScheduleBuilderPopupContents()
        {
            // common
            _dpStartDateTime = new DateTimePicker();

            _tbDurationHours = new NumberBox();
            _tbDurationMinutes = new NumberBox();

            _radOneTime = new RadioButton();
            _radRecurring = new RadioButton();

            _radSpecificDates = new RadioButton();
            _radDaily = new RadioButton();
            _radWeekly = new RadioButton();
            _radMonthly = new RadioButton();

            // specific date
            _hfSpecificDateListValues = new HiddenField();

            _dpSpecificDate = new DatePicker();

            // daily
            _radDailyEveryXDays = new RadioButton();
            _tbDailyEveryXDays = new NumberBox();
            _radDailyEveryWeekday = new RadioButton();
            _radDailyEveryWeekendDay = new RadioButton();

            // weekly
            _tbWeeklyEveryX = new NumberBox();
            _cbWeeklySunday = new RockCheckBox();
            _cbWeeklyMonday = new RockCheckBox();
            _cbWeeklyTuesday = new RockCheckBox();
            _cbWeeklyWednesday = new RockCheckBox();
            _cbWeeklyThursday = new RockCheckBox();
            _cbWeeklyFriday = new RockCheckBox();
            _cbWeeklySaturday = new RockCheckBox();

            // monthly
            _radMonthlyDayX = new RadioButton();
            _tbMonthlyDayX = new NumberBox();
            _tbMonthlyXMonths = new NumberBox();
            _radMonthlyNth = new RadioButton();
            _ddlMonthlyNth = new RockDropDownList();
            _ddlMonthlyDayName = new RockDropDownList();

            // end date
            _radEndByNone = new RadioButton();
            _radEndByDate = new RadioButton();
            _dpEndBy = new DatePicker();
            _radEndByOccurrenceCount = new RadioButton();
            _tbEndByOccurrenceCount = new NumberBox();

            // exclusions
            _hfExclusionDateRangeListValues = new HiddenField();
            _dpExclusionDateRange = new DateRangePicker();
        }
コード例 #32
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfActivityTypeGuid    = new HiddenField();
            _hfActivityTypeGuid.ID = this.ID + "_hfActivityTypeGuid";

            _lblActivityTypeName = new Label();
            _lblActivityTypeName.ClientIDMode        = ClientIDMode.Static;
            _lblActivityTypeName.ID                  = this.ID + "_lblActivityTypeName";
            _lblActivityTypeDescription              = new Label();
            _lblActivityTypeDescription.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeDescription.ID           = this.ID + "_lblActivityTypeDescription";

            _lblInactive = new Label();
            _lblInactive.ClientIDMode = ClientIDMode.Static;
            _lblInactive.ID           = this.ID + "_lblInactive";
            _lblInactive.CssClass     = "label label-important pull-right";
            _lblInactive.Text         = "Inactive";

            _lbDeleteActivityType = new LinkButton();
            _lbDeleteActivityType.CausesValidation = false;
            _lbDeleteActivityType.ID       = this.ID + "_lbDeleteActivityType";
            _lbDeleteActivityType.CssClass = "btn btn-xs btn-danger";
            _lbDeleteActivityType.Click   += lbDeleteActivityType_Click;
            _lbDeleteActivityType.Controls.Add(new LiteralControl {
                Text = "<i class='fa fa-times'></i>"
            });

            _cbActivityTypeIsActive = new RockCheckBox {
                Label = "Active"
            };
            _cbActivityTypeIsActive.ID = this.ID + "_cbActivityTypeIsActive";
            string checkboxScriptFormat = @"
javascript: 
    if ($(this).is(':checked')) {{ 
        $('#{0}').hide(); 
        $('#{1}').removeClass('workflow-activity-inactive'); 
    }} 
    else {{ 
        $('#{0}').show(); 
        $('#{1}').addClass('workflow-activity-inactive'); 
    }}
";

            _cbActivityTypeIsActive.InputAttributes.Add("onclick", string.Format(checkboxScriptFormat, _lblInactive.ID, this.ID + "_section"));

            _tbActivityTypeName       = new DataTextBox();
            _tbActivityTypeName.ID    = this.ID + "_tbActivityTypeName";
            _tbActivityTypeName.Label = "Name";

            // set label when they exit the edit field
            _tbActivityTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActivityTypeName.ID);
            _tbActivityTypeName.SourceTypeName       = "Rock.Model.WorkflowActivityType, Rock";
            _tbActivityTypeName.PropertyName         = "Name";

            _tbActivityTypeDescription          = new DataTextBox();
            _tbActivityTypeDescription.ID       = this.ID + "_tbActivityTypeDescription";
            _tbActivityTypeDescription.Label    = "Description";
            _tbActivityTypeDescription.TextMode = TextBoxMode.MultiLine;
            _tbActivityTypeDescription.Rows     = 4;

            // set label when they exit the edit field
            _tbActivityTypeDescription.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActivityTypeDescription.ID);
            _tbActivityTypeDescription.SourceTypeName       = "Rock.Model.WorkflowActivityType, Rock";
            _tbActivityTypeDescription.PropertyName         = "Description";

            _cbActivityTypeIsActivatedWithWorkflow = new RockCheckBox {
                Label = "Activated with Workflow"
            };
            _cbActivityTypeIsActivatedWithWorkflow.ID = this.ID + "_cbActivityTypeIsActivatedWithWorkflow";

            _lbAddActionType                  = new LinkButton();
            _lbAddActionType.ID               = this.ID + "_lbAddAction";
            _lbAddActionType.CssClass         = "btn btn-xs btn-action";
            _lbAddActionType.Click           += lbAddActionType_Click;
            _lbAddActionType.CausesValidation = false;
            _lbAddActionType.Controls.Add(new LiteralControl {
                Text = "<i class='fa fa-plus'></i> Add Action"
            });

            Controls.Add(_hfActivityTypeGuid);
            Controls.Add(_lblActivityTypeName);
            Controls.Add(_lblActivityTypeDescription);
            Controls.Add(_lblInactive);
            Controls.Add(_tbActivityTypeName);
            Controls.Add(_tbActivityTypeDescription);
            Controls.Add(_cbActivityTypeIsActive);
            Controls.Add(_cbActivityTypeIsActivatedWithWorkflow);
            Controls.Add(_lbDeleteActivityType);
            Controls.Add(_lbAddActionType);
        }
コード例 #33
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls( System.Web.UI.Control parentControl )
        {
            var comparisonControl = ComparisonHelper.ComparisonControl( ComparisonType.LessThan | ComparisonType.GreaterThanOrEqualTo | ComparisonType.EqualTo );
            comparisonControl.ID = parentControl.ID + "_0";
            parentControl.Controls.Add( comparisonControl );

            var globalAttributes = Rock.Web.Cache.GlobalAttributesCache.Read();

            NumberBox numberBoxAmount = new NumberBox();
            numberBoxAmount.PrependText = globalAttributes.GetValue( "CurrencySymbol" ) ?? "$";
            numberBoxAmount.NumberType = ValidationDataType.Currency;
            numberBoxAmount.ID = parentControl.ID + "_1";
            numberBoxAmount.Label = "Amount";

            parentControl.Controls.Add( numberBoxAmount );

            AccountPicker accountPicker = new AccountPicker();
            accountPicker.AllowMultiSelect = true;
            accountPicker.ID = parentControl.ID + "_accountPicker";
            accountPicker.AddCssClass( "js-account-picker" );
            accountPicker.Label = "Accounts";
            parentControl.Controls.Add( accountPicker );

            DateRangePicker dateRangePicker = new DateRangePicker();
            dateRangePicker.ID = parentControl.ID + "_2";
            dateRangePicker.Label = "Date Range";
            dateRangePicker.Required = true;
            parentControl.Controls.Add( dateRangePicker );

            RockCheckBox cbCombineGiving = new RockCheckBox();
            cbCombineGiving.ID = parentControl.ID + "_cbCombineGiving";
            cbCombineGiving.Label = "Combine Giving";
            cbCombineGiving.CssClass = "js-combine-giving";
            cbCombineGiving.Help = "Combine individuals in the same giving group when calculating totals and reporting the list of individuals.";
            parentControl.Controls.Add( cbCombineGiving );

            var controls = new Control[5] { comparisonControl, numberBoxAmount, accountPicker, dateRangePicker, cbCombineGiving };

            SetSelection( controls, string.Format( "{0}|||||", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString() ) );

            return controls;
        }
コード例 #34
0
ファイル: PersonFieldType.cs プロジェクト: NewSpring/Rock
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            var cbEnableSelfSelection = new RockCheckBox();
            controls.Add( cbEnableSelfSelection );
            cbEnableSelfSelection.Label = "Enable Self Selection";
            cbEnableSelfSelection.Text = "Yes";
            cbEnableSelfSelection.Help = "When using Person Picker, show the self selection option";
            return controls;
        }
コード例 #35
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfExpanded = new HiddenFieldWithClass();
            Controls.Add( _hfExpanded );
            _hfExpanded.ID = this.ID + "_hfExpanded";
            _hfExpanded.CssClass = "filter-expanded";
            _hfExpanded.Value = "False";

            _hfActivityTypeGuid = new HiddenField();
            Controls.Add( _hfActivityTypeGuid );
            _hfActivityTypeGuid.ID = this.ID + "_hfActivityTypeGuid";

            _lblActivityTypeName = new Label();
            Controls.Add( _lblActivityTypeName );
            _lblActivityTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeName.ID = this.ID + "_lblActivityTypeName";

            _lblActivityTypeDescription = new Label();
            Controls.Add( _lblActivityTypeDescription );
            _lblActivityTypeDescription.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeDescription.ID = this.ID + "_lblActivityTypeDescription";

            _lblInactive = new Label();
            Controls.Add( _lblInactive );
            _lblInactive.ClientIDMode = ClientIDMode.Static;
            _lblInactive.ID = this.ID + "_lblInactive";
            _lblInactive.CssClass = "pull-right";
            _lblInactive.Text = "<span class='label label-danger'>Inactive</span>";

            _lbDeleteActivityType = new LinkButton();
            Controls.Add( _lbDeleteActivityType );
            _lbDeleteActivityType.CausesValidation = false;
            _lbDeleteActivityType.ID = this.ID + "_lbDeleteActivityType";
            _lbDeleteActivityType.CssClass = "btn btn-xs btn-danger js-activity-delete";
            _lbDeleteActivityType.Click += lbDeleteActivityType_Click;
            _lbDeleteActivityType.Controls.Add( new LiteralControl { Text = "<i class='fa fa-times'></i>" } );

            _sbSecurity = new SecurityButton();
            Controls.Add( _sbSecurity );
            _sbSecurity.ID = this.ID + "_sbSecurity";
            _sbSecurity.Attributes["class"] = "btn btn-security btn-xs security pull-right";
            _sbSecurity.EntityTypeId = EntityTypeCache.Read( typeof( Rock.Model.WorkflowActivityType ) ).Id;

            _cbActivityTypeIsActive = new RockCheckBox { Text = "Active" };
            Controls.Add( _cbActivityTypeIsActive );
            _cbActivityTypeIsActive.ID = this.ID + "_cbActivityTypeIsActive";
            string checkboxScriptFormat = @"
            javascript:
            if ($(this).is(':checked')) {{
            $('#{0}').hide();
            $('#{1}').removeClass('workflow-activity-inactive');
            }}
            else {{
            $('#{0}').show();
            $('#{1}').addClass('workflow-activity-inactive');
            }}
            ";

            _cbActivityTypeIsActive.InputAttributes.Add( "onclick", string.Format( checkboxScriptFormat, _lblInactive.ID, this.ID + "_section" ) );

            _tbActivityTypeName = new RockTextBox();
            Controls.Add( _tbActivityTypeName );
            _tbActivityTypeName.ID = this.ID + "_tbActivityTypeName";
            _tbActivityTypeName.Label = "Name";
            _tbActivityTypeName.Required = true;
            _tbActivityTypeName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblActivityTypeName.ID );

            _tbActivityTypeDescription = new RockTextBox();
            Controls.Add( _tbActivityTypeDescription );
            _tbActivityTypeDescription.ID = this.ID + "_tbActivityTypeDescription";
            _tbActivityTypeDescription.Label = "Description";
            _tbActivityTypeDescription.TextMode = TextBoxMode.MultiLine;
            _tbActivityTypeDescription.Rows = 2;
            _tbActivityTypeDescription.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblActivityTypeDescription.ID );

            _cbActivityTypeIsActivatedWithWorkflow = new RockCheckBox { Text = "Activated with Workflow" };
            Controls.Add( _cbActivityTypeIsActivatedWithWorkflow );
            _cbActivityTypeIsActivatedWithWorkflow.ID = this.ID + "_cbActivityTypeIsActivatedWithWorkflow";
            checkboxScriptFormat = @"
            javascript:
            if ($(this).is(':checked')) {{
            $('#{0}').addClass('activated-with-workflow');
            }}
            else {{
            $('#{0}').removeClass('activated-with-workflow');
            }}
            ";
            _cbActivityTypeIsActivatedWithWorkflow.InputAttributes.Add( "onclick", string.Format( checkboxScriptFormat, this.ID + "_section" ) );

            _lbAddActionType = new LinkButton();
            Controls.Add( _lbAddActionType );
            _lbAddActionType.ID = this.ID + "_lbAddAction";
            _lbAddActionType.CssClass = "btn btn-xs btn-action";
            _lbAddActionType.Click += lbAddActionType_Click;
            _lbAddActionType.CausesValidation = false;
            _lbAddActionType.Controls.Add( new LiteralControl { Text = "<i class='fa fa-plus'></i> Add Action" } );

            _pwAttributes = new PanelWidget();
            Controls.Add( _pwAttributes );
            _pwAttributes.ID = this.ID + "_pwAttributes";
            _pwAttributes.Title = "Activity Attributes";
            _pwAttributes.CssClass = "attribute-panel";

            _gAttributes = new Grid();
            _pwAttributes.Controls.Add( _gAttributes );
            _gAttributes.ID = this.ID + "_gAttributes";
            _gAttributes.AllowPaging = false;
            _gAttributes.DisplayType = GridDisplayType.Light;
            _gAttributes.RowItemText = "Activity Attribute";
            _gAttributes.AddCssClass( "attribute-grid" );
            _gAttributes.DataKeyNames = new string[] { "Guid" };
            _gAttributes.Actions.ShowAdd = true;
            _gAttributes.Actions.AddClick += gAttributes_Add;
            _gAttributes.GridRebind += gAttributes_Rebind;
            _gAttributes.GridReorder += gAttributes_Reorder;

            var reorderField = new ReorderField();
            _gAttributes.Columns.Add( reorderField );

            var nameField = new BoundField();
            nameField.DataField = "Name";
            nameField.HeaderText = "Attribute";
            _gAttributes.Columns.Add( nameField );

            var descField = new BoundField();
            descField.DataField = "Description";
            descField.HeaderText = "Description";
            _gAttributes.Columns.Add( descField );

            var fieldTypeField = new BoundField();
            fieldTypeField.DataField = "FieldType";
            fieldTypeField.HeaderText = "Field Type";
            _gAttributes.Columns.Add( fieldTypeField );

            var reqField = new BoolField();
            reqField.DataField = "IsRequired";
            reqField.HeaderText = "Required";
            _gAttributes.Columns.Add( reqField );

            var editField = new EditField();
            editField.Click += gAttributes_Edit;
            _gAttributes.Columns.Add( editField );

            var delField = new DeleteField();
            delField.Click += gAttributes_Delete;
            _gAttributes.Columns.Add( delField );
        }
コード例 #36
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfActionTypeGuid    = new HiddenField();
            _hfActionTypeGuid.ID = this.ID + "_hfActionTypeGuid";

            _lblActionTypeName = new Label();
            _lblActionTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActionTypeName.ID           = this.ID + "_lblActionTypeName";

            _lbDeleteActionType = new LinkButton();
            _lbDeleteActionType.CausesValidation = false;
            _lbDeleteActionType.ID       = this.ID + "_lbDeleteActionType";
            _lbDeleteActionType.CssClass = "btn btn-xs btn-danger";
            _lbDeleteActionType.Click   += lbDeleteActionType_Click;

            var iDelete = new HtmlGenericControl("i");

            _lbDeleteActionType.Controls.Add(iDelete);
            iDelete.AddCssClass("fa fa-times");

            _tbActionTypeName       = new DataTextBox();
            _tbActionTypeName.ID    = this.ID + "_tbActionTypeName";
            _tbActionTypeName.Label = "Name";

            _ddlEntityType       = new RockDropDownList();
            _ddlEntityType.ID    = this.ID + "_ddlEntityType";
            _ddlEntityType.Label = "Action Type";

            // make it autopostback since Attributes are dependant on which EntityType is selected
            _ddlEntityType.AutoPostBack          = true;
            _ddlEntityType.SelectedIndexChanged += ddlEntityType_SelectedIndexChanged;

            foreach (var item in WorkflowActionContainer.Instance.Components.Values.OrderBy(a => a.Value.EntityType.FriendlyName))
            {
                var type = item.Value.GetType();
                if (type != null)
                {
                    var entityType = EntityTypeCache.Read(type);
                    var li         = new ListItem(entityType.FriendlyName, entityType.Id.ToString());

                    // Get description
                    string description    = string.Empty;
                    var    descAttributes = type.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
                    if (descAttributes != null)
                    {
                        foreach (System.ComponentModel.DescriptionAttribute descAttribute in descAttributes)
                        {
                            description = descAttribute.Description;
                        }
                    }
                    if (!string.IsNullOrWhiteSpace(description))
                    {
                        li.Attributes.Add("title", description);
                    }

                    _ddlEntityType.Items.Add(li);
                }
            }

            // set label when they exit the edit field
            _tbActionTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActionTypeName.ID);
            _tbActionTypeName.SourceTypeName       = "Rock.Model.WorkflowActionType, Rock";
            _tbActionTypeName.PropertyName         = "Name";

            _cbIsActionCompletedOnSuccess = new RockCheckBox {
                Label = "Action is Completed on Success"
            };
            _cbIsActionCompletedOnSuccess.ID = this.ID + "_cbIsActionCompletedOnSuccess";

            _cbIsActivityCompletedOnSuccess = new RockCheckBox {
                Label = "Activity is Completed on Success"
            };
            _cbIsActivityCompletedOnSuccess.ID = this.ID + "_cbIsActivityCompletedOnSuccess";

            _phActionAttributes    = new PlaceHolder();
            _phActionAttributes.ID = this.ID + "_phActionAttributes";

            Controls.Add(_hfActionTypeGuid);
            Controls.Add(_lblActionTypeName);
            Controls.Add(_tbActionTypeName);
            Controls.Add(_ddlEntityType);
            Controls.Add(_cbIsActionCompletedOnSuccess);
            Controls.Add(_cbIsActivityCompletedOnSuccess);
            Controls.Add(_phActionAttributes);
            Controls.Add(_lbDeleteActionType);
        }
コード例 #37
0
ファイル: FilterField.cs プロジェクト: SparkDevNetwork/Rock
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            ddlFilterType = new RockDropDownList();
            Controls.Add(ddlFilterType);
            ddlFilterType.ID = this.ID + "_ddlFilter";

            nbFilterError         = new NotificationBox();
            nbFilterError.ID      = this.ID + "_nbFilterError";
            nbFilterError.Visible = false;
            HasFilterError        = false;

            var filterEntityType = EntityTypeCache.Get(FilterEntityTypeName);
            var component        = Rock.Reporting.DataFilterContainer.GetComponent(FilterEntityTypeName);

            if (component != null)
            {
                component.Options = FilterOptions;
                filterControls    = component.CreateChildControls(FilteredEntityType, this, this.FilterMode);
            }
            else
            {
                nbFilterError.NotificationBoxType = NotificationBoxType.Danger;
                nbFilterError.Text    = $"Unable to determine filter component for {FilterEntityTypeName}. ";
                nbFilterError.Visible = true;
                HasFilterError        = true;
                Controls.Add(nbFilterError);
                filterControls = new Control[0];
            }

            SetFilterControlsValidationGroup(this.ValidationGroup);

            ddlFilterType.AutoPostBack          = true;
            ddlFilterType.SelectedIndexChanged += ddlFilterType_SelectedIndexChanged;

            ddlFilterType.Items.Clear();
            if (HasFilterError)
            {
                // if there is a FilterError, the filter component might not be listed, so it shows that nothing is selected if filtertype can't be found
                ddlFilterType.Items.Add(new ListItem());
            }

            if (AuthorizedComponents != null)
            {
                foreach (var section in AuthorizedComponents)
                {
                    foreach (var item in section.Value)
                    {
                        if (!this.ExcludedFilterTypes.Any(a => a == item.Key))
                        {
                            ListItem li = new ListItem(item.Value, item.Key);

                            if (!string.IsNullOrWhiteSpace(section.Key))
                            {
                                li.Attributes.Add("optiongroup", section.Key);
                            }

                            var filterComponent = Rock.Reporting.DataFilterContainer.GetComponent(item.Key);
                            if (filterComponent != null)
                            {
                                string description = Reflection.GetDescription(filterComponent.GetType());
                                if (!string.IsNullOrWhiteSpace(description))
                                {
                                    li.Attributes.Add("title", description);
                                }
                            }

                            li.Selected = item.Key == FilterEntityTypeName;
                            ddlFilterType.Items.Add(li);
                        }
                    }
                }
            }

            hfExpanded = new HiddenField();
            Controls.Add(hfExpanded);
            hfExpanded.ID    = this.ID + "_hfExpanded";
            hfExpanded.Value = "True";

            lbDelete = new LinkButton();
            Controls.Add(lbDelete);
            lbDelete.ID               = this.ID + "_lbDelete";
            lbDelete.CssClass         = "btn btn-xs btn-square btn-danger";
            lbDelete.Click           += lbDelete_Click;
            lbDelete.CausesValidation = false;

            var iDelete = new HtmlGenericControl("i");

            lbDelete.Controls.Add(iDelete);
            iDelete.AddCssClass("fa fa-times");

            cbIncludeFilter = new RockCheckBox();
            cbIncludeFilter.ContainerCssClass = "filterfield-checkbox";
            cbIncludeFilter.TextCssClass      = "control-label";
            Controls.Add(cbIncludeFilter);
            cbIncludeFilter.ID = this.ID + "_cbIncludeFilter";

            nbComponentDescription = new NotificationBox();
            nbComponentDescription.NotificationBoxType = NotificationBoxType.Info;
            nbComponentDescription.ID = this.ID + "_nbComponentDescription";
            Controls.Add(nbComponentDescription);
        }
コード例 #38
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a drop down list of defined types (the one that gets selected is
            // used to build a list of defined values) 
            var ddl = new RockDropDownList();
            controls.Add( ddl );
            ddl.AutoPostBack = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Defined Type";
            ddl.Help = "The Defined Type to select values from.";

            Rock.Model.DefinedTypeService definedTypeService = new Model.DefinedTypeService();
            foreach ( var definedType in definedTypeService.Queryable().OrderBy( d => d.Order ) )
            {
                ddl.Items.Add( new ListItem( definedType.Name, definedType.Id.ToString() ) );
            }

            // Add checkbox for deciding if the defined values list is renedered as a drop
            // down list or a checkbox list.
            var cb = new RockCheckBox();
            controls.Add( cb );
            cb.AutoPostBack = true;
            cb.CheckedChanged += OnQualifierUpdated;
            cb.Label = "Allow Multiple Values";
            cb.Text = "Yes";
            cb.Help = "When set, allows multiple defined type values to be selected.";
            return controls;
        }
コード例 #39
0
ファイル: FilterField.cs プロジェクト: BricksandMortar/Rock
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            ddlFilterType = new RockDropDownList();
            Controls.Add(ddlFilterType);
            ddlFilterType.ID = this.ID + "_ddlFilter";

            var component = Rock.Reporting.DataFilterContainer.GetComponent(FilterEntityTypeName);

            if (component != null)
            {
                component.Options = FilterOptions;
                filterControls    = component.CreateChildControls(FilteredEntityType, this, this.FilterMode);
            }
            else
            {
                filterControls = new Control[0];
            }

            ddlFilterType.AutoPostBack          = true;
            ddlFilterType.SelectedIndexChanged += ddlFilterType_SelectedIndexChanged;

            ddlFilterType.Items.Clear();

            foreach (var section in AuthorizedComponents)
            {
                foreach (var item in section.Value)
                {
                    if (!this.ExcludedFilterTypes.Any(a => a == item.Key))
                    {
                        ListItem li = new ListItem(item.Value, item.Key);

                        if (!string.IsNullOrWhiteSpace(section.Key))
                        {
                            li.Attributes.Add("optiongroup", section.Key);
                        }

                        var filterComponent = Rock.Reporting.DataFilterContainer.GetComponent(item.Key);
                        if (filterComponent != null)
                        {
                            string description = Reflection.GetDescription(filterComponent.GetType());
                            if (!string.IsNullOrWhiteSpace(description))
                            {
                                li.Attributes.Add("title", description);
                            }
                        }

                        li.Selected = item.Key == FilterEntityTypeName;
                        ddlFilterType.Items.Add(li);
                    }
                }
            }

            hfExpanded = new HiddenField();
            Controls.Add(hfExpanded);
            hfExpanded.ID    = this.ID + "_hfExpanded";
            hfExpanded.Value = "True";

            lbDelete = new LinkButton();
            Controls.Add(lbDelete);
            lbDelete.ID               = this.ID + "_lbDelete";
            lbDelete.CssClass         = "btn btn-xs btn-danger ";
            lbDelete.Click           += lbDelete_Click;
            lbDelete.CausesValidation = false;

            var iDelete = new HtmlGenericControl("i");

            lbDelete.Controls.Add(iDelete);
            iDelete.AddCssClass("fa fa-times");

            cbIncludeFilter = new RockCheckBox();
            cbIncludeFilter.ContainerCssClass = "filterfield-checkbox";
            Controls.Add(cbIncludeFilter);
            cbIncludeFilter.ID = this.ID + "_cbIncludeFilter";
        }
コード例 #40
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfActionGuid = new HiddenField();
            Controls.Add( _hfActionGuid );
            _hfActionGuid.ID = this.ID + "_hfActionGuid";

            _lblActionTypeName = new Label();
            Controls.Add( _lblActionTypeName );
            _lblActionTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActionTypeName.ID = this.ID + "_lblActionTypeName";

            _lLastProcessed = new Literal();
            Controls.Add( _lLastProcessed );
            _lLastProcessed.ID = this.ID + "_lLastProcessed";

            _lCompleted = new Literal();
            Controls.Add( _lCompleted );
            _lCompleted.ID = this.ID + "_lCompleted";

            _cbIsActionCompleted = new RockCheckBox();
            Controls.Add( _cbIsActionCompleted );
            _cbIsActionCompleted.ID = this.ID + "_cbIsActionCompleted";
        }
コード例 #41
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (!_controlsLoaded)
            {
                Controls.Clear();

                _lAttributeActionTitle    = new Literal();
                _lAttributeActionTitle.ID = "lAttributeActionTitle";
                Controls.Add(_lAttributeActionTitle);

                _validationSummary            = new ValidationSummary();
                _validationSummary.ID         = "valiationSummary";
                _validationSummary.CssClass   = "alert alert-danger";
                _validationSummary.HeaderText = "Please Correct the Following";
                Controls.Add(_validationSummary);

                _tbName          = new RockTextBox();
                _tbName.ID       = "tbName";
                _tbName.Label    = "Name";
                _tbName.Required = true;
                Controls.Add(_tbName);

                _tbDescription          = new RockTextBox();
                _tbDescription.Label    = "Description";
                _tbDescription.ID       = "tbDescription";
                _tbDescription.TextMode = TextBoxMode.MultiLine;
                _tbDescription.Rows     = 3;
                Controls.Add(_tbDescription);

                _cpCategories                           = new CategoryPicker();
                _cpCategories.ID                        = "cpCategories_" + this.ID.ToString();
                _cpCategories.Label                     = "Categories";
                _cpCategories.AllowMultiSelect          = true;
                _cpCategories.EntityTypeId              = EntityTypeCache.Read(typeof(Rock.Model.Attribute)).Id;
                _cpCategories.EntityTypeQualifierColumn = "EntityTypeId";
                Controls.Add(_cpCategories);

                _tbKey          = new RockTextBox();
                _tbKey.ID       = "tbKey";
                _tbKey.Label    = "Key";
                _tbKey.Required = true;
                Controls.Add(_tbKey);

                _cvKey    = new CustomValidator();
                _cvKey.ID = "cvKey";
                _cvKey.ControlToValidate        = _tbKey.ID;
                _cvKey.ClientValidationFunction = "validateKey";
                _cvKey.ServerValidate          += cvKey_ServerValidate;
                _cvKey.Display      = ValidatorDisplay.Dynamic;
                _cvKey.CssClass     = "validation-error help-inline";
                _cvKey.ErrorMessage = "There is already an existing property with the key value you entered.  Please select a different key value.";
                Controls.Add(_cvKey);

                _cbRequired       = new RockCheckBox();
                _cbRequired.ID    = "cbRequired";
                _cbRequired.Label = "Required";
                _cbRequired.Text  = "Require a value";
                Controls.Add(_cbRequired);

                _cbShowInGrid       = new RockCheckBox();
                _cbShowInGrid.ID    = "cbShowInGrid";
                _cbShowInGrid.Label = "Show in Grid";
                _cbShowInGrid.Text  = "Yes";
                _cbShowInGrid.Help  = "If selected, this attribute will be included in a grid.";
                Controls.Add(_cbShowInGrid);

                _ddlFieldType                       = new RockDropDownList();
                _ddlFieldType.ID                    = "ddlFieldType";
                _ddlFieldType.Label                 = "Field Type";
                _ddlFieldType.AutoPostBack          = true;
                _ddlFieldType.SelectedIndexChanged += _ddlFieldType_SelectedIndexChanged;
                Controls.Add(_ddlFieldType);

                if (!Page.IsPostBack)
                {
                    _ddlFieldType.DataValueField = "Id";
                    _ddlFieldType.DataTextField  = "Name";
                    _ddlFieldType.DataSource     = new FieldTypeService()
                                                   .Queryable()
                                                   .OrderBy(a => a.Name)
                                                   .Select(a => new { a.Id, a.Name }).ToList();;
                    _ddlFieldType.DataBind();
                }

                _phQualifiers    = new PlaceHolder();
                _phQualifiers.ID = "phQualifiers";
                _phQualifiers.EnableViewState = false;
                Controls.Add(_phQualifiers);

                _phDefaultValue    = new PlaceHolder();
                _phDefaultValue.ID = "phDefaultValue";
                _phDefaultValue.EnableViewState = false;
                Controls.Add(_phDefaultValue);

                _btnSave          = new LinkButton();
                _btnSave.ID       = "btnSave";
                _btnSave.Text     = "OK";
                _btnSave.CssClass = "btn btn-primary";
                _btnSave.Click   += btnSave_Click;
                Controls.Add(_btnSave);

                _btnCancel                  = new LinkButton();
                _btnCancel.ID               = "btnCancel";
                _btnCancel.Text             = "Cancel";
                _btnCancel.CssClass         = "btn btn-link";
                _btnCancel.CausesValidation = false;
                _btnCancel.Click           += btnCancel_Click;
                Controls.Add(_btnCancel);

                _tbName.Attributes["onblur"] = string.Format("populateAttributeKey('{0}','{1}')", _tbName.ClientID, _tbKey.ClientID);

                _controlsLoaded = true;
            }
        }
コード例 #42
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfExpanded = new HiddenFieldWithClass();
            Controls.Add(_hfExpanded);
            _hfExpanded.ID       = this.ID + "_hfExpanded";
            _hfExpanded.CssClass = "filter-expanded";
            _hfExpanded.Value    = "False";

            _hfActionTypeGuid = new HiddenField();
            Controls.Add(_hfActionTypeGuid);
            _hfActionTypeGuid.ID = this.ID + "_hfActionTypeGuid";

            _lblActionTypeName = new Label();
            Controls.Add(_lblActionTypeName);
            _lblActionTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActionTypeName.ID           = this.ID + "_lblActionTypeName";

            _lbDeleteActionType = new LinkButton();
            Controls.Add(_lbDeleteActionType);
            _lbDeleteActionType.CausesValidation = false;
            _lbDeleteActionType.ID       = this.ID + "_lbDeleteActionType";
            _lbDeleteActionType.CssClass = "btn btn-xs btn-square btn-danger js-action-delete";
            _lbDeleteActionType.Click   += lbDeleteActionType_Click;

            var iDelete = new HtmlGenericControl("i");

            _lbDeleteActionType.Controls.Add(iDelete);
            iDelete.AddCssClass("fa fa-times");

            _ddlCriteriaAttribute = new RockDropDownList();
            Controls.Add(_ddlCriteriaAttribute);
            _ddlCriteriaAttribute.ID = this.ID + "_ddlCriteriaAttribute";
            _ddlCriteriaAttribute.EnableViewState = false;
            _ddlCriteriaAttribute.CssClass        = "js-conditional-run-criteria";
            _ddlCriteriaAttribute.Label           = "Run If";
            _ddlCriteriaAttribute.Help            = "Optional criteria to prevent the action from running.  If the criteria is not met, this action will be skipped when this activity is processed.";

            _ddlCriteriaComparisonType = new RockDropDownList();
            Controls.Add(_ddlCriteriaComparisonType);
            _ddlCriteriaComparisonType.ID = this.ID + "_ddlCriteriaComparisonType";
            _ddlCriteriaComparisonType.EnableViewState = false;
            _ddlCriteriaComparisonType.CssClass        = "js-action-criteria-comparison";
            _ddlCriteriaComparisonType.BindToEnum <ComparisonType>();
            _ddlCriteriaComparisonType.Label = "&nbsp;";

            _tbddlCriteriaValue = new RockTextOrDropDownList();
            Controls.Add(_tbddlCriteriaValue);
            _tbddlCriteriaValue.ID = this.ID + "_tbddlCriteriaValue";
            _tbddlCriteriaValue.EnableViewState    = false;
            _tbddlCriteriaValue.TextBox.Label      = "Text Value";
            _tbddlCriteriaValue.DropDownList.Label = "Attribute Value";

            _tbActionTypeName = new RockTextBox();
            Controls.Add(_tbActionTypeName);
            _tbActionTypeName.ID                   = this.ID + "_tbActionTypeName";
            _tbActionTypeName.Label                = "Name";
            _tbActionTypeName.Required             = true;
            _tbActionTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActionTypeName.ID);

            _wfatpEntityType             = new WorkflowActionTypePicker();
            _wfatpEntityType.SelectItem += wfatpEntityType_SelectItem;
            Controls.Add(_wfatpEntityType);
            _wfatpEntityType.ID    = this.ID + "_wfatpEntityType";
            _wfatpEntityType.Label = "Action Type";

            _rlEntityTypeOverview = new RockLiteral();
            Controls.Add(_rlEntityTypeOverview);
            _rlEntityTypeOverview.ID    = this.ID + "";
            _rlEntityTypeOverview.Label = "Action Type Overview";

            _cbIsActionCompletedOnSuccess = new RockCheckBox {
                Text = "Action is Completed on Success"
            };
            Controls.Add(_cbIsActionCompletedOnSuccess);
            _cbIsActionCompletedOnSuccess.ID = this.ID + "_cbIsActionCompletedOnSuccess";

            _cbIsActivityCompletedOnSuccess = new RockCheckBox {
                Text = "Activity is Completed on Success"
            };
            Controls.Add(_cbIsActivityCompletedOnSuccess);
            _cbIsActivityCompletedOnSuccess.ID = this.ID + "_cbIsActivityCompletedOnSuccess";

            _formEditor = new WorkflowFormEditor();
            Controls.Add(_formEditor);
            _formEditor.ID = this.ID + "_formEditor";

            _phActionAttributes = new PlaceHolder();
            Controls.Add(_phActionAttributes);
            _phActionAttributes.ID = this.ID + "_phActionAttributes";
        }
コード例 #43
0
ファイル: ReportDetail.ascx.cs プロジェクト: pkdevbox/Rock
        /// <summary>
        /// Adds the field panel widget.
        /// </summary>
        /// <param name="reportFieldGuid">The report field unique identifier.</param>
        /// <param name="reportFieldType">Type of the report field.</param>
        /// <param name="fieldSelection">The field selection.</param>
        /// <param name="showExpanded">if set to <c>true</c> [show expanded].</param>
        /// <param name="setReportFieldValues">if set to <c>true</c> [set report field values].</param>
        /// <param name="reportField">The report field.</param>
        private void AddFieldPanelWidget( Guid reportFieldGuid, ReportFieldType reportFieldType, string fieldSelection, bool showExpanded, bool setReportFieldValues = false, ReportField reportField = null )
        {
            int entityTypeId = ddlEntityType.SelectedValueAsInt() ?? 0;
            if (entityTypeId == 0)
            {
                return;
            }
            
            PanelWidget panelWidget = new PanelWidget();
            panelWidget.ID = string.Format( "reportFieldWidget_{0}", reportFieldGuid.ToString( "N" ) );

            string fieldTitle = null;
            DataSelectComponent dataSelectComponent = null;
            switch ( reportFieldType )
            {
                case ReportFieldType.Property:
                    var entityType = EntityTypeCache.Read( entityTypeId ).GetEntityType();
                    var entityField = EntityHelper.GetEntityFields( entityType ).FirstOrDefault( a => a.Name == fieldSelection );
                    if ( entityField != null )
                    {
                        fieldTitle = entityField.Title;
                    }

                    break;

                case ReportFieldType.Attribute:
                    var attribute = AttributeCache.Read( fieldSelection.AsInteger() ?? 0 );
                    if ( attribute != null )
                    {
                        fieldTitle = attribute.Name;
                    }

                    break;

                case ReportFieldType.DataSelectComponent:
                    string dataSelectComponentTypeName = EntityTypeCache.Read( fieldSelection.AsInteger() ?? 0 ).GetEntityType().FullName;
                    dataSelectComponent = Rock.Reporting.DataSelectContainer.GetComponent( dataSelectComponentTypeName );
                    if ( dataSelectComponent != null )
                    {
                        fieldTitle = dataSelectComponent.GetTitle( null );
                    }

                    break;
            }

            if ( fieldTitle == null )
            {
                // return if we can't determine field
                return;
            }

            panelWidget.Title = fieldTitle;
            panelWidget.ShowDeleteButton = true;
            panelWidget.DeleteClick += FieldsPanelWidget_DeleteClick;
            panelWidget.ShowReorderIcon = true;
            panelWidget.Expanded = showExpanded;

            HiddenField hfReportFieldType = new HiddenField();
            hfReportFieldType.ID = panelWidget.ID + "_hfReportFieldType";
            hfReportFieldType.Value = reportFieldType.ConvertToString();
            panelWidget.Controls.Add( hfReportFieldType );

            HiddenField hfFieldSelection = new HiddenField();
            hfFieldSelection.ID = panelWidget.ID + "_hfFieldSelection";
            hfFieldSelection.Value = fieldSelection;
            panelWidget.Controls.Add( hfFieldSelection );

            RockCheckBox showInGridCheckBox = new RockCheckBox();
            showInGridCheckBox.ID = panelWidget.ID + "_showInGridCheckBox";
            showInGridCheckBox.Text = "Show in Grid";

            if ( setReportFieldValues )
            {
                showInGridCheckBox.Checked = reportField.ShowInGrid;
            }

            panelWidget.Controls.Add( showInGridCheckBox );

            RockTextBox columnHeaderTextTextBox = new RockTextBox();
            columnHeaderTextTextBox.ID = panelWidget.ID + "_columnHeaderTextTextBox";
            columnHeaderTextTextBox.Label = "Column Label";
            if ( setReportFieldValues )
            {
                columnHeaderTextTextBox.Text = string.IsNullOrWhiteSpace( reportField.ColumnHeaderText ) ? fieldTitle : reportField.ColumnHeaderText;
            }

            panelWidget.Controls.Add( columnHeaderTextTextBox );

            if ( dataSelectComponent != null )
            {
                PlaceHolder phDataSelectControls = new PlaceHolder();
                phDataSelectControls.ID = panelWidget.ID + "_phDataSelectControls";
                panelWidget.Controls.Add( phDataSelectControls );
                var dataSelectControls = dataSelectComponent.CreateChildControls( phDataSelectControls );

                if ( setReportFieldValues )
                {
                    dataSelectComponent.SetSelection( dataSelectControls, reportField.Selection );
                }
            }

            phReportFields.Controls.Add( panelWidget );
        }
コード例 #44
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfExpanded = new HiddenFieldWithClass();
            Controls.Add(_hfExpanded);
            _hfExpanded.ID       = this.ID + "_hfExpanded";
            _hfExpanded.CssClass = "filter-expanded";
            _hfExpanded.Value    = "False";

            _hfActivityTypeGuid = new HiddenField();
            Controls.Add(_hfActivityTypeGuid);
            _hfActivityTypeGuid.ID = this.ID + "_hfActivityTypeGuid";

            _lblActivityTypeName = new Label();
            Controls.Add(_lblActivityTypeName);
            _lblActivityTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeName.ID           = this.ID + "_lblActivityTypeName";

            _lblActivityTypeDescription = new Label();
            Controls.Add(_lblActivityTypeDescription);
            _lblActivityTypeDescription.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeDescription.ID           = this.ID + "_lblActivityTypeDescription";

            _lblInactive = new Label();
            Controls.Add(_lblInactive);
            _lblInactive.ClientIDMode = ClientIDMode.Static;
            _lblInactive.ID           = this.ID + "_lblInactive";
            _lblInactive.CssClass     = "pull-right";
            _lblInactive.Text         = "<span class='label label-danger'>Inactive</span>";

            _lbDeleteActivityType = new LinkButton();
            Controls.Add(_lbDeleteActivityType);
            _lbDeleteActivityType.CausesValidation = false;
            _lbDeleteActivityType.ID       = this.ID + "_lbDeleteActivityType";
            _lbDeleteActivityType.CssClass = "btn btn-xs btn-square btn-danger js-activity-delete";
            _lbDeleteActivityType.Click   += lbDeleteActivityType_Click;
            _lbDeleteActivityType.Controls.Add(new LiteralControl {
                Text = "<i class='fa fa-times'></i>"
            });

            _sbSecurity = new SecurityButton();
            Controls.Add(_sbSecurity);
            _sbSecurity.ID = this.ID + "_sbSecurity";
            _sbSecurity.Attributes["class"] = "btn btn-security btn-xs security pull-right";
            _sbSecurity.EntityTypeId        = EntityTypeCache.Get(typeof(Rock.Model.WorkflowActivityType)).Id;

            _cbActivityTypeIsActive = new RockCheckBox {
                Text = "Active"
            };
            Controls.Add(_cbActivityTypeIsActive);
            _cbActivityTypeIsActive.ID = this.ID + "_cbActivityTypeIsActive";
            string checkboxScriptFormat = @"
javascript: 
    if ($(this).is(':checked')) {{ 
        $('#{0}').hide(); 
        $('#{1}').removeClass('workflow-activity-inactive'); 
    }} 
    else {{ 
        $('#{0}').show(); 
        $('#{1}').addClass('workflow-activity-inactive'); 
    }}
";

            _cbActivityTypeIsActive.InputAttributes.Add("onclick", string.Format(checkboxScriptFormat, _lblInactive.ID, this.ID + "_section"));

            _tbActivityTypeName = new RockTextBox();
            Controls.Add(_tbActivityTypeName);
            _tbActivityTypeName.ID                   = this.ID + "_tbActivityTypeName";
            _tbActivityTypeName.Label                = "Name";
            _tbActivityTypeName.Required             = true;
            _tbActivityTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActivityTypeName.ID);

            _tbActivityTypeDescription = new RockTextBox();
            Controls.Add(_tbActivityTypeDescription);
            _tbActivityTypeDescription.ID                   = this.ID + "_tbActivityTypeDescription";
            _tbActivityTypeDescription.Label                = "Description";
            _tbActivityTypeDescription.TextMode             = TextBoxMode.MultiLine;
            _tbActivityTypeDescription.Rows                 = 2;
            _tbActivityTypeDescription.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActivityTypeDescription.ID);

            _cbActivityTypeIsActivatedWithWorkflow = new RockCheckBox {
                Text = "Activated with Workflow"
            };
            Controls.Add(_cbActivityTypeIsActivatedWithWorkflow);
            _cbActivityTypeIsActivatedWithWorkflow.ID = this.ID + "_cbActivityTypeIsActivatedWithWorkflow";
            checkboxScriptFormat = @"
javascript: 
    if ($(this).is(':checked')) {{ 
        $('#{0}').addClass('activated-with-workflow'); 
    }} 
    else {{ 
        $('#{0}').removeClass('activated-with-workflow'); 
    }}
";
            _cbActivityTypeIsActivatedWithWorkflow.InputAttributes.Add("onclick", string.Format(checkboxScriptFormat, this.ID + "_section"));


            _lbAddActionType = new LinkButton();
            Controls.Add(_lbAddActionType);
            _lbAddActionType.ID               = this.ID + "_lbAddAction";
            _lbAddActionType.CssClass         = "btn btn-xs btn-action add-action";
            _lbAddActionType.Click           += lbAddActionType_Click;
            _lbAddActionType.CausesValidation = false;
            _lbAddActionType.Controls.Add(new LiteralControl {
                Text = "<i class='fa fa-plus'></i> Add Action"
            });

            _pwAttributes = new PanelWidget();
            Controls.Add(_pwAttributes);
            _pwAttributes.ID       = this.ID + "_pwAttributes";
            _pwAttributes.Title    = "Activity Attributes";
            _pwAttributes.CssClass = "attribute-panel";

            _gAttributes = new Grid();
            _pwAttributes.Controls.Add(_gAttributes);
            _gAttributes.ID          = this.ID + "_gAttributes";
            _gAttributes.AllowPaging = false;
            _gAttributes.DisplayType = GridDisplayType.Light;
            _gAttributes.RowItemText = "Activity Attribute";
            _gAttributes.AddCssClass("attribute-grid");
            _gAttributes.DataKeyNames        = new string[] { "Guid" };
            _gAttributes.Actions.ShowAdd     = true;
            _gAttributes.Actions.AddClick   += gAttributes_Add;
            _gAttributes.GridRebind         += gAttributes_Rebind;
            _gAttributes.GridReorder        += gAttributes_Reorder;
            _gAttributes.ShowActionsInHeader = false;

            var reorderField = new ReorderField();

            _gAttributes.Columns.Add(reorderField);

            var nameField = new BoundField();

            nameField.DataField  = "Name";
            nameField.HeaderText = "Attribute";
            _gAttributes.Columns.Add(nameField);

            var descField = new BoundField();

            descField.DataField  = "Description";
            descField.HeaderText = "Description";
            _gAttributes.Columns.Add(descField);

            var fieldTypeField = new BoundField();

            fieldTypeField.DataField  = "FieldType";
            fieldTypeField.HeaderText = "Field Type";
            _gAttributes.Columns.Add(fieldTypeField);

            var reqField = new BoolField();

            reqField.DataField  = "IsRequired";
            reqField.HeaderText = "Required";
            _gAttributes.Columns.Add(reqField);

            var editField = new EditField();

            editField.Click += gAttributes_Edit;
            _gAttributes.Columns.Add(editField);

            var delField = new DeleteField();

            delField.Click += gAttributes_Delete;
            _gAttributes.Columns.Add(delField);
        }
コード例 #45
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfExpanded = new HiddenField();
            Controls.Add( _hfExpanded );
            _hfExpanded.ID = this.ID + "_hfExpanded";
            _hfExpanded.Value = "False";

            _hfActivityGuid = new HiddenField();
            Controls.Add( _hfActivityGuid );
            _hfActivityGuid.ID = this.ID + "_hfActivityTypeGuid";

            _lblActivityTypeName = new Label();
            Controls.Add( _lblActivityTypeName );
            _lblActivityTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeName.ID = this.ID + "_lblActivityTypeName";
            
            _lblActivityTypeDescription = new Label();
            Controls.Add( _lblActivityTypeDescription );
            _lblActivityTypeDescription.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeDescription.ID = this.ID + "_lblActivityTypeDescription";

            _lblStatus = new Label();
            Controls.Add( _lblStatus );
            _lblStatus.ClientIDMode = ClientIDMode.Static;
            _lblStatus.ID = this.ID + "_lblInactive";
            _lblStatus.CssClass = "label label-important pull-right";

            _lbDeleteActivityType = new LinkButton();
            Controls.Add( _lbDeleteActivityType );
            _lbDeleteActivityType.CausesValidation = false;
            _lbDeleteActivityType.ID = this.ID + "_lbDeleteActivityType";
            _lbDeleteActivityType.CssClass = "btn btn-xs btn-danger js-activity-delete";
            _lbDeleteActivityType.Click += lbDeleteActivityType_Click;
            _lbDeleteActivityType.Controls.Add( new LiteralControl { Text = "<i class='fa fa-times'></i>" } );

            _cbActivityIsComplete = new RockCheckBox { Text = "Complete" };
            Controls.Add( _cbActivityIsComplete );
            _cbActivityIsComplete.ID = this.ID + "_cbActivityTypeIsActive";

            _ppAssignedToPerson = new PersonPicker();
            _ppAssignedToPerson.ID = this.ID + "_ppAssignedToPerson";
            Controls.Add( _ppAssignedToPerson );
            _ppAssignedToPerson.Label = "Assign to Person";

            _gpAssignedToGroup = new GroupPicker();
            _gpAssignedToGroup.ID = this.ID + "_gpAssignedToGroup";
            Controls.Add( _gpAssignedToGroup );
            _gpAssignedToGroup.Label = "Assign to Group";

            _ddlAssignedToRole = new RockDropDownList();
            Controls.Add( _ddlAssignedToRole );
            _ddlAssignedToRole.ID = this.ID + "_ddlAssignedToRole";
            _ddlAssignedToRole.Label = "Assign to Security Role";
            _lState = new Literal();
            Controls.Add( _lState );
            _lState.ID = this.ID + "_lState";

            _ddlAssignedToRole.Items.Add( new ListItem( string.Empty, "0" ) );
            var roles = new GroupService( new RockContext() ).Queryable().Where( g => g.IsSecurityRole ).OrderBy( t => t.Name );
            if ( roles.Any() )
            {
                foreach ( var role in roles )
                {
                    _ddlAssignedToRole.Items.Add( new ListItem( role.Name, role.Id.ToString() ) );
                }
            }

            _phAttributes = new PlaceHolder();
            Controls.Add( _phAttributes );
            _phAttributes.ID = this.ID + "_phAttributes";
        }
コード例 #46
0
ファイル: WorkflowFormEditor.cs プロジェクト: Ganon11/Rock
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfFormGuid = new HiddenField();
            _hfFormGuid.ID = this.ID + "_hfFormGuid";
            Controls.Add( _hfFormGuid );

            _ddlNotificationSystemEmail = new RockDropDownList();
            _ddlNotificationSystemEmail.DataValueField = "Id";
            _ddlNotificationSystemEmail.DataTextField = "Title";
            _ddlNotificationSystemEmail.Label = "Notification Email";
            _ddlNotificationSystemEmail.Help = "An optional system email that should be sent to the person or people assigned to this activity (Any System Email with a category of 'Workflow').";
            _ddlNotificationSystemEmail.ID = this.ID + "_ddlNotificationSystemEmail";
            Controls.Add( _ddlNotificationSystemEmail );

            _ddlNotificationSystemEmail.DataSource = new SystemEmailService( new RockContext() ).Queryable()
                .Where( e => e.Category == "Workflow" ).OrderBy( e => e.Title ).ToList();
            _ddlNotificationSystemEmail.DataBind();
            _ddlNotificationSystemEmail.Items.Insert( 0, new ListItem( "None", "0" ) );

            _cbIncludeActions = new RockCheckBox();
            _cbIncludeActions.Label = "Include Actions in Email";
            _cbIncludeActions.Text = "Yes";
            _cbIncludeActions.Help = "Should the email include the option for recipient to select an action directly from within the email? Note: This only applies if none of the the form fields are required.";
            _cbIncludeActions.ID = this.ID + "_cbIncludeActions";
            Controls.Add( _cbIncludeActions );

            _ceHeaderText = new CodeEditor();
            _ceHeaderText.Label = "Form Header";
            _ceHeaderText.Help = "Text to display to user above the form fields. <span class='tip tip-liquid'></span> <span class='tip tip-html'>";
            _ceHeaderText.ID = this.ID + "_tbHeaderText";
            _ceHeaderText.EditorMode = CodeEditorMode.Html;
            _ceHeaderText.EditorTheme = CodeEditorTheme.Rock;
            _ceHeaderText.EditorHeight = "200";
            Controls.Add( _ceHeaderText );

            _ceFooterText = new CodeEditor();
            _ceFooterText.Label = "Form Footer";
            _ceFooterText.Help = "Text to display to user below the form fields. <span class='tip tip-liquid'></span> <span class='tip tip-html'>";
            _ceFooterText.ID = this.ID + "_tbFooterText";
            _ceFooterText.EditorMode = CodeEditorMode.Html;
            _ceFooterText.EditorTheme = CodeEditorTheme.Rock;
            _ceFooterText.EditorHeight = "200";
            Controls.Add( _ceFooterText );

            _falActions = new WorkflowFormActionList();
            _falActions.ID = this.ID + "_falActions";
            Controls.Add( _falActions );

            _ddlActionAttribute = new RockDropDownList();
            _ddlActionAttribute.ID = this.ID + "_ddlActionAttribute";
            _ddlActionAttribute.Label = "Command Selected Attribute";
            _ddlActionAttribute.Help = "Optional text attribute that should be updated with the selected command label.";
            Controls.Add( _ddlActionAttribute );
        }
コード例 #47
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfExpanded = new HiddenField();
            Controls.Add(_hfExpanded);
            _hfExpanded.ID    = this.ID + "_hfExpanded";
            _hfExpanded.Value = "False";

            _hfActivityGuid = new HiddenField();
            Controls.Add(_hfActivityGuid);
            _hfActivityGuid.ID = this.ID + "_hfActivityTypeGuid";

            _lblActivityTypeName = new Label();
            Controls.Add(_lblActivityTypeName);
            _lblActivityTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeName.ID           = this.ID + "_lblActivityTypeName";

            _lblActivityTypeDescription = new Label();
            Controls.Add(_lblActivityTypeDescription);
            _lblActivityTypeDescription.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeDescription.ID           = this.ID + "_lblActivityTypeDescription";

            _lblStatus = new Label();
            Controls.Add(_lblStatus);
            _lblStatus.ClientIDMode = ClientIDMode.Static;
            _lblStatus.ID           = this.ID + "_lblInactive";
            _lblStatus.CssClass     = "pull-right";

            _lbDeleteActivityType = new LinkButton();
            Controls.Add(_lbDeleteActivityType);
            _lbDeleteActivityType.CausesValidation = false;
            _lbDeleteActivityType.ID       = this.ID + "_lbDeleteActivityType";
            _lbDeleteActivityType.CssClass = "btn btn-xs btn-square btn-danger js-activity-delete";
            _lbDeleteActivityType.Click   += lbDeleteActivityType_Click;
            _lbDeleteActivityType.Controls.Add(new LiteralControl {
                Text = "<i class='fa fa-times'></i>"
            });

            _cbActivityIsComplete = new RockCheckBox {
                Text = "Complete"
            };
            Controls.Add(_cbActivityIsComplete);
            _cbActivityIsComplete.ID    = this.ID + "_cbActivityTypeIsActive";
            _cbActivityIsComplete.Label = "Activity Completed";
            _cbActivityIsComplete.Text  = "Yes";

            _ppAssignedToPerson    = new PersonPicker();
            _ppAssignedToPerson.ID = this.ID + "_ppAssignedToPerson";
            Controls.Add(_ppAssignedToPerson);
            _ppAssignedToPerson.Label = "Assign to Person";

            _lAssignedToPerson    = new RockLiteral();
            _lAssignedToPerson.ID = this.ID + "_lAssignedToPerson";
            Controls.Add(_lAssignedToPerson);
            _lAssignedToPerson.Label = "Assigned to Person";

            _gpAssignedToGroup    = new GroupPicker();
            _gpAssignedToGroup.ID = this.ID + "_gpAssignedToGroup";
            Controls.Add(_gpAssignedToGroup);
            _gpAssignedToGroup.Label = "Assign to Group";

            _lAssignedToGroup    = new RockLiteral();
            _lAssignedToGroup.ID = this.ID + "_lAssignedToGroup";
            Controls.Add(_lAssignedToGroup);
            _lAssignedToGroup.Label = "Assigned to Group";

            _ddlAssignedToRole = new RockDropDownList();
            Controls.Add(_ddlAssignedToRole);
            _ddlAssignedToRole.ID    = this.ID + "_ddlAssignedToRole";
            _ddlAssignedToRole.Label = "Assign to Security Role";

            _lAssignedToRole    = new RockLiteral();
            _lAssignedToRole.ID = this.ID + "_lAssignedToRole";
            Controls.Add(_lAssignedToRole);
            _lAssignedToRole.Label = "Assigned to Security Role";

            _lState = new Literal();
            Controls.Add(_lState);
            _lState.ID = this.ID + "_lState";

            _ddlAssignedToRole.Items.Add(new ListItem(string.Empty, "0"));
            var roles = new GroupService(new RockContext()).Queryable().Where(g => g.IsSecurityRole).OrderBy(t => t.Name);

            if (roles.Any())
            {
                foreach (var role in roles)
                {
                    _ddlAssignedToRole.Items.Add(new ListItem(role.Name, role.Id.ToString()));
                }
            }

            _phAttributes = new PlaceHolder();
            Controls.Add(_phAttributes);
            _phAttributes.ID = this.ID + "_phAttributes";
        }