-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update weathermap to work with modern LibreNMS
- Loading branch information
Showing
6 changed files
with
161 additions
and
199 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,39 @@ | ||
<?php | ||
|
||
namespace LibreNMS\Plugins; | ||
|
||
include_once 'lib/editor.inc.php'; | ||
|
||
class Weathermap { | ||
class Weathermap | ||
{ | ||
public static $name = 'Weathermap'; | ||
|
||
public static function menu() | ||
{ | ||
|
||
public static function menu() { | ||
//Include config | ||
include_once 'config.inc.php'; | ||
include 'config.inc.php'; | ||
|
||
//Parse config files | ||
//Parse config files | ||
$files = list_weathermaps($mapdir); | ||
|
||
//Create submenu | ||
$submenu = ' <ul class="dropdown-menu scrollable-menu">'; | ||
$count = 0; | ||
foreach ($files as $file=>$data) { | ||
$nicefile = htmlspecialchars($file); | ||
$submenu .= ' <li><a href="/plugins/'.get_class().'/'.htmlspecialchars($data['page']).'"><i class="fa fa-map fa-fw fa-lg" aria-hidden="true"></i> '.htmlspecialchars($data['title']).'</a></li>'; | ||
$count ++; | ||
//Create submenu | ||
$submenu = ' <ul class="dropdown-menu scrollable-menu">'; | ||
$count = 0; | ||
foreach ($files as $file => $data) { | ||
$submenu .= ' <li><a href="/plugins/' . self::$name . '/' . htmlspecialchars($data['page']) . '"><i class="fa fa-map fa-fw fa-lg" aria-hidden="true"></i> ' . htmlspecialchars($data['title']) . '</a></li>'; | ||
$count++; | ||
} | ||
$submenu .= ' </ul>'; | ||
$submenu .= ' </ul>'; | ||
|
||
//Display it if not empty | ||
if ($count > 0) { | ||
echo('<li class="dropdown-submenu"><a href="plugin/p='.get_class().'">'.get_class().'</a>'); | ||
echo('<li class="dropdown-submenu"><a href="plugin/p=' . self::$name . '">' . self::$name . '</a>'); | ||
echo $submenu; | ||
echo ('</li>'); | ||
echo('</li>'); | ||
} else { | ||
//Create menu without submenu | ||
echo('<li><a href="plugin/p='.get_class().'">'.get_class().'</a></li>'); | ||
echo('<li><a href="plugin/p=' . self::$name . '">' . self::$name . '</a></li>'); | ||
} | ||
} | ||
} | ||
} | ||
?> |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Hello. I have this error here:
Fatal error: Uncaught Error: Class 'Auth' not found in /opt/librenms/html/plugins/Weathermap/data-pick.php:41 Stack trace: #0 {main} thrown in /opt/librenms/html/plugins/Weathermap/data-pick.php on line 41
The same as in editor.php +38. What's wrong? @murrant