network-weathermap: Editor on Cacti not working (PHP Weathermap version 1.0.0dev)

Hello. Editor not work correctly. When I open editor, browser console have next error:

ncaught SyntaxError: Unexpected token <
jquery.min.js:2 jQuery.Deferred exception: fromplug is not defined ReferenceError: fromplug is not defined
    at attach_click_events (http://noc/cacti/plugins/weathermap/editor-resources/editor.js:83:5)
    at HTMLDocument.initJS (http://noc/cacti/plugins/weathermap/editor-resources/editor.js:59:9)
    at j (http://noc/cacti/plugins/weathermap/vendor/jquery/dist/jquery.min.js:2:29999)
    at k (http://noc/cacti/plugins/weathermap/vendor/jquery/dist/jquery.min.js:2:30313) undefined
r.Deferred.exceptionHook @ jquery.min.js:2
jquery.min.js:2 jQuery.Deferred exception: imlist is not defined ReferenceError: imlist is not defined
    at HTMLDocument.initJS16 (http://noc/cacti/plugins/weathermap/editor-resources/editor16.js:13:17)
    at j (http://noc/cacti/plugins/weathermap/vendor/jquery/dist/jquery.min.js:2:29999)
    at k (http://noc/cacti/plugins/weathermap/vendor/jquery/dist/jquery.min.js:2:30313) undefined
r.Deferred.exceptionHook @ jquery.min.js:2
jquery.min.js:2 Uncaught ReferenceError: fromplug is not defined
    at attach_click_events (editor.js:83)
    at HTMLDocument.initJS (editor.js:59)
    at j (jquery.min.js:2)
    at k (jquery.min.js:2)
jquery.min.js:2 Uncaught ReferenceError: imlist is not defined
    at HTMLDocument.initJS16 (editor16.js:13)
    at j (jquery.min.js:2)
    at k (jquery.min.js:2)

and on cacti log:

2018/01/31 10:02:35 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/weathermap/weathermap-cacti10-plugin-editor.php: 25 require_once)(/plugins/weathermap/editor.php: 34 main)(/plugins/weathermap/lib/Weathermap/Editor/EditorUI.php: 932 showMainPage)(/plugins/weathermap/lib/Weathermap/Editor/EditorUI.php: 1123 fetch)(/plugins/weathermap/lib/Weathermap/UI/SimpleTemplate.php: 48 include)(/plugins/weathermap/editor-resources/templates/main-oldstyle.php: 28 CactiErrorHandler)(/lib/functions.php: 4516 cacti_debug_backtrace)
--
2018/01/31 10:02:35 - ERROR PHP NOTICE in Plugin 'weathermap': Use of undefined constant host_url - assumed 'host_url' in file: /var/www/data/cacti/plugins/weathermap/editor-resources/templates/main-oldstyle.php on line: 28

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 35 (32 by maintainers)

Commits related to this issue

Most upvoted comments

@howardjones You’re getting things closer so people’s expectations are raising 😉

Ok, now I have link for choose data source and it’s work.

But I have many device name on Cyrillic (russian) my database have utf8mb4 collection and it’s dafault charset for cacti:

image

Agreed (re: error reporting).

Also, a bug in your fix 😉 The value for host_url is a string, so the actual change is:

    var host_url = '<?php echo $host_url ?>';

(with the quotes)

Just testing a slightly wider patch that actually sets the value though 😉

The second can be fixed by editing editor-resources/templates/main-oldstyle.php at line 28 and changing it to:

var host_url = <?php echo $host_url ?>;

However, do note that $host_url or the $tpl->set("host_url"); isn’t actually primed with the correct URL yet (or I’ve missed how it was set).