public void Execute(XElement element, string name, UrlString parameters, string value) { Assert.ArgumentNotNull((object)element, "element"); Assert.ArgumentNotNull((object)name, "name"); Assert.ArgumentNotNull((object)parameters, "parameters"); Assert.ArgumentNotNull((object)value, "value"); var selectItemOptions = new SelectItemOptions(); var obj1 = (Item)null; if (!string.IsNullOrEmpty(value)) { obj1 = Client.ContentDatabase.GetItem(value); } var path = XElement.Parse(element.ToString()).FirstAttribute.Value; if (!string.IsNullOrEmpty(path)) { var obj2 = Client.ContentDatabase.GetItem(path); if (obj2 != null) { selectItemOptions.FilterItem = obj2; } } selectItemOptions.Root = Client.ContentDatabase.GetItem(new ID(WellKnownIdentifiers.ProfilesContainerId)); selectItemOptions.SelectedItem = obj1 ?? (selectItemOptions.Root != null ? selectItemOptions.Root.Children.FirstOrDefault <Item>() : (Item)null); selectItemOptions.IncludeTemplatesForSelection = SelectItemOptions.GetTemplateList("{0FC09EA4-8D87-4B0E-A5C9-8076AE863D9C}"); selectItemOptions.Title = "Select Profile Card"; selectItemOptions.Text = "Select the profile card to use in this rule."; selectItemOptions.Icon = "Business/16x16/chart.png"; selectItemOptions.ShowRoot = false; SheerResponse.ShowModalDialog(selectItemOptions.ToUrlString().ToString(), "1200px", "700px", string.Empty, true); }
protected override void OnLoad(EventArgs e) { Assert.ArgumentNotNull(e, "e"); base.OnLoad(e); if (!Context.ClientPage.IsEvent) { this.SelectOption.Click = string.Format("ChangeMode(\"{0}\")", "Select"); this.CreateOption.Click = string.Format("ChangeMode(\"{0}\")", "Create"); this.CloneOption.Click = string.Format("ChangeMode(\"{0}\")", "Clone"); this.SearchOption.Click = string.Format("ChangeMode(\"{0}\")", "Search"); SelectDatasourceOptions options = SelectItemOptions.Parse <SelectDatasourceOptions>(); if (options.DatasourcePrototype == null) { this.DisableCreateOption(); } else { this.Prototype = options.DatasourcePrototype; } if (!string.IsNullOrEmpty(options.DatasourceItemDefaultName)) { this.NewDatasourceName.Value = this.GetNewItemDefaultName(options.DatasourceRoot, options.DatasourceItemDefaultName); } if (options.ContentLanguage != null) { this.ContentLanguage = options.ContentLanguage; } if (!string.IsNullOrEmpty(options.CurrentDatasource)) { this.CurrentDatasourcePath = options.CurrentDatasource; if (options.DatasourceRoot != null) { string copyOfName = string.Empty; if (!string.IsNullOrEmpty(options.DatasourceItemDefaultName)) { copyOfName = ItemUtil.GetCopyOfName(options.DatasourceRoot, options.DatasourceItemDefaultName); } if (this.CurrentDatasourceItem != null) { copyOfName = this.CloneName.Value = ItemUtil.GetCopyOfName(options.DatasourceRoot, this.CurrentDatasourceItem.Name); } this.CloneName.Value = copyOfName; } } else { this.CloneOption.Visible = false; } this.SetDataContexts(); Item folder = base.DataContext.GetFolder(); this.SetControlsForSelection(folder); this.SetSectionHeader(); } }
public void Execute(XElement element, string name, UrlString parameters, string value) { // Param validations Condition.Requires(element, nameof(element)).IsNotNull(); Condition.Requires(name, nameof(name)).IsNotNull(); Condition.Requires(parameters, nameof(parameters)).IsNotNull(); Condition.Requires(value, nameof(value)).IsNotNull(); var selectItemOptions = new SelectItemOptions(); // Rule Condition item var path = XElement.Parse(element.ToString()).FirstAttribute.Value; if (!string.IsNullOrEmpty(path)) { var ruleConditionItem = Context.ContentDatabase.GetItem(path); if (ruleConditionItem != null) { selectItemOptions.FilterItem = ruleConditionItem; } } // Filter templates selectItemOptions.ShowRoot = false; selectItemOptions.IncludeTemplatesForSelection = SelectItemOptions.GetTemplateList(IoTDevice.TemplateID.ToString()); // Selected Item Item deviceItem = null; if (!string.IsNullOrEmpty(value)) { deviceItem = Context.ContentDatabase.GetItem(value); } // Setup component state selectItemOptions.Root = Context.ContentDatabase.GetItem(DeviceRootId); selectItemOptions.SelectedItem = deviceItem; selectItemOptions.Title = "Select IoT Device"; selectItemOptions.Text = "Select the IoT Device to use in this rule."; selectItemOptions.Icon = "/~/icon/office/32x32/password_field.png"; var parameter = parameters["resulttype"]; if (!string.IsNullOrEmpty(parameter)) { selectItemOptions.ResultType = (SelectItemOptions.DialogResultType)Enum.Parse(typeof(SelectItemOptions.DialogResultType), parameter); } SheerResponse.ShowModalDialog(selectItemOptions.ToUrlString().ToString(), "1200px", "700px", string.Empty, true); }
/// <summary> /// CloneMe run method /// </summary> /// <param name="args">Pipeline args.</param> protected void Run(ClientPipelineArgs args) { //Null check for args Assert.ArgumentNotNull(args, "args"); //Current item's sitecore id, template id and name var itemId = args.Parameters["id"]; var templateId = args.Parameters["templateId"]; var itemPath = args.Parameters["path"]; if (!args.IsPostBack) { //Selecting current item's source for cloning var options = new SelectItemOptions() { Title = "Select Source Item", Text = "Selecting current item's source for cloning", Icon = "Applications/32x32/sync-colored.png", ResultType = SelectItemOptions.DialogResultType.Id, Root = Client.ContentDatabase.GetItem("/sitecore/content") }; //Show popup for source item selection Log.Info(string.Format("Cloning process started for item: {0}", itemPath), this); SheerResponse.ShowModalDialog(options.ToUrlString().ToString(), true); args.WaitForPostBack(true); } else if (args.HasResult) { var selectedSourceItem = Client.GetItemNotNull(new ID(args.Result)); Assert.ArgumentNotNull(selectedSourceItem, "selectedSourceItem"); var currentItem = Client.GetItemNotNull(new ID(itemId)); Assert.ArgumentNotNull(currentItem, "currentItem"); var isError = false; var errorMessage = string.Empty; Feature.CloneItemFeature.CloneExistingItem(currentItem, selectedSourceItem, out isError, out errorMessage); if (!isError) { Context.ClientPage.ClientResponse.Alert(Translate.Text(itemPath + " succesfully cloned from " + selectedSourceItem.Paths.FullPath)); Log.Info(itemPath + " succesfully cloned from " + selectedSourceItem.Paths.FullPath, this); } else { Log.Error(errorMessage, this); } } }
public void Execute(XElement element, string name, UrlString parameters, string value) { Assert.ArgumentNotNull(element, "element"); Assert.ArgumentNotNull(name, "name"); Assert.ArgumentNotNull(parameters, "parameters"); Assert.ArgumentNotNull(value, "value"); var selectItemOptions = new SelectItemOptions(); Item item = null; if (!string.IsNullOrEmpty(value)) { item = Client.ContentDatabase.GetItem(value); } var path = XElement.Parse(element.ToString()).FirstAttribute.Value; if (!string.IsNullOrEmpty(path)) { var filterItem = Client.ContentDatabase.GetItem(path); if (filterItem != null) { selectItemOptions.FilterItem = filterItem; } } var rootItemId = new ID(ItemHierarchyOperatorSettings.Settings.OperatorRoot); selectItemOptions.Root = Client.ContentDatabase.GetItem(rootItemId); if (item == null) { if (selectItemOptions.Root != null) { item = selectItemOptions.Root.Children.FirstOrDefault(); } } selectItemOptions.SelectedItem = item; selectItemOptions.Title = "Select Item Hierarchy Operator"; selectItemOptions.Text = "Select the item hierarchal type to use in this rule."; selectItemOptions.Icon = "applications/32x32/media_stop.png"; selectItemOptions.ShowRoot = false; SheerResponse.ShowModalDialog(selectItemOptions.ToUrlString().ToString(), "1200px", "700px", string.Empty, true); }
/// <summary> /// The on load. /// </summary> /// <param name="e"> /// The e. /// </param> protected override void OnLoad(EventArgs e) { Assert.ArgumentNotNull(e, "e"); base.OnLoad(e); if (Context.ClientPage.IsEvent) { return; } var options = SelectItemOptions.Parse <SelectBaseLayoutOptions>(); options.Items.Insert(0, CreateNullSelectionItem()); Previews.InnerHtml = RenderPreviews(options.Items, options.CurrentBaseLayoutId); if (!ID.IsNullOrEmpty(options.CurrentBaseLayoutId)) { SelectedItemId = options.CurrentBaseLayoutId.ToShortID().ToString(); } }
// Methods public void Execute(XElement element, string name, UrlString parameters, string value) { Assert.ArgumentNotNull(element, "element"); Assert.ArgumentNotNull(name, "name"); Assert.ArgumentNotNull(parameters, "parameters"); Assert.ArgumentNotNull(value, "value"); SelectItemOptions options = new SelectItemOptions(); if (!string.IsNullOrEmpty(value)) { Item item = Client.ContentDatabase.GetItem(value); if (item != null) { options.SelectedItem = item; } } string str = parameters["root"]; if (!string.IsNullOrEmpty(str)) { Item item2 = Client.ContentDatabase.GetItem(str); if (item2 != null) { options.Root = item2; } } string str2 = parameters["selection"]; if (!string.IsNullOrEmpty(str2)) { options.IncludeTemplatesForSelection = SelectItemOptions.GetTemplateList(str2.Split(new char[] { '|' })); } string str3 = parameters["display"]; if (!string.IsNullOrEmpty(str3)) { options.IncludeTemplatesForDisplay = SelectItemOptions.GetTemplateList(str3.Split(new char[] { '|' })); } options.Title = "Select Item"; options.Text = "Select the item to use in this rule."; options.Icon = "People/16x16/cube_blue.png"; SheerResponse.ShowModalDialog(options.ToUrlString().ToString(), true); }
protected virtual SelectItemOptions GetSelectItemOptions(AdaptiveTreeMacroSettingsItem item) { var options = new SelectItemOptions(); options.ResultType = SelectItemOptions.DialogResultType.Id; if (item != null) { options.ShowRoot = item.ShowRoot; options.IncludeTemplatesForDisplay = item.IncludeTemplatesForDisplay; options.IncludeTemplatesForSelection = item.IncludeTemplatesForSelection; options.Title = item.WindowTitle; options.Text = item.WindowText; options.Icon = item.Icon; } else { options.Title = this.DefaultWindowTitle; options.Text = this.DefaultWindowText; options.Icon = this.DefaultWindowIcon; } return options; }
protected virtual SelectItemOptions GetSelectItemOptions(AdaptiveTreeMacroSettingsItem item) { var options = new SelectItemOptions(); options.ResultType = SelectItemOptions.DialogResultType.Id; if (item != null) { options.ShowRoot = item.ShowRoot; options.IncludeTemplatesForDisplay = item.IncludeTemplatesForDisplay; options.IncludeTemplatesForSelection = item.IncludeTemplatesForSelection; options.Title = item.WindowTitle; options.Text = item.WindowText; options.Icon = item.Icon; } else { options.Title = this.DefaultWindowTitle; options.Text = this.DefaultWindowText; options.Icon = this.DefaultWindowIcon; } return(options); }
/// <summary> /// Gets the filter. /// </summary> /// <param name="options">The options.</param> /// <returns> /// The filter. /// </returns> protected override string GetFilter(SelectItemOptions options) { Assert.ArgumentNotNull((object)options, "options"); if (options.IncludeTemplatesForDisplay.Count == 0 && options.ExcludeTemplatesForDisplay.Count == 0) { return(string.Empty); } string list1 = SelectItemForm.GetList(options.IncludeTemplatesForDisplay); string list2 = SelectItemForm.GetList(options.ExcludeTemplatesForDisplay); if (options.IncludeTemplatesForDisplay.Count > 0 && options.ExcludeTemplatesForDisplay.Count > 0) { return(string.Format("(contains('{0}', ',' + @@templateid + ',') or contains('{0}', ',' + @@templatekey + ',')) and not (contains('{1}', ',' + @@templateid + ',') or contains('{1}', ',' + @@templatekey + ','))", (object)list1, (object)list2)); } if (options.IncludeTemplatesForDisplay.Count > 0) { return(string.Format("(contains('{0}', ',' + @@templateid + ',') or contains('{0}', ',' + @@templatekey + ','))", (object)list1)); } else { return("not (contains('{ExcludeList}', ',' + @@templateid + ',') or contains('{0}', ',' + @@templatekey + ',') or @@name='Placeholder Settings' or @@name='Devices' or @@name='Layouts' or @@id='{B4A0FB13-9758-427C-A7EB-1A406C045192}')".Replace("{ExcludeList}", list2)); } }
protected override void OnLoad(EventArgs e) { Assert.ArgumentNotNull((object)e, "e"); IsOpenPropertiesChecked = Registry.GetBool("/Current_User/SelectRendering/IsOpenPropertiesChecked"); SelectRenderingOptions renderingOptions = SelectItemOptions.Parse <SelectRenderingOptions>(); base.OnLoad(e); if (Context.ClientPage.IsEvent) { return; } var groupedRenderings = renderingOptions.Items?.GroupBy(i => i.Parent.Name).ToArray() ?? new IGrouping <string, Item> [0]; if (renderingOptions.ShowTree || groupedRenderings.Length == 0) { var gridPanel = Renderings.Parent as GridPanel; gridPanel?.SetExtensibleProperty(Tabs, "class", "scDisplayNone"); } else { foreach (var renderingGroup in groupedRenderings) { var newTab = new Tab { Header = renderingGroup.Key, CssClass = "scTabPage" }; newTab.Controls.Add(new LiteralControl(RenderPreviews(renderingGroup))); Tabs.Controls.Add(newTab); } Renderings.Visible = false; var gridPanel = Renderings.Parent as GridPanel; gridPanel?.SetExtensibleProperty(Renderings, "class", "scDisplayNone"); } }
/// <summary> /// Gets the filter. /// </summary> /// <param name="options">The options.</param> /// <returns> /// The filter. /// </returns> protected override string GetFilter(SelectItemOptions options) { Assert.ArgumentNotNull((object)options, "options"); if (options.IncludeTemplatesForDisplay.Count == 0 && options.ExcludeTemplatesForDisplay.Count == 0) { return(string.Empty); } string list1 = SelectItemForm.GetList(options.IncludeTemplatesForDisplay); string list2 = SelectItemForm.GetList(options.ExcludeTemplatesForDisplay); if (options.IncludeTemplatesForDisplay.Count > 0 && options.ExcludeTemplatesForDisplay.Count > 0) { return(string.Format("(contains('{0}', ',' + @@templateid + ',') or contains('{0}', ',' + @@templatekey + ',')) and not (contains('{1}', ',' + @@templateid + ',') or contains('{1}', ',' + @@templatekey + ','))", (object)list1, (object)list2)); } if (options.IncludeTemplatesForDisplay.Count > 0) { return(string.Format("(contains('{0}', ',' + @@templateid + ',') or contains('{0}', ',' + @@templatekey + ','))", (object)list1)); } string str1 = "{B4A0FB13-9758-427C-A7EB-1A406C045192}"; string str2 = "{B87CD5F0-4E72-429D-90A3-B285F1D038CA}"; string str3 = "{75D27C2B-5F88-4CC8-B1DE-8412A1628408}"; return(string.Format("not (contains('{0}', ',' + @@templateid + ',') or contains('{0}', ',' + @@templatekey + ',') or @@name='Placeholder Settings' or @@name='Devices' or @@name='Layouts' or @@id='{1}' or @@id='{2}' or @@id='{3}' or @@id='{4}')", (object)list2, (object)str1, (object)DeviceSimulationUtil.SimulatorsFolderId, (object)str2, (object)str3)); }
protected void AddItem(ClientPipelineArgs args) { if (args.IsPostBack) { if (args.HasResult) { SetModified(); LastSelectedItemID = args.Result; SheerResponse.Eval("window.frames['{0}_frame'].window.scVisualList.addItem('{1}');".FormatWith(ID, args.Result)); } } else { var source = new UrlString(StringUtil.GetString(Source, "/sitecore/media library")).Path; Item lastSelectedItem = null; if (!string.IsNullOrEmpty(LastSelectedItemID)) { lastSelectedItem = Client.ContentDatabase.GetItem(LastSelectedItemID); } if (source.Contains("/sitecore/media library")) { var options = new MediaBrowserOptions(); if (source.StartsWith("~")) { options.Root = Client.GetItemNotNull(ItemIDs.MediaLibraryRoot); options.SelectedItem = Client.GetItemNotNull(source.Substring(1)); } else { options.Root = Client.GetItemNotNull(source); } if (lastSelectedItem != null && lastSelectedItem.Parent.Paths.IsDescendantOf(options.Root)) { options.SelectedItem = lastSelectedItem.Parent; } SheerResponse.ShowModalDialog(options.ToUrlString().ToString(), true); } else { var options = new SelectItemOptions { Title = "Please Select an Item", Text = "Select an item to add", Icon = "Applications/32x32/star_green.png" }; if (source.StartsWith("~")) { options.Root = Client.GetItemNotNull(ItemIDs.ContentRoot); options.SelectedItem = Client.GetItemNotNull(source.Substring(1)); } else { options.Root = Client.GetItemNotNull(source); } if (lastSelectedItem != null && lastSelectedItem.Paths.IsDescendantOf(options.Root)) { options.SelectedItem = lastSelectedItem; } SheerResponse.ShowModalDialog(options.ToUrlString().ToString(), true); } args.WaitForPostBack(); } }
protected override void OnLoad(EventArgs e) { Assert.ArgumentNotNull((object)e, "e"); base.OnLoad(e); if (Context.ClientPage.IsEvent) { return; } IsOpenPropertiesChecked = Registry.GetBool("/Current_User/SelectRendering/IsOpenPropertiesChecked"); SelectRenderingOptions renderingOptions = SelectItemOptions.Parse <SelectRenderingOptions>(); if (renderingOptions.ShowOpenProperties) { OpenPropertiesBorder.Visible = true; OpenProperties.Checked = IsOpenPropertiesChecked; } if (renderingOptions.ShowPlaceholderName) { PlaceholderNameBorder.Visible = true; PlaceholderName.Value = renderingOptions.PlaceholderName; } if (!renderingOptions.ShowTree) { TreeviewContainer.Class = string.Empty; TreeviewContainer.Visible = false; TreeSplitter.Visible = false; GridPanel gridPanel = TreeviewContainer.Parent as GridPanel; if (gridPanel != null) { gridPanel.SetExtensibleProperty(TreeviewContainer, "class", "scDisplayNone"); } //Line of Code that does grouping var gruppedSublayouts = renderingOptions.Items.GroupBy(i => i.Parent.Name); //Add new tab for each folder foreach (IGrouping <string, Item> gruppedSublayout in gruppedSublayouts) { var newTab = new Tab(); newTab.Header = gruppedSublayout.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); newScrollbox.InnerHtml = RenderPreviews(gruppedSublayout); newTab.Controls.Add(newScrollbox); Tabs.Controls.Add(newTab); } gridPanel = Renderings.Parent as GridPanel; if (gridPanel != null) { gridPanel.SetExtensibleProperty(Renderings, "class", "scDisplayNone"); } } else { var gridPanel = Renderings.Parent as GridPanel; if (gridPanel != null) { gridPanel.SetExtensibleProperty(Tabs, "class", "scDisplayNone"); } } //end of new code SetOpenPropertiesState(renderingOptions.SelectedItem); }
public void Execute(XElement element, string name, UrlString parameters, string value) { // Param validations Condition.Requires(element, nameof(element)).IsNotNull(); Condition.Requires(name, nameof(name)).IsNotNull(); Condition.Requires(parameters, nameof(parameters)).IsNotNull(); Condition.Requires(value, nameof(value)).IsNotNull(); var selectItemOptions = new SelectItemOptions(); // Rule Condition item var path = XElement.Parse(element.ToString()).FirstAttribute.Value; if (!string.IsNullOrEmpty(path)) { var ruleConditionItem = Context.ContentDatabase.GetItem(path); if (ruleConditionItem != null) { selectItemOptions.FilterItem = ruleConditionItem; } } // Filter templates selectItemOptions.ShowRoot = false; selectItemOptions.IncludeTemplatesForSelection = SelectItemOptions.GetTemplateList(IoTMessageProperty.TemplateID.ToString()); // Get Method Item var methodId = element.Attribute("MethodId")?.Value; if (string.IsNullOrEmpty(methodId)) { SheerResponse.Alert("Please select a valid IoT Method"); return; } var methodItem = Context.ContentDatabase.GetItem(methodId); if (methodItem == null) { SheerResponse.Alert("Please select a valid IoT Method"); return; } var method = _ioTHubRepository.CastToMethod(methodItem); // Get Return Type item var returnTypeField = method.ReturnType; if (returnTypeField?.TargetItem == null) { SheerResponse.Alert($"The IoT Method item {methodItem.ID} has an invalid value in the 'Return Type' field"); return; } var returnType = _ioTHubRepository.CastToMessageType(returnTypeField.TargetItem); // Selected Item Item propertyItem = null; if (!string.IsNullOrEmpty(value)) { propertyItem = Context.ContentDatabase.GetItem(value); } // Setup component state selectItemOptions.Root = returnType.InnerItem; selectItemOptions.SelectedItem = propertyItem; selectItemOptions.Title = "Select Property"; selectItemOptions.Text = "Select the property to use in this rule."; selectItemOptions.Icon = "/~/icon/office/32x32/password_field.png"; var parameter = parameters["resulttype"]; if (!string.IsNullOrEmpty(parameter)) { selectItemOptions.ResultType = (SelectItemOptions.DialogResultType)Enum.Parse(typeof(SelectItemOptions.DialogResultType), parameter); } SheerResponse.ShowModalDialog(selectItemOptions.ToUrlString().ToString(), "1200px", "700px", string.Empty, true); }
/// <summary> /// Raises the load event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected override void OnLoad(EventArgs e) { Assert.ArgumentNotNull(e, "e"); base.OnLoad(e); if (Context.ClientPage.IsEvent) { return; } IsOpenPropertiesChecked = Registry.GetBool("/Current_User/SelectRendering/IsOpenPropertiesChecked"); var renderingOptions = SelectItemOptions.Parse <SelectRenderingOptions>(); if (renderingOptions.ShowOpenProperties) { OpenPropertiesBorder.Visible = true; OpenProperties.Checked = this.IsOpenPropertiesChecked; } if (renderingOptions.ShowPlaceholderName) { PlaceholderNameBorder.Visible = true; PlaceholderName.Value = renderingOptions.PlaceholderName; } if (!renderingOptions.ShowTree) { TreeviewContainer.Class = string.Empty; TreeviewContainer.Visible = false; TreeSplitter.Visible = false; var gridPanel = TreeviewContainer.Parent as GridPanel; if (gridPanel != null) { gridPanel.SetExtensibleProperty(TreeviewContainer, "class", "scDisplayNone"); } var groupedRenderings = renderingOptions.Items.GroupBy(i => i.Parent.Name).ToArray(); if (groupedRenderings.Length <= 1) { Renderings.InnerHtml = RenderPreviews(renderingOptions.Items); gridPanel = Tabs.Parent as GridPanel; if (gridPanel != null) { gridPanel.SetExtensibleProperty(Tabs, "class", "scDisplayNone"); } } else { foreach (var renderingGroup in groupedRenderings) { var newTab = new Tab { Header = renderingGroup.Key, CssClass = "scScrollbox scFixSize scFixSize4", Height = new Unit(100, UnitType.Percentage), Width = new Unit(100, UnitType.Percentage) }; var newScrollbox = new Scrollbox { Class = "scScrollbox scFixSize scFixSize4", Background = "white", Padding = "0px", Width = new Unit(100, UnitType.Percentage), Height = new Unit(100, UnitType.Percentage), InnerHtml = RenderPreviews(renderingGroup) }; newTab.Controls.Add(newScrollbox); Tabs.Controls.Add(newTab); } gridPanel = Renderings.Parent as GridPanel; if (gridPanel != null) { gridPanel.SetExtensibleProperty(Renderings, "class", "scDisplayNone"); } } } else { var gridPanel = Renderings.Parent as GridPanel; if (gridPanel != null) { gridPanel.SetExtensibleProperty(Tabs, "class", "scDisplayNone"); } } SetOpenPropertiesState(renderingOptions.SelectedItem); }
/// <summary> /// Raises the load event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected override void OnLoad(EventArgs e) { Assert.ArgumentNotNull((object)e, "e"); base.OnLoad(e); if (Context.ClientPage.IsEvent) { return; } this.IsOpenPropertiesChecked = Registry.GetBool("/Current_User/SelectRendering/IsOpenPropertiesChecked"); SelectRenderingOptions renderingOptions = SelectItemOptions.Parse <SelectRenderingOptions>(); if (renderingOptions.ShowOpenProperties) { this.OpenPropertiesBorder.Visible = true; this.OpenProperties.Checked = this.IsOpenPropertiesChecked; } if (renderingOptions.ShowPlaceholderName) { this.PlaceholderNameBorder.Visible = true; this.PlaceholderName.Value = renderingOptions.PlaceholderName; } if (!renderingOptions.ShowTree) { this.TreeviewContainer.Class = string.Empty; this.TreeviewContainer.Visible = false; this.TreeSplitter.Visible = false; GridPanel gridPanel = this.TreeviewContainer.Parent as GridPanel; if (gridPanel != null) { gridPanel.SetExtensibleProperty((System.Web.UI.Control) this.TreeviewContainer, "class", "scDisplayNone"); } this.Renderings.InnerHtml = this.RenderPreviews((IEnumerable <Item>)renderingOptions.Items); // Start custom code this.TabbedGridPanel.Visible = true; this.DefaultGridPanel.Visible = false; var renderingGroups = renderingOptions.Items.GroupBy(i => i.Parent.Name); foreach (IGrouping <string, Item> rendering in renderingGroups) { var newTab = new Tab(); newTab.Header = rendering.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); newScrollbox.InnerHtml = RenderPreviews(rendering); newTab.Controls.Add(newScrollbox); Tabs.Controls.Add(newTab); } gridPanel = Renderings.Parent as GridPanel; if (gridPanel != null) { gridPanel.SetExtensibleProperty(Renderings, "class", "scDisplayNone"); } // End custom code } else { this.MainGridPanel.Controls.RemoveAt(0); this.DefaultGridPanel.Visible = true; this.TabbedGridPanel.Visible = false; } this.SetOpenPropertiesState(renderingOptions.SelectedItem); }