Exemple #1
0
        public void OnPostSave()
        {
            StreamingLiveLib.Page page = (PageId == 0) ? new StreamingLiveLib.Page() : StreamingLiveLib.Page.Load(PageId);
            page.Name         = Name;
            page.LastModified = DateTime.UtcNow;
            page.SiteId       = AppUser.CurrentSite.Id;
            page.Save();

            string cssLink = "<link href=\"/data/" + AppUser.CurrentSite.KeyName + "/data.css\" rel=\"stylesheet\">"
                             + "<link href=\"/css/page.css\" rel=\"stylesheet\">";

            Utils.WriteToS3(S3Client, $"data/{AppUser.CurrentSite.KeyName}/page{page.Id}.html", $"<html><head>{cssLink}</head><body>{PageBody}</body></html>", "text/html");
            Populate();
        }
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            int pageId = Convert.ToInt32(PageIdHid.Value);

            StreamingLiveLib.Page page = (pageId == 0) ? new StreamingLiveLib.Page() : StreamingLiveLib.Page.Load(pageId);
            page.Name         = NameText.Text;
            page.LastModified = DateTime.UtcNow;
            page.SiteId       = AppUser.Current.Site.Id;
            page.Save();

            string cssLink = "<link href=\"/data/" + AppUser.Current.Site.KeyName + "/data.css\" rel=\"stylesheet\">"
                             + "<link href=\"/css/page.css\" rel=\"stylesheet\">";

            cssLink = "<link href=\"/css/page.css\" rel=\"stylesheet\">";

            string htmlFile = Server.MapPath("/data/" + AppUser.Current.Site.KeyName + "/page" + page.Id + ".html");

            System.IO.File.WriteAllText(htmlFile, $"<html><head>{cssLink}</head><body>{BodyHid.Value}</body></html>");


            Populate();
        }