/// <summary> /// Gets the layout definition. /// </summary> /// <returns> /// The layout definition. /// </returns> /// <contract><ensures condition="not null" /></contract> private static LayoutDefinition GetLayoutDefinition() { string sessionString = WebUtil.GetSessionString(DeviceEditorForm.GetSessionHandle()); Assert.IsNotNull(sessionString, "layout definition"); return(LayoutDefinition.Parse(sessionString)); }
/// <summary> /// Sets the definition. /// </summary> /// <param name="layout"> /// The layout. /// </param> private static void SetDefinition(LayoutDefinition layout) { Assert.ArgumentNotNull(layout, "layout"); string value = layout.ToXml(); WebUtil.SetSessionValue(DeviceEditorForm.GetSessionHandle(), value); }
protected void PersonalizeControl(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (this.SelectedIndex < 0) { return; } LayoutDefinition layoutDefinition = DeviceEditorForm.GetLayoutDefinition(); DeviceDefinition device = layoutDefinition.GetDevice(this.DeviceID); System.Collections.ArrayList renderings = device.Renderings; if (renderings == null) { return; } RenderingDefinition renderingDefinition = renderings[this.SelectedIndex] as RenderingDefinition; if (renderingDefinition == null) { return; } if (string.IsNullOrEmpty(renderingDefinition.ItemID) || string.IsNullOrEmpty(renderingDefinition.UniqueId)) { return; } if (args.IsPostBack) { if (args.HasResult) { XElement rules = XElement.Parse(args.Result); renderingDefinition.Rules = rules; DeviceEditorForm.SetDefinition(layoutDefinition); this.Refresh(); return; } } else { Item itemFromQueryString = UIUtil.GetItemFromQueryString(Client.ContentDatabase); string contextItemUri = (itemFromQueryString != null) ? itemFromQueryString.Uri.ToString() : string.Empty; PersonalizeOptions personalizeOptions = new PersonalizeOptions { SessionHandle = DeviceEditorForm.GetSessionHandle(), DeviceId = this.DeviceID, RenderingUniqueId = renderingDefinition.UniqueId, ContextItemUri = contextItemUri }; SheerResponse.ShowModalDialog(personalizeOptions.ToUrlString().ToString(), "980px", "712px", string.Empty, true); args.WaitForPostBack(); } }