From dd626c35852ce41ed2c738f0faaea2d07fe32564 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Tue, 29 Apr 2014 13:04:47 +0000
Subject: [PATCH] Improve navigation of user pages

Link to org & user landing pages & kill pjax on internal pages
---
 include/staff/footer.inc.php                  |  3 ++-
 .../staff/templates/ticket-preview.tmpl.php   | 19 +++++++++++--------
 include/staff/user-view.inc.php               |  5 ++---
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/include/staff/footer.inc.php b/include/staff/footer.inc.php
index fb434ffb0..529fe8bfc 100644
--- a/include/staff/footer.inc.php
+++ b/include/staff/footer.inc.php
@@ -26,7 +26,8 @@ if(is_object($thisstaff) && $thisstaff->isStaff()) { ?>
 if ($.support.pjax) {
   $(document).on('click', 'a', function(event) {
     if (!$(this).hasClass('no-pjax')
-        && !$(this).closest('.no-pjax').length)
+        && !$(this).closest('.no-pjax').length
+        && $(this).attr('href')[0] != '#')
       $.pjax.click(event, {container: $('#pjax-container'), timeout: 2000});
   })
 }
diff --git a/include/staff/templates/ticket-preview.tmpl.php b/include/staff/templates/ticket-preview.tmpl.php
index 82c3e392f..8e0fc32b6 100644
--- a/include/staff/templates/ticket-preview.tmpl.php
+++ b/include/staff/templates/ticket-preview.tmpl.php
@@ -95,7 +95,7 @@ echo sprintf(
     '
         <tr>
             <th>From:</th>
-            <td>%s <span class="faded">%s</span></td>
+            <td><a href="users.php?id=%d" class="no-pjax">%s</a> <span class="faded">%s</span></td>
         </tr>
         <tr>
             <th width="100">Department:</th>
@@ -105,6 +105,7 @@ echo sprintf(
             <th>Help Topic:</th>
             <td>%s</td>
         </tr>',
+    $ticket->getUserId(),
     Format::htmlchars($ticket->getName()),
     $ticket->getEmail(),
     Format::htmlchars($ticket->getDeptName()),
@@ -118,14 +119,16 @@ echo '</div>'; // ticket preview content.
     <table border="0" cellspacing="" cellpadding="1">
         <colgroup><col style="min-width: 250px;"></col></colgroup>
         <?php
-        if (($users=$ticket->getCollaborators())) {?>
+        if (($collabs=$ticket->getCollaborators())) {?>
         <?php
-            foreach($users as $user) {
-                echo sprintf('<tr><td %s><i class="icon-%s"></i> %s <em>&lt;%s&gt;</em></td></tr>',
-                        ($user->isActive()? '' : 'class="faded"'),
-                        ($user->isActive()? 'comments' :  'comment-alt'),
-                        $user->getName(),
-                        $user->getEmail());
+            foreach($collabs as $collab) {
+                echo sprintf('<tr><td %s><i class="icon-%s"></i>
+                        <a href="users.php?id=%d" class="no-pjax">%s</a> <em>&lt;%s&gt;</em></td></tr>',
+                        ($collab->isActive()? '' : 'class="faded"'),
+                        ($collab->isActive()? 'comments' :  'comment-alt'),
+                        $collab->getUserId(),
+                        $collab->getName(),
+                        $collab->getEmail());
             }
         }  else {
             echo "Ticket doesn't have collaborators.";
diff --git a/include/staff/user-view.inc.php b/include/staff/user-view.inc.php
index 8e6514447..52af878ed 100644
--- a/include/staff/user-view.inc.php
+++ b/include/staff/user-view.inc.php
@@ -84,9 +84,8 @@ $org = $user->getOrganization();
                         <span id="user-<?php echo $user->getId(); ?>-org">
                         <?php
                             if ($org)
-                                echo sprintf('<a href="#users/%d/org"
-                                        class="user-action">%s</a>',
-                                        $user->getId(), $org->getName());
+                                echo sprintf('<a href="orgs.php?id=%d">%s</a>',
+                                        $org->getId(), $org->getName());
                             else
                                 echo sprintf('<a href="#users/%d/org"
                                         class="user-action">Add Organization</a>',
-- 
GitLab