Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bradlay Law 4 posts 24 karma points
    Dec 10, 2010 @ 17:00
    Bradlay Law
    0

    Automatically setting review date

    Hi,

    I've been trying to modify CogPageReview to set the document review date to the current date + 6 months but am being unsuccesful.

    I've added 

    void Document_AfterSave(Document sender, SaveEventArgs e)
            {
                sender.getProperty("reviewDate").Value = DateTime.Now.AddMonths(6).ToString("yyyy-MM-dd");
                sender.Save();
            }

    to DocumentActions.cs but it doesn't do anything. Any ideas?

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Dec 10, 2010 @ 17:45
    Ismail Mayat
    0

    bradley,

    the document then needs to be published as cogpagereview only queries published pages. also the config file has settings as the different states and howmany days to query on if something is set six months in the future then the config file needs to know at what point to indicate then as due for review, see the pdf document that details the date parameters that tell the page review what colour to set the pages.

    Regards

     

    Ismail

  • Bradlay Law 4 posts 24 karma points
    Dec 10, 2010 @ 17:54
    Bradlay Law
    0

    The cog does hook into DocumentActions though and my Document.AfterSave does something when you save a document. I just can't get it to update the reviewDate property that has been setup

     

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Dec 13, 2010 @ 10:10
    Ismail Mayat
    0

    Bradlay,

    I think this may be umbraco issue as event handlers is part of the umbraco core and not cogpagereview. I have done something similar using event handlers for a client where they wanted by default for every page on publish a new review date to be set namely 3 weeks and that all worked fine i did that for an umbraco 4.0.3 site.  What version of umbraco are you using also can you in the event handler update other properties automatically?  I also recently did another website 4.5.2 where i had to set a boolean property via action handler and that worked fine.

    Regards


    Ismail

  • Bradlay Law 4 posts 24 karma points
    Dec 14, 2010 @ 10:31
    Bradlay Law
    0

    What code did you use to automatically set the review date?

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Dec 14, 2010 @ 10:40
    Ismail Mayat
    0

    Dont have it handy but it was actionhandler i was tapping into document.new event then testing that the page type was textPage if it was then setting the date property to todays date + 21 days i.e. 3 weeks.  Do a search on the forum about the document save event in case there are issues also try just to narrow things down using the  document new event to see if it works.  if it does then there may be issue with updating properties in document after save.  

    In fact thinking about it would you not end up in loop as you are in document after save then you update a property then save and that fires the save event again?

    Regards

    Ismail

  • Bradlay Law 4 posts 24 karma points
    Dec 14, 2010 @ 10:43
    Bradlay Law
    0

    Okay, thanks. I'm a PHP dev, not a C# dev and have been given this task to do so you can understand why I'm struggling.

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Dec 14, 2010 @ 10:54
    Ismail Mayat
    0

    Bradlay,

    No worries were here to help.  With event handlers which is more an umbracoism rather than php/c# issue it is possible to end up in a loop but try the document new action and let us know how you get on hopefully that should solve the problem.

    Regards

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft