article dates problem

Author Message

Alessandro Cipriani

Monday 23 February 2004 12:19:31 am

hi all
i've already posted a similar message without answers, so i'll retry...
i modified my own article class by adding another two dates: the pubblication date (different from the built-in date) and the expiry date.
now i'd like to have the following function. i need to "elaborate" these dates in order to:
- publish the article only if the current date is between the publication date and the expiry date, and hide it otherwise.

any hint?

best regards

alessandro

Balazs Halasy

Monday 23 February 2004 3:01:58 am

Hi,

What you need to do in order to achieve this kind of functionality is to create/program a custom workflow event (or events). The events would take care of publishing if the date is correct, unpublishing, etc.

Balazs

Alessandro Cipriani

Monday 23 February 2004 3:08:33 am

thanks for your answer
can I have an example of this kind of workflow?

best regards

alessandro

Iain MacLean

Tuesday 24 February 2004 2:51:47 pm

Hi again Alessandro

You can do this using workflows. Check out http://ez.no/community/forum/general/publish_articles_by_date on how to publish articles on the new date attribute you specify in your article class. Also have a look at http://ez.no/community/forum/developer/unpublish_by_date on how to hide articles after they expire.

I have got the publish articles by date workflow working properly, but not the unpublish workflow. (I'm recreating my workflows now, so hope to get it going.)

Cheers
Iain

Alessandro Cipriani

Wednesday 25 February 2004 2:55:34 am

hi all
i'm trying to use the "wait until date" workflow in my site
i read http://ez.no/community/forum/general/publish_articles_by_date and followed the hints in that thread, but with no results. i got to apply it to my Article class, which i've already added the "publish date" attribute and use it to check with the current date
then i linked the before publish trigger to this workflow, but with no results...

is it a problem on version 3.3-3 or do I mistake something?

best regards
alessandro

Iain MacLean

Thursday 26 February 2004 2:45:13 am

Hi Alessandro

I should have mentioned before that you have to run the runcronjobs.php script for this to work. The next time the script runs after the date or time for publication it will publish the article on the site.

One tip, if you are not using the default site in the eZpublish setup, you should use the siteaccess switch with the script, e.g. php runcronjobs.php -s <sitename> at the command line. That is the only way I have been able to get it to work during testing.

Cheers
Iain

Alessandro Cipriani

Thursday 26 February 2004 6:17:29 am

Ian,
i know i've tu run the runcronjob file. i've already setup a very simple approval workflow (to test the workflow functionality to work) and everything was ok
then i created a new workflow (wait until date) and linked the "before-publish" trigger to it, indicating the publish date as parameter. but even if i set the publish date to 2 days after the current date the article is published. and if i run the cronjob the workflow queue is empty... the event doesn't enter the queue...

any advice
best regards

alessandro

Iain MacLean

Monday 15 March 2004 7:52:44 pm

Hi Alessandro

You've probably worked this out already. I'm not sure what the problem could be. If you follow the basic instructions in other posts, and get a list of Class name and ClassAttribute name in a 'Wait until date' event it should work OK.

However, I have got the 'unpublish by date' process working. My problem was caused by the fact that the advice given in the post http://www.ez.no/community/forum/developer/unpublish_by_date is misleading. You don't need to create a new workflow to retract items.

When you run runcronjobs.php, one of the scripts it runs is cronjobs/unpublish.php. This looks for an attribute called 'unpublish_date' in all the classes on the site. If it finds it, it checks the timestamp in that field and retracts any objects where the current datetime is past the timestamp. The retracted object goes into the trash.

I finally got this to work last night. All I had to do was change the attribute name in the appropriate classes, but it works without a workflow.

(Sorry I didn't reply earlier, but I didn't check this thread.)

Cheers

Iain

Bruce Morrison

Monday 15 March 2004 10:42:55 pm

There are more details on unpublish cronjob here
http://www.ez.no/community/forum/general/unpublish_event_in_ez_3_3_missing/re_unpublish_event_in_ez_3_3_missing__3

Cheers
bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Alessandro Cipriani

Tuesday 16 March 2004 2:00:40 am

hi ian

i'm sorry but the publish workflow event doesn't work to me...
i'm running it on 2 different machines, one runningh the 3.3-1 version, and the other running the 3.3-3 version. there is no difference between them, because doesn't work...

there are 2 strange things i've noticed:
- when i setup the workflow event by selecting the article class and by loading the date attribute everithing is ok, but when i try to modify it (the unique way to view it and to be sure that i setup it right) i see only the class list, not the attribute list with the attribute i've selected. my doubt now is if the workflow is stored right
- when i run the cronjob i notice that no processes are stored into the workflow list... so i think this is a store problem...

any hint?

best regards
alessandro

Iain MacLean

Tuesday 16 March 2004 2:02:54 am

Oops, yes, completely forgot about the settings in content.ini. You have to use the class object ids, e.g. '2' for an article, rather than their names. Thanks Bruce.

Cheers
Iain

Iain MacLean

Tuesday 16 March 2004 2:10:46 am

Hi Alessandro

Do you mean that when you try to edit the workflow after storing it that the ClassAttribute names have disappeared from the list? I've never seen that happen. I don't know what would cause it.

What happens if you don't try to look at it by opening it up to edit it? Does it work then?

Iain

Alessandro Cipriani

Tuesday 16 March 2004 2:22:29 am

hi ian
yes, if i try to edit the class attribute list disappears. also if i don't try to edit the workflow event it doesn't work.
no items are inserted into the workflow list, while the article is published also if the publication date is set to tomorrow.
if you want/can: icq #326457502

help! :)
cheers
alessandro

Alessandro Cipriani

Tuesday 16 March 2004 6:35:04 am

ok, the publish function works! great!

now i need a little help about the unpublish one
in particular i don't know how to modify the siteaccess/mysite/content.ini.append file

i added the section
[UnpublishSettings]
RootNodeList[]=????
ClassList[]=2

i want to unpublish all the Article objects (class id = 2) in my site. so classlist should be 2. what about rootNodeList?

best regards
alessandro

Alessandro Cipriani

Tuesday 16 March 2004 7:04:14 am

resolved!
i wrote "2" also in the RootNodeList. this because i need to unpublish ALL the articles on my site having a specified unpublish_date.

thanks a lot to bruce and iain and all the people that daily work in ezpublish development

alessandro

Iain MacLean

Tuesday 16 March 2004 9:42:49 pm

Hi Alessandro,

I think putting '2' in the RootNodeList worked for you because 2 is the NodeID of the Root folder for the site, rather than the ClassID for articles. Also, it seems you have to have a separate line for each ClassID and RootNodeID if you have an unpublish_date in several classes, i.e. you can't have a list of them separated by commas.

Cheers
Iain

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.