+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / possible bug on recycle bin

possible bug on recycle bin

4 posts, 0 answered
  1. Francesco
    Francesco avatar
    2 posts
    Registered:
    13 Feb 2012
    12 Aug 2014
    Link to this post

    Hi,
    I am not sure if this is a normal behavior or not.

    Basically I am retrieving a list of top level pages via code using something like:

    var topLevelPages = manager
                                            .GetPageNodes()
                                            .Where(p => p.Parent.Title == "Pages")
                                            .OrderBy(o => o.Ordinal);

    The problem in not in the code but on the recycle bin.
    I had a list of pages on the CMS market "show in the menu". The snippet above (with an if statement) is picking everything fine. 

    I deleted a top level page (was a group page) and I could still see the page listed. (The code was still picking the page even though I delete it).

    In order to completely remove the page from being displayed I had to remove it from the bin.

    I suppose the code should not picks up things from the bin?

    Hope this makes sense

    Thanks

    Francesco

  2. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    05 Sep 2014
    Link to this post
    Hello Francesco,

    Since the release of "Recycle bin" feature, if you wish to filter out pages located in your bin, you have to add
    pN.Page.Visible == true as a parameter:
    var pageNodes = App.WorkWith()
        .Pages()
        .LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend)
        .Where(pN => (pN.Page != null && pN.Page.Status == ContentLifecycleStatus.Live && pN.Page.Visible == true))
        .Get()
        .ToList();

    Hope this helps.

    Regards,
    Vassil Vassilev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Jeff Pignataro
    Jeff Pignataro avatar
    3 posts
    Registered:
    20 May 2013
    12 Mar 2015 in reply to Vassil Vassilev
    Link to this post

    Can you please explain the difference between

    pN.Page.Status == ContentLifecycleStatus.Live
     and

    pN.Page.Visible == true

    My understanding is that if something is "ContentLifecycleStatus.Live" then it can't be in the Recycle Bin. Am I incorrect in my understanding of the Recycle Bin?

    I've experienced similar issues when querying images, previous widgets I've created used:

    HomepageSliderRepeater.DataSource = album.Images().Where(i => ContentLifecycleStatus.Live).OrderBy(i => i.Ordinal);

    Which then had to be changed to:

    HomepageSliderRepeater.DataSource = album.Images().Where(i => i.Status == ContentLifecycleStatus.Live).OrderBy(i => i.Ordinal);

    Is this adjustment required for all widgets which query content types that can be placed in the Recycle Bin?

     

  4. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    30 Sep 2016
    17 Mar 2015
    Link to this post
    Hi Jeff,

    If you would like to get the live versions of the pages or content items which are visible on the frontend (excluding the pages or content items from the recycle bin) you should also check the IsDeleted property of the pages or items:

    PageManager pageManager = PageManager.GetManager();
    IQueryable<PageData> pages = pageManager.GetPageDataList().Where(pData => pData.IsDeleted == false && pData.Status == ContentLifecycleStatus.Live);

    Regards,
    Sabrie Nedzhip
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
4 posts, 0 answered