ROCKVIEW SLPS — DATA COLLECTIONS
21 October 2026 — Maintenance Control Restored

GLOBAL STAFF NAVIGATION FIX
Maintenance Mode is now loaded directly by the staff dashboard, campus/HOD
management pages and the shared module shell. A shared staff-control script
checks the signed-in role and keeps the entry present after menus are rebuilt.
It works independently of the panel-policy refresh request. Non-staff roles
still cannot manage maintenance. Entry-point script versions have been refreshed
to prevent older cached navigation from masking the update.
Upload ALL supplied folders/files, not just the Data Collections page. Extract
into the existing slps folder, overwrite the supplied files, then Ctrl+F5. No SQL
migration is needed. This patch does not change maintenance's current setting.

MAINTENANCE CONTROL RESTORED
The staff Maintenance Mode entry is restored in the A–Z sidebar. It is also
rendered by shared module pages as a direct link, with navigation refresh keeping
it present on dashboards. The Panel Permissions page includes the Maintenance
mode button and memo dialog. Maintenance API updates preserve panel visibility
settings, and changing panel links preserves the maintenance state.
The direct staff route is:
 /slps/shared/views/modules/panel-permissions.php?maintenance=1
Only staff manage maintenance. Admins and other roles do not get this control.
This fix restores the missing link; it does not enable or disable maintenance.
No additional SQL is needed on an installation that already has Panel Permissions
and Maintenance Mode. Upload/extract all supplied files, overwrite, then Ctrl+F5.
Tested the staff-only navigation, direct popup, enable/restore UI flows, master
permissions controls and retained Data Collections link using DOM tests. Live
PHP/MySQL deployment still needs testing on the hosting account.

EDITABLE SPREADSHEET UPDATE
No new SQL migration is required if Data Collections is already installed.
The Responses table now opens as a spreadsheet-style grid with column letters,
row numbers, gridlines, a selected-cell address and a read-only value/formula bar.
Select an answer cell and choose Edit cell, double-click it, or press Enter/F2.
Use Save to store the correction, or Cancel/Escape to discard it. Arrow keys and
Tab move among cells. The Edit response button opens all answers together,
including questions made required by a corrected conditional answer.
IDs and original submission timestamps are read-only. Answers remain literal;
this is not a formula/calculation engine or a complete Microsoft Excel clone.
Choice and rating cells use predefined options; numbers, dates and other field
formats are validated both in the grid and by the server. Conditional changes
that hide existing answers require confirmation before the inline save.
Corrections update charts, the full response view and subsequent CSV exports.
The existing system audit log records who corrected which response and when;
it does not store a before/after revision history or provide undo after saving.
Ownership, form revision and per-response edit tokens protect correction writes.
Rejected saves keep the inline correction available to copy or retry.

FIND IN THE SHEET
Ctrl+F on Windows/Linux or Command+F on Mac opens the spreadsheet Find bar while
the Responses spreadsheet is active. Type a value, then Enter/Shift+Enter or the
arrow buttons to navigate matching cells. Escape closes Find. The normal browser
shortcut remains available on other system pages/tabs. Find and the response
filter search LOADED rows, not every saved response: use Show more to load older
rows or Download CSV for every record in the selected version.

CHARTS AND TABLE UPDATE
This package supersedes the first Data Collections ZIP. If you already imported
20261021_data_collections.sql, there is no new database migration. Extract into
the existing SLPS folder and overwrite the supplied files, then hard-refresh.
The response workspace now includes real native SVG pie charts with percentage
labels and interactive legends; a pie/bar switch for single-choice questions;
bar charts for checkbox/rating/date results and numeric distributions; a daily
activity line chart including zero-response dates within its displayed range;
and accessible chart-data tables.
The response register has question columns, sticky headings/response IDs,
formatted multi-select chips, search across loaded rows and a View button to
open each complete submission. It defaults to Table and can switch to Individual.
Long answers scroll inside cells. The table scrolls horizontally on small screens
so the surrounding page stays within the viewport. Use Show more to load older
records for table search, or CSV to export every response in the selected version.
All charts and table columns follow the selected published form version.
No external chart library or CDN is required. Theme colours update automatically.

INSTALL ON YOUR EXISTING SYSTEM
1. Download a backup of the existing SLPS files and database.
2. In cPanel > phpMyAdmin select the SLPS database and import:
   database/migrations/20261021_data_collections.sql
   This adds three dc_* tables. It does not replace existing user data.
3. Upload this ZIP into the existing SLPS root (the folder containing
   authentication, shared and database). Extract there and replace the supplied
   files. Do not extract into a second nested slps folder. This is an update,
   not a standalone application or a replacement for your entire system.
4. Refresh the browser with Ctrl+F5, then sign in as Staff, Admin or Data Expert.
   The alphabetically sorted sidebar includes Data Collections. Staff can
   hide this link using the existing Panel Permissions controls.
   Direct route: /slps/shared/views/modules/data-collections.php
   Adjust /slps if your installation uses a different base folder.
5. Create a collection, select a template, edit its questions, Save draft,
   Preview, then Publish. Click Share to copy the public response link.
   Test that link in a private browser window; submit a sample response and
   check Responses and Download CSV. Close the collection when finished.

Requires the current SLPS deployment with the prior Data Experts, Panel
Permissions, maintenance and folder-sharing updates. Uses the existing PHP 8.1+
application authentication and MySQL/MariaDB connection. No database credentials,
email settings, Firebase keys or vendor dependencies are included or replaced.
No email setup is required. HTTPS is recommended for your public forms.

WHAT IS INCLUDED
- Personal collections for staff, admins and Data Experts, using university
  green, gold and charcoal colours and the existing light/dark theme.
- Questions / Responses / Settings workspace; phone layouts; compact dialogs;
  spinner feedback; draft save, preview, duplicate and delete controls.
- Blank, survey, registration, feedback, research-consent and event templates.
- Short text, long text, email, telephone, web address, number, date, time,
  single choice, multiple selection, dropdown and rating questions.
- Ordered sections with Next/Back navigation and progress; reorder questions,
  required answers, hints, numeric bounds and conditional question visibility.
  Conditions depend on an earlier choice/dropdown/multiple-selection answer.
- Public share URLs: respondents do not need SLPS accounts. Share the copied
  link yourself. Anyone holding an open form's link can respond.
- Publish creates an immutable version. Saved edits stay in the draft until
  published. View each version's results separately to avoid mixing changed
  questions. Republishing makes the new version available at the same URL.
- Closing dates (entered in local time, stored in UTC), response limits, manual
  close/reopen, confirmation message and optional one-response-per-browser.
- Choice counts and percentages; rating distribution; numeric statistics and
  histogram; date counts by month; submission activity; recent written answers;
  individual response browsing/deletion; formatted searchable response register;
  version-specific CSV export.
- Creator draft recovery in local browser storage. Respondents can opt into
  session-only draft recovery on a trusted device. Successful submission clears
  that draft. Data collection requires an online connection for final submission.
- Server-side validation, CSRF protection, owner isolation, rate limits,
  transactional response limits, retry deduplication and safe text rendering.
  CSV output protects against spreadsheet formula injection.

LIMITS AND EXPECTATIONS
100 collections per creator; 100 questions/sections per collection; 2–40 options
per choice question; ratings up to 10; maximum 10,000 total responses per form.
The response cap counts all published versions. Deleting responses frees capacity.
Text limits are enforced in UTF-8 bytes on the server; longer multilingual text
may reach a limit sooner. Each response is limited to 128 KiB of encoded answers.
One-per-browser uses a cookie; it is not identity verification and cannot prevent
someone responding from another browser or after clearing cookies.
Each creator sees their own collections. No public results are exposed.
There are no file-upload questions, quizzes, collaborative editing or Google
service integrations in this version. This is a native SLPS form workflow,
not a claim of complete Google Forms feature parity.
The research template shows conditional consent; it does not establish research
ethics approval. Review the questions and consent wording before publishing.

VERIFICATION
Passed Node core validation tests and jsdom DOM flows covering section validation,
creating/saving/publishing templates, share URLs, safe response rendering,
historical question labels, CSV links, table search/detail navigation, chart
percentages, empty/single-slice charts, interactive legends, zero-day activity,
spreadsheet editing/selection, correction validation, save failure recovery,
Ctrl+F activation, Find navigation, failed-submit recovery, opt-in drafts,
retry keys and successful draft clearing. PHP files passed syntax-tree parsing;
JavaScript files passed node --check. ZIP contents are verified against source.
PHP and MySQL were unavailable in the build environment, so database migration,
server execution, cPanel deployment and full visual browser QA require testing
on the hosting server before general use.

Developer tests:
  node tests/data_collections_core.cjs
For DOM tests install jsdom in a separate test folder, then set SLPS_TEST_JSDOM
 to its absolute node_modules/jsdom path before running:
  node tests/data_collections_dom.cjs
  node tests/data_collections_charts.cjs
  node tests/data_collections_sheet.cjs
  node tests/data_collections_public.cjs

TROUBLESHOOTING
Missing link: confirm shared/lib/panel_permissions.php and both navigation scripts
were overwritten; hard-refresh; check Staff > Panel Permissions. Open the direct
route above to distinguish stale navigation from a missing module.
Service unavailable: import the SQL into the database this SLPS installation
actually uses. Check cPanel's PHP error log if the error remains.
Form unavailable: publish it and ensure its owner's account is active.
Closed form: check closing date, response cap and its open/closed status.
This package does not itself upload changes to your hosting account.
