Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 9:22 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Date Timeout Evaluation
PostPosted: October 15th, 2010, 1:04 am 
Offline

Joined: June 9th, 2007, 10:53 am
Posts: 34
Location: UK
Opus: Opus Pro 8.0
OS: Windows XP Pro SP3
System: Acer Intel Core 2 Quad, 2.4GHz, 3 MB RAM
Hi all, can anyone help with how to make a publication expire after a certain date. i.e if a publication set to say expire on 31 October 2010 and is run it just stops and exits. I need to set a date before each compile for it to expire and exit on the new date. I have read various posts but can't seem to find an answer on hot to set an actual date for a publication to expire. Thanks for any help anyone can offer - appreciated. Regards


Top
 Profile  
 
 Post subject: Re: Date Timeout Evaluation
PostPosted: October 15th, 2010, 3:50 am 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Something like this do what you want...
Drop it into a page script on your entry page..
The pub will exit immediately once the pub has expired, but you can send the user to another page with info on the expiry...

//#################################

myDate = "31 Oct 2010" // hardwire in required expiry date...

var futureDate = Date.parse(myDate);

var myDate2 = new Date();
var currDate = myDate2.getTime();

if ((currDate >= futureDate)){
ReallyExitPublication();
}

//#################################

In theory the user can wind back the computer clock to keep the pub working, but that will usually cause problems with other software they are using.
Most people will not do this...
You can use a similar script to check the date is past the time you compiled the pub as well.

cheers
Paul


Top
 Profile  
 
 Post subject: Re: Date Timeout Evaluation
PostPosted: October 15th, 2010, 5:26 am 
Offline

Joined: June 9th, 2007, 10:53 am
Posts: 34
Location: UK
Opus: Opus Pro 8.0
OS: Windows XP Pro SP3
System: Acer Intel Core 2 Quad, 2.4GHz, 3 MB RAM
Thanks Paul, terrific as that is perfect. I will be putting the date and time on my first screen so if date turned back will be obvious to users. Thanks a million for your time - appreciated. :lol:


Top
 Profile  
 
 Post subject: Re: Date Timeout Evaluation
PostPosted: October 15th, 2010, 5:31 am 
Offline

Joined: June 9th, 2007, 10:53 am
Posts: 34
Location: UK
Opus: Opus Pro 8.0
OS: Windows XP Pro SP3
System: Acer Intel Core 2 Quad, 2.4GHz, 3 MB RAM
Hi again Paul, many thanks for your script - out of curiosity, how would I send them to an "Out of Date Screen" - thanks in advance.


Top
 Profile  
 
 Post subject: Re: Date Timeout Evaluation
PostPosted: October 15th, 2010, 11:18 am 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
If the name of your "Out of Date Screen" page is, for example, "Expired"
change the last part of the script to

if ((currDate >= futureDate)){
GotoPage("Expired");
}


Paul


Top
 Profile  
 
 Post subject: Re: Date Timeout Evaluation
PostPosted: October 15th, 2010, 12:30 pm 
Offline

Joined: June 9th, 2007, 10:53 am
Posts: 34
Location: UK
Opus: Opus Pro 8.0
OS: Windows XP Pro SP3
System: Acer Intel Core 2 Quad, 2.4GHz, 3 MB RAM
Thanks for your time Paul - much appreciated. I ended up with the following script and thought maybe other less experienced like myself may be interested: Just need to remember to change the date to whatever needed before publishing.

Thanks again Paul for stearing me in the right direction.

//#################################
myDate = "31 Oct 2010" // hardwire in required expiry date...
var futureDate = Date.parse(myDate);
var myDate2 = new Date();
var currDate = myDate2.getTime();
if ((currDate >= futureDate)){
GotoPage("MainPage_ENGLISH")
}
else
{
GotoPage("MainMenu_ENGLISH")
}
//#################################


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 29 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group