Files
itflow/agent/modals/file/file_view.php
johnnyq 1a613eab7b Files and documents overhaul: rebuilt files list with folder tree (counts, open/close remembered, phone collapse), current folder path and folder menu, All/Documents/Uploads tabs with counts, colour-coded type tiles, shared and portal pills, updated time and author, linked record counts, permission-gated row menus, search across every folder from the top level showing where each result lives, grid view with real previews (image thumbnails, PDF first page, document and text excerpts) and an arrow-key previewer with a Details button, drag and drop files onto the list to upload into the folder on show, bulk move/archive/restore/delete for files and documents together; document page rebuilt like the asset and contact pages with header actions (Edit, Share, PDF, Print, Rename, Move, Link, portal visibility, Archive, Delete), Linked card, folder and portal card and a History card where versions can be viewed, restored (current content kept as a version) or deleted, revision table moved to print only; new file quick look with preview, folder, uploader, share status and links; document quick look and version viewer redone; one link modal for every relation (files, documents, assets, contacts, licenses, vendors) with type tabs and multi-select, offering only the client's own unarchived, not yet linked records, old link modals now open it; upload modal with drop box, file list and size checks; new and edit document share one form with folder and client portal switch; template, rename, move, bulk move, visibility and folder add/rename/delete modals modernized with folder tree pickers; asset and contact pages show the same file and document tiles and open the file quick look; fixes: folder, contact and asset ownership checked on upload, new document, template, move and bulk move, links limited to records of the same client, linking an existing link no longer errors, deleting a folder now moves its files, documents and subfolders up instead of orphaning them, file delete confirmation no longer builds its name into inline JS, permission checks added to the upload, new document, folder, visibility and link modals, upload modal script error that skipped the size check, skipped uploads now reported, mime type read from the uploaded file, per-row link modals that broke grid view, search with quotes double escaped, document search text stored without tags and with words spaced, bulk messages with empty counts, visibility wording, file rename icon, PDF export redirecting after output and needing write access, file and document deletes now remove their links and skip missing files on disk, duplicate asset to file link handler removed; developer: new functions/links.php (relation registry, linkAdd, linkRemove, linkRemoveAll, linkedRecords, linkCandidates, linkGroupsHtml), post/link.php with link_items and unlink_item plus the legacy link and unlink names, functions/files.php gains fileTypeInfo, fileTypeTile, documentTile, folderTree, folderPath, folderSubtree, folderOptionsHtml, folderOwnedId, delete helpers, documentContentRaw and documentHtmlPurify, new agent/js/files.js, modals/link/link.php, modals/file/file.php, modals/folder/folder_delete.php and modals/document/document_form.php, removed unused document_bulk_move.php, document_add_file_relation.php and js/file_delete_modal.js
2026-10-14 20:35:41 -04:00

54 lines
3.1 KiB
PHP

<?php
/*
* The previewer for agent/files.php's grid - one at a time, full size, with
* the arrow keys paging through everything on show. Driven by agent/js/files.js
* from the payload files.php writes; what each item can show was worked out
* against getInlineViewableMimeTypes(), so anything else gets the fallback
* panel rather than a frame of a download.
*/
?>
<div class="modal" id="viewFileModal" tabindex="-1">
<div class="modal-dialog modal-xl modal-dialog-centered">
<div class="modal-content bg-dark text-white" data-bs-theme="dark">
<div class="modal-header">
<div class="min-w-0">
<h6 class="modal-title text-truncate" id="modalTitle"></h6>
<div class="small text-body-secondary" id="modalMeta"></div>
</div>
<button type="button" class="btn-close btn-close-white ms-auto" data-bs-dismiss="modal"></button>
</div>
<div class="position-relative text-center">
<button type="button" class="btn btn-dark position-absolute top-50 start-0 translate-middle-y ms-2 itflow-preview-nav" title="Previous (left arrow)" id="modalPrev">
<i class="fas fa-chevron-left"></i>
</button>
<img id="modalImage" class="img-fluid my-3 d-none" src="" alt="" style="max-height: 75vh;">
<iframe id="modalFrame" class="w-100 my-3 d-none bg-white" style="height:75vh; border:0;" title="File preview"></iframe>
<pre id="modalText" class="text-start text-white bg-black p-3 my-3 mx-5 d-none overflow-auto" style="max-height:70vh; white-space:pre-wrap; word-break:break-word;"></pre>
<?php /* Documents render as HTML, on white like the document page */ ?>
<div id="modalDocument" class="text-start bg-white text-dark p-4 my-3 mx-5 d-none overflow-auto prettyContent" data-bs-theme="light" style="max-height:70vh;"></div>
<div id="modalFallback" class="my-5 d-none">
<i class="fas fa-file fa-4x text-secondary" id="modalFallbackIcon"></i>
<p class="mt-3 mb-0">This kind of file cannot be previewed in the browser - download it to open it.</p>
</div>
<button type="button" class="btn btn-dark position-absolute top-50 end-0 translate-middle-y me-2 itflow-preview-nav" title="Next (right arrow)" id="modalNext">
<i class="fas fa-chevron-right"></i>
</button>
</div>
<div class="modal-footer">
<span class="text-body-secondary small me-auto" id="modalPosition"></span>
<button type="button" class="btn btn-outline-light" id="modalDetails"><i class="fas fa-fw fa-info-circle me-2"></i>Details</button>
<a class="btn btn-primary" id="modalDownload" href="#"><i class="fas fa-fw fa-download me-2"></i>Download</a>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><i class="fas fa-fw fa-times me-2"></i>Close</button>
</div>
</div>
</div>
</div>