[rt-users] Date/Time Display

Ian Daniel ian at remstar-computing.co.uk
Thu Dec 16 08:42:19 EST 2004


Hi,

	Well I managed to customise the user Preference and Modification pages  
to add a Timezone field and it's created ok in the database (I thought  
I'd try and do it as I had some spare time). All I did was add a text  
field to each of the User Preference and User Modification schemas for  
now. I probably need to think about auto generated users although they  
could be given the system TZ I guess, or it could be left as NULL and  
if it's NULL $RT::Timezone gets returned? I know this isn't a great way  
to do it but it's interesting to play around with it and if I actually  
got it working it'd suit me for now.

mysql> describe Users;
+-----------------------+--------------+------+-----+--------- 
+----------------+
| Field                 | Type         | Null | Key | Default | Extra    
        |
+-----------------------+--------------+------+-----+--------- 
+----------------+
| id                    | int(11)      |      | PRI | NULL    |  
auto_increment |
| Name                  | varchar(200) |      | UNI |         |          
        |
| Password              | varchar(40)  | YES  |     | NULL    |          
        |
| Comments              | blob         | YES  |     | NULL    |          
        |
| Signature             | blob         | YES  |     | NULL    |          
        |
| EmailAddress          | varchar(120) | YES  | MUL | NULL    |          
        |
| FreeformContactInfo   | blob         | YES  |     | NULL    |          
        |
| Organization          | varchar(200) | YES  |     | NULL    |          
        |
| RealName              | varchar(120) | YES  |     | NULL    |          
        |
| NickName              | varchar(16)  | YES  |     | NULL    |          
        |
| Lang                  | varchar(16)  | YES  |     | NULL    |          
        |
| EmailEncoding         | varchar(16)  | YES  |     | NULL    |          
        |
| WebEncoding           | varchar(16)  | YES  |     | NULL    |          
        |
| ExternalContactInfoId | varchar(100) | YES  |     | NULL    |          
        |
| ContactInfoSystem     | varchar(30)  | YES  |     | NULL    |          
        |
| ExternalAuthId        | varchar(100) | YES  |     | NULL    |          
        |
| AuthSystem            | varchar(30)  | YES  |     | NULL    |          
        |
| Gecos                 | varchar(16)  | YES  |     | NULL    |          
        |
| HomePhone             | varchar(30)  | YES  |     | NULL    |          
        |
| WorkPhone             | varchar(30)  | YES  |     | NULL    |          
        |
| MobilePhone           | varchar(30)  | YES  |     | NULL    |          
        |
| PagerPhone            | varchar(30)  | YES  |     | NULL    |          
        |
| Address1              | varchar(200) | YES  |     | NULL    |          
        |
| Address2              | varchar(200) | YES  |     | NULL    |          
        |
| City                  | varchar(100) | YES  |     | NULL    |          
        |
| State                 | varchar(100) | YES  |     | NULL    |          
        |
| Zip                   | varchar(16)  | YES  |     | NULL    |          
        |
| Country               | varchar(50)  | YES  |     | NULL    |          
        |
| Timezone              | varchar(50)  | YES  |     | NULL    |          
        |
| PGPKey                | text         | YES  |     | NULL    |          
        |
| Creator               | int(11)      |      |     | 0       |          
        |
| Created               | datetime     | YES  |     | NULL    |          
        |
| LastUpdatedBy         | int(11)      |      |     | 0       |          
        |
| LastUpdated           | datetime     | YES  |     | NULL    |          
        |
+-----------------------+--------------+------+-----+--------- 
+----------------+

What I'm confused about now is the way to make RT use that variable.  
The Date.pm file seems to return $RT::Timezone but also looks like it's  
geared up to take a value from the User property Timezone (bear with  
me, I'm not good at perl). The code I think needs modifying is this.

sub LocalTimezone {
     my $self = shift;

     return $self->CurrentUser->Timezone
         if $self->CurrentUser and $self->CurrentUser->can('Timezone');

     return ($RT::Timezone);
}

Which lives in lib/RT/Date.pm am I right? If I am I'll persevere a bit  
longer and try to learn a bit of perl ;-)

Thanks,

--Ian




On 16 Dec 2004, at 13:15, Jason A. Diegmueller wrote:

> Just a note, to anyone who develops something like this:
>
> It would have to have an option to use the host OS's current timezone,  
> or be easily (and I mean VERY easily) changble.  I am on the road  
> about 70% of the time, and the last thing people in my situation need  
> is another "time zone" knob to remember to turn as they are travelling  
> about.
>
> Not everyone is always in the same spot.
>
> Just something to think about.  Regardless, if someone does create  
> this, it would be appreciate either way.
>
> -jd
>
>
> On Thu, 16 Dec 2004, Ian Daniel wrote:
>
>> Hi Rick ,
>>
>> 	Thanks very much for the offer, I could use it now but I'll be more  
>> than happy to wait until you have time to fit it in after Christmas.
>>
>> Regards,
>>
>> --Ian
>>
>> On 16 Dec 2004, at 05:21, Rick Measham wrote:
>>
>>> I'm one of the DateTime coders (http://datetime.perl.org) and would  
>>> be
>>> happy to write and contribute this functionality. Note that it will  
>>> be
>>> written using the DateTime libraries as these give the only accurate
>>> time zone information available.
>>> Ian: Do you need it before Christmas? Or can I get it to you by
>>> new-year?
>>> Cheers!
>>> Rick
>>> On Thu, 2004-12-16 at 15:38, Jesse Vincent wrote:
>>>> On Thu, Dec 16, 2004 at 01:06:34AM +0000, Ian Daniel wrote:
>>>>> Hi,
>>>>> 	I'm currently looking at implementing RT on a Solaris system and
>>>>> 	have a question. We have multiple sites and it'd be nice to have  
>>>>> ticket
>>>>> date/time information localised. So for example the Timezone on the
>>>>> server is set to GB, but if a support person in Boston views the  
>>>>> ticket
>>>>> he sees the date and time the ticket was raised adjusted for his
>>>>> Timezone. Is this possible? It's possible in some commercial  
>>>>> products
>>>>> (Remedy does it) but I think you'd need to associate a Timezone  
>>>>> with
>>>>> each user account somehow and RT doesn't seem to do that. Remedy  
>>>>> uses
>>>>> environment variables and its web client's actually Java based.
>>>> Right. To do this, we'd need a per-user timezone setting. It's not  
>>>> a lot
>>>> of code, but not something that anyone's contributed code for or  
>>>> had us
>>>> do for them.
>>>> 	Best,
>>>> 	Jesse
>>>> _______________________________________________
>>>> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>>>> Be sure to check out the RT wiki at http://wiki.bestpractical.com
>>
>> _______________________________________________
>> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>>
>> Be sure to check out the RT wiki at http://wiki.bestpractical.com
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 6976 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20041216/bbb0ed41/attachment.bin>


More information about the rt-users mailing list