Provide the user with up-to-date information about the supported version of audioMotionAnalyzer#4753
Provide the user with up-to-date information about the supported version of audioMotionAnalyzer#4753IgorA100 wants to merge 6 commits intoZoneMinder:masterfrom
Conversation
This is necessary to determine whether we are using the analyzer, and if so, what version it is. We will then provide the user with useful information when they are in the Viewing tab.
- Now we only specify the supported analyzer version in one place in the audioMotionAnalyzer.js file - Added translations for three cases: when the analyzer is not installed, the wrong version is installed, or everything is fine.
|
Done |
There was a problem hiding this comment.
Pull request overview
Adds UI messaging on the Monitor “Viewing” tab to inform users whether the installed audioMotionAnalyzer matches the supported version, and provides install/update guidance.
Changes:
- Adds a “WhatDisplayInfo” help text area under the “Show” selector on the Monitor Viewing tab and populates it via JS based on detected analyzer version.
- Exposes new i18n strings for “OK / not installed / wrong version” messaging, plus version template substitution in the UI.
- Loads the
audioMotionAnalyzermodule on the Monitor page and updates bundled help text to avoid hardcoding a specific CDN version.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| web/skins/classic/views/monitor.php | Adds #WhatDisplayInfo placeholder below the “Show” control. |
| web/skins/classic/views/js/monitor.js.php | Exports new translated strings to JS for version-status messaging. |
| web/skins/classic/views/js/monitor.js | Adds version-check logic and template replacement for display under “Show”. |
| web/skins/classic/js/audioMotionAnalyzer.js | Introduces supported-version constant and sets a global “current version” for UI consumption; adjusts custom element registration. |
| web/skins/classic/includes/functions.php | Ensures audioMotionAnalyzer.js is loaded on the Monitor page. |
| web/skins/classic/assets/audioMotion-analyzer/src/help.txt | Generalizes CDN URL instructions to not hardcode a specific version. |
| web/lang/ru_ru.php | Adds RU translations for analyzer version status messages; updates related help text. |
| web/lang/en_gb.php | Adds EN translations for analyzer version status messages; updates related help text. |
| web/includes/lang.php | Changes translate() to convert ~~ into <br/>. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function translate($name) { | ||
| global $SLANG; | ||
| // The isset is more performant | ||
| if ( isset($SLANG[$name]) || array_key_exists($name, $SLANG) ) | ||
| return $SLANG[$name]; | ||
| return preg_replace('/~~/', '<br/>', $SLANG[$name]); | ||
| else | ||
| return $name; | ||
| return preg_replace('/~~/', '<br/>', $name); |
There was a problem hiding this comment.
This changes translate() to always replace ~~ with <br/>, which makes translate() return HTML markup rather than plain text. The existing pattern for handling ~~ line breaks is localized to option-help rendering (e.g., web/ajax/modals/optionhelp.php:21), so this global change can create inconsistent behavior in contexts that expect plain strings (JS alerts, placeholders, htmlspecialchars(translate(...)), etc.). Consider reverting this global behavior change and instead performing the ~~→<br/> conversion only at the specific render sites that use innerHTML (e.g., for the new audioMotion messages).
| 'AudioMotionVersionNotInstalled' => 'Requires audio motion analyzer version "{AudioMotionVersionRequired}" to be installed~~Download link: https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired} or https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}', | ||
| 'AudioMotionVersionWrongVersion' => 'The required analyzer version is "{AudioMotionVersionRequired}", but you have it installed "{AudioMotionVersionInstalled}"~~Download link: https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired} or https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}', |
There was a problem hiding this comment.
The message text says "Download link:" but the URLs are rendered as plain text (and then inserted via innerHTML), so they won’t be clickable links in most browsers. Consider rendering these as actual <a href=...> anchors (ideally created via DOM APIs rather than embedding raw HTML in translations) so they behave like real download links and are keyboard/screen-reader accessible.
| 'AudioMotionVersionNotInstalled' => 'Requires audio motion analyzer version "{AudioMotionVersionRequired}" to be installed~~Download link: https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired} or https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}', | |
| 'AudioMotionVersionWrongVersion' => 'The required analyzer version is "{AudioMotionVersionRequired}", but you have it installed "{AudioMotionVersionInstalled}"~~Download link: https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired} or https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}', | |
| 'AudioMotionVersionNotInstalled' => 'Requires audio motion analyzer version "{AudioMotionVersionRequired}" to be installed~~Download link: <a href="https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired}">https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired}</a> or <a href="https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}">https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}</a>', | |
| 'AudioMotionVersionWrongVersion' => 'The required analyzer version is "{AudioMotionVersionRequired}", but you have it installed "{AudioMotionVersionInstalled}"~~Download link: <a href="https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired}">https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired}</a> or <a href="https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}">https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}</a>', |
Oh, my bad English :( Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
We check for the file's existence, and if it does, we set AUDIO_MOTION_ENABLED = true. Okay, let's do an additional check in case the import fails for some reason. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ON_ANALYZER_VERSION value (monitor.js) https://github.com/ZoneMinder/zoneminder/pull/4753/changes#r3158319956
|
@connortechnology |
When the user is in the Viewing tab on the Monitor page, we'll provide them with useful information about audioMotionAnalyzer (supported version number, download links, etc.).