Forums

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity Older Versions (3.x): Developing with Sitefinity > Page Check In == Publish?

Page Check In == Publish?

  • Posted on Feb 24, 2010 (permalink)

    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

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Feb 25, 2010 (permalink)

    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.

    Reply

  • Posted on Feb 25, 2010 (permalink)

    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?

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Feb 26, 2010 (permalink)

    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.

    Reply

  • Posted on Feb 26, 2010 (permalink)

    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

    Reply

  • Answer Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Feb 28, 2010 (permalink)

    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.

    Reply

  • Posted on Mar 2, 2010 (permalink)

    Thanks Ivan. That's exactly what I was looking for and it's working great.

    Jeff

    Reply

  • Register for webinar
Skip Navigation LinksHome / Developer Network / Forums / Sitefinity Older Versions (3.x): Developing with Sitefinity > Page Check In == Publish?