From 157b3d96fd26c2c2a3a086dd022b6251a6919366 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Mon, 25 Aug 2014 22:10:57 -0500 Subject: [PATCH] forms: Fix saving of form config and list item props --- include/ajax.forms.php | 7 +++++-- include/staff/dynamic-form.inc.php | 6 ++---- include/staff/dynamic-list.inc.php | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/ajax.forms.php b/include/ajax.forms.php index 47ace2a54..84b2cb3d8 100644 --- a/include/ajax.forms.php +++ b/include/ajax.forms.php @@ -39,9 +39,10 @@ class DynamicFormsAjaxAPI extends AjaxController { function saveFieldConfiguration($field_id) { $field = DynamicFormField::lookup($field_id); if (!$field->setConfiguration()) - include(STAFFINC_DIR . 'templates/dynamic-field-config.tmpl.php'); + return (include STAFFINC_DIR . 'templates/dynamic-field-config.tmpl.php'); else $field->save(); + Http::response(201, 'Field successfully updated'); } function deleteAnswer($entry_id, $field_id) { @@ -74,9 +75,11 @@ class DynamicFormsAjaxAPI extends AjaxController { Http::response(404, 'No such list item'); if (!$item->setConfiguration()) - include(STAFFINC_DIR . 'templates/list-item-properties.tmpl.php'); + return (include STAFFINC_DIR . 'templates/list-item-properties.tmpl.php'); else $item->save(); + + Http::response(201, 'Successfully updated record'); } } ?> diff --git a/include/staff/dynamic-form.inc.php b/include/staff/dynamic-form.inc.php index 0f18c7e89..b160e2c25 100644 --- a/include/staff/dynamic-form.inc.php +++ b/include/staff/dynamic-form.inc.php @@ -150,13 +150,11 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); <?php } ?> </select> <?php if ($f->isConfigurable()) { ?> - <a class="action-button" style="float:none;overflow:inherit" + <a class="action-button field-config" style="float:none;overflow:inherit" href="#ajax.php/form/field-config/<?php echo $f->get('id'); ?>" onclick="javascript: - $('#overlay').show(); - $('#field-config .body').empty().load($(this).attr('href').substr(1)); - $('#field-config').show(); + $.dialog($(this).attr('href').substr(1), [201]); return false; "><i class="icon-edit"></i> <?php echo __('Config'); ?></a> <?php } ?> diff --git a/include/staff/dynamic-list.inc.php b/include/staff/dynamic-list.inc.php index 280d85ecc..f25f67113 100644 --- a/include/staff/dynamic-list.inc.php +++ b/include/staff/dynamic-list.inc.php @@ -339,7 +339,7 @@ $(function() { e.preventDefault(); var $id = $(this).attr('id'); var url = 'ajax.php/'+$(this).attr('href').substr(1); - $.dialog(url, [200], function (xhr) { + $.dialog(url, [201], function (xhr) { $('a#'+$id+' i').removeAttr('style'); }); return false; -- GitLab