protected void Save_Click(object sender, EventArgs e) { PageIO page = new PageIO("", "", pageName, EditBodyTextBox.Text, System.DateTime.Now, ContentTypeDropDown.SelectedValue, userID, false, true); page.SavePage(); Response.Redirect(Request.Url.AbsolutePath); }
protected void Page_Load(object sender, EventArgs e) { Guid session = new Guid(); String loginText = ""; if (Request.Cookies["session"] != null && !string.IsNullOrEmpty(Request.Cookies["session"].Value) && Guid.TryParse(Request.Cookies["session"].Value, out session)) { int userID = Auth.checkSession(session); string username = Auth.LookupUserName(userID); if (!string.IsNullOrEmpty(username)) { loginText = "You are currently logged in as: " + username + " <a href=\"/Logout.aspx\">click here to logout</a>"; } else { loginText = "<a href=\"/Login.aspx\">Login</a>"; } } else { loginText = "<a href=\"/Login.aspx\">Login</a>"; } //Header PageIO headerPage = new PageIO(header); MasterHeader.Text = headerPage.GetBodyAsHTML(); //General Template PageIO page = new PageIO(template); if (-1 != page.ID && !string.IsNullOrWhiteSpace(page.Body)) { string pageContent = page.GetBodyAsHTML(); //if we can't find it unencoded try encoding is and try again if (pageContent.IndexOf(Server.HtmlEncode(loginPlaceHolder)) > -1) loginPlaceHolder = Server.HtmlEncode(loginPlaceHolder); if (pageContent.IndexOf(loginPlaceHolder) > -1) pageContent = pageContent.Replace(loginPlaceHolder, loginText); if (pageContent.IndexOf(Server.HtmlEncode(contentPlaceHolder)) > -1) contentPlaceHolder = Server.HtmlEncode(contentPlaceHolder); if (pageContent.IndexOf(contentPlaceHolder) > -1) { MasterPreBody.Text = pageContent.Substring(0, pageContent.IndexOf(contentPlaceHolder)); string postContent = pageContent.Substring(pageContent.IndexOf(contentPlaceHolder) + contentPlaceHolder.Length); MasterPostBody.Text = postContent; } else { MasterPreBody.Text = pageContent; MasterPostBody.Text = ""; } } }
private void PopulatePage() { page = new PageIO(pageName); if (!Page.IsPostBack) { if (-1 != page.ID && !string.IsNullOrWhiteSpace(page.Body)) { DefaultBody.Visible = false; CustomBody.Visible = true; CustomBodyHTML.Text = page.GetBodyAsHTML(); } } }
private void PopulateTemplate() { //We can generate this login text early. string loginText = "<a href=\"/Login.aspx\">Login</a>"; if (0 < userID) loginText = "You are currently logged in as: " + username + " <a href=\"/Logout.aspx\">click here to logout</a>"; //Header Template page = new PageIO(GetUniqueHeaderName()); if (-1 != page.ID) { CustomHeader.Visible = true; CustomHeader.Text = page.Body; } Page.Title = SettingsIO.GetSetting("SiteName") + " - Home"; //General Template page = new PageIO(GetUniqueTemplateName()); if (-1 != page.ID) { string pageContent = page.GetBodyAsHTML(); //if we can't find it unencoded try encoding is and try again if (pageContent.IndexOf(Server.HtmlEncode(loginPlaceHolder)) > -1) loginPlaceHolder = Server.HtmlEncode(loginPlaceHolder); if (pageContent.IndexOf(loginPlaceHolder) > -1) pageContent = pageContent.Replace(loginPlaceHolder, loginText); if (pageContent.IndexOf(Server.HtmlEncode(contentPlaceHolder)) > -1) contentPlaceHolder = Server.HtmlEncode(contentPlaceHolder); if (pageContent.IndexOf(contentPlaceHolder) > -1) { PreContentHTML.Text = pageContent.Substring(0, pageContent.IndexOf(contentPlaceHolder)); string postContent = pageContent.Substring(pageContent.IndexOf(contentPlaceHolder) + contentPlaceHolder.Length); PostContentHTML.Text = postContent; } else { PreContentHTML.Text = pageContent; PostContentHTML.Text = ""; SystemContent.Visible = false; } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/css"; //first try the minified version PageIO minifiedCSS = new PageIO("System_CSS_Min"); if (!string.IsNullOrWhiteSpace(minifiedCSS.Body)) context.Response.Write(minifiedCSS.Body); else { //now try the uncompressed version. PageIO defaultCSS = new PageIO("System_CSS"); if (!string.IsNullOrWhiteSpace(defaultCSS.Body)) context.Response.Write(defaultCSS.Body); else { //Default version context.Response.WriteFile("SiteResources/ExampleStyleSheet.css"); } } }