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

Forums / Developing with Sitefinity / Page Check In == Publish?

Page Check In == Publish?

7 posts, 1 answered
  1. Jeff
    Jeff avatar
    124 posts
    Registered:
    05 Aug 2007
    25 Feb 2010
    Link to this post
    The Page.Staged.CheckIn() method seems to have the same effect as Page.Publish: When I call CheckIn, the live page is updated.

    Hopefully I'm just doing this wrong somehow.

    Here are the steps I take. I can post sample code if need be.


    Version 1 of Page (all in one server round trip):

    1. Create a page with CmsManager.CreatePage()
    2. Assign a MasterPage and Title
    3. Check out the page
    4. Assign a template and add content to the staged page
    5. Check in
    6. Publish

    Version 2 of Page (each step is a separate postback):

    1. Check out the page
    2. Add content to the staged page. At this point, I can preview the new content but the live page (using Telerik.Cms.Web.InternalPage) still shows version 1.
    3. Check in the page. Live page now shows new content but I haven't called CmsManager.Publish() yet.

    Is there a step I'm missing? Is there something I'm not understanding about the process?

    Thanks,
    Jeff
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    25 Feb 2010
    Link to this post
    Hi Jeff,

    Staged.CheckIn() unlocks a page if locked. Then Publish method of Telerik.Cms.Data.StagedPage is called. Nolics commit the transaction and CmsManager.RaiseExecuted is called where as a sender "Publish" or "PblishNew" is passed.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Jeff
    Jeff avatar
    124 posts
    Registered:
    05 Aug 2007
    25 Feb 2010
    Link to this post
    OK, so are you saying that CheckIn does publish the page? How does the Staged.CheckIn method differ from ICmsPage.Publish?

    I'm trying to get the page into a "Draft" mode, where changes have been made to the page, the page is unlocked but the changes aren't live yet. Is that possible?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    26 Feb 2010
    Link to this post
    Hi Jeff,

    In both case Telerik.Cms.Data.Publish is called as a final result. There is PageStatus which is enum that has enumerator list  - New, Archived and Published.

    To get a page in Draft mode you can use Sitefinity's workflow. When the page is in Workflow status draft, the page is unlocked and the changes are not live yet.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Jeff
    Jeff avatar
    124 posts
    Registered:
    05 Aug 2007
    26 Feb 2010
    Link to this post
    Of course, workflow! I got so fixated on the check in behavior that I neglected to look at the big picture!

    Next question, can you point me to any sample code demonstrating how to work with workflow programmatically? I found this KB article but I haven't found anything else of significance.

    I see the WorkflowManager class, PageWorkflow class and the WorkflowID property of ICmsPage. I have little clue as to how to get anything useful done with them, though.

    Thanks,
    Jeff
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Feb 2010
    Link to this post
    Hi Jeff,

    Here are two samples

    1. Get the page workflow status

    var cmsManager = new CmsManager();
    CmsSiteMapNode currentNode = (CmsSiteMapNode)SiteMap.Provider.CurrentNode;
    ICmsPage editPage = cmsManager.GetPage(currentNode.CmsPage.ID, true) as ICmsPage;
    WorkflowInstance workflow;
    workflow = editPage.GetWorkflow();
    if (workflow != null)
    {
     
        PageWorkflow activity = (PageWorkflow)workflow.Activity;
        if (activity.ApprovalStatus == ApprovalStatus.Published)
        {
               // do something here
        }
    }


    2. Moving between the activities

    ExecuteActivity(cmsPage.WorkflowID, "SendForApproval");
    Nolics.ORMapper.Base.DataConnection.InitWebRequest();
    ExecuteActivity(cmsPage.WorkflowID, "Approve");
    Nolics.ORMapper.Base.DataConnection.InitWebRequest();
    cmsManager.SavePage(cmsPage);


    You can take a look at this blog post - Schedule content items publishing with workflow enabled

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
    Answered
  7. Jeff
    Jeff avatar
    124 posts
    Registered:
    05 Aug 2007
    02 Mar 2010
    Link to this post
    Thanks Ivan. That's exactly what I was looking for and it's working great.

    Jeff
Register for webinar
7 posts, 1 answered