Example #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);
 }
Example #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);
 }
Example #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);
 }
Example #4
0
        public XmlDocument GetXml()
        {
            if (InPreviewMode)
            {
                if (_previewContent == null)
                {
                    _previewContent = new PreviewContent(UmbracoUser, new Guid(StateHelper.Cookies.Preview.GetValue()), true);
                    if (_previewContent.ValidPreviewSet)
                        _previewContent.LoadPreviewset();
                }
                if (_previewContent.ValidPreviewSet)
                    return _previewContent.XmlContent;
            }
            return content.Instance.XmlContent;

        }
Example #5
0
 public XmlDocument GetXml()
 {
     if (InPreviewMode)
     {
         // zb-00004 #29956 : refactor cookies names & handling
         PreviewContent pc = new PreviewContent(new Guid(StateHelper.Cookies.Preview.GetValue()));
         pc.LoadPreviewset();
         return pc.XmlContent;
     }
     else
     {
         return content.Instance.XmlContent;
     }
 }
        protected override void DisposeResources()
        {
            Security.DisposeIfDisposable();
            Security = null;
            _previewContent = null;
            _umbracoContext = null;
            //ensure not to dispose this!
            Application = null;

            //Before we set these to null but in fact these are application lifespan singletons so 
            //there's no reason we need to set them to null and this also caused a problem with packages
            //trying to access the cache properties on RequestEnd.
            //http://issues.umbraco.org/issue/U4-2734
            //http://our.umbraco.org/projects/developer-tools/301-url-tracker/version-2/44327-Issues-with-URL-Tracker-in-614
            //ContentCache = null;
            //MediaCache = null;     
        }
 /// <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();
     }          
 }
Example #8
0
 protected override void DisposeResources()
 {
     Security.DisposeIfDisposable();
     Security = null;
     _previewContent = null;
     _umbracoContext = null;
     //ensure not to dispose this!
     Application = null;
     ContentCache = null;
     MediaCache = null;     
 }