Merge pull request #345 from mkoch227/user-agent-support

User agent support
merge-requests/2/head
Mike Koch 9 years ago
commit 3cf50f2aec

@ -877,6 +877,27 @@ if ( defined('HESK_DEMO') )
?>
</div>
</div>
<div class="form-group">
<label for="display_user_agent_information" class="col-sm-6 control-label">
<span class="label label-primary"
data-toggle="tooltip"
title="<?php echo $hesklang['added_in_mods_for_hesk']; ?>"><?php echo $hesklang['mods_for_hesk_acronym']; ?></span>
<?php echo $hesklang['display_user_agent_information']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="htmlpopover"
title="<?php echo $hesklang['display_user_agent_information']; ?>"
data-content="<?php echo $hesklang['display_user_agent_information_help']; ?>"></i>
</label>
<div class="col-sm-6">
<?php
$on = $modsForHesk_settings['display_user_agent_information'] ? 'checked' : '';
$off = $modsForHesk_settings['display_user_agent_information'] ? '' : 'checked';
echo '
<div class="radio"><label><input type="radio" name="statuses_order_column" value="0" '.$off.'>'.$hesklang['no'].'</label></div>
<div class="radio"><label><input type="radio" name="statuses_order_column" value="1" '.$on.'>'.$hesklang['yes'].'</label></div>
';
?>
</div>
</div>
</div>
<!-- Second column -->
<div class="col-md-6">

@ -551,6 +551,7 @@ if ($rich_text_setting == 0) {
$set['statuses_order_column'] = empty($_POST['statuses_order_column']) ? 'sort' : 'name';
$set['kb_attach_dir'] = hesk_POST('kb_attach_dir', 'attachments');
$set['display_user_agent_information'] = empty($_POST['display_user_agent_information']) ? 0 : 1;
if ($set['customer-email-verification-required'])
{
@ -594,6 +595,7 @@ mfh_updateSetting('dropdownItemTextColor', $set['dropdownItemTextColor'], true);
mfh_updateSetting('dropdownItemTextHoverColor', $set['dropdownItemTextHoverColor'], true);
mfh_updateSetting('questionMarkColor', $set['questionMarkColor'], true);
mfh_updateSetting('dropdownItemTextHoverBackgroundColor', $set['dropdownItemTextHoverBackgroundColor'], true);
mfh_updateSetting('display_user_agent_information', $set['display_user_agent_information']);
// Prepare settings file and save it
$settings_file_content='<?php
@ -833,7 +835,6 @@ else
exit();
/** FUNCTIONS **/
function mfh_updateSetting($key, $value, $isString = false) {
global $hesk_settings;

@ -281,6 +281,11 @@ $tmpvar['longitude'] = hesk_POST('longitude', 'E-4');
$tmpvar['html'] = $modsForHesk_settings['rich_text_for_tickets'];
// Set user agent and screen res to null
$tmpvar['user_agent'] = NULL;
$tmpvar['screen_resolution_height'] = NULL;
$tmpvar['screen_resolution_width'] = NULL;
// Insert ticket to database
$ticket = hesk_newTicket($tmpvar);

@ -882,6 +882,59 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
{
echo '<span class="fa fa-lock"></span>&nbsp;';
}
if ($modsForHesk_settings['display_user_agent_information']
&& $ticket['user_agent'] !== NULL
&& $ticket['screen_resolution_height'] !== NULL
&& $ticket['screen_resolution_height'] != 0
&& $ticket['screen_resolution_width'] !== NULL
&& $ticket['screen_resolution_width'] != 0):
?>
<span data-toggle="modal" data-target="#user-agent-modal" style="cursor: pointer">
<i class="fa fa-desktop" data-toggle="tooltip"
title="<?php echo htmlspecialchars($hesklang['click_for_device_information']); ?>"></i>
</span>
<div id="user-agent-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4><?php echo $hesklang['device_information']; ?></h4>
</div>
<div class="modal-body">
<script>
var userAgent = platform.parse('<?php echo addslashes($ticket['user_agent']); ?>');
console.log(userAgent);
var screenResWidth = <?php echo intval($ticket['screen_resolution_width']); ?>;
var screenResHeight = <?php echo intval($ticket['screen_resolution_height']); ?>;
</script>
<table class="table table-striped">
<tbody>
<tr>
<td><strong><?php echo $hesklang['operating_system']; ?></strong></td>
<td id="operating-system">&nbsp;</td>
<script>$('#operating-system').html(userAgent.os.toString());</script>
</tr>
<tr>
<td><strong><?php echo $hesklang['browser']; ?></strong></td>
<td id="browser">&nbsp;</td>
<script>$('#browser').html(userAgent.name + ' ' + userAgent.version);</script>
</tr>
<tr>
<td><strong><?php echo $hesklang['screen_resolution']; ?></strong></td>
<td id="screen-resolution">&nbsp;</td>
<script>$('#screen-resolution').html(screenResWidth + ' x ' + screenResHeight);</script>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php
endif;
if ($modsForHesk_settings['request_location'])
{
$locationText = '';

@ -74,6 +74,7 @@ $modsForHesk_settings = mfh_getSettings();
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/iconset-octicon-2.1.2.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-iconpicker.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/platform.js"></script>
<style>
.navbar-default {
background-color: <?php echo $modsForHesk_settings['navbarBackgroundColor']; ?>;

@ -71,6 +71,7 @@ $modsForHesk_settings = mfh_getSettings();
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/iconset-octicon-2.1.2.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-iconpicker.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/platform.js"></script>
<style>
.navbar-default {
background-color: <?php echo $modsForHesk_settings['navbarBackgroundColor']; ?>;

@ -339,6 +339,13 @@ function hesk_email2ticket($results, $pop3 = 0, $set_category = 1, $set_priority
$tmpvar[$k] = '';
}
$ticket['latitude'] = NULL;
$ticket['longitude'] = NULL;
$ticket['html'] = 0;
$ticket['user_agent'] = NULL;
$ticket['screen_resolution_width'] = NULL;
$ticket['screen_resolution_height'] = NULL;
// Insert ticket to database
$ticket = hesk_newTicket($tmpvar);

@ -100,7 +100,10 @@ function hesk_newTicket($ticket, $isVerified = true)
`status`,
`latitude`,
`longitude`,
`html`
`html`,
`user_agent`,
`screen_resolution_height`,
`screen_resolution_width`
)
VALUES
(
@ -144,7 +147,10 @@ function hesk_newTicket($ticket, $isVerified = true)
'".intval($ticket['status'])."',
'".hesk_dbEscape($ticket['latitude'])."',
'".hesk_dbEscape($ticket['longitude'])."',
'".hesk_dbEscape($ticket['html'])."'
'".hesk_dbEscape($ticket['html'])."',
'".hesk_dbEscape($ticket['user_agent'])."',
'".hesk_dbEscape($ticket['screen_resolution_height'])."',
'".hesk_dbEscape($ticket['screen_resolution_width'])."'
)
");

@ -1055,8 +1055,14 @@ if (!$show['show']) {
<div class="col-md-9 col-md-offset-3">
<input type="hidden" id="latitude" name="latitude" value="E-0">
<input type="hidden" id="longitude" name="longitude" value="E-0">
<input type="hidden" id="screen-resolution-height" name="screen_resolution_height">
<input type="hidden" id="screen-resolution-width" name="screen_resolution_width">
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>">
<input class="btn btn-default" type="submit" value="<?php echo $hesklang['sub_ticket']; ?>">
<script>
$('#screen-resolution-height').prop('value', screen.height);
$('#screen-resolution-width').prop('value', screen.width);
</script>
</div>
</div>

@ -790,4 +790,18 @@ function migrateSettings() {
function getSettingValue($settings, $setting, $default) {
return isset($settings[$setting]) ? $settings[$setting] : $default;
}
}
function execute250Scripts() {
global $hesk_settings;
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` ADD COLUMN `user_agent` TEXT");
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` ADD COLUMN `screen_resolution_width` INT");
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` ADD COLUMN `screen_resolution_height` INT");
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."stage_tickets` ADD COLUMN `user_agent` TEXT");
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."stage_tickets` ADD COLUMN `screen_resolution_width` INT");
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."stage_tickets` ADD COLUMN `screen_resolution_height` INT");
executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) VALUES ('display_user_agent_information', '0')");
}
// END Version 2.5.0

File diff suppressed because it is too large Load Diff

@ -23,6 +23,14 @@ $hesklang['EMAIL_HR']='------ Reply above this line ------';
// ADDED OR MODIFIED IN Mods for HESK 2.5.0
$hesklang['ticket_message_no_attachments'] = 'Ticket/Reply message, however attachments will not be included in the email';
$hesklang['click_for_device_information'] = 'Click for device information';
$hesklang['device_information'] = 'Device information';
$hesklang['operating_system'] = 'Operating System';
$hesklang['browser'] = 'Browser';
$hesklang['screen_resolution'] = 'Screen Resolution';
$hesklang['display_user_agent_information'] = 'Show user agent';
$hesklang['display_user_agent_information_help'] = 'When enabled, staff will be able to view the operating system, browser,
and screen resolution of the device used to create the ticket.';
// ADDED OR MODIFIED IN Mods for HESK 2.4.0
$hesklang['sort_by_user_defined_order'] = 'Sort by user-defined order';

@ -452,6 +452,11 @@ $tmpvar['longitude'] = hesk_POST('longitude');
// Set html
$tmpvar['html'] = $modsForHesk_settings['rich_text_for_tickets_for_customers'];
// Set screen res and user agent
$tmpvar['screen_resolution_height'] = hesk_POST('screen_resolution_height');
$tmpvar['screen_resolution_width'] = hesk_POST('screen_resolution_width');
$tmpvar['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
// Should the helpdesk validate emails?
$createTicket = true;
if ($modsForHesk_settings['customer_email_verification_required'])

Loading…
Cancel
Save