@@ 77-88 (lines=12) @@ | ||
74 | ||
75 | switch ($error) |
|
76 | { |
|
77 | case NO_ERROR: |
|
78 | /** |
|
79 | * jQuery Form Plugin uses "success" callback function in both cases - success and failure |
|
80 | * (see https://github.com/malsup/form/issues/107 for details). |
|
81 | * It makes impossible to distinguish successful response from error messages. |
|
82 | * To make the difference a successful response is prefixed with "OK ". |
|
83 | * For the same reasons a workaround function "attachmentSuccess2" is appeared (see its code below). |
|
84 | */ |
|
85 | header('HTTP/1.0 200 OK'); |
|
86 | $rs = dal_query('attachs/list.sql', $record['record_id'], 'attachment_id'); |
|
87 | echo(sprintf('OK %s (%u)', get_html_resource(RES_ATTACHMENTS_ID), $rs->rows)); |
|
88 | break; |
|
89 | ||
90 | case ERROR_INCOMPLETE_FORM: |
|
91 | send_http_error(get_html_resource(RES_ALERT_REQUIRED_ARE_EMPTY_ID)); |
@@ 280-294 (lines=15) @@ | ||
277 | ||
278 | switch ($error) |
|
279 | { |
|
280 | case NO_ERROR: |
|
281 | ||
282 | header('HTTP/1.0 200 OK'); |
|
283 | ||
284 | if ($parent) |
|
285 | { |
|
286 | $rs = dal_query('depends/list.sql', $parent['record_id']); |
|
287 | echo(sprintf('%s (%u)', get_html_resource(RES_SUBRECORDS_ID), $rs->rows)); |
|
288 | } |
|
289 | else |
|
290 | { |
|
291 | echo($record_id); |
|
292 | } |
|
293 | ||
294 | break; |
|
295 | ||
296 | case ERROR_INCOMPLETE_FORM: |
|
297 | send_http_error(get_html_resource(RES_ALERT_REQUIRED_ARE_EMPTY_ID)); |