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/dynamic-field-config.tmpl.php b/include/staff/templates/dynamic-field-config.tmpl.php index 4a0703b308e8b0769be1016e9e565bcc2d331d8d..a295041c4787f2427ca5d223abeb7d02c1224e00 100644 --- a/include/staff/templates/dynamic-field-config.tmpl.php +++ b/include/staff/templates/dynamic-field-config.tmpl.php @@ -66,7 +66,7 @@ </span> </td></tr> </table> - <hr style="margin-top:3em"/> + <hr> <p class="full-width"> <span class="buttons" style="float:left"> <input type="reset" value="Reset"> diff --git a/include/staff/templates/user-info.tmpl.php b/include/staff/templates/user-info.tmpl.php index ddd40743e8494fc9ba1572359cbd6821cc89d1de..09b99b72743f6e7f5b4a27277c50ce5a49cf7ac1 100644 --- a/include/staff/templates/user-info.tmpl.php +++ b/include/staff/templates/user-info.tmpl.php @@ -1,16 +1,21 @@ <h3><?php echo $user->getFullName() ?></h3> <a class="close" href=""><i class="icon-remove-circle"></i></a> +<br> +<div><p id="msg_info"><i class="icon-info-sign"></i> Please note that updates will be reflected system-wide.</p></div> <hr/> <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; @@ -22,7 +27,7 @@ $form->render(); ?> </table> - <hr style="margin-top:3em"/> + <hr> <p class="full-width"> <span class="buttons" style="float:left"> <input type="reset" value="Reset"> diff --git a/include/staff/templates/user-lookup.tmpl.php b/include/staff/templates/user-lookup.tmpl.php index b969e64ac109d2a394cd6da2c0e2e04b3acdfd0e..ad9b5ae01e033cda8d70d83b4c0f1f4809c32a92 100644 --- a/include/staff/templates/user-lookup.tmpl.php +++ b/include/staff/templates/user-lookup.tmpl.php @@ -21,7 +21,7 @@ <input type="hidden" id="user-lookup-id" name="user_id" value=""/> <div class="clear"></div> </div> - <hr style="margin-top:3em"/> + <hr> <p class="full-width"> <span class="buttons" style="float:left"> <input type="button" value="Cancel" class="close"> 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>', diff --git a/scp/css/scp.css b/scp/css/scp.css index 457c4def71f94d77026b48cd920547323c01da63..3a3be70fc71dacf1af2d4f5bfdd5c8d63124f1c3 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -43,6 +43,8 @@ a { color: #555; } +#msg_info { margin: 0; padding: 5px; margin-bottom: 10px; color: #3a87ad; border: 1px solid #bce8f1; background-color: #d9edf7; } + #msg_notice { margin: 0; padding: 5px 10px 5px 36px; height: 16px; line-height: 16px; margin-bottom: 10px; border: 1px solid #0a0; background: url('../images/icons/ok.png') 10px 50% no-repeat #e0ffe0; } #msg_warning { margin: 0; padding: 5px 10px 5px 36px; height: 16px; line-height: 16px; margin-bottom: 10px; border: 1px solid #f26522; background: url('../images/icons/alert.png') 10px 50% no-repeat #ffffdd; } diff --git a/scp/forms.php b/scp/forms.php index 311207756652d6c1d560d79923a93bc16abc0c5b..0ac4086cda8bc2e46c1298bb865087f06e02f896 100644 --- a/scp/forms.php +++ b/scp/forms.php @@ -88,7 +88,7 @@ if($_POST) { continue; $field = DynamicFormField::create(array( 'form_id'=>$form->get('id'), - 'sort'=>$_POST["sort-new-$i"] ? $_POST["sort-new-$i"] : $max_sort++, + 'sort'=>$_POST["sort-new-$i"] ? $_POST["sort-new-$i"] : ++$max_sort, 'label'=>$_POST["label-new-$i"], 'type'=>$_POST["type-new-$i"], 'name'=>$_POST["name-new-$i"],