diff --git a/CHANGELOG.md b/CHANGELOG.md index 33ee0ea..6e33f3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Changes 4/27/2025 +## Changes 4/27/2025 1.2.7 - **Select-All** checkbox now correctly toggles all `.file-checkbox` inputs - Updated `toggleAllCheckboxes(masterCheckbox)` to call `updateRowHighlight()` on each row so selections get the `.row-selected` highlight @@ -8,6 +8,17 @@ - Enhanced `updateFileActionButtons()` to set the header checkbox to checked, unchecked, or indeterminate based on how many files are selected - Fixed Pagination controls & Items-per-page dropdown - Fixed `#advancedSearchToggle` in both `renderFileTable()` and `renderGalleryView()` +- **Shared folder gallery view logic** + - Introduced new `public/js/sharedFolderView.js` containing all DOMContentLoaded wiring, `toggleViewMode()`, gallery rendering, and event listeners + - Embedded a non-executing JSON payload in `shareFolder.php` +- **`FolderController::shareFolder()` / `shareFolder.php`** + - Removed all inline `onclick="…"` attributes and inline `` to export `$token` and `$files` + - Added `` to load the external view logic +- **Styling updates** + - Added `.toggle-btn` CSS for blue header-style toggle button and applied it in JS + - Added `.pagination a:hover { background-color: #0056b3; }` to match button hover + - Tweaked `body` padding and `header h1` margins to reduce whitespace above header --- diff --git a/public/js/authModals.js b/public/js/authModals.js index b913d17..f1e058b 100644 --- a/public/js/authModals.js +++ b/public/js/authModals.js @@ -3,7 +3,7 @@ import { sendRequest } from './networkUtils.js'; import { t, applyTranslations, setLocale } from './i18n.js'; import { loadAdminConfigFunc } from './auth.js'; -const version = "v1.2.6"; // Update this version string as needed +const version = "v1.2.7"; // Update this version string as needed const adminTitle = `${t("admin_panel")} ${version}`; let lastLoginData = null; diff --git a/public/js/sharedFolderView.js b/public/js/sharedFolderView.js new file mode 100644 index 0000000..8bd4fea --- /dev/null +++ b/public/js/sharedFolderView.js @@ -0,0 +1,60 @@ +// sharedFolderView.js +document.addEventListener('DOMContentLoaded', function() { + let viewMode = 'list'; + const payload = JSON.parse( + document.getElementById('shared-data').textContent + ); + const token = payload.token; + const filesData = payload.files; + const downloadBase = `${window.location.origin}/api/folder/downloadSharedFile.php?token=${encodeURIComponent(token)}&file=`; + + function toggleViewMode() { + const listEl = document.getElementById('listViewContainer'); + const galleryEl = document.getElementById('galleryViewContainer'); + const btn = document.getElementById('toggleBtn'); + if (btn) { + btn.classList.add('toggle-btn'); + } + + if (viewMode === 'list') { + viewMode = 'gallery'; + listEl.style.display = 'none'; + renderGalleryView(); + galleryEl.style.display = 'block'; + btn.textContent = 'Switch to List View'; + } else { + viewMode = 'list'; + galleryEl.style.display = 'none'; + listEl.style.display = 'block'; + btn.textContent = 'Switch to Gallery View'; + } + } + + document.getElementById('toggleBtn').addEventListener('click', toggleViewMode); + + function renderGalleryView() { + const galleryContainer = document.getElementById('galleryViewContainer'); + let html = ''; + galleryContainer.innerHTML = html; + + galleryContainer.querySelectorAll('.gallery-preview') + .forEach(el => el.addEventListener('click', () => { + window.location.href = el.dataset.url; + })); + } + + window.renderGalleryView = renderGalleryView; + }); \ No newline at end of file diff --git a/src/controllers/folderController.php b/src/controllers/folderController.php index 05d90c5..8743a62 100644 --- a/src/controllers/folderController.php +++ b/src/controllers/folderController.php @@ -550,13 +550,18 @@ class FolderController body { background: #f2f2f2; font-family: Arial, sans-serif; - padding: 20px; + padding: 0px 20px 20px 20px; color: #333; } .header { text-align: center; margin-bottom: 30px; + margin-top: 0; + } + + .header h1 { + margin-top: 0; } .container { @@ -661,6 +666,28 @@ class FolderController font-size: 0.9rem; color: #777; } + + .toggle-btn { + background-color: #007BFF; + color: #fff; + border: none; + border-radius: 4px; + padding: 8px 16px; + font-size: 1rem; + cursor: pointer; + } + + .toggle-btn:hover { + background-color: #0056b3; + } + + .pagination a:hover { + background-color: #0056b3; + } + + .pagination span { + cursor: default; + } @@ -670,7 +697,7 @@ class FolderController
- +
@@ -757,86 +784,14 @@ class FolderController - - +