Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the statistics/structure_insights backend page by adding a graphical sitemap (SVG-based) with modal zoom/export controls, while also refactoring parts of the data fetching and date handling for structure insights and export functionality.
Changes:
- Added a graphical sitemap panel + modal, rendered client-side from the existing structure table.
- Refactored date parsing to consistently handle SQL datetime strings and UNIX timestamps via
DateTimeImmutable. - Improved export handling by adding an XLS fallback path for the XLSX (ExcelJS) export flow and switched ExcelJS to a bundled asset.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pages/structure_insights.php | Refactors metainfo lookup + date resolution, changes age/latest-edit calculation approach, adds graph panel/modal markup, and enhances export link data attributes. |
| lang/en_gb.lang | Adds i18n strings for the new graphical sitemap UI. |
| lang/de_de.lang | Adds i18n strings for the new graphical sitemap UI. |
| boot.php | Registers new CSS/JS assets for the structure insights graph and switches ExcelJS to a local asset. |
| assets/structure_insights_graph.js | Implements SVG sitemap rendering, modal view, zoom controls, and SVG export. |
| assets/structure_insights_graph.css | Adds styling for the sitemap frame and modal canvas. |
| assets/structure_insights_export.js | Adds XLS fallback download behavior when ExcelJS is unavailable for XLSX export. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| parts.push('<g>'); | ||
| parts.push('<rect x="' + x + '" y="' + y + '" width="' + w + '" height="' + h + '" rx="12" ry="12" fill="' + fill + '" stroke="#223961" stroke-width="3"/>'); | ||
| parts.push('<circle cx="' + (x + 14) + '" cy="' + (y + 14) + '" r="6" fill="' + statusColor + '" stroke="#223961" stroke-width="2"/>'); | ||
| parts.push('<text x="' + (x + 28) + '" y="' + (y + 24) + '" fill="#203556" font-family="Aptos, Segoe UI, sans-serif" font-size="12" font-weight="700">' + escapeXml(kind === 'article' ? 'Artikel' : (kind === 'category' ? 'Kategorie' : 'Root')) + '</text>'); |
Comment on lines
+330
to
+331
| var emptyText = $container.attr('data-empty-text') || 'Keine Daten vorhanden'; | ||
| $container.html('<div class="alert alert-info" style="margin-bottom:0;">' + escapeXml(emptyText) + '</div>'); |
Comment on lines
+272
to
277
| $cutoff = new DateTimeImmutable('-2 years'); | ||
| $sql = rex_sql::factory(); | ||
|
|
||
| $oldCategoryCount = (int) $sql->getValue( | ||
| 'SELECT COUNT(*) FROM ' . rex::getTable('article') | ||
| . ' WHERE clang_id = :clang AND startarticle = 1' | ||
| . ' AND COALESCE(NULLIF(updatedate, ""), createdate) <> ""' | ||
| . ' AND COALESCE(NULLIF(updatedate, ""), createdate) < :cutoff', | ||
| ['clang' => $clangId, 'cutoff' => $cutoff], | ||
| $ageRows = $sql->getArray( | ||
| 'SELECT startarticle, updatedate, createdate FROM ' . rex::getTable('article') . ' WHERE clang_id = :clang', | ||
| ['clang' => $clangId], | ||
| ); |
Comment on lines
471
to
+475
| $xlsxUrl = '#'; | ||
|
|
||
| echo '<div style="margin-bottom:10px;display:flex;gap:8px;">'; | ||
| echo '<a class="btn btn-default js-statistics-structure-export" data-pjax="false" href="' . $csvUrl . '">' . rex_escape($addon->i18n('statistics_structure_export_csv')) . '</a>'; | ||
| echo '<a class="btn btn-default js-statistics-structure-export" data-export-format="xlsx" data-pjax="false" href="' . $xlsxUrl . '">' . rex_escape($addon->i18n('statistics_structure_export_xlsx')) . '</a>'; | ||
| echo '<a class="btn btn-default js-statistics-structure-export" data-export-format="xlsx" data-export-fallback-url="' . $xlsUrl . '" data-pjax="false" href="' . $xlsxUrl . '">' . rex_escape($addon->i18n('statistics_structure_export_xlsx')) . '</a>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.