/// <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() { //_hfBinaryFileId = new HiddenField(); base.CreateChildControls(); Controls.Clear(); RockControlHelper.CreateChildControls(this, Controls); Controls.Add(_hfBinaryFileId); _hfBinaryFileId.ID = this.ID + "_hfBinaryFileId"; _hfBinaryFileId.Value = "0"; _hfOriginalBinaryFileId.ID = this.ID + "_hfOriginalBinaryFileId"; Controls.Add(_hfOriginalBinaryFileId); _hfCropBinaryFileId.ID = this.ID + "_hfCropBinaryFileId"; Controls.Add(_hfCropBinaryFileId); _hfBinaryFileTypeGuid.ID = this.ID + "_hfBinaryFileTypeGuid"; Controls.Add(_hfBinaryFileTypeGuid); _aRemove = new HtmlAnchor(); _aRemove.ID = "rmv"; _aRemove.InnerHtml = "<i class='fa fa-times'></i>"; Controls.Add(_aRemove); _lbShowModal = new LinkButton(); _lbShowModal.ID = this.ID + "_lbShowModal"; _lbShowModal.CssClass = this.ButtonCssClass; _lbShowModal.Text = this.ButtonText; _lbShowModal.ToolTip = this.ButtonToolTip; _lbShowModal.Click += _lbShowModal_Click; _lbShowModal.CausesValidation = false; Controls.Add(_lbShowModal); // If we are not showing the delete button then // only the UploadImage button should be active. if (!ShowDeleteButton) { _aRemove.Visible = false; _lbShowModal.Visible = false; } _lbUploadImage = new LinkButton(); _lbUploadImage.ID = this.ID + "_lbUploadImage"; _lbUploadImage.CssClass = this.ButtonCssClass; _lbUploadImage.Text = this.ButtonText; _lbUploadImage.ToolTip = this.ButtonToolTip; _lbUploadImage.CausesValidation = false; Controls.Add(_lbUploadImage); _lSaveStatus = new Label(); _lSaveStatus.ID = this.ID + "_lSaveStatus"; _lSaveStatus.CssClass = "fa fa-2x fa-check-circle-o text-success"; _lSaveStatus.Style.Add("vertical-align", "bottom"); _lSaveStatus.Visible = false; Controls.Add(_lSaveStatus); _fileUpload = new FileUpload(); _fileUpload.ID = this.ID + "_fu"; Controls.Add(_fileUpload); _mdImageDialog = new ModalDialog(); _mdImageDialog.ValidationGroup = "vg_mdImageDialog"; _mdImageDialog.ID = this.ID + "_mdImageDialog"; _mdImageDialog.Title = "Image"; _mdImageDialog.SaveButtonText = "Crop"; _mdImageDialog.SaveClick += _mdImageDialog_SaveClick; _pnlCropContainer = new Panel(); _pnlCropContainer.CssClass = "crop-container image-editor-crop-container clearfix"; _nbImageWarning = new NotificationBox(); _nbImageWarning.ID = this.ID + "_nbImageWarning"; _nbImageWarning.NotificationBoxType = NotificationBoxType.Warning; _nbImageWarning.Text = "SVG image cropping is not supported."; _imgCropSource = new Image(); _imgCropSource.ID = this.ID + "_imgCropSource"; _imgCropSource.CssClass = "image-editor-crop-source"; _pnlCropContainer.Controls.Add(_imgCropSource); _mdImageDialog.Content.Controls.Add(_nbImageWarning); _mdImageDialog.Content.Controls.Add(_pnlCropContainer); _hfCropCoords = new HiddenField(); _hfCropCoords.ID = this.ID + "_hfCropCoords"; _pnlCropContainer.Controls.Add(_hfCropCoords); Controls.Add(_mdImageDialog); RequiredFieldValidator.InitialValue = "0"; RequiredFieldValidator.ControlToValidate = _hfBinaryFileId.ID; RequiredFieldValidator.Display = ValidatorDisplay.Dynamic; }
/// <summary> /// Adds a control to move the block to another zone on the page. /// </summary> private void AddBlockMove() { // Add Zone Selection Popup (for moving blocks to another zone) ModalDialog modalBlockMove = new ModalDialog(); modalBlockMove.ID = "modal-block-move"; modalBlockMove.Title = "Move Block"; modalBlockMove.OnOkScript = "Rock.admin.pageAdmin.saveBlockMove();"; this.Form.Controls.Add( modalBlockMove ); HtmlGenericControl fsZoneSelect = new HtmlGenericControl( "fieldset" ); fsZoneSelect.ClientIDMode = ClientIDMode.Static; fsZoneSelect.Attributes.Add( "id", "fsZoneSelect" ); modalBlockMove.Content.Controls.Add( fsZoneSelect ); HtmlGenericControl legend = new HtmlGenericControl( "legend" ); legend.InnerText = "New Location"; fsZoneSelect.Controls.Add( legend ); RockDropDownList ddlZones = new RockDropDownList(); ddlZones.ClientIDMode = ClientIDMode.Static; ddlZones.ID = "block-move-zone"; ddlZones.Label = "Zone"; foreach ( var zone in Zones ) ddlZones.Items.Add( new ListItem( zone.Value.Key, zone.Key ) ); fsZoneSelect.Controls.Add( ddlZones ); RockRadioButtonList rblLocation = new RockRadioButtonList(); rblLocation.RepeatDirection = RepeatDirection.Horizontal; rblLocation.ClientIDMode = ClientIDMode.Static; rblLocation.ID = "block-move-Location"; rblLocation.CssClass = "inputs-list"; rblLocation.Items.Add( new ListItem( "Current Page" ) ); rblLocation.Items.Add( new ListItem( string.Format( "All Pages Using the '{0}' Layout", _pageCache.Layout.Name ) ) ); rblLocation.Label = "Parent"; fsZoneSelect.Controls.Add( rblLocation ); }
/// <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(); this.Controls.Clear(); _scheduleBuilderPanel = new Panel(); _scheduleBuilderPanel.ID = "scheduleBuilderPanel_" + this.ClientID; _scheduleBuilderPanel.CssClass = "picker"; _scheduleBuilderPanel.ClientIDMode = ClientIDMode.Static; _btnShowPopup = new LinkButton(); _btnShowPopup.CausesValidation = false; _btnShowPopup.ID = "btnShowPopup_" + this.ClientID; _btnShowPopup.CssClass = "picker-label"; _btnShowPopup.Text = "<i class='fa fa-calendar'></i> Edit Schedule"; _btnShowPopup.ClientIDMode = ClientIDMode.Static; _btnShowPopup.Click += _btnShowPopup_Click; _modalDialog = new ModalDialog(); _modalDialog.ID = "modalDialog_" + this.ClientID; _modalDialog.ValidationGroup = _modalDialog.ID + "_validationgroup"; _modalDialog.ClientIDMode = ClientIDMode.Static; _modalDialog.Title = "Schedule Builder"; _modalDialog.SaveButtonText = "OK"; _modalDialog.SaveClick += btnSaveSchedule_Click; _scheduleBuilderPopupContents = new ScheduleBuilderPopupContents(); _scheduleBuilderPopupContents.ID = "scheduleBuilderPopupContents_" + this.ClientID; _scheduleBuilderPopupContents.ValidationGroup = _modalDialog.ValidationGroup; _scheduleBuilderPopupContents.ClientIDMode = ClientIDMode.Static; this.Controls.Add( _scheduleBuilderPanel ); _scheduleBuilderPanel.Controls.Add( _btnShowPopup ); _scheduleBuilderPanel.Controls.Add( _modalDialog ); _modalDialog.Content.Controls.Add( _scheduleBuilderPopupContents ); RockControlHelper.CreateChildControls( this, Controls ); }
/// <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() { _hfBinaryFileId = new HiddenField(); _hfBinaryFileId.ID = this.ID + "_hfBinaryFileId"; Controls.Add( _hfBinaryFileId ); _hfCropBinaryFileId = new HiddenField(); _hfCropBinaryFileId.ID = this.ID + "_hfCropBinaryFileId"; Controls.Add( _hfCropBinaryFileId ); _hfBinaryFileTypeGuid = new HiddenField(); _hfBinaryFileTypeGuid.ID = this.ID + "_hfBinaryFileTypeGuid"; Controls.Add( _hfBinaryFileTypeGuid ); _aRemove = new HtmlAnchor(); _aRemove.ID = "rmv"; _aRemove.InnerHtml = "<i class='fa fa-times'></i>"; Controls.Add( _aRemove ); _lbShowModal = new LinkButton(); _lbShowModal.ID = this.ID + "_lbShowModal"; _lbShowModal.CssClass = this.ButtonCssClass; _lbShowModal.Text = this.ButtonText; _lbShowModal.Click += _lbShowModal_Click; Controls.Add( _lbShowModal ); // If we are not showing the delete button then // only the UploadImage button should be active. if ( !ShowDeleteButton ) { _aRemove.Visible = false; _lbShowModal.Visible = false; } _lbUploadImage = new LinkButton(); _lbUploadImage.ID = this.ID + "_lbUploadImage"; _lbUploadImage.CssClass = this.ButtonCssClass; _lbUploadImage.Text = this.ButtonText; Controls.Add( _lbUploadImage ); _fileUpload = new FileUpload(); _fileUpload.ID = this.ID + "_fu"; Controls.Add( _fileUpload ); _mdImageDialog = new ModalDialog(); _mdImageDialog.ID = this.ID + "_mdImageDialog"; _mdImageDialog.Title = "Image"; _mdImageDialog.SaveButtonText = "Crop"; _mdImageDialog.SaveClick += _mdImageDialog_SaveClick; _pnlCropContainer = new Panel(); _pnlCropContainer.CssClass = "crop-container image-editor-crop-container clearfix"; _nbImageWarning = new NotificationBox(); _nbImageWarning.ID = this.ID + "_nbImageWarning"; _nbImageWarning.NotificationBoxType = NotificationBoxType.Warning; _nbImageWarning.Text = "SVG image cropping is not supported."; _imgCropSource = new Image(); _imgCropSource.ID = this.ID + "_imgCropSource"; _imgCropSource.CssClass = "image-editor-crop-source"; _pnlCropContainer.Controls.Add( _imgCropSource ); _mdImageDialog.Content.Controls.Add( _nbImageWarning ); _mdImageDialog.Content.Controls.Add( _pnlCropContainer ); _hfCropCoords = new HiddenField(); _hfCropCoords.ID = this.ID + "_hfCropCoords"; _pnlCropContainer.Controls.Add( _hfCropCoords ); Controls.Add( _mdImageDialog ); }