diff --git a/include/ajax.users.php b/include/ajax.users.php index b17d742a478af318cc7127161b56172aef9d8157..81d53af17a6349bea66fcbcfcec1010239d25fa1 100644 --- a/include/ajax.users.php +++ b/include/ajax.users.php @@ -87,8 +87,10 @@ class UsersAjaxAPI extends AjaxController { elseif(!($user = User::lookup($id))) Http::response(404, 'Unknown user'); - $info = array('title' => ''); - + $info = array( + 'title' => '', + 'useredit' => sprintf('#users/%d/edit', $user->getId()), + ); ob_start(); echo sprintf('<div style="width:650px; padding: 2px 2px 0 5px;" id="u%d">', $user->getId()); diff --git a/include/staff/templates/user.tmpl.php b/include/staff/templates/user.tmpl.php index 4776bf4a3946f42a6a7e59f3d240c5cb6b0cd2b1..52f5f9fc7fc44b455649cd35bdccf7354b4406ea 100644 --- a/include/staff/templates/user.tmpl.php +++ b/include/staff/templates/user.tmpl.php @@ -48,7 +48,7 @@ if ($info['error']) { <div class="tab_content" id="info-tab"> <div class="floating-options"> - <a href="#" id="edituser" class="action" title="Edit"><i class="icon-edit"></i></a> + <a href="<?php echo $info['useredit'] ?: '#'; ?>" id="edituser" class="action" title="Edit"><i class="icon-edit"></i></a> <a href="users.php?id=<?php echo $user->getId(); ?>" title="Manage User" class="action"><i class="icon-share"></i></a> </div> @@ -141,8 +141,18 @@ if ($ticket && $ticket->getOwnerId() == $user->getId()) $(function() { $('a#edituser').click( function(e) { e.preventDefault(); - $('div#user-profile').hide(); - $('div#user-form').fadeIn(); + if ($(this).attr('href').length > 1) { + var url = 'ajax.php/'+$(this).attr('href').substr(1); + $.dialog(url, [201, 204], function (xhr) { + window.location.href = window.location.href; + }, { + onshow: function() { $('#user-search').focus(); } + }); + } else { + $('div#user-profile').hide(); + $('div#user-form').fadeIn(); + } + return false; });