public void Process(RenderContentEditorArgs args) { Assert.ArgumentNotNull(args, "args"); var editorFormatter = new EditorFormatter(args); editorFormatter.RenderSections(args.Parent, args.Sections, args.ReadOnly); }
/// <summary> /// Renders the media info. /// </summary> /// <param name="args">The args.</param> /// <param name="mediaItem">The media item.</param> private static void RenderMediaInfo(RenderContentEditorArgs args, MediaItem mediaItem) { var mediaUrlOptions = new MediaUrlOptions { AbsolutePath = false }; var sb = new StringBuilder(); sb.Append(Constants.DisplayFormat.OpenTable); // Get the path of the media item using it's path mediaUrlOptions.UseItemPath = true; sb.AppendFormat(Constants.DisplayFormat.Row, Constants.MediaInfo.UrlByPath, MediaManager.GetMediaUrl(mediaItem, mediaUrlOptions)); // Get the path of the media item using it's ID mediaUrlOptions.UseItemPath = false; sb.AppendFormat(Constants.DisplayFormat.Row, Constants.MediaInfo.UrlById, MediaManager.GetMediaUrl(mediaItem, mediaUrlOptions)); // Is it File or DB media? sb.AppendFormat(Constants.DisplayFormat.Row, Constants.MediaInfo.MediaLocation, mediaItem.FileBased ? Constants.MediaType.FileSystem : Constants.MediaType.Database); sb.Append(Constants.DisplayFormat.CloseTable); args.EditorFormatter.AddLiteralControl(args.Parent, sb.ToString()); }
/// <summary> /// Processes the specified args. /// </summary> /// <param name="args">The args.</param> public void Process(RenderContentEditorArgs args) { var current = args.Item; if (current == null || !current.Template.FullName.StartsWith(Constants.TemplateFolder)) { return; } var mediaItem = current; var renderMediaInfo = !IsSectionCollapsed || UserOptions.ContentEditor.RenderCollapsedSections; args.EditorFormatter.RenderSectionBegin(args.Parent, Constants.ControlId, Constants.SectionName, Constants.DisplayName, Constants.Icon, IsSectionCollapsed, UserOptions.ContentEditor.RenderCollapsedSections); if (renderMediaInfo) { RenderMediaInfo(args, mediaItem); } args.EditorFormatter.RenderSectionEnd(args.Parent, renderMediaInfo, true); }
public void Process(RenderContentEditorArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.Item != null) { GetContentEditorSkinArgs args2 = new GetContentEditorSkinArgs(args.Item, args.Sections); using (new LongRunningOperationWatcher(Settings.Profiling.RenderFieldThreshold, "GetContentEditorSkin pipeline", new string[0])) { CorePipeline.Run("getContentEditorSkin", args2); } string skin = args2.Skin; if (!string.IsNullOrEmpty(skin)) { XmlDocument document = XmlUtil.LoadXml(skin); if (document.DocumentElement != null) { this._args = args; this._item = args.Item; this._sections = args.Sections; this.Render(document); args.AbortPipeline(); } } } }
/// <summary> /// Runs the processor. /// </summary> /// <param name="args">The arguments.</param> public void Process(RenderContentEditorArgs args) { Assert.ArgumentNotNull(args, "args"); Context.Page.Page.ClientScript.RegisterClientScriptInclude("voice-mate", "/sitecore modules/shell/voice mate/scripts/voice-mate.min.js"); args.Parent.PreRender += (s, e) => OnPagePreRender(args); }
// Methods public void Process(RenderContentEditorArgs args) { Assert.ArgumentNotNull(args, "args"); FieldSuiteEditorFormatter advisoryEditorFormatter = new FieldSuiteEditorFormatter(); advisoryEditorFormatter.IsFieldEditor = args.EditorFormatter.IsFieldEditor; advisoryEditorFormatter.RenderSections(args); }
public void RenderSections(RenderContentEditorArgs args) { CurrentItem = args.Item; Assert.ArgumentNotNull(args, "args"); this.Arguments = args; RenderSections(args.Parent, args.Sections, args.ReadOnly); }
// Methods public void Process(RenderContentEditorArgs args) { Assert.ArgumentNotNull(args, "args"); FieldSuiteEditorFormatter advisoryEditorFormatter = new FieldSuiteEditorFormatter(); advisoryEditorFormatter.IsFieldEditor = args.EditorFormatter.IsFieldEditor; advisoryEditorFormatter.RenderSections(args); AddCustomScripts(); AddCustomStyles(); }
/// <summary> /// Called when the page pre has render. /// </summary> /// <param name="args">The arguments.</param> private void OnPagePreRender([NotNull] RenderContentEditorArgs args) { foreach (var section in args.Sections) { foreach (var field in section.Fields) { if (voiceEnabledFields.Contains(field.ItemField.Type)) { var script = "enableVoice('{0}');".FormatWith(field.ControlID); Context.Page.Page.ClientScript.RegisterClientScriptBlock(typeof(Page), script, "jQuery(function(){{ {0} }});".FormatWith(script), true); SheerResponse.Eval(script); } } } }
public void Process(RenderContentEditorArgs args) { args.EditorFormatter.RenderSectionBegin(args.Parent, SECTION_NAME, SECTION_NAME, DISPLAY_NAME, ICON, !Settings.GetBoolSetting(ALWAYSOPEN, false), true); if (args.Item == null) { return; } var stats = new Statistics { ItemId = args.Item.ID.ToString() }; args.EditorFormatter.AddLiteralControl(args.Parent, stats.Render()); args.EditorFormatter.RenderSectionEnd(args.Parent, true, true); }
public void Process(RenderContentEditorArgs args) { Assert.ArgumentNotNull(args, "args"); if (!(HttpContext.Current.Handler is Page page)) { return; } foreach (var script in _scripts) { page.Form.Controls.Add(new LiteralControl($"<script type='text/javascript' src='{script}'></script>")); } foreach (var css in _styles) { page.Form.Controls.Add(new LiteralControl($"<link rel='stylesheet' type='text/css' href='{css}'/>")); } }
public void Process(RenderContentEditorArgs args) { Assert.ArgumentNotNull(args, "args"); var parentControl = args.Parent; var editorFormatter = args.EditorFormatter; CurrentItem = args.Item; if (CurrentItem == null) { return; } CurrentLanguage = CurrentItem.Language.Name; var languageVersions = LanguageContainer.GetLanguageVersions(CurrentItem); editorFormatter.RenderSectionBegin(parentControl, SectionName, SectionName, SectionName, IconPath, false, true); RenderLanguageVersions(languageVersions, editorFormatter, parentControl); editorFormatter.RenderSectionEnd(parentControl, true, false); }
public void Process(RenderContentEditorArgs args) { if (args.Item == null) { return; } try { //if the item isnt in a specified path, return if (!Paths.Any(x => args.Item.Paths.FullPath.ToLower().StartsWith(x))) { return; } //set a context variable so that if necessary it can be picked up in a custom LinkProvider SetHttpContextItem(); //get the urls for the specified item var urls = GetUrlsForItem(args.Item); var siteUrls = urls as SiteUrl[] ?? urls.ToArray(); if (!siteUrls.Any()) { return; } //args.EditorFormatter.RenderSectionBegin(args.Parent, "Urls", "Urls", "URLs", "Applications/16x16/information.png", true, false); //generate the table that contains the URLs var markup = BuildUrlTableMarkup(siteUrls); args.EditorFormatter.AddLiteralControl(args.Parent, markup); //args.EditorFormatter.RenderSectionEnd(args.Parent, true, false); } catch (Exception ex) { Sitecore.Diagnostics.Log.Error("Error in UrlViewer.UrlSection: ", ex, this); } }
public void Process(RenderContentEditorArgs args) { args.EditorFormatter = new MyEditorFormatter(); args.EditorFormatter.Arguments = args; }
public EditorFormatter(RenderContentEditorArgs args) { Arguments = args; }