Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Document d = new Document(int.Parse(helper.Request("id")));
     PreviewContent pc = new PreviewContent(base.getUser(), Guid.NewGuid(), false);
     pc.PrepareDocument(base.getUser(), d, true);
     pc.SavePreviewSet();
     docLit.Text = d.Text;
     changeSetUrl.Text = pc.PreviewsetPath;
     pc.ActivatePreviewCookie();
     Response.Redirect("../../" + d.Id.ToString() + ".aspx", true);
 }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     var d = new Document(Request.GetItemAs<int>("id"));
     var pc = new PreviewContent(UmbracoUser, Guid.NewGuid(), false);
     pc.PrepareDocument(UmbracoUser, d, true);
     pc.SavePreviewSet();
     docLit.Text = d.Text;
     changeSetUrl.Text = pc.PreviewsetPath;
     pc.ActivatePreviewCookie();
     Response.Redirect("../../" + d.Id.ToString(CultureInfo.InvariantCulture) + ".aspx", true);
 }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Document d = new Document(int.Parse(helper.Request("id")));
     bool includeChildren = true; //  !String.IsNullOrEmpty(UmbracoContext.Current.Request["children"]) ? true : false;
     PreviewContent pc = new PreviewContent(Guid.NewGuid());
     pc.PrepareDocument(base.getUser(), d, includeChildren);
     pc.SavePreviewSet();
     docLit.Text = d.Text;
     changeSetUrl.Text = pc.PreviewsetPath;
     pc.ActivatePreviewCookie();
     Response.Redirect("../../" + d.Id.ToString() + ".aspx", true);
 }
Пример #4
0
 /// <summary>
 /// Checks if the user is currently in preview mode and if so will update the preview content for this item
 /// </summary>
 /// <param name="contentId"></param>
 private void UpdatePreviewContext(int contentId)
 {
     var previewId = Request.GetPreviewCookieValue();
     if (previewId.IsNullOrWhiteSpace()) return;
     Guid id;
     if (Guid.TryParse(previewId, out id))
     {
         var d = new Document(contentId);
         var pc = new PreviewContent(UmbracoUser, id, false);
         pc.PrepareDocument(UmbracoUser, d, true);
         pc.SavePreviewSet();
     }          
 }