/// <summary>Gets the curent state of the control panel.</summary> /// <param name="html"></param> /// <returns></returns> public static ControlPanelState GetControlPanelState(HtmlHelper html) { return ControlPanel.GetState(html.ContentEngine().SecurityManager, html.ViewContext.HttpContext.User, html.ViewContext.HttpContext.Request.QueryString); }
private static string Plugins(HtmlHelper html, ContentItem item, ControlPanelState state) { ContentItem start = html.StartPage(); ContentItem root = html.RootPage(); Page p = new Page(); foreach (IControlPanelPlugin plugin in html.ContentEngine().Resolve<IPluginFinder>().GetPlugins<IControlPanelPlugin>()) { var span = new System.Web.UI.HtmlControls.HtmlGenericControl("span"); span.Attributes["class"] = "control"; var pluginControl = plugin.AddTo(span, new PluginContext(item, null, start, root, state, html.ContentEngine(), html.ViewContext.HttpContext)); if (pluginControl != null) p.Controls.Add(span); } using (var sw = new StringWriter()) using (var htw = new HtmlTextWriter(sw)) { p.RenderControl(htw); return sw.ToString(); } }