Created
October 5, 2015 13:14
-
-
Save jammykam/9fd0f2dc944cbd8e470a to your computer and use it in GitHub Desktop.
Updated Sitecore Tabbed Select Rendering Dialog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<control xmlns:def="Definition" xmlns="http://schemas.sitecore.net/Visual-Studio-Intellisense"> | |
<Sitecore.Shell.Applications.Dialogs.SelectRendering> | |
<FormDialog ID="Dialog" Icon="Core/32x32/open_document.png" Header="Open Item" | |
Text="Select the item that you wish to open. Then click the Open button." OKButton="Open"> | |
<Stylesheet Src="SelectItemWithThumbnails.css" DeviceDependant="true" /> | |
<CodeBeside Type="MyProject.Custom.Dialogs.SelectRenderingTabbed.SelectRenderingForm, MyProject.Custom"/> | |
<DataContext ID="DataContext" Root="/"/> | |
<GridPanel Width="100%" Height="100%"> | |
<GridPanel ID="RenderingSelector" Width="100%" Height="0%" Columns="3" GridPanel.Height="0%" Style="display:none"> | |
<Scrollbox Width="100%" ID="TreeviewContainer" Height="100%" Class="scScrollbox scFixSize scFixSize4" style="border-right: 2px solid #474747;" Background="white" Padding="0px" GridPanel.Width="200px" GridPanel.Height="100%"> | |
<TreeviewEx ID="Treeview" DataContext="DataContext" ShowRoot="true" Click="Treeview_Click" /> | |
</Scrollbox> | |
<VSplitter ID="TreeSplitter" GridPanel.Class="scThinSplitter" Target="left" /> | |
<Scrollbox ID="Renderings" Width="100%" Height="100%" Class="scScrollbox scFixSize scFixSize4" Background="white" Padding="0px" GridPanel.Height="100%"> | |
</Scrollbox> | |
</GridPanel> | |
<GridPanel ID="TabbedSelector" Width="100%" Height="100%" Columns="1" GridPanel.Height="100%" Style="table-layout:fixed"> | |
<Tabstrip ID="Tabs" Width="100%" Height="100%"> | |
</Tabstrip> | |
</GridPanel> | |
<Border ID="PlaceHolderNameBorder" Visible="false" style="padding:12px 0px 0px 0px"> | |
<GridPanel Columns="3" Width="100%"> | |
<Literal Text="Add to Placeholder: " GridPanel.NoWrap="true" /> | |
<Space Width="4" /> | |
<Edit ID="PlaceholderName" Name="PlaceholderName" GridPanel.Width="100%" class="scQuirksBoxModel" Width="100%" /> | |
</GridPanel> | |
</Border> | |
</GridPanel> | |
<Border ID="OpenPropertiesBorder" def:placeholder="Buttons" Visible="false" style="padding:0px 0px 8px 0px"> | |
<Checkbox ID="OpenProperties" Header="Open the Properties dialog box immediately." /> | |
</Border> | |
</FormDialog> | |
</Sitecore.Shell.Applications.Dialogs.SelectRendering> | |
</control> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
using Sitecore; | |
using Sitecore.Data.Items; | |
using Sitecore.Diagnostics; | |
using Sitecore.Form.UI.Controls; | |
using Sitecore.Shell.Applications.Dialogs.ItemLister; | |
using Sitecore.Web.UI.HtmlControls; | |
using Sitecore.Web.UI.WebControls; | |
namespace MyProject.Custom.Dialogs.SelectRenderingTabbed | |
{ | |
[UsedImplicitly] | |
public class SelectRenderingForm : Sitecore.Shell.Applications.Dialogs.SelectRendering.SelectRenderingForm | |
{ | |
protected Tabstrip Tabs; | |
protected GridPanel RenderingSelector; | |
protected GridPanel TabbedSelector; | |
protected override void OnLoad(EventArgs e) | |
{ | |
Assert.ArgumentNotNull((object)e, "e"); | |
IsOpenPropertiesChecked = Registry.GetBool("/Current_User/SelectRendering/IsOpenPropertiesChecked"); | |
var renderingOptions = SelectItemOptions.Parse<SelectRenderingOptions>(); | |
base.OnLoad(e); | |
if (Context.ClientPage.IsEvent) | |
return; | |
if (!renderingOptions.ShowTree) | |
{ | |
base.Renderings.InnerHtml = String.Empty; //reset the rendering listing | |
var grouppedSublayouts = renderingOptions.Items.GroupBy(i => i.Parent.Name); | |
//Add new tab for each folder | |
foreach (IGrouping<string, Item> grouppedSublayout in grouppedSublayouts) | |
{ | |
var newTab = new Tab(); | |
newTab.Header = grouppedSublayout.Key; | |
var newScrollbox = new Scrollbox(); | |
newScrollbox.Class = "scScrollbox scFixSize scFixSize4"; | |
newScrollbox.Background = "white"; | |
newScrollbox.Padding = "0px"; | |
newScrollbox.Width = new Unit(100, UnitType.Percentage); | |
newScrollbox.Height = new Unit(100, UnitType.Percentage); | |
string text = Sitecore.Reflection.ReflectionUtil.CallMethod(this, "RenderPreviews", new object[] { grouppedSublayout.ToList() }).ToString(); | |
newScrollbox.InnerHtml = text; | |
newTab.Controls.Add(newScrollbox); | |
Tabs.Controls.Add(newTab); | |
} | |
RenderingSelector.Visible = false; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment