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

Forums / General Discussions / Audits and workflow action dates

Audits and workflow action dates

4 posts, 0 answered
  1. Jon
    Jon avatar
    22 posts
    Registered:
    11 Mar 2010
    16 Jun 2010
    Link to this post
    I have a situation where we need to know the following per page which has been published:

    Editor (last / final), date, time
    Approve, date, time
    Publisher, date, time

    Right now I can only see the author


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    16 Jun 2010
    Link to this post
    Hello Jon,

    I am not sure which section of the CMS you are referring to, but let's assume that this is the Sitefinity backend where an instance of GridView control lists the pages

    You can add an additional column to the all pages Grid that will show the actual date of an update, modifier and publisher

    1. Open Sitefinity\Admin\ControlTemplates\Pages\AllPagesList.ascx and add a new column to the GridView
    2. Subscribe for RowCreated, get the page and its staged version, find the cell of this row and set the text to the actual date modified.

    sample - the code below will show you the last date a page has been modified by a user.

    public void Page_Load(object sender, EventArgs e)
       {
           
           GridView1.RowCreated += new GridViewRowEventHandler(GridView1_RowCreated);
          
       }
      
       void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
       {
           if (e.Row.DataItem != null)
           {
               if (((Telerik.Cms.CmsPageInfo)(e.Row.DataItem)).ID != null)
               {
                   var cmsManager = new Telerik.Cms.CmsManager();
                   var dm = cmsManager.GetPage(((Telerik.Cms.CmsPageInfo)(e.Row.DataItem)).ID).Staged.DateModified;
                   e.Row.Cells[9].Text = dm.ToString();
                     
               }
           }
       }

    The Modifier property will return the user that has modified the page.

    Additionally you could populate a custom data table will information about the workflow status, current user and so on, so that you will be able to track more information and display more precise data. You can do this inside Sitefinity\Admin\ControlTemplates\Pages\PageViewer.ascx

    sample code

    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);
        var manager = new Telerik.Cms.CmsManager();
        Guid pageID = ((Telerik.Cms.Web.UI.PageEditor)(this.Parent.Parent.Parent.Parent.Parent.Parent)).SelectedPageId;
        var currentPage = (Telerik.Cms.ICmsPage)manager.GetPage(pageID, true);
        Telerik.Workflow.WorkflowInstance wInstance = currentPage.GetWorkflow();
        if (wInstance != null)
        {
            var activity = (Telerik.Cms.PageWorkflow)wInstance.Activity;
            switch (activity.ApprovalStatus)
            {
                  ...
            }
        }
     }

    In the switch loop you can access each workflow status Telerik.Workflow.ApprovalStatus

    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. Dale
    Dale avatar
    2 posts
    Registered:
    16 Jul 2010
    20 Oct 2010
    Link to this post
    Forgive my ignorance. I'm just getting started with Sitefinity. I understand step 1, adding a column to AllPagesList.ascx.

    In step 2, the instruction says, "Subscribe for RowCreated". I'm not certain what that means. Also, the code snippets are for Page_Load and OnRender events. What page does the code go into?

    Thanks in advance,
    DJ
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    20 Oct 2010
    Link to this post
    Hi Dale,

    Please take a look at

    GridView events

    The code where Page_Load method is used should be added to Sitefinity\Admin\ControlTemplates\Pages\AllPagesList.ascx

    The code where OnPreRender is overridden should be added to Sitefinity\Admin\ControlTemplates\Pages\PageViewer.ascx



    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
Register for webinar
4 posts, 0 answered