From 21595d4520d044645414009c0e9da7e6dd0b957c Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Sat, 18 Oct 2014 23:17:31 -0500 Subject: [PATCH] i18n: Add autodetect support for staff timezone --- README.md | 1 + include/staff/profile.inc.php | 15 ++++++++++++++- include/staff/settings-system.inc.php | 13 +++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b6bb407c..7939d80d5 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ osTicket is supported by several magical open source projects including: * [Font-Awesome](http://fortawesome.github.com/Font-Awesome/) * [HTMLawed](http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed) * [jQuery dropdown](http://labs.abeautifulsite.net/jquery-dropdown/) + * [jsTimezoneDetect](http://pellepim.bitbucket.org/jstz/) * [mPDF](http://www.mpdf1.com/) * [PasswordHash](http://www.openwall.com/phpass/) * [PEAR](http://pear.php.net/package/PEAR) diff --git a/include/staff/profile.inc.php b/include/staff/profile.inc.php index c4c3972b3..fad56576c 100644 --- a/include/staff/profile.inc.php +++ b/include/staff/profile.inc.php @@ -94,7 +94,20 @@ $info['id']=$staff->getId(); ?>><?php echo $zone; ?></option> <?php } ?> </select> - <span class="error"><?php echo $errors['timezone']; ?></span> + <button class="action-button" onclick="javascript: + $('head').append($('<script>').attr('src', '<?php + echo ROOT_PATH; ?>/js/jstz.min.js')); + var recheck = setInterval(function() { + if (window.jstz !== undefined) { + clearInterval(recheck); + var zone = jstz.determine(); + $('#timezone-dropdown').multiselect('widget') + .find('[value=\'' + zone.name() + '\']') + .trigger('click'); + } + }, 200); + return false;"><i class="icon-map-marker"></i> <?php echo __('Auto Detect'); ?></button> + <div class="error"><?php echo $errors['timezone']; ?></div> </td> </tr> <tr> diff --git a/include/staff/settings-system.inc.php b/include/staff/settings-system.inc.php index 7bae31512..0df985cdf 100644 --- a/include/staff/settings-system.inc.php +++ b/include/staff/settings-system.inc.php @@ -150,6 +150,19 @@ $gmtime = Misc::gmtime(); ?>><?php echo $zone; ?></option> <?php } ?> </select> + <button class="action-button" onclick="javascript: + $('head').append($('<script>').attr('src', '<?php + echo ROOT_PATH; ?>/js/jstz.min.js')); + var recheck = setInterval(function() { + if (window.jstz !== undefined) { + clearInterval(recheck); + var zone = jstz.determine(); + $('#timezone-dropdown').multiselect('widget') + .find('[value=\'' + zone.name() + '\']') + .trigger('click'); + } + }, 200); + return false;"><i class="icon-map-marker"></i> <?php echo __('Auto Detect'); ?></button> </td> </tr> <tr><td width="220" class="required"><?php echo __('Date and Time Format');?>:</td> -- GitLab