I took the Timezone changes one step further

Basic Installation and Setup.

Moderator: davidyin

Post Reply
User avatar
tyman00
Members
Members
Posts: 42
Joined: Tue Dec 20, 2005 12:59 pm
Location: Mandan, ND
Contact:

I took the Timezone changes one step further

Post by tyman00 »

First off, David, I appreciate the timezone change that you made. The people in the locations in the other timezones finally quit complaining 8)

Your changes were great, but not exactly what I wanted. I took the little knowledge that I have gained from this In/Out Board in ASP/VBScript and made a few of my own changes.

I was looking to have the times that were displayed altered according to the users timezone no matter where they were. Currently the time is only changed when you are looking in a location that is different than the server.

An example is this:

Server time is: 3pm CST
Server is in -7 CST
Location1 is in -7 CST
Location2 is in -6 MST
User1 is in location1 (-7) CST
User2 is in location2 (-6) MST

User 1 is set to lunch and returning at 4pm CST

User2 looks in Location1 to see when User1 will get back from lunch. I want User2 to see that User1 will get back at 3pm MST. (It is setup right now so User2 would see that User1 is getting back at 4 CST because Location1 is in CST, this means User2 would have to still remember that Location1 is 1 hour ahead of them).

Anyway, the changes I made did what I wanted them to. If you don't understand what I wanted you could have two Pentacle installs. One as David's Original and another with my changes. Create two locations in different time zones and two users. One user in one timezone the other user in the other timezone. Set up different scenarios and compare how mine displays it differently, then you should understand (if my explination didn't work)

I also made the fields read only when setting the return time because I didn't want the users to enter their own time in which wouldn't be compatible with the server format and have the wrong times displayed. This way they are forced to click on the calendar icon to select their time.

There is a file called Comparison.html that is included with the .zip file it is a side by side comparison between David's Original files (on the left) and my files that were updated (on the right) . Be sure to read the README.txt file as well, it explains that a column MUST be added to a table in the database or the page will not display correctly.

I by no means am a ASP programmer, so if my code is bad/dirty please feel free to make any changes you see fit.

I will let you look into these changes and then we can discuss them further. I look forward to your input.

Tyler
Attachments
6.03.0081_tymanv2.zip
(97.03 KiB) Downloaded 523 times
Last edited by tyman00 on Tue Mar 07, 2006 12:50 pm, edited 1 time in total.
User avatar
tyman00
Members
Members
Posts: 42
Joined: Tue Dec 20, 2005 12:59 pm
Location: Mandan, ND
Contact:

Post by tyman00 »

No Feedback? :cry:
User avatar
davidyin
Members
Members
Posts: 192
Joined: Wed Apr 27, 2005 10:50 pm
Location: Burnaby

Post by davidyin »

Because of the security problem, I focus on the security improvement.

I will study the timezone issue you mentioned next week.
User avatar
tyman00
Members
Members
Posts: 42
Joined: Tue Dec 20, 2005 12:59 pm
Location: Mandan, ND
Contact:

Post by tyman00 »

I found a bug in the code I attached.

In default.asp line 577 needs to change from

Code: Select all

	ret12hour = Ucase(right(Time,2))
to

Code: Select all

	ret12hour = Ucase(right(userreturn,2))
It was displaying the AM/PM incorrectly.
User avatar
davidyin
Members
Members
Posts: 192
Joined: Wed Apr 27, 2005 10:50 pm
Location: Burnaby

Post by davidyin »

I feel a little bit confusing about the time zone abobe.
Server time is: 3pm CST
Server is in -7 CST
Location1 is in -7 CST
Location2 is in -6 MST
User1 is in location1 (-7) CST
User2 is in location2 (-6) MST

Let me try to understand it.
CST stands Center Standard Time, it is UTC-6
MST stands Mountain Standard Time, it is UTC-7
So if it is 3pm CST, the MST time is 2pm.
Server timezone is same as location 1 CST, Location 2 is MST.
When server time is 3pm CST, the location 1 is 3pm CST, and location 2 is 2pm MST.
User 1 is in location 1, 3pm CST.
User 2 is in location 2, 2pm MST.

User 1 is set to lunch and returning at 4pm CST.
4pm CST is 3pm CST.

What you want is in the signin/out page, the expected return time entered can be viewed in the first page in which the time format adjusted according to the timezone of the viewer.
User avatar
davidyin
Members
Members
Posts: 192
Joined: Wed Apr 27, 2005 10:50 pm
Location: Burnaby

Post by davidyin »

There are some error in your code.
For example:
When sign in/out, without the expect return time, the error comes.


I have to say, add one more field to divided the time and comment is good idea.
The reason why I put them together in my original design is to save a field to keep the database slim and for simplify the code.
You know, in the begining, this software is working for one location only.

I would like to add this feature into next version.
Guest

Post by Guest »

davidyin wrote:I feel a little bit confusing about the time zone abobe.
Server time is: 3pm CST
Server is in -7 CST
Location1 is in -7 CST
Location2 is in -6 MST
User1 is in location1 (-7) CST
User2 is in location2 (-6) MST

Let me try to understand it.
CST stands Center Standard Time, it is UTC-6
MST stands Mountain Standard Time, it is UTC-7
So if it is 3pm CST, the MST time is 2pm.
Server timezone is same as location 1 CST, Location 2 is MST.
When server time is 3pm CST, the location 1 is 3pm CST, and location 2 is 2pm MST.
User 1 is in location 1, 3pm CST.
User 2 is in location 2, 2pm MST.

User 1 is set to lunch and returning at 4pm CST.
4pm CST is 3pm CST.

What you want is in the signin/out page, the expected return time entered can be viewed in the first page in which the time format adjusted according to the timezone of the viewer.
Yes, this is exactly correct. This is what I would like.


davidyin wrote: There are some error in your code.
For example:
When sign in/out, without the expect return time, the error comes.


I have to say, add one more field to divided the time and comment is good idea.
The reason why I put them together in my original design is to save a field to keep the database slim and for simplify the code.
You know, in the begining, this software is working for one location only.

I would like to add this feature into next version.
I know that without the column there is an error. If you open the README.txt file that I included section B is as follows:
README.txt wrote:B. You must modify your database, so Microsoft Access is necessary (or another editor capable of editing
this database). If you do not have one, maybe David will create another patch for us like he did when
upgrading from 5.12 or 6.03.0080 to 6.03.0081. I may look into creating a patch if necessary. I would
much rather David did so, this way your copy is always the same as his. (This sill make your upgrades
much easier in the future for you)

In the database open pt_records. There create a column named: recordreturn
So yes you are right, you have to add that column. Maybe we can create a batch file that will create that column automatically for those who do not have Microsoft Access. I was thinking something like the upgrade files you made for upgrading from 5.12 to 6.03.

Something else we could consider is adding code to the pages to check to see if that column exists. If it doesn't then it could combine the date/time and comment fields like before.

I can understand why you would want to combine the fields to keep the size of the database down, it is crucial for a smooth and fast running application.

Since I do not have much ASPVBScript knowledge adding the extra "recordreturn" column was the best solution that I could think of. Is there another way to do it that I am missing?
User avatar
tyman00
Members
Members
Posts: 42
Joined: Tue Dec 20, 2005 12:59 pm
Location: Mandan, ND
Contact:

Post by tyman00 »

That was me. I have to quit forgetting to login before I post. :roll:

Edit: I just attached the new version (to fix my bug in default.asp) to my original post.
User avatar
davidyin
Members
Members
Posts: 192
Joined: Wed Apr 27, 2005 10:50 pm
Location: Burnaby

Post by davidyin »

I mean even if the field "recordreturn" added already, the error is still there.
Because the code you added does not check the field value provided or not, the record add precedure will be send the error when the value of recordreturn is null.
Last edited by davidyin on Tue Mar 07, 2006 7:19 pm, edited 1 time in total.
User avatar
tyman00
Members
Members
Posts: 42
Joined: Tue Dec 20, 2005 12:59 pm
Location: Mandan, ND
Contact:

Post by tyman00 »

Where does the error show up? Is it in the server side error log and not displayed on the page? Do you have a link so I can see it?

I never noticed it.

Edit:

I looked further I am not sure where the error is and where it is comming from. I do check to see if there is data or not in signinout.asp much like the "usercomment" field

Code: Select all

if request.form("fldDate") <> empty then
	expectreturn = request.form("fldDate")
else
	expectreturn = ""
end if
if request.form("usercomment") <> empty then
	usercomment = request.form("usercomment") 
else
	usercomment = ""
In default.asp I do the same here

Code: Select all

if userreturn <> empty then
....

else
	userreturn = ""
end if
User avatar
davidyin
Members
Members
Posts: 192
Joined: Wed Apr 27, 2005 10:50 pm
Location: Burnaby

Post by davidyin »

I think the problem is when I add a new field "recordreturn" into the pt_record table, I set the data type is "date/time".
So the error is:
Provider error '80020005'

Type mismatch.

/signinout.asp, line 204
User avatar
tyman00
Members
Members
Posts: 42
Joined: Tue Dec 20, 2005 12:59 pm
Location: Mandan, ND
Contact:

Post by tyman00 »

Since it says 'type mismatch' I would be you are right. I looked at mine, it is setup as a text only field.
User avatar
davidyin
Members
Members
Posts: 192
Joined: Wed Apr 27, 2005 10:50 pm
Location: Burnaby

Post by davidyin »

Anyway, I will add this feature into the next version.
Post Reply