/// <summary> /// Shows the settings. /// </summary> /// <exception cref="System.NotImplementedException"></exception> protected override void ShowSettings() { // only enable viewstate for htmlEditor when needed (it is really big) pnlEdit.EnableViewState = true; pnlEdit.Visible = true; pnlVersionGrid.Visible = false; pnlEditModel.Visible = true; upnlHtmlContentEdit.Update(); mdEdit.Show(); bool useCodeEditor = GetAttributeValue(AttributeKey.UseCodeEditor).AsBoolean(); htmlEditor.StartInCodeEditorMode = useCodeEditor; htmlEditor.Toolbar = HtmlEditor.ToolbarConfig.Full; // if the current user can't approve their own edits, set the approval to Not-Approved when they change something if (!IsUserAuthorized("Approve")) { string onchangeScriptFormat = @" $('#{0}').removeClass('label label-success label-danger').addClass('label label-danger'); $('#{0}').text('Not-Approved'); $('#{1}').val('false'); $('#{2}').val(''); $('#{3}').hide();"; string onchangeScript = string.Format(onchangeScriptFormat, lblApprovalStatus.ClientID, hfApprovalStatus.ClientID, hfApprovalStatusPersonId.ClientID, lblApprovalStatusPerson.ClientID); htmlEditor.CallbackOnKeyupScript = onchangeScript; } htmlEditor.MergeFields.Clear(); htmlEditor.MergeFields.Add("GlobalAttribute"); htmlEditor.MergeFields.Add("CurrentPerson^Rock.Model.Person|Current Person"); htmlEditor.MergeFields.Add("Campuses"); htmlEditor.MergeFields.Add("PageParameter"); htmlEditor.MergeFields.Add("RockVersion"); htmlEditor.MergeFields.Add("Date"); htmlEditor.MergeFields.Add("Time"); htmlEditor.MergeFields.Add("DayOfWeek"); var contextObjects = new Dictionary <string, object>(); foreach (var contextEntityType in RockPage.GetContextEntityTypes()) { var contextEntity = RockPage.GetCurrentContext(contextEntityType); if (LavaHelper.IsLavaDataObject(contextEntity)) { var type = Type.GetType(contextEntityType.AssemblyName ?? contextEntityType.Name); if (type != null) { string mergeField = string.Format("Context.{0}^{1}|Current {0} (Context)|Context", type.Name, type.FullName); htmlEditor.MergeFields.Add(mergeField); } } } string documentRoot = GetAttributeValue(AttributeKey.DocumentRootFolder); string imageRoot = GetAttributeValue(AttributeKey.ImageRootFolder); htmlEditor.UserSpecificRoot = GetAttributeValue(AttributeKey.UserSpecificFolders).AsBoolean(); htmlEditor.DocumentFolderRoot = documentRoot; htmlEditor.ImageFolderRoot = imageRoot; bool supportsVersioning = GetAttributeValue(AttributeKey.SupportVersions).AsBoolean(); bool requireApproval = GetAttributeValue(AttributeKey.RequireApproval).AsBoolean(); lVersion.Visible = supportsVersioning; lbShowVersionGrid.Visible = supportsVersioning; cbOverwriteVersion.Visible = supportsVersioning; cbOverwriteVersion.Checked = false; // RequireApproval only applies if SupportsVersioning=True upnlApproval.Visible = supportsVersioning && requireApproval; lbApprove.Enabled = IsUserAuthorized("Approve"); lbDeny.Enabled = IsUserAuthorized("Approve"); string entityValue = EntityValue(); HtmlContent htmlContent = new HtmlContentService(new RockContext()).GetLatestVersion(this.BlockId, entityValue); // set Height of editors if (supportsVersioning && requireApproval) { htmlEditor.Height = 280; } else if (supportsVersioning) { htmlEditor.Height = 350; } else { htmlEditor.Height = 380; } ShowEditDetail(htmlContent); }