Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 06:09:58 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155547 Posts in 21714 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: calendar in topics module sets -2 hours automatically  (Read 556 times)
YoJoe

Offline Offline

Posts: 74


WWW
« on: June 01, 2011, 12:12:12 AM »

I tried to set a start and end date of created topic, then move it to archive page.
But its calendar behaves very strange.
1. I have to set +2 hours to actually launch the article at fixed time
2. every time I edit an article, calendar's date/hour is lowered by 2 hours.
for example when I set publishing date  to 06.06.2011 12:00, save page, exit, edit the article again, loaded date and hour is set to 06.06.2011 10:00.
It takes place every time I edit the article or resave it, so couple edits within short period of time, and publication will  be set to start yesterday :/

News module is working fine; I tried to mess with time zone (global and per user) and add or substract 2 hours.
But it didn't work out. Happens on local lamp and production server.

I guess the problem stays in modify.topic.php line 141
Code:
$published_when = gmdate($jscal_format, $t);
and line 320
Code:
$t = time() - $fetch_content['posted_first']; $t = $t / 3600;
but I'm not familiar with gmdate nor the way dates are being held by topics module.

Could anyone shred some light on this matter ?


ps. WB 2.8.2RC5 1450 + CKEdit module
« Last Edit: June 01, 2011, 12:28:29 AM by YoJoe » Logged

WuJitsu - in web I trust  cool
dbs
WebsiteBaker Org e.V.

Offline Offline

Posts: 3719


WWW
« Reply #1 on: June 01, 2011, 05:51:03 AM »

@2.: Same problem here with wb2.8.1 and FCK.
A solution would be nice.
« Last Edit: June 01, 2011, 05:52:39 AM by dbs » Logged

marmot

Offline Offline

Posts: 208


« Reply #2 on: June 01, 2011, 02:15:47 PM »

Hi,
I guess the problem stays in modify.topic.php line 141
Code:
$published_when = gmdate($jscal_format, $t);
I gues you are almost right. Serach the file modify_topic.php for "gmdate" (found 3 times in lines 141, 148, 153) and replace with "date". This solved the issue for me as the timestamps ist stored at local time and read in gmt time. I think there should be no risk as this is only for displaying the date but however, no guarentee Smiley.

regards
Logged
YoJoe

Offline Offline

Posts: 74


WWW
« Reply #3 on: June 01, 2011, 02:39:41 PM »

Valuable hint. If date() works correctly - according to user's account timezone - it should work.
But I think date variables should be generated with additional var responsible of adding/substracting time set in user profile.
That's a sidenote.

I'll try with date later on, as I'm fed up in messing with currently developed website's code.
Every time I am "this" close to end development, a bug like this one appears.
ohhh... that sucks my morale pretty fast :/
Logged

WuJitsu - in web I trust  cool
YoJoe

Offline Offline

Posts: 74


WWW
« Reply #4 on: June 03, 2011, 06:34:14 PM »

As I suspected, Marmot's hints aren't enough to fix the problem.
Changing gmdate() to date() in modify_topic.php fix only date displayed during topic edit.
It doesn't fluent onto display topic on website, and doing the same steps (gmdate() -> date()) is not enough, because the true dates still lack 2 hours.

Logged

WuJitsu - in web I trust  cool
marmot

Offline Offline

Posts: 208


« Reply #5 on: June 03, 2011, 09:34:13 PM »

Hi,
As I suspected, Marmot's hints aren't enough to fix the problem.
I disagree, maybe my hints do not fix all problems but as far as I can see the problems you described in the opening post are fixed, as you didn't mention display problems on frontend there. I recognized the frontend issue during testing, but you didn't ask for it grin. But of course u are right the problems are there.
Quote
It doesn't fluent onto display topic on website, and doing the same steps (gmdate() -> date()) is not enough, because the true dates still lack 2 hours.
I don't understand. Of course you have to change gmdate to date in the view files if you want to have the correct time displayed. That works for me for example in the overvwiew list by editing view.list.php in the way described above.

Another approach could be to store time in gmt format. But this might mess up time controlled publishing. Sorry I'm not the developer and so I don't know why gmdate is used.

regards
Logged
YoJoe

Offline Offline

Posts: 74


WWW
« Reply #6 on: June 04, 2011, 12:40:10 AM »

I disagree, maybe my hints do not fix all problems but as far as I can see the problems you described in the opening post are fixed, as you didn't mention display problems on frontend there. I recognized the frontend issue during testing, but you didn't ask for it grin. But of course u are right the problems are there.

heh, yeah, changing gmdate to date in modify topic is a raw fix for substracting 2 hours from date during edit.
But I didn't know that views have their own ways to diplay date, thus time based publishing is still screwed.

Quote
I don't understand. Of course you have to change gmdate to date in the view files if you want to have the correct time displayed. That works for me for example in the overvwiew list by editing view.list.php in the way described above.
Another approach could be to store time in gmt format. But this might mess up time controlled publishing. Sorry I'm not the developer and so I don't know why gmdate is used.

I've done that, and this didn't help out.
At least didn't work for me.
I changed time based publishing to archiving mode, and I'll just go with choosing a hour around midnight.
That's not a solution I wanted, but I don't see any other way.

As it goes about using gmdate I suppose it has been chosen to start/stop displaying articles according to all timezones, especially on multilanguage dates.


Regardless of that I shouldn't have used topics, as news system would be enough to create articles.
But I've gone too far in changing it, to start with news module from the beginning.


Anyway thx for giving a hand Wink
« Last Edit: June 04, 2011, 02:09:41 PM by YoJoe » Logged

WuJitsu - in web I trust  cool
fischstäbchenbrenner

Offline Offline

Posts: 271



« Reply #7 on: June 04, 2011, 08:26:31 AM »

Hi,
Yes, there are problems with the exact time in Topics. (There seem to problem with this in most modules, News also)

In the first versions (up to 0.6 ?)  I used time()+TIMEZONE and date().
Some of the gurus here told me that I have to use gmdate(), which is used in Topics 0.7.

In the next version I'll use date() like before.
Logged

Burn, baby, burn!
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!