implementovane pridavanie priloh typu "comment",

dynamicka uprava komentarov dvojklikom
This commit is contained in:
2025-05-14 00:36:56 +02:00
parent e870a62b89
commit 82e14b8fa4
5 changed files with 226 additions and 21 deletions

57
api.php
View File

@ -28,22 +28,35 @@ switch ($action) {
case 'get':
$result = reportGet($_REQUEST['report_id']);
break;
case 'getall':
case 'getAll':
$result = reportGetAll($_REQUEST['status']);
break;
case 'getallgrouped':
case 'getAllGrouped':
$result = reportGetAllGrouped($_REQUEST['status']);
break;
case 'updateordnum':
case 'updateOrdNum':
$suc = reportUpdateOrdnum($_REQUEST['ordnums']);
if ($suc === false) $error = 'Update Ordnum failed';
$result = array('processed' => $suc);
break;
case 'updatestatus':
case 'updateStatus':
$suc = reportUpdateStatus($_REQUEST['report_id'], $_REQUEST['status']);
if ($suc === false) $error = 'Update Status failed';
$result = array('processed' => $suc);
break;
case 'attachmentAdd':
$suc = attachmentAdd($_REQUEST['report_id'], $_REQUEST['attachment_type'], $_REQUEST['attachment_content']);
if ($suc === false) $error = 'Attachment add failed';
$result = array('processed' => $suc);
break;
case 'attachmentUpdate':
$suc = attachmentUpdate($_REQUEST['attachment_id'], $_REQUEST['attachment_content']);
if ($suc === false) $error = 'Attachment update failed';
$result = array('processed' => $suc);
break;
case 'attachmentGetAll':
$result = attachmentGetAll($_REQUEST['report_id']);
break;
}
header('Content-Type: application/json');
@ -107,28 +120,28 @@ function help()
'report_id' => 'Report id',
]
],
'getall' => [
'name' => 'getall',
'getAll' => [
'name' => 'getAll',
'description' => 'Get all reports',
'params' => [
'status' => '(ptional) Report status, default: 0,1,2,3',
]
],
'getallgrouped' => [
'name' => 'getallgrouped',
'getAllGrouped' => [
'name' => 'getAllGrouped',
'description' => 'Get all reports grouped by group',
'params' => [
'status' => '(ptional) Report status, default: 0,1,2,3',
]
],
'updateordnum' => [
'updateOrdNum' => [
'name' => 'updateordnum',
'description' => 'Update report ordnum',
'params' => [
'ordnums' => 'Report ordnums in json format {report_id: ordnum, ...}',
]
],
'updatestatus' => [
'updateStatus' => [
'name' => 'updatestatus',
'description' => 'Update report status',
'params' => [
@ -136,6 +149,30 @@ function help()
'status' => 'Report status',
]
],
'attachmentAdd' => [
'name' => 'attachmentAdd',
'description' => 'Add attachment to report',
'params' => [
'report_id' => 'Report id',
'content_type' => 'Attachment content type',
'content' => 'Attachment content',
]
],
'attachmentUpdate' => [
'name' => 'attachmentUpdate',
'description' => 'Update attachment',
'params' => [
'attachment_id' => 'Attachment id',
'content' => 'Attachment content; if empty, attachment will be deleted',
]
],
'attachmentGetAll' => [
'name' => 'attachmentGetAll',
'description' => 'Get all attachments for report',
'params' => [
'report_id' => 'Report id',
]
]
]
];
}