diff --git a/classes/form/edit_query_form.php b/classes/form/edit_query_form.php
index 582a57d..c2475a9 100644
--- a/classes/form/edit_query_form.php
+++ b/classes/form/edit_query_form.php
@@ -128,29 +128,6 @@ protected function definition() {
);
$this->add_audience_elements($mform);
-
- // Authors get a plain Save (draft); approvers additionally get a one-click Save & publish so
- // they don't have to round-trip through the index page to publish. The capability is also
- // re-checked in edit.php before publishing — the button is convenience, not the gate.
- $buttonarray = [];
- $buttonarray[] = $mform->createElement('submit', 'submitbutton', get_string('savechanges'));
- if (!empty($this->_customdata['canpublish'])) {
- $buttonarray[] = $mform->createElement(
- 'submit',
- 'saveandpublish',
- get_string('saveandpublish', 'report_sql')
- );
- // Publish but stay on the form to iterate (republish, configure the just-unlocked
- // chart / filters) without round-tripping the index. edit.php redirects back here.
- $buttonarray[] = $mform->createElement(
- 'submit',
- 'saveandpublishedit',
- get_string('saveandpublishedit', 'report_sql')
- );
- }
- $buttonarray[] = $mform->createElement('cancel');
- $mform->addGroup($buttonarray, 'buttonar', '', [' '], false);
- $mform->closeHeaderBefore('buttonar');
}
/**
@@ -254,6 +231,16 @@ private function add_audience_elements(\MoodleQuickForm $mform): void {
* Add chart configuration fields once column metadata is available (published queries only).
*/
public function definition_after_data() {
+ parent::definition_after_data();
+ $this->add_late_sections();
+ // Added last so the buttons sit below the sections that depend on the saved record.
+ $this->add_action_buttons_group();
+ }
+
+ /**
+ * Add the chart / filter sections that depend on the saved record.
+ */
+ private function add_late_sections(): void {
global $DB;
$mform = $this->_form;
@@ -481,4 +468,33 @@ public function validation($data, $files): array {
return $errors;
}
+
+ /**
+ * Add the save / publish / cancel buttons.
+ */
+ private function add_action_buttons_group(): void {
+ $mform = $this->_form;
+ // Authors get a plain Save (draft); approvers additionally get a one-click Save & publish so
+ // they don't have to round-trip through the index page to publish. The capability is also
+ // re-checked in edit.php before publishing — the button is convenience, not the gate.
+ $buttonarray = [];
+ $buttonarray[] = $mform->createElement('submit', 'submitbutton', get_string('savechanges'));
+ if (!empty($this->_customdata['canpublish'])) {
+ $buttonarray[] = $mform->createElement(
+ 'submit',
+ 'saveandpublish',
+ get_string('saveandpublish', 'report_sql')
+ );
+ // Publish but stay on the form to iterate (republish, configure the just-unlocked
+ // chart / filters) without round-tripping the index. edit.php redirects back here.
+ $buttonarray[] = $mform->createElement(
+ 'submit',
+ 'saveandpublishedit',
+ get_string('saveandpublishedit', 'report_sql')
+ );
+ }
+ $buttonarray[] = $mform->createElement('cancel');
+ $mform->addGroup($buttonarray, 'buttonar', '', [' '], false);
+ $mform->closeHeaderBefore('buttonar');
+ }
}
diff --git a/classes/reportbuilder/local/entities/query.php b/classes/reportbuilder/local/entities/query.php
index 83ff40c..4e5640c 100644
--- a/classes/reportbuilder/local/entities/query.php
+++ b/classes/reportbuilder/local/entities/query.php
@@ -113,7 +113,7 @@ private function get_all_columns(): array {
$columns[] = (new column('name', new lang_string('name', 'report_sql'), $this->get_entity_name()))
->add_joins($this->get_joins())
->set_type(column::TYPE_TEXT)
- ->add_fields("{$q}.name, {$q}.chartmeta, {$q}.querysql")
+ ->add_fields("{$q}.name, {$q}.id, {$q}.ownerid, {$q}.chartmeta, {$q}.querysql")
->set_is_sortable(true, ["{$q}.name"])
->add_callback(static function ($value, \stdClass $row): string {
if ($value === null) {
@@ -121,6 +121,15 @@ private function get_all_columns(): array {
}
$name = format_string($value);
+ // Link to the edit page for users who may edit (admin-owned queries are locked to admins).
+ global $USER;
+ if (
+ has_capability('report/sql:author', \context_system::instance())
+ && (!is_siteadmin($row->ownerid) || is_siteadmin($USER))
+ ) {
+ $name = html_writer::link(new \moodle_url('/report/sql/edit.php', ['id' => $row->id]), $name);
+ }
+
// Cap the column width (main used a 33% html_table size); long names wrap within it.
$wrap = static fn(string $html): string => \html_writer::span($html, 'rs-query-name');
diff --git a/classes/reportbuilder/local/systemreports/queries.php b/classes/reportbuilder/local/systemreports/queries.php
index 8e21b15..1ed5cb7 100644
--- a/classes/reportbuilder/local/systemreports/queries.php
+++ b/classes/reportbuilder/local/systemreports/queries.php
@@ -56,8 +56,24 @@ protected function initialise(): void {
"{$alias}.id, {$alias}.status, {$alias}.reportid, {$alias}.chartreportid, {$alias}.ownerid, {$alias}.chartmeta"
);
+ $this->add_columns_from_entities(["{$entityname}:name"]);
+
+ // Link to the live report, in its own column beside the name. Only published queries have one.
+ $this->add_column((new column('viewreport', new lang_string('runreport', 'report_sql'), $entityname))
+ ->set_type(column::TYPE_TEXT)
+ ->add_fields("{$alias}.reportid, {$alias}.status")
+ ->set_is_sortable(false)
+ ->add_callback(static function ($value, \stdClass $row): string {
+ if ($row->status !== query::STATUS_PUBLISHED || empty($row->reportid)) {
+ return '';
+ }
+ return html_writer::link(
+ new moodle_url('/reportbuilder/view.php', ['id' => $row->reportid]),
+ get_string('runreport', 'report_sql')
+ );
+ }));
+
$columns = [
- "{$entityname}:name",
"{$entityname}:owner",
"{$entityname}:course",
"{$entityname}:status",
diff --git a/classes/reportbuilder/local/systemreports/usage.php b/classes/reportbuilder/local/systemreports/usage.php
index 6764b9d..0654955 100644
--- a/classes/reportbuilder/local/systemreports/usage.php
+++ b/classes/reportbuilder/local/systemreports/usage.php
@@ -18,13 +18,12 @@
namespace report_sql\reportbuilder\local\systemreports;
-use core_reportbuilder\local\report\action;
+use core_reportbuilder\local\report\column;
use core_reportbuilder\system_report;
use lang_string;
use report_sql\local\query;
use report_sql\reportbuilder\local\entities\query as query_entity;
use moodle_url;
-use pix_icon;
/**
* System report showing how often each published report source has been opened.
@@ -39,7 +38,7 @@
*/
class usage extends system_report {
/**
- * Initialise the report: main table, entity, columns, filters, action.
+ * Initialise the report: main table, entity, columns and filters.
*/
protected function initialise(): void {
$entity = new query_entity();
@@ -49,11 +48,36 @@ protected function initialise(): void {
$this->set_main_table('report_sql_query', $alias);
$this->add_entity($entity);
- // Consumed by the row actions below.
- $this->add_base_fields("{$alias}.id, {$alias}.reportid");
+ $this->add_columns_from_entities(["{$entityname}:name"]);
+
+ // Link to the live report, in its own column beside the name.
+ $this->add_column((new column('viewreport', new lang_string('runreport', 'report_sql'), $entityname))
+ ->set_type(column::TYPE_TEXT)
+ ->add_field("{$alias}.reportid")
+ ->set_is_sortable(false)
+ ->add_callback(static function ($value): string {
+ if (empty($value)) {
+ return '';
+ }
+ return \html_writer::link(
+ new moodle_url('/reportbuilder/view.php', ['id' => $value]),
+ get_string('runreport', 'report_sql')
+ );
+ }));
+
+ // Link to this source's usage detail (who / trend / recent), in its own column.
+ $this->add_column((new column('viewdetail', new lang_string('usage:detaillabel', 'report_sql'), $entityname))
+ ->set_type(column::TYPE_TEXT)
+ ->add_field("{$alias}.id")
+ ->set_is_sortable(false)
+ ->add_callback(static function ($value): string {
+ return \html_writer::link(
+ new moodle_url('/report/sql/query_usage.php', ['id' => $value]),
+ get_string('usage:detaillabel', 'report_sql')
+ );
+ }));
$this->add_columns_from_entities([
- "{$entityname}:name",
"{$entityname}:owner",
"{$entityname}:course",
"{$entityname}:viewcount",
@@ -73,26 +97,6 @@ protected function initialise(): void {
// Only published queries have a report and can accrue views.
$this->add_base_condition_simple("{$alias}.status", query::STATUS_PUBLISHED);
- // Drill into this source's usage detail (who / trend / recent).
- $this->add_action((new action(
- new moodle_url('/report/sql/query_usage.php', ['id' => ':id']),
- new pix_icon('i/stats', ''),
- [],
- false,
- new lang_string('usage:detaillabel', 'report_sql')
- )));
-
- // Open the live report.
- $this->add_action((new action(
- new moodle_url('/reportbuilder/view.php', ['id' => ':reportid']),
- new pix_icon('i/report', ''),
- [],
- false,
- new lang_string('runreport', 'report_sql')
- ))->add_callback(static function (\stdClass $row): bool {
- return !empty($row->reportid);
- }));
-
// Default sort: busiest report sources first.
$this->set_initial_sort_column("{$entityname}:viewcount", SORT_DESC);
$this->set_default_per_page(50);
diff --git a/docs.php b/docs.php
index c53e785..fb7bf10 100644
--- a/docs.php
+++ b/docs.php
@@ -24,14 +24,17 @@
require(__DIR__ . '/../../config.php');
-require_login();
+require_once($CFG->libdir . '/adminlib.php');
+
$context = context_system::instance();
-// Only authors (people who can create report views) get the docs page.
-require_capability('report/sql:author', $context);
-$PAGE->set_context($context);
-$PAGE->set_url(new moodle_url('/report/sql/docs.php'));
-$PAGE->set_pagelayout('admin');
+// Registered in the admin tree (settings.php) gated by report/sql:author, so only authors get the page
+// and the primary/secondary navigation and breadcrumb are set.
+// The listing is the active parent, so tabs and the breadcrumb trail run through index.php.
+navigation_node::override_active_url(new moodle_url('/report/sql/index.php'));
+admin_externalpage_setup('report_sql_docs', '', null, new moodle_url('/report/sql/docs.php'));
+$PAGE->navbar->add(get_string('userdocs', 'report_sql'));
+$PAGE->add_body_class('limitedwidth');
$PAGE->set_title(get_string('userdocs', 'report_sql'));
$PAGE->set_heading(get_string('reportsources', 'report_sql'));
@@ -85,5 +88,31 @@ function ($m) use ($slugger) {
$html
);
-echo $OUTPUT->box($html, 'generalbox rs-docs');
+// Lift the "Contents" list out of the flow. It is output first so on small and medium screens it sits
+// at the top of the content, and on large screens (see styles.css) it floats in the left margin outside
+// the content box without narrowing it (the list is rendered twice, once per breakpoint).
+$toc = '';
+if (preg_match('/
.*?<\/ol>/s', $html, $m)) {
+ $toc = $m[0];
+ $html = str_replace($m[0], '', $html);
+ // The "---" rules on either side of the list would leave a double divider behind.
+ $html = preg_replace('/(
\s*){2,}/', '
', $html, 1);
+}
+
+// Below xxl the list is plain content at the top of the box. From xxl up it floats in the left page margin
+// (as in mod_cms's type edit page): absolutely positioned outside a relative wrapper, sticky within it.
+$floating = '';
+if ($toc !== '') {
+ $floating = html_writer::tag(
+ 'nav',
+ html_writer::div($toc, 'position-sticky overflow-auto', ['style' => 'top: 9rem; max-height: calc(100vh - 10rem);']),
+ [
+ 'class' => 'rs-docs-toc d-none d-xxl-block position-absolute top-0 bottom-0 end-100 me-3',
+ 'style' => 'width: 16rem;',
+ 'aria-label' => get_string('userdocs', 'report_sql'),
+ ]
+ );
+ $toc = html_writer::div($toc, 'd-xxl-none mb-4');
+}
+echo html_writer::div($floating . $OUTPUT->box($toc . $html, 'generalbox rs-docs'), 'position-relative');
echo $OUTPUT->footer();
diff --git a/docs/principles.md b/docs/principles.md
new file mode 100644
index 0000000..82b5489
--- /dev/null
+++ b/docs/principles.md
@@ -0,0 +1,134 @@
+# Report SQL: security principles
+
+This page records the first principles behind what Report SQL refuses to run, and why. It is the
+reference to check before changing the validator (`classes/local/sql/validator.php`,
+`postgres_validator.php`, `mysql_validator.php`) or the default denylists in `settings.php`.
+
+Each rule is written as a MUST / MUST NOT so it can be mapped to a test. Anything that relaxes a
+rule needs a deliberate decision, not a convenience tweak.
+
+## Threat model
+
+Report authors are trusted to write queries, but not trusted with everything the database holds.
+A report author is not a site administrator, and an author's mistake should not become a data leak.
+
+Report SQL protects against:
+
+- Authors (or an imported report) reading **credentials, secrets, tokens, sessions or site
+ configuration**, even by accident.
+- Authors **changing data or schema**, or leaving locks behind.
+- **Hidden reads**: ways to reach data that the table and column checks would otherwise see.
+- A viewer seeing more than the report's **audience** is meant to see.
+
+It does not protect against:
+
+- Expensive queries. Cost is not analysed or guaranteed.
+- A `SELECT` function with side effects. The validator cannot certify this. See "Non-goals".
+- Reading ordinary user data an author has legitimate access to. Reports expose sensitive data
+ by design, so audience control is the safeguard there.
+
+## Principles
+
+### 1. Read-only, one statement
+
+- A report MUST be a single `SELECT`. No DML, DDL, `CALL`, `COPY`, `GRANT`, transaction control,
+ `INTO`/`OUTFILE`, or variable assignment (`:=`).
+- A report MUST NOT contain more than one statement, whether `;`-separated or nested at top level.
+- Explicit row locks (`FOR UPDATE`, `FOR SHARE`, `LOCK`) MUST be rejected. A report must not block
+ the site.
+
+*Why:* the report runs as the Moodle DB user, which can write everything.
+
+### 2. No credentials, secrets or sessions
+
+- Tables that hold credentials, tokens, keys, sessions or site configuration MUST be denied.
+ The default list lives in `validator::DENY_TABLES` and is editable through the `denytables`
+ setting. It currently covers:
+ - core config: `config`, `config_plugins`, `config_log`, `adminpresets_it`
+ - passwords: `user_password_history`, `user_password_resets`
+ - sessions: `sessions`, `mnet_session`
+ - OAuth2: issuer, endpoint, field mapping, access and refresh tokens, system account, linked
+ logins, backpack tokens
+ - web service tokens: `external_tokens`, `external_services`, `external_services_users`,
+ `lti_access_tokens`, `enrol_lti_lti2_share_key`
+ - keys and secrets: `user_private_key`, `tool_mfa_secrets`, `messageinbound_datakeys`,
+ `message_airnotifier_devices`
+ - tasks: `task_adhoc`
+- Sensitive column names MUST be denied wherever they appear (`denycolumns`: `password`, `secret`,
+ `token`, `sesskey`, `salt`, `hash`, `privatekey` and similar).
+- Column denial MUST apply to the SQL source, not only the output name. `SELECT password AS pw`
+ must be rejected.
+- Denial MUST also apply to quoted identifiers (`"token"`, `` `token` ``).
+
+*Why:* a leaked token or key is a credential for the whole site, not just a data exposure.
+
+### 3. No hidden reads
+
+- The validator MUST reject any construct that reads data outside the visible table and column
+ checks:
+ - PostgreSQL `query_to_xml()`, `table_to_xml()`, `schema_to_xml()`, `database_to_xml()`,
+ `cursor_to_xml()` and their `*_xmlschema` variants. These run an SQL string or read a
+ relation the parser never sees.
+ - MySQL/MariaDB executable comments (`/*! ... */`, `/*M! ... */`) and `LOAD_FILE()`.
+- Schema-qualified tables MUST be rejected, so a report cannot cross into another schema or database.
+- Table checks MUST be recursive (subqueries, CTEs, `UNION` branches).
+
+*Why:* a denylist is only as good as its coverage. Any path that reads a table without naming it
+in the AST defeats it.
+
+### 4. The denylist fails safe for admins, closed for authors
+
+- The `denytables` and `denycolumns` settings are the source of truth at runtime. Only an admin
+ can edit them.
+- If `denytables` has never been saved, the built-in baseline MUST apply.
+- Adding to a denylist is cheap. Removing from one is a security decision and needs a reason.
+
+### 5. Defence in depth, not a single check
+
+- Several independent layers MUST remain: keyword denylist, parser/AST checks, table and column
+ denylists, quoted-identifier checks and the live database check.
+- A layer MUST NOT be removed because another layer "should" catch the same thing. The parser alone
+ does not block, for example, `INTO OUTFILE`.
+
+### 6. Visibility is the author's responsibility, enforced by the plugin
+
+- A report MUST be visible only to its configured audience. The plugin enforces the
+ "Restrict to viewing user" and audience controls. It does not rely on authors remembering them.
+- Imported reports (Configurable Reports, Ad-hoc database queries) MUST pass the same validation as
+ hand-written ones, and MUST land as drafts.
+
+### 7. Reject loudly, never silently rewrite
+
+- Where a rule fires, the validator MUST fail with a named error. It MUST NOT quietly strip or
+ alter the query and run something the author did not write.
+- Portable `%%TOKEN%%` expansion is the one sanctioned rewrite. It is deterministic and documented.
+
+## Non-goals and known limits
+
+- Parsing does not verify that tables or columns exist, function signatures, permissions or query
+ cost.
+- A `SELECT` can call a function with side effects. The validator cannot prove otherwise.
+- Greenlion (MySQL) is a non-validating parser. Syntax checking still needs the live DB. The bundled
+ PostgreSQL grammar covers PostgreSQL 16, and newer syntax may be rejected.
+- The denylist is name-based. A new table that holds secrets is **not** protected until it is added.
+
+## Reviewing the denylist
+
+The default list is not exhaustive. When adding a plugin or upgrading Moodle, check for new tables
+or columns that hold secrets. Tables worth checking against the defaults include:
+
+- `enrol.password` (enrolment keys)
+- `registration_hubs`, `lti`, `lti_tool_proxies` and `enrol_lti_tools`
+- `badge_backpack`, `repository_instances` and `oauth2_server_client_secrets`
+- `rest_api_tokens`
+- `quiz.password`, `lesson.password` and `quizaccess_seb_quizsettings`
+
+Some of these are covered by the column denylist (`password`, `secret`, `token`). Column coverage is
+broad but name-based, so verify before assuming. Do not store a list of "secret tables" only in this
+file. Keep it in `DENY_TABLES` and test it.
+
+## Changing these rules
+
+1. State which principle the change touches.
+2. Add or update a test that fails without the change (`tests/sql_validator_test.php`).
+3. Update this page if a principle is added, relaxed or reworded.
diff --git a/edit.php b/edit.php
index 2165b61..4f567c9 100644
--- a/edit.php
+++ b/edit.php
@@ -60,6 +60,9 @@
// SQL Report) so editing highlights the right menu entry and builds a breadcrumb back to the
// listing, rather than a bare Home ▸ heading trail. The edit page's own url/title override the
// node's afterwards; the edit/new leaf is appended once $existing is known.
+// Treat the listing as the active page for the primary/secondary navigation and breadcrumb, so this
+// edit page sits under it rather than being unmatched.
+navigation_node::override_active_url(new moodle_url('/report/sql/index.php'));
admin_externalpage_setup(
'report_sql_index',
'',
diff --git a/index.php b/index.php
index bcef028..e9e2398 100644
--- a/index.php
+++ b/index.php
@@ -72,13 +72,13 @@
if (has_capability('report/sql:author', $syscontext)) {
// Wrapped with a stable id so the user tour can anchor a step to the New report view button.
$newbutton = html_writer::div(
- $OUTPUT->single_button(
+ html_writer::link(
new moodle_url(
'/report/sql/edit.php',
$courseid ? ['courseid' => $courseid] : []
),
- get_string('addnew', 'report_sql'),
- 'get'
+ $OUTPUT->pix_icon('t/add', '', 'moodle', ['class' => 'me-1']) . get_string('addnew', 'report_sql'),
+ ['class' => 'btn btn-secondary']
),
'',
['id' => 'rs-tour-newbutton']
@@ -123,7 +123,8 @@
if (has_capability('report/sql:viewall', $syscontext)) {
$usagebutton = html_writer::link(
new moodle_url('/report/sql/usage.php'),
- get_string('usage:linklabel', 'report_sql'),
+ html_writer::tag('i', '', ['class' => 'fa fa-chart-line me-1', 'aria-hidden' => 'true']) .
+ get_string('usage:linklabel', 'report_sql'),
['class' => 'btn btn-secondary']
);
}
diff --git a/lang/en/report_sql.php b/lang/en/report_sql.php
index c81667f..a5aa861 100644
--- a/lang/en/report_sql.php
+++ b/lang/en/report_sql.php
@@ -367,7 +367,7 @@
$string['repository:unconfigured'] = 'No shared repository is configured. Set one in the plugin settings (Shared report source repository) first.';
$string['roledescription'] = 'Create, edit and publish report sources (report_sql) site-wide. NOTE: authoring allows arbitrary SQL SELECT against the database, so this role grants effectively site-wide data read. Assign only to trusted report builders.';
$string['rolename'] = 'Report author';
-$string['runreport'] = 'Open report';
+$string['runreport'] = 'View report';
$string['samples:coldesc'] = 'Description';
$string['samples:colname'] = 'Name';
$string['samples:colselect'] = 'Import';
diff --git a/query_usage.php b/query_usage.php
index d893a73..573a949 100644
--- a/query_usage.php
+++ b/query_usage.php
@@ -26,22 +26,30 @@
*/
require(__DIR__ . '/../../config.php');
+require_once($CFG->libdir . '/adminlib.php');
use report_sql\local\query;
use report_sql\local\usagestats;
$id = required_param('id', PARAM_INT);
-require_login();
$context = context_system::instance();
-require_capability('report/sql:viewall', $context);
+
+// The listing is the active parent for tabs and breadcrumb, giving: SQL Report > Usage > this report.
+// The usage node is gated by report/sql:viewall, as this page always was.
+navigation_node::override_active_url(new moodle_url('/report/sql/index.php'));
+admin_externalpage_setup(
+ 'report_sql_usage',
+ '',
+ null,
+ new moodle_url('/report/sql/query_usage.php', ['id' => $id])
+);
$q = query::get($id);
$rec = $q->record();
-$PAGE->set_context($context);
-$PAGE->set_url(new moodle_url('/report/sql/query_usage.php', ['id' => $id]));
-$PAGE->set_pagelayout('admin');
+$PAGE->navbar->add(get_string('usage:title', 'report_sql'), new moodle_url('/report/sql/usage.php'));
+$PAGE->navbar->add(format_string($rec->name));
$PAGE->set_title(get_string('usage:detailtitle', 'report_sql', format_string($rec->name)));
$PAGE->set_heading(format_string($rec->name));
diff --git a/samples.php b/samples.php
index 5a956b3..1642a7c 100644
--- a/samples.php
+++ b/samples.php
@@ -33,7 +33,10 @@
require_login();
+// The listing is the active parent, so tabs and the breadcrumb trail run through index.php.
+navigation_node::override_active_url(new moodle_url('/report/sql/index.php'));
admin_externalpage_setup('report_sql_samples');
+$PAGE->navbar->add(get_string('samples:title', 'report_sql'));
$indexurl = new moodle_url('/report/sql/index.php');
diff --git a/settings.php b/settings.php
index d1d07e5..c16d311 100644
--- a/settings.php
+++ b/settings.php
@@ -39,6 +39,16 @@
'report/sql:author',
false
));
+
+ // User documentation, listed beside the index. docs.php sets the index page as the active parent
+ // for navigation and breadcrumb.
+ $ADMIN->add($indexparent, new admin_externalpage(
+ 'report_sql_docs',
+ get_string('userdocs', 'report_sql'),
+ new moodle_url('/report/sql/docs.php'),
+ 'report/sql:author',
+ false
+ ));
}
// Usage overview (read-only, viewall-gated). Registered outside the $hassiteconfig guard for the
diff --git a/styles.css b/styles.css
index 0d18ae4..5692af1 100644
--- a/styles.css
+++ b/styles.css
@@ -65,6 +65,15 @@
height: auto;
}
+/* Docs floating contents: about 30% wider on very wide screens, where the left margin has room.
+ !important is needed to override the inline width set in docs.php. */
+@media (min-width: 1600px) {
+ .rs-docs-toc {
+ /* stylelint-disable-next-line declaration-no-important -- must override the inline width. */
+ width: 23rem !important;
+ }
+}
+
/* Error / warning alerts echo the author's SQL from the DB error. Preserve its linebreaks and
indentation (Bootstrap .alert collapses whitespace by default) so the offending query stays
readable instead of squashing onto one line; word-break keeps a long single line from
diff --git a/usage.php b/usage.php
index 87158e2..3e426cf 100644
--- a/usage.php
+++ b/usage.php
@@ -32,7 +32,10 @@
use core_reportbuilder\system_report_factory;
use report_sql\reportbuilder\local\systemreports\usage;
+// The listing is the active parent, so tabs and the breadcrumb trail run through index.php.
+navigation_node::override_active_url(new moodle_url('/report/sql/index.php'));
admin_externalpage_setup('report_sql_usage');
+$PAGE->navbar->add(get_string('usage:title', 'report_sql'));
$context = context_system::instance();
require_capability('report/sql:viewall', $context);
diff --git a/version.php b/version.php
index fe94924..8752bf5 100644
--- a/version.php
+++ b/version.php
@@ -25,8 +25,8 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'report_sql';
-$plugin->release = 2026091004;
-$plugin->version = 2026091004;
+$plugin->release = 2026091005;
+$plugin->version = 2026091005;
$plugin->requires = 2024100700; // Moodle 4.5 LTS — the Reportbuilder API this plugin uses is stable from 4.5.
$plugin->maturity = MATURITY_ALPHA;
$plugin->supported = [405, 503];