diff --git a/include/staff/templates/tickets.tmpl.php b/include/staff/templates/tickets.tmpl.php index 338e4c2b33ae1be5cddcab8ebc62e926609073dc..ca1ff2b406ebdcd8a072f3aa543e7cac07cbb7c6 100644 --- a/include/staff/templates/tickets.tmpl.php +++ b/include/staff/templates/tickets.tmpl.php @@ -140,10 +140,12 @@ if ($results) { ?> <?php } ?> <td align="center" nowrap> - <a class="Icon <?php echo strtolower($row['source']); ?>Ticket ticketPreview" + <a class="Icon <?php + echo strtolower($row['source']); ?>Ticket preview" title="<?php echo __('Preview Ticket'); ?>" - href="tickets.php?id=<?php echo $row['ticket_id']; ?>"><?php echo $tid; ?></a></td> - <td align="center" nowrap><?php echo Format::datetime($row['effective_date']); ?></td> + href="tickets.php?id=<?php echo $row['ticket_id']; ?>" + data-preview="#tickets/<?php echo $row['ticket_id']; ?>/preview"><?php echo $tid; ?></a></td> + <td align="center" nowrap><?php echo Format::db_datetime($row['effective_date']); ?></td> <td><?php echo $status; ?></td> <td><a <?php if ($flag) { ?> class="Icon <?php echo $flag; ?>Ticket" title="<?php echo ucfirst($flag); ?> Ticket" <?php } ?> href="tickets.php?id=<?php echo $row['ticket_id']; ?>"><?php echo $subject; ?></a> diff --git a/include/staff/templates/users.tmpl.php b/include/staff/templates/users.tmpl.php index 47358580bf66bb48be0d9d9ec8f8b22385827b3e..51f8f7e3d6b84fa57c8174aae8a4e2547fa7ea9e 100644 --- a/include/staff/templates/users.tmpl.php +++ b/include/staff/templates/users.tmpl.php @@ -99,8 +99,10 @@ if ($num) { ?> value="<?php echo $row['id']; ?>" <?php echo $sel?'checked="checked"':''; ?> > </td> <td> - <a class="userPreview" - href="users.php?id=<?php echo $row['id']; ?>"><?php + <a class="preview" + href="users.php?id=<?php echo $row['id']; ?>" + data-preview="#users/<?php + echo $row['id']; ?>/preview" ><?php echo Format::htmlchars($name); ?></a> <?php diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index f4b7840c2dcb6df064d4a4e1e96e2e0f0d4ba0ff..b664515de34b7693655c00ab99babf6a85de96b2 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -304,9 +304,12 @@ $_SESSION[':Q:tickets'] = $tickets; </td> <?php } ?> <td title="<?php echo $T['user__default_email__address']; ?>" nowrap> - <a class="Icon <?php echo strtolower($T['source']); ?>Ticket ticketPreview" title="Preview Ticket" - href="tickets.php?id=<?php echo $T['ticket_id']; ?>"><?php echo $tid; ?></a></td> - <td align="center" nowrap><?php echo Format::datetime($T[$date_col ?: 'lastupdate']); ?></td> + <a class="Icon <?php echo strtolower($row['source']); ?>Ticket preview" + title="Preview Ticket" + href="tickets.php?id=<?php echo $row['ticket_id']; ?>" + data-preview="#tickets/<?php echo $row['ticket_id']; ?>/preview" + ><?php echo $tid; ?></a></td> + <td align="center" nowrap><?php echo Format::db_datetime($T[$date_col ?: 'lastupdate']); ?></td> <td><a <?php if ($flag) { ?> class="Icon <?php echo $flag; ?>Ticket" title="<?php echo ucfirst($flag); ?> Ticket" <?php } ?> href="tickets.php?id=<?php echo $T['ticket_id']; ?>"><?php echo $subject; ?></a> <?php diff --git a/include/staff/users.inc.php b/include/staff/users.inc.php index 3c1152e918d6f87d58a031131b137459b218b8d3..073c33a03431a9c39fd3007c95649d3733e77e92 100644 --- a/include/staff/users.inc.php +++ b/include/staff/users.inc.php @@ -124,7 +124,9 @@ else ?> <tr id="<?php echo $U['id']; ?>"> <td> - <a class="userPreview" href="users.php?id=<?php echo $U['id']; ?>"><?php + <a class="preview" + href="users.php?id=<?php echo $U['id']; ?>" + data-preview="#users/<?php echo $U['id']; ?>/preview"><?php echo Format::htmlchars($name); ?></a> <?php diff --git a/scp/js/scp.js b/scp/js/scp.js index c84b07b29102078bf83d1312151bff0be4183812..1dfeefd1d48d7c76b5cefe85c04b8de7db1fe13e 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -748,7 +748,7 @@ $(document).on('pjax:click', function(options) { $(document).stop(false, true); // Remove tips and clear any pending timer - $('.tip, .help-tips, .userPreview, .ticketPreview, .previewfaq').each(function() { + $('.tip, .help-tips, .previewfaq, .preview').each(function() { if ($(this).data('timer')) clearTimeout($(this).data('timer')); }); diff --git a/scp/js/tips.js b/scp/js/tips.js index 93f4f14c75d49d1c151e27ffc787e1abb42f3078..d035dbea86f1bbddec23bfc52c7a0f648e406d19 100644 --- a/scp/js/tips.js +++ b/scp/js/tips.js @@ -219,16 +219,15 @@ jQuery(function() { }); - //Ticket preview - $('.ticketPreview').live('mouseover', function(e) { + // Tooltip preview + $('.preview').live('mouseover', function(e) { e.preventDefault(); var elem = $(this); - var vars = elem.attr('href').split('='); - var url = 'ajax.php/tickets/'+vars[1]+'/preview'; - var id='t'+vars[1]; + var url = 'ajax.php/'+elem.data('preview').substr(1); + // TODO - hash url to integer and use it as id. + var id= url.match(/\d/g).join(""); var xoffset = 80; - elem.data('timer', 0); if(!elem.data('id')) { elem.data('id', id); @@ -245,32 +244,6 @@ jQuery(function() { clearTimeout($(this).data('timer')); }); - //User preview - $('.userPreview').live('mouseover', function(e) { - e.preventDefault(); - var elem = $(this); - - var vars = elem.attr('href').split('='); - var url = 'ajax.php/users/'+vars[1]+'/preview'; - var id='u'+vars[1]; - var xoffset = 80; - - elem.data('timer', 0); - if(!elem.data('id')) { - elem.data('id', id); - if(e.type=='mouseover') { - /* wait about 1 sec - before showing the tip - mouseout kills the timeout*/ - elem.data('timer',setTimeout(function() { showtip(url,elem,xoffset);},750)) - }else{ - clearTimeout(elem.data('timer')); - showtip(url, elem, xoffset); - } - } - }).live('mouseout', function(e) { - $(this).data('id', 0); - clearTimeout($(this).data('timer')); - }); - $('body') .delegate('.tip_close', 'click', function(e) { e.preventDefault();