diff --git a/README.md b/README.md index 9b6bb407c87429ebe55302a33392945ab7291c8a..7939d80d545ca3c00f06ee82a4093e52d1aba47c 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 c4c3972b3679c97bfa9243f9ec750e0066d4ecb8..fad56576c59bd8e28e4e76acc37322a96dcb01bd 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 7bae3151295b2013e95f34495b8ce16b5110c7da..0df985cdf366c535fbc6ff36af481dafe6b16b81 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>