Link opens the standard picker under the button instead of a window - linked records ticked, tick to link and untick to unlink, saved when the picker closes with one message - for every record link, contact and asset credentials, a contact's assets, project and service tickets, a ticket's services and related tickets, with a document's or file's Link grouped by kind and quick looks reloading in place; the old link windows and the handlers only they used are removed

This commit is contained in:
johnnyq
2026-11-20 18:23:48 -05:00
parent c1bdc99c14
commit 8ac88a48fd
54 changed files with 837 additions and 1252 deletions

View File

@@ -97,6 +97,36 @@ if (isset($_GET['certificate_check'])) {
exit;
}
/*
* Link picker (js/link_picker.js, functions/link_picker.php) - replaces the
* Link windows. GET what a record can be linked to, the linked ones ticked;
* POST what was ticked and unticked, as the picker closes. With flash=1 the
* message is kept for the page the picker reloads, as a post handler's is.
*/
if (isset($_GET['link_picker'])) {
header('Content-Type: application/json');
$answer = linkPickerOptions((string) ($_GET['from'] ?? ''), intval($_GET['id'] ?? 0), (string) ($_GET['to'] ?? ''));
if (isset($answer['error'])) {
http_response_code(403);
}
echo json_encode($answer);
exit;
}
if (isset($_POST['link_picker_save'])) {
validateCSRFToken();
header('Content-Type: application/json');
$answer = linkPickerSave((string) ($_POST['from'] ?? ''), intval($_POST['id'] ?? 0), (string) ($_POST['to'] ?? ''),
(array) ($_POST['add'] ?? []), (array) ($_POST['remove'] ?? []));
if (isset($answer['error'])) {
http_response_code(403);
} elseif (!empty($_POST['flash'])) {
flashAlert($answer['message'], $answer['type']);
}
echo json_encode($answer);
exit;
}
/*
* Tag picker (js/tag_picker.js) - replaces the "Assign Tags" modals.
*