private void PagePreRender(object sender, EventArgs e) { HttpContext context = HttpContext.Current; if (IsValid(context.Request)) { Page page = HttpContext.Current.Handler as Page; if (page == null) { return; } // TODO: Get Javascript and CSS from plugin properties string js = EmbeddedResources.GetString(string.Format("{0}console.js", EmbeddedResources.BasePath)); string css = EmbeddedResources.GetString(string.Format("{0}console.css", EmbeddedResources.BasePath)); string url = string.Format( "/ControlPanel/Utility/RevertTheme.aspx?ThemeTypeID={0}&ThemeContextID={1}&ThemeName={2}", SiteThemeContext.Instance().ThemeTypeID, Guid.Empty, CSContext.Current.SiteTheme); js += string.Format(@" $(function () {{ $.fourroads.plugins.themeConsole.register({{ urls: {{ modal: '{0}' }} }}); }})", url); Head.AddRawContent(string.Format(@"<style type=""text/css"">{0}</style>", css), HttpContext.Current); page.ClientScript.RegisterStartupScript(GetType(), "cacheconsole", js, true); } }
public void RegisterCssBlock(string css, string key) { if (IsScriptRended(key)) { return; } SetScriptRended(key); Head.AddRawContent(string.Format("<style type='text/css'>{0}</style>", css), HttpContext.Current); }