Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

--- develop ---

* feature: Shorten the graph 'Add to QuickTree' action icon's title to "Add to Quicktree" so it reads cleanly as a label in the Cacti graph drilldown action menu
* bug: Pass a boolean (not the integer 1) to api_plugin_register_hook()'s $enable argument so the hook registration stays type-correct under Cacti 1.3's strict bool type-hint (the int only coerces while the file lacks declare(strict_types=1))
* security: Move the graph 'Add to QuickTree' icon's inline `onClick='addQuickTree()'` handler into a delegated jQuery binding in `js/quicktree.js` (via a `quicktreeAddLink` class and `data-` attributes) and replace the confirmation pages' inline `onClick='cactiReturnTo()'` Cancel buttons with the CSP-safe `cactiReturnTo` class, so the pages no longer trip Cacti's Content-Security-Policy script-src-attr directive
* dev: Replace the translation-template CI check that regenerated locales/po/cacti.pot and compared it with a diff-based gate (tests/bin/check-i18n-pot.php) requiring cacti.pot to be updated only when a pull request adds, removes, or modifies an i18n function call
Expand Down
4 changes: 2 additions & 2 deletions locales/po/cacti.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Cacti \n"
"Report-Msgid-Bugs-To: developers@cacti.net\n"
"POT-Creation-Date: 2026-09-28 16:07-0400\n"
"POT-Creation-Date: 2026-10-12 14:07-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Howard Jones <howie@thingy.com>>\n"
"Language-Team: Howard Jones <howie@thingy.com>\n"
Expand Down Expand Up @@ -205,7 +205,7 @@ msgid "Both Tab and Console Menu"
msgstr ""

#: setup.php
msgid "Add this graph to QuickTree"
msgid "Add to Quicktree"
msgstr ""

#: setup.php
Expand Down
4 changes: 2 additions & 2 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function quicktree_show_tab(): void {

/**
* Hook implementation for Cacti's 'graph_buttons'/'graph_buttons_thumbnails'
* filters. Prints an "Add this graph to QuickTree" icon/link for the
* filters. Prints an "Add to Quicktree" icon/link for the
* current graph, when the user is authorized. Called by Cacti core via
* api_plugin_hook('graph_buttons'/'graph_buttons_thumbnails', ...) while
* rendering a graph's action buttons.
Expand All @@ -216,7 +216,7 @@ function quicktree_graph_buttons($data): void {
$local_graph_id = $data[1]['local_graph_id'];
$rra_id = $data[1]['rra'];

print "<a class='iconLink quicktreeAddLink' data-local-graph-id='$local_graph_id' data-rra-id='$rra_id' title='" . __esc('Add this graph to QuickTree', 'quicktree') . "' href='#'><i class='quicktreeAdd fas fa-plus-circle'></i></a><br>";
print "<a class='iconLink quicktreeAddLink' data-local-graph-id='$local_graph_id' data-rra-id='$rra_id' title='" . __esc('Add to Quicktree', 'quicktree') . "' href='#'><i class='quicktreeAdd fas fa-plus-circle'></i></a><br>";
Comment thread
TheWitness marked this conversation as resolved.
}
}

Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/QuicktreeGraphButtonsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/*
* Coverage for quicktree_graph_buttons(): the 'graph_buttons' hook prints an
* "Add this graph to QuickTree" glyph for the current graph, but only when
* "Add to Quicktree" glyph for the current graph, but only when
* the user is authorized for the quicktree realm.
*/

Expand All @@ -29,6 +29,8 @@
expect($output)->toContain("data-local-graph-id='42'");
expect($output)->toContain("data-rra-id='7'");

// This PR's behavior: the shortened visible action label.
expect($output)->toContain("title='Add to Quicktree'");
Comment thread
TheWitness marked this conversation as resolved.
// The delegated click binding in js/quicktree.js keys off this class, so
// its presence is what actually wires the glyph up once the inline
// handler is gone.
Expand Down
Loading