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.
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
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.
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?
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.
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?
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
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
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
What code did you use to automatically set the review date?
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
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.
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
is working on a reply...