Skip to content
Open
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
7 changes: 7 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

$librenms_base = realpath(__DIR__ . '/../../..');
//this is for the docker version
//$librenms_base = '/opt/librenms/';
$mapdir='configs';
$librenms_url = '/';
63 changes: 30 additions & 33 deletions data-pick.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<?php

require_once 'config.php';
// ******************************************
// sensible defaults
$mapdir='configs';
$ignore_librenms=FALSE;
$config['base_url'] = '/';
$whats_installed = '';

$librenms_base = '../../../';

$weathermap_config = array (
'show_interfaces' => 'all',
'sort_if_by' => 'ifAlias',
Expand Down Expand Up @@ -39,7 +36,7 @@
/* Load Weathermap config defaults, see file for description. */

$init_modules = array('web', 'auth');
require realpath(__DIR__ . '/../../..') . '/includes/init.php';
require $librenms_base . '/includes/init.php';

if (empty($_SESSION['authenticated']) || !isset($_SESSION['authenticated'])) {
header('Location: /');
Expand Down Expand Up @@ -129,18 +126,18 @@ function update_source_step2(graphid)

function filterlist(previous)
{
var filterstring = $('input#filterstring').val();
var filterstring = $('input#filterstring').val();

if(filterstring=='')
{
$('ul#dslist > li').show();
if($('#ignore_desc').is(':checked')) {
$("ul#dslist > li:contains('Desc::')").hide();
}
return;

} else if(filterstring!=previous)
{
{
$('ul#dslist > li').hide();
$("ul#dslist > li:contains('" + filterstring + "')").show();
if($('#ignore_desc').is(':checked')) {
Expand Down Expand Up @@ -229,7 +226,7 @@ function update_source_step1(dataid,name,portid,ifAlias,ifDesc,ifIndex)
self.close();
}
}

function applyDSFilterChange(objForm) {
strURL = '?host_id=' + objForm.host_id.value;
strURL = strURL + '&command=link_step1';
Expand All @@ -252,7 +249,7 @@ function applyDSFilterChange(objForm) {
}
document.location = strURL;
}

</script>
<style type="text/css">
body { font-family: sans-serif; font-size: 10pt; }
Expand All @@ -271,13 +268,13 @@ function applyDSFilterChange(objForm) {
//$SQL_picklist = "select data_local.host_id, data_template_data.local_data_id, data_template_data.name_cache, data_template_data.active, data_template_data.data_source_path from data_local,data_template_data,data_input,data_template where data_local.id=data_template_data.local_data_id and data_input.id=data_template_data.data_input_id and data_local.data_template_id=data_template.id ";

$host_id = $weathermap_config['show_interfaces'];

$overlib = true;
$aggregate = false;

if(isset($_REQUEST['aggregate'])) $aggregate = ( $_REQUEST['aggregate']==0 ? false : true);
if(isset($_REQUEST['overlib'])) $overlib= ( $_REQUEST['overlib']==0 ? false : true);

/* Explicit device_id given? */
if (isset ($_REQUEST['host_id']) and !empty ($_REQUEST['host_id']))
{
Expand All @@ -294,9 +291,9 @@ function applyDSFilterChange(objForm) {
if ($node1_id)
$host_id = $node1_id;
}

//$SQL_picklist .= " order by name_cache;";

// Link query
$result = mysqli_query($link,"SELECT device_id,hostname FROM devices ORDER BY hostname");
//$hosts = mysql_fetch_assoc($result);
Expand All @@ -307,7 +304,7 @@ function applyDSFilterChange(objForm) {
<h3>Pick a data source:</h3>

<form name="mini">
<?php
<?php
if(sizeof($hosts) > 0) {
print 'Host: <select name="host_id" onChange="applyDSFilterChange(document.mini)">';

Expand Down Expand Up @@ -356,7 +353,7 @@ function applyDSFilterChange(objForm) {
$deleted = $queryrows['deleted'] ? " (D)" : "";
echo "<a href=\"#\" onclick=\"update_source_step1('$key')\">". $queryrows['hostname'] . "/" . $queryrows['ifDescr'] . " Desc:" . $queryrows['ifAlias'] . "$deleted</a>";
echo "</li>\n";

$i++;
}
}
Expand Down Expand Up @@ -384,23 +381,23 @@ function applyDSFilterChange(objForm) {
$host_id = -1;
$SQL_picklist = "SELECT `device_id` AS `id`,`hostname` AS `name` FROM devices ORDER BY hostname";
//$SQL_picklist = "SELECT 1,2,'Test','Y','/dsad'";

$overlib = true;
$aggregate = false;

if(isset($_REQUEST['aggregate'])) $aggregate = ( $_REQUEST['aggregate']==0 ? false : true);
if(isset($_REQUEST['overlib'])) $overlib= ( $_REQUEST['overlib']==0 ? false : true);


if(isset($_REQUEST['host_id']))
{
$host_id = intval($_REQUEST['host_id']);
//if($host_id>=0) $SQL_picklist .= " and graph_local.host_id=$host_id ";
}
//$SQL_picklist .= " order by title_cache";
//$SQL_picklist .= " order by title_cache";

$query = mysqli_query($link,"SELECT id,hostname AS name FROM `devices` ORDER BY hostname");
$hosts = mysqli_fetch_assoc($query);
$hosts = mysqli_fetch_assoc($query);

?>
<html>
Expand All @@ -410,16 +407,16 @@ function applyDSFilterChange(objForm) {

function filterlist(previous)
{
var filterstring = $('input#filterstring').val();
var filterstring = $('input#filterstring').val();

if(filterstring=='')
{
$('ul#dslist > li').show();
return;
}

if(filterstring!=previous)
{
{
$('ul#dslist > li').hide();
$("ul#dslist > li:contains('" + filterstring + "')").show();
//$('ul#dslist > li').contains(filterstring).show();
Expand All @@ -444,7 +441,7 @@ function applyDSFilterChange(objForm) {
{
strURL = strURL + "&overlib=0";
}

//if( objForm.aggregate.checked)
//{
// strURL = strURL + "&aggregate=1";
Expand All @@ -455,7 +452,7 @@ function applyDSFilterChange(objForm) {
//}
document.location = strURL;
}

</script>
<script type="text/javascript">

Expand All @@ -480,7 +477,7 @@ function update_source_step1(graphid,name)
opener.document.forms["frmMain"].node_new_name.value = graphid;
opener.document.forms["frmMain"].node_label.value = name;
}
self.close();
self.close();
}
</script>
<style type="text/css">
Expand All @@ -499,7 +496,7 @@ function update_source_step1(graphid,name)
<h3>Pick a graph:</h3>

<form name="mini">
<?php
<?php
if(sizeof($hosts) > 0) {
print 'Host: <select name="host_id" onChange="applyDSFilterChange(document.mini)">';

Expand Down
Loading