/// <summary> /// Initializes the controls on the page. /// </summary> private void SetupControls() { // Hide code name editing for simple mode if (DisplayMode == ControlDisplayModeEnum.Simple) { plcCodeName.Visible = false; } // Register scripts ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ShowDateFields", ScriptHelper.GetScript( "function ShowDateFields(){ \n" + " document.getElementById('" + lblBoardOpenFrom.ClientID + "').style.display = 'block'; \n" + " document.getElementById('" + dtpBoardOpenFrom.ClientID + "').style.display = 'block'; \n" + " document.getElementById('" + lblBoardOpenTo.ClientID + "').style.display = 'block'; \n" + " document.getElementById('" + dtpBoardOpenTo.ClientID + "').style.display = 'block'; } \n" + "function HideDateFields(){ \n " + " document.getElementById('" + lblBoardOpenFrom.ClientID + "').style.display = 'none'; \n " + " document.getElementById('" + dtpBoardOpenFrom.ClientID + "').style.display = 'none'; \n" + " document.getElementById('" + lblBoardOpenTo.ClientID + "').style.display = 'none'; \n" + " document.getElementById('" + dtpBoardOpenTo.ClientID + "').style.display = 'none'; }" )); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "CheckBoxes", ScriptHelper.GetScript(@" function check(txtId,chk,inhV) { txt = document.getElementById(txtId); if ((txt != null)&&(chk != null)) { if (chk.checked) { txt.disabled = 'disabled'; txt.value = inhV; } else { txt.disabled = ''; } } }" )); // Set the labels lblBoardCodeName.Text = GetString("general.codename") + ResHelper.Colon; lblBoardOwner.Text = GetString("board.owner.title") + ResHelper.Colon; lblBoardDescription.Text = GetString("general.description") + ResHelper.Colon; lblBoardDisplayName.Text = GetString("general.displayname") + ResHelper.Colon; lblBoardEnable.Text = GetString("general.enable") + ResHelper.Colon; lblBoardOpen.Text = GetString("general.open") + ResHelper.Colon; lblBoardOpenFrom.Text = GetString("general.openfrom") + ResHelper.Colon; lblBoardOpenTo.Text = GetString("general.opento") + ResHelper.Colon; lblBoardRequireEmail.Text = GetString("board.edit.requireemail") + ResHelper.Colon; lblUnsubscriptionUrl.Text = GetString("general.unsubscriptionurl") + ResHelper.Colon; lblBaseUrl.Text = GetString("general.baseurl") + ResHelper.Colon; btnOk.Text = GetString("general.ok"); chkBoardOpen.Attributes.Add("onclick", "if(this.checked){ ShowDateFields() }else{ HideDateFields() }"); // Set the error messages for validators rfvBoardCodeName.ErrorMessage = GetString("board.edit.errcodename"); rfvBoardDisplayName.ErrorMessage = GetString("board.edit.errdisplayname"); if (IsLiveSite) { plcUnsubscription.Visible = false; } chkInheritBaseUrl.Attributes.Add("onclick", "check('" + txtBaseUrl.ClientID + "', this,'" + ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSBoardBaseUrl"), "") + "')"); chkInheritUnsubUrl.Attributes.Add("onclick", "check('" + txtUnsubscriptionUrl.ClientID + "', this,'" + ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSBoardUnsubsriptionURL"), "") + "')"); chkInheritOptInURL.Attributes.Add("onclick", "check('" + txtOptInURL.PathTextBox.ClientID + "', this,'" + ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSBoardSubsriptionApprovalURL"), "") + "');ChangeState_" + txtOptInURL.ClientID + "(!this.checked);"); chkEnableOptIn.NotSetChoice.Text = chkSendOptInConfirmation.NotSetChoice.Text = GetString("general.sitesettings") + " (##DEFAULT##)"; chkEnableOptIn.SetDefaultValue(BoardInfoProvider.EnableDoubleOptIn(SiteContext.CurrentSiteName)); chkSendOptInConfirmation.SetDefaultValue(BoardInfoProvider.SendOptInConfirmation(SiteContext.CurrentSiteName)); if (ActivitySettingsHelper.IsModuleLoaded()) { plcOnline.Visible = true; } }