diff --git a/include/ajax.forms.php b/include/ajax.forms.php index c196ea2b2f4d3c503f4e77fe50be6bf9f279416d..be185fc29f4d47cde1df6dafadb596aaeed564bb 100644 --- a/include/ajax.forms.php +++ b/include/ajax.forms.php @@ -101,6 +101,8 @@ class DynamicFormsAjaxAPI extends AjaxController { } $cd->save(); } + + return Http::response(201, $user->to_json()); } } diff --git a/include/class.user.php b/include/class.user.php index c89543f2bee68326a3de4368c1a56631716b5876..269e202cad3d479a9c47a0e04844fece79955ce2 100644 --- a/include/class.user.php +++ b/include/class.user.php @@ -119,6 +119,15 @@ class User extends UserModel { return new PersonsName($this->name); } + function to_json() { + + $info = array( + 'id' => $this->getId(), + 'name' => (string) $this->getName()); + + return JsonDataEncoder::encode($info); + } + function asVar() { return (string) $this->getName(); } diff --git a/include/staff/templates/user-info.tmpl.php b/include/staff/templates/user-info.tmpl.php index 867fc84f65459c29da70c71effa76c9c1a7437c2..572f396dff2604a0d529dce5172b43b7cb1f64fb 100644 --- a/include/staff/templates/user-info.tmpl.php +++ b/include/staff/templates/user-info.tmpl.php @@ -6,13 +6,16 @@ <form method="post" action="ajax.php/form/user-info/<?php echo $user->get('id'); ?>" onsubmit="javascript: var form = $(this); + var dialog = form.closest('.dialog'); $.post(this.action, form.serialize(), function(data, status, xhr) { - if (!data.length) { - form.closest('.dialog').hide(); + if(xhr && xhr.status == 201) { + var user = $.parseJSON(xhr.responseText); + $('#user-'+user.id+'-name').html(user.name); + $('div.body', dialog).empty(); + dialog.hide(); $('#overlay').hide(); - location.reload(); } else { - form.closest('.dialog').empty().append(data); + $('div.body', dialog).html(data); } }); return false; diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index dd113733c46468d85a5b14ef5d7376102665e4aa..d60bd2c73100cdc259a7f85d94b7a9b1c523e678 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -151,8 +151,9 @@ if($ticket->isOverdue()) $('#user-info .body').load(this.href); $('#user-info').show(); return false; - "><i class="icon-user"></i> <?php - echo Format::htmlchars($ticket->getName()); ?></a> + "><i class="icon-user"></i> <span id="user-<?php echo $ticket->getOwnerId(); ?>-name" + ><?php echo Format::htmlchars($ticket->getName()); + ?></span></a> <?php if(($client=$ticket->getClient())) { echo sprintf(' <a href="tickets.php?a=search&ownerId=%d" title="Related Tickets" data-dropdown="#action-dropdown-stats">(<b>%d</b>)</a>',