Наследование: System.Web.UI.WebControls.CompositeControl
Пример #1
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.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 );
        }
        /// <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);
        }