diff --git a/auth_profile.php b/auth_profile.php
index 6eb05122db..1a2829a367 100644
--- a/auth_profile.php
+++ b/auth_profile.php
@@ -233,7 +233,7 @@ function settings() {
if (is_view_allowed('graph_settings') == true) {
if (read_config_option('auth_method') != 0) {
- $settings_user['tree']['default_tree_id']['sql'] = get_graph_tree_array(true);
+ $settings_user['tree']['default_tree_id']['sql'] = get_allowed_trees(false, true);
}
html_start_box( __('User Settings'), '100%', '', '3', 'center', '');
diff --git a/cacti.sql b/cacti.sql
index 9e605fc319..fdc2460e27 100644
--- a/cacti.sql
+++ b/cacti.sql
@@ -1573,12 +1573,13 @@ CREATE TABLE graph_template_input_defs (
--
CREATE TABLE graph_templates (
- id mediumint(8) unsigned NOT NULL auto_increment,
- hash char(32) NOT NULL default '',
- name char(255) NOT NULL default '',
- PRIMARY KEY (id))
- ENGINE=InnoDB
- COMMENT='Contains each graph template name.';
+ `id` mediumint(8) unsigned NOT NULL auto_increment,
+ `hash` char(32) NOT NULL default '',
+ `name` char(255) NOT NULL default '',
+ `multiple` char(2) NOT NULL default '',
+ PRIMARY KEY (`id`),
+ KEY `multiple_name` (`multiple`, `name`)
+) ENGINE=InnoDB COMMENT='Contains each graph template name.';
--
-- Dumping data for table `graph_templates`
@@ -2342,7 +2343,8 @@ CREATE TABLE snmp_query_graph (
snmp_query_id mediumint(8) unsigned NOT NULL default '0',
name varchar(100) NOT NULL default '',
graph_template_id mediumint(8) unsigned NOT NULL default '0',
- PRIMARY KEY (id)
+ PRIMARY KEY (id),
+ KEY `graph_template_id_name` (`graph_template_id`, `name`)
) ENGINE=InnoDB;
--
diff --git a/data_templates.php b/data_templates.php
index 318cef74c8..8546b448ca 100644
--- a/data_templates.php
+++ b/data_templates.php
@@ -247,7 +247,7 @@ function form_save() {
/* push out field mappings for the data collector */
/* its important to delete first due to the possibility that
* the field names were changed */
- db_execute('DELETE FROM poller_data_template_field_mappings
+ db_execute_prepared('DELETE FROM poller_data_template_field_mappings
WHERE data_template_id = ?',
array($data_template_id));
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 3db7a05e6e..e3e05c1ea9 100644
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -3,6 +3,7 @@ Cacti CHANGELOG
1.1.6
-issue#620: The table poller_data_template_field_mappings can get out of sync when manipulating data templates
-issue#622: Can not connect to MySQL over a socket
+-issue: List for creating a Graph type shows already added Graph Templates
1.1.5
-issue#580: Data collection warnings when using cmd.php
@@ -17,6 +18,8 @@ Cacti CHANGELOG
-issue#613: Network Automation, now requires a site or your are unable to save rules
-issue#615: Data Input field length too short for longer scripts
-issue#619: Export logging option in settings no longer used
+-issue#635: Error when saving change to data template
+-issue#637: When displaying tree graphs, use the same layout as preview mode
1.1.4
-issue#524: Reporting not working when Tree branch is device
diff --git a/graph_templates.php b/graph_templates.php
index 1b793c6742..2a1fe513b8 100644
--- a/graph_templates.php
+++ b/graph_templates.php
@@ -100,9 +100,10 @@ function form_save() {
get_filter_request_var('graph_template_graph_id');
/* ==================================================== */
- $save1['id'] = $graph_template_id;
- $save1['hash'] = get_hash_graph_template($graph_template_id);
- $save1['name'] = form_input_validate(get_nfilter_request_var('name'), 'name', '', false, 3);
+ $save1['id'] = $graph_template_id;
+ $save1['hash'] = get_hash_graph_template($graph_template_id);
+ $save1['name'] = form_input_validate(get_nfilter_request_var('name'), 'name', '', false, 3);
+ $save1['multiple'] = isset_request_var('multiple') ? 'on':'';
$save2['id'] = get_nfilter_request_var('graph_template_graph_id');
$save2['local_graph_template_graph_id'] = 0;
diff --git a/graphs_new.php b/graphs_new.php
index d5f830227b..0ca5f700aa 100644
--- a/graphs_new.php
+++ b/graphs_new.php
@@ -535,9 +535,9 @@ function graphs() {
array($host['id']));
if (sizeof($snmp_queries) > 0) {
- foreach ($snmp_queries as $query) {
- print "' . $query['name'] . " \n";
- }
+ foreach ($snmp_queries as $query) {
+ print "' . $query['name'] . " \n";
+ }
}
?>
@@ -618,15 +618,6 @@ function graphs() {
\n
\n";
- $graph_templates = db_fetch_assoc_prepared('SELECT
- gt.id AS graph_template_id,
- gt.name AS graph_template_name
- FROM host_graph AS hg
- INNER JOIN graph_templates AS gt
- ON hg.graph_template_id=gt.id
- WHERE hg.host_id = ?
- ORDER BY gt.name', array(get_request_var('host_id')));
-
if (!isempty_request_var('host_id')) {
$template_graphs = db_fetch_assoc_prepared('SELECT
gl.graph_template_id
@@ -651,6 +642,17 @@ function graphs() {
}
}
+ $graph_templates = db_fetch_assoc_prepared('SELECT
+ gt.id AS graph_template_id,
+ gt.name AS graph_template_name
+ FROM host_graph AS hg
+ INNER JOIN graph_templates AS gt
+ ON hg.graph_template_id=gt.id
+ WHERE hg.host_id = ?
+ ORDER BY gt.name',
+ array(get_request_var('host_id'))
+ );
+
/* create a row for each graph template associated with the host template */
if (sizeof($graph_templates)) {
foreach ($graph_templates as $graph_template) {
@@ -671,11 +673,21 @@ function graphs() {
html_start_box('', '100%', '', '3', 'center', '');
- $available_graph_templates = db_fetch_assoc('SELECT
- graph_templates.id, graph_templates.name
- FROM snmp_query_graph RIGHT JOIN graph_templates
- ON (snmp_query_graph.graph_template_id = graph_templates.id)
- WHERE (((snmp_query_graph.name) Is Null)) ORDER BY graph_templates.name');
+ $available_graph_templates = db_fetch_assoc_prepared('
+ (
+ SELECT graph_templates.id, graph_templates.name
+ FROM graph_templates
+ LEFT JOIN snmp_query_graph
+ ON snmp_query_graph.graph_template_id = graph_templates.id
+ WHERE snmp_query_graph.name IS NULL
+ AND graph_templates.id NOT IN (SELECT graph_template_id FROM host_graph WHERE host_id = ?)
+ AND graph_templates.multiple = ""
+ ) UNION (
+ SELECT id, name FROM graph_templates WHERE multiple = "on"
+ )
+ ORDER BY name',
+ array(get_request_var('host_id'))
+ );
/* create a row at the bottom that lets the user create any graph they choose */
print "
@@ -756,8 +768,8 @@ function graphs() {
$cg_ctr = 0;
if (sizeof($created_graphs)) {
foreach ($created_graphs as $created_graph) {
- $script .= (($cg_ctr > 0) ? ',' : '') . "'" . encode_data_query_index($created_graph['snmp_index']) . "'";
- $cg_ctr++;
+ $script .= ($cg_ctr > 0 ? ',' : '') . "'" . encode_data_query_index($created_graph['snmp_index']) . "'";
+ ++$cg_ctr;
}
}
@@ -769,9 +781,6 @@ function graphs() {
if ($xml_array != false) {
$html_dq_header = '';
- $snmp_query_indexes = array();
-
- reset($xml_array['fields']);
/* if there is a where clause, get the matching snmp_indexes */
$sql_where = '';
diff --git a/include/global.php b/include/global.php
index 2669d3d189..c4f5b07d75 100644
--- a/include/global.php
+++ b/include/global.php
@@ -348,5 +348,5 @@ if ($is_web) {
api_plugin_hook('config_insert');
/* current cacti version */
-$config['cacti_version'] = '1.1.5';
+$config['cacti_version'] = '1.1.6';
diff --git a/include/global_arrays.php b/include/global_arrays.php
index efbc461842..d5fc366dcd 100644
--- a/include/global_arrays.php
+++ b/include/global_arrays.php
@@ -965,6 +965,7 @@ $hash_version_codes = array(
'1.1.3' => '0100',
'1.1.4' => '0100',
'1.1.5' => '0100',
+ '1.1.6' => '0101',
);
$hash_type_names = array(
diff --git a/include/global_form.php b/include/global_form.php
index 3f5c157805..6deb78e5e8 100644
--- a/include/global_form.php
+++ b/include/global_form.php
@@ -933,6 +933,14 @@ $fields_graph_template_template_edit = array(
'max_length' => '150',
'size' => '80'
),
+ 'multiple' => array(
+ 'method' => 'checkbox',
+ 'friendly_name' => __('Multiple Instances'),
+ 'description' => __('Check this checkbox if there can be more than one Graph of this type per Device.'),
+ 'value' => '|arg1:multiple|',
+ 'default' => '',
+ 'form_id' => false
+ ),
'graph_template_id' => array(
'method' => 'hidden_zero',
'value' => '|arg2:graph_template_id|'
@@ -1531,6 +1539,11 @@ $fields_user_user_edit_host = array(
);
$export_types = array(
+ 'host_template' => array(
+ 'name' => __('Device Template'),
+ 'title_sql' => 'SELECT name FROM host_template WHERE id=|id|',
+ 'dropdown_sql' => 'SELECT id,name FROM host_template ORDER BY name'
+ ),
'graph_template' => array(
'name' => __('Graph Template'),
'title_sql' => 'SELECT name FROM graph_templates WHERE id=|id|',
@@ -1541,15 +1554,25 @@ $export_types = array(
'title_sql' => 'SELECT name FROM data_template WHERE id=|id|',
'dropdown_sql' => 'SELECT id,name FROM data_template ORDER BY name'
),
- 'host_template' => array(
- 'name' => __('Device Template'),
- 'title_sql' => 'SELECT name FROM host_template WHERE id=|id|',
- 'dropdown_sql' => 'SELECT id,name FROM host_template ORDER BY name'
- ),
'data_query' => array(
'name' => __('Data Query'),
'title_sql' => 'SELECT name FROM snmp_query WHERE id=|id|',
'dropdown_sql' => 'SELECT id,name FROM snmp_query ORDER BY name'
+ ),
+ 'automation_devices' => array(
+ 'name' => __('Discovery Rules'),
+ 'title_sql' => 'SELECT CONCAT(ht.name, " (", at.sysDescr, ")") AS name FROM automation_templates AS at INNER JOIN host_template AS ht ON ht.id=at.host_template WHERE at.id=|id|',
+ 'dropdown_sql' => 'SELECT at.id, CONCAT(ht.name, " (", at.sysDescr, ")") AS name FROM automation_templates AS at INNER JOIN host_template AS ht ON ht.id=at.host_template ORDER BY name'
+ ),
+ 'automation_graphs' => array(
+ 'name' => __('Graph Rules'),
+ 'title_sql' => 'SELECT name FROM automation_graph_rules WHERE id=|id|',
+ 'dropdown_sql' => 'SELECT id, name FROM automation_graph_rules ORDER BY name'
+ ),
+ 'automation_trees' => array(
+ 'name' => __('Tree Rules'),
+ 'title_sql' => 'SELECT name FROM automation_tree_rules WHERE id=|id|',
+ 'dropdown_sql' => 'SELECT id, name FROM automation_tree_rules ORDER BY name'
)
);
diff --git a/include/layout.js b/include/layout.js
index 64bba41063..166c56b237 100644
--- a/include/layout.js
+++ b/include/layout.js
@@ -44,6 +44,9 @@ var columnsHidden = 0;
var lastColumnsHidden = {};
var lastWidth = {};
var lastMain = 0;
+var resizeDelta = 100;
+var resizeTime = 0;
+var resizeTimeout = false;
var isMobile = {
Android: function() {
@@ -589,7 +592,7 @@ function applySkin() {
});
$.when.apply(this, showPage).done(function() {
- responsiveMenu(null);
+ responsiveUI(null);
});
}
@@ -621,15 +624,33 @@ function setupResponsiveMenuAndTabs() {
});
$(window).resize(function(event) {
- responsiveMenu(event);
+ resizeTime = new Date();
+ myEvent = event;
+ if (resizeTimeout === false) {
+ resizeTimeout = true;
+ setTimeout(function() {
+ responsiveUI(myEvent);
+ }, resizeDelta);
+ }
});
$(window).on('orientationchange', function() {
- responsiveMenu(null);
+ responsiveUI(null);
});
}
-function responsiveMenu(event) {
+function responsiveUI(event) {
+ if (new Date() - resizeTime < resizeDelta) {
+ myEvent = event;
+ setTimeout(function() {
+ responsiveUI(myEvent);
+ }, resizeDelta);
+
+ return false;
+ } else {
+ resizeTimeout = false;
+ }
+
if ($('.cactiTreeNavigationArea').length > 0) {
tree = true;
}else{
@@ -646,7 +667,7 @@ function responsiveMenu(event) {
mainWidth = $('#main').width();
}
- if ($(window).width() < 780) {
+ if ($(window).width() < 640) {
menuHide(tree);
menuHideResponsive = true;
}else if (menuHideResponsive == true) {
@@ -662,6 +683,33 @@ function responsiveMenu(event) {
menuShow(tree);
}
+ mainWidth = $('#main').width();
+
+ /* change textbox and textarea widths */
+ if (event != null) {
+ $('input[type="text"], textarea').each(function() {
+ //console.log('Main:'+mainWidth+', Element:'+$(this).attr('id')+', Width:'+$(this).width());
+
+ if ($(this).attr('type') == 'text') {
+ offset = 20;
+ }else{
+ offset = 5;
+ }
+
+ if (mainWidth != 100) {
+ if ($(this).width() > mainWidth) {
+ $(this).css('max-width', (mainWidth - offset)+'px');
+ }else{
+ $(this).css('max-width', '');
+ }
+
+ if ($(this).width() > mainWidth) {
+ $(this).css('max-width', (mainWidth - offset)+'px');
+ }
+ }
+ });
+ }
+
if (event != null && !$(event.target).hasClass('ui-resizable')) {
height = Math.max(document.body.scrollHeight, $(window).height());
if (tree) {
@@ -718,7 +766,7 @@ function tuneTable(object, width) {
minColumns = 2;
}
- $($(object).find('th').get().reverse()).each(function() {
+ $($(object).find('th').not('.noHide').get().reverse()).each(function() {
if (!$(this).hasClass('tableSubHeaderCheckbox') && $(this).is(':visible')) {
reducedWidth += parseInt($(this).width());
$('#'+id+' th:nth-child('+column+')').hide();
@@ -991,13 +1039,13 @@ function setupCollapsible() {
id=$(this).attr('id')+'_cs';
if ($(this).find('i').hasClass('fa-angle-double-up')) {
$(this).addClass('collapsed');
- $(this).nextUntil('tr.spacer').slideUp('slow');
+ $(this).nextUntil('div.spacer').slideUp('slow');
$(this).find('i').removeClass('fa-angle-double-up').addClass('fa-angle-double-down');
storage.set(id, 'hide');
}else{
$(this).removeClass('collapsed');
- $(this).nextUntil('tr.spacer').slideDown('slow');
- $(this).nextUntil('tr.spacer').each(function(data) {
+ $(this).nextUntil('div.spacer').slideDown('slow');
+ $(this).nextUntil('div.spacer').each(function(data) {
$(this).find('input, select').change();
});
$(this).find('i').removeClass('fa-angle-double-down').addClass('fa-angle-double-up');
@@ -1280,7 +1328,7 @@ $(function() {
});
}
- responsiveMenu(null);
+ responsiveUI(null);
});
/* Graph related javascript functions */
diff --git a/include/themes/classic/main.css b/include/themes/classic/main.css
index 3d1629b2a4..c605cd8405 100755
--- a/include/themes/classic/main.css
+++ b/include/themes/classic/main.css
@@ -11,6 +11,15 @@ body, table, tr, td, textarea {
font-size: 10px;
}
+textarea {
+ padding: 5px;
+ width: 400px;
+ height: 100px;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
+
body {
background-color: #ffffff;
background-repeat: repeat-y;
@@ -23,7 +32,7 @@ table {
}
td, th, select {
- padding: 2px;
+ padding: 0px;
margin: 0px;
}
@@ -62,6 +71,17 @@ th .fa {
height: 100%;
}
+input {
+ padding: 0.4em;
+ font-size: 12px;
+ max-width: 400px;
+}
+
+select {
+ padding: 0.5em 0.5em 0.5em 0.5em;
+ font-size: 12px;
+}
+
tr.selected {
background-color: khaki;
}
@@ -84,6 +104,8 @@ label {
.center {
text-align:center !important;
+ margin-left:auto;
+ margin-right:auto;
}
.usermenudown {
@@ -146,6 +168,10 @@ label {
}
.running {
+ color:orange;
+}
+
+.errored {
color:red;
font-weight:bold;
}
@@ -646,6 +672,7 @@ ul#breadcrumbs {
}
.cactiContent {
+ clear: both;
width: 100%;
height: 100%;
vertical-align: top;
@@ -790,7 +817,7 @@ legend {
float: right;
margin-top: 1px;
margin-left: 3px;
- display: table-cell;
+ display: table-column;
}
.actionsDropdownArrow {
@@ -999,7 +1026,7 @@ legend {
text-align: left;
padding: 2px 0px;
height: 16px;
- display: table-cell;
+ display: table-column;
width: 90%;
background-color: #00438c;
}
@@ -1008,7 +1035,7 @@ legend {
float: right;
padding: 2px 0px;
height: 16px;
- display: table-cell;
+ display: table-column;
text-align: right;
width: 10%;
background-color: #00438c;
@@ -1030,13 +1057,131 @@ legend {
.filterTable td:first-child {
width:55px;
+ min-width:55px;
}
-.formItemDescription {
+.filterTable td {
+ padding: 2px;
}
-.formItemName {
+.formRow {
+ display: table;
+ width: 100%;
+ line-height: 30px;
+}
+
+.formColumn {
+ float: left;
+ display: table-column;
+}
+
+.formColumnLeft {
+ float: left;
+ display: table-column;
+ padding-left: 4px;
+ width: 28%;
+}
+
+.formColumnRight {
+ float: left;
+ display: table-column;
+ width: 70%;
+}
+
+.formData {
+ display: inline-block;
+ float: left;
+}
+
+.formFieldName {
+ display: inline-block;
+ color: #444;
+ float: left;
+ text-align: left;
+ white-space: nowrap;
+}
+
+.formFieldDescription {
+ float: left;
+ text-align: left;
+}
+
+.formTooltip {
+ display: inline-block;
+ padding-left: 4px;
+}
+
+.formHeader {
+ float: left;
+ width: 100%;
+ text-align: left;
+ line-height: 20px;
+ color: #ffffff;
font-weight:bold;
+ cursor: pointer;
+ vertical-align:middle;
+ text-align:left;
+ border-right: 1px groove #efefef;
+ font-size:11px;
+ background-color: #6d88ad !important;
+}
+
+.formHeaderText {
+ padding-left: 3px;
+}
+
+.formHeaderAnchor {
+ float:right;
+ padding-right:4px;
+}
+
+.hostInfoHeader {
+ width: 100%;
+}
+
+@media screen and (max-width: 640px) {
+ .formRow {
+ display: table;
+ width: 100%;
+ line-height: 30px;
+ }
+
+ .formColumn {
+ float: left;
+ display: table-row;
+ }
+
+ .formColumnLeft {
+ float: left;
+ display: table-row;
+ width: 100%;
+ }
+
+ .formColumnRight {
+ float: left;
+ display: table-row;
+ width: 100%;
+}
+
+ .formFieldName {
+ color: #444;
+ float: left;
+ text-align: left;
+ white-space: nowrap;
+ }
+
+ .formData {
+ float: left;
+ }
+
+ .hostInfoHeader {
+ overflow: hidden;
+ }
+
+ .queryAdd, .templateAdd, .navBar, #ping_results {
+ display: none;
+}
+
}
.graphItem {
@@ -1106,6 +1251,7 @@ legend {
vertical-align:middle;
text-align:left;
cursor:pointer;
+ padding-left: 3px;
}
.graphSubHeaderColumn {
@@ -1318,7 +1464,7 @@ legend {
float:left !important;
padding:5px 4px;
text-decoration:none;
- font-size: 11px;
+ font-size: 9px;
border-color: #999 #666 !important;
border-style: solid solid none;
border-width: 1px 1px medium;
@@ -1329,6 +1475,9 @@ div#tabs {
padding-bottom: 0px;
float: left;
vertical-align: bottom;
+ height: 38px;
+ overflow: hidden;
+ width: 60%;
}
td#tabs {
@@ -1347,6 +1496,8 @@ div#gtabs {
padding-bottom: 0px;
vertical-align: bottom;
float:right;
+ height: 38px;
+ overflow: hidden;
}
.tabs {
diff --git a/include/themes/dark/main.css b/include/themes/dark/main.css
index dd0e102706..a45b818f26 100644
--- a/include/themes/dark/main.css
+++ b/include/themes/dark/main.css
@@ -19,12 +19,12 @@ html, body {
height: 100%;
width: 100%;
margin: 0px;
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body {
background: #161616 none repeat scroll 0 0;
color: #bbbfc2;
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 12px;
}
@@ -40,6 +40,11 @@ textarea {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 1.0em;
padding: 5px;
+ width: 400px;
+ height: 100px;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
}
table {
@@ -49,7 +54,7 @@ table {
}
td, th {
- padding: 2px;
+ padding: 0px;
margin: 0px;
}
@@ -96,7 +101,13 @@ th i.fa {
z-index: 3;
}
-input, select {
+input {
+ padding: 0.5em 0.5em 0.5em 0.5em;
+ font-size: 12px;
+ max-width: 400px;
+}
+
+select {
padding: 0.5em 0.5em 0.5em 0.5em;
font-size: 12px;
}
@@ -1131,6 +1142,7 @@ legend {
color: snow;
font-weight: normal;
padding: 2px;
+ white-space: nowrap;
}
.cactiTable {
@@ -1156,6 +1168,10 @@ legend {
background: linear-gradient(to bottom, #252426 0%, #0C0D0D 100%);
}
+.cactiTableTitle span {
+ padding-left: 3px;
+}
+
.cactiTableButton {
float: right;
padding: 5px 0px;
@@ -1184,11 +1200,119 @@ legend {
min-width:55px;
}
-.formItemDescription {
+.filterTable td {
+ padding: 2px;
}
-.formItemName {
- color:snow;
+.formRow {
+ display: table;
+ width: 100%;
+ line-height: 35px;
+}
+
+.formColumn {
+ float: left;
+ display: table-column;
+}
+
+.formColumnLeft {
+ float: left;
+ display: table-column;
+ width: 30%;
+}
+
+.formColumnRight {
+ float: left;
+ display: table-column;
+ width: 70%;
+}
+
+.formData {
+ display: inline-block;
+ float: left;
+}
+
+.formFieldName {
+ display: inline-block;
+ color: snow;
+ float: left;
+ text-align: left;
+ white-space: nowrap;
+ padding-left: 3px;
+}
+
+.formFieldDescription {
+ float: left;
+ text-align: left;
+}
+
+.formTooltip {
+ display: inline-block;
+}
+
+.formHeader {
+ float: left;
+ width: 100%;
+ text-align: left;
+ line-height: 25px;
+ background: -moz-linear-gradient(top, #45484d 0%, #000000 100%); /* FF3.6+ */
+ background: -webkit-linear-gradient(top, #45484d 0%,#000000 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #45484d 0%,#000000 100%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, #45484d 0%,#000000 100%); /* IE10+ */
+}
+
+.formHeaderAnchor {
+ float:right;
+ padding-right:4px;
+}
+
+.hostInfoHeader {
+ width: 100%;
+}
+
+@media screen and (max-width: 640px) {
+ .formRow {
+ display: table;
+ width: 100%;
+ line-height: 30px;
+ }
+
+ .formColumn {
+ float: left;
+ display: table-row;
+ }
+
+ .formColumnLeft {
+ float: left;
+ display: table-row;
+ width: 100%;
+ }
+
+ .formColumnRight {
+ float: left;
+ display: table-row;
+ width: 100%;
+ }
+
+ .formFieldName {
+ color: snow;
+ float: left;
+ text-align: left;
+ white-space: nowrap;
+ padding-left: 3px;
+ }
+
+ .formData {
+ float: left;
+ }
+
+ .hostInfoHeader {
+ overflow: hidden;
+ }
+
+ .queryAdd, .templateAdd, .navBar, #ping_results {
+ display: none;
+ }
}
.graphItem {
@@ -1271,6 +1395,7 @@ th.secondarySort {
vertical-align:middle;
text-align:left;
cursor:pointer;
+ padding-left: 3px;
}
.graphSubHeaderColumn {
@@ -1540,6 +1665,7 @@ div#tabs {
vertical-align: bottom;
position: fixed;
top: 5px;
+ width: 70%;
}
td#tabs {
@@ -1566,6 +1692,11 @@ div#gtabs {
height: 30px;
}
+.maintabs {
+ overflow: hidden;
+ height: 25px;
+}
+
.tabs a, .maintabs a {
-moz-border-radius:5px 5px 0 0;
border-radius:5px 5px 0 0;
@@ -1764,6 +1895,10 @@ ul#nav {
border: transparent;
}
+.ui-button-text-only .ui-button-text {
+ padding: 0.4em;
+}
+
div.preformatted {
color: snow !important;
font-size: 11px !important;
diff --git a/include/themes/dark/main.js b/include/themes/dark/main.js
index 1666f92f52..de1dbb914c 100644
--- a/include/themes/dark/main.js
+++ b/include/themes/dark/main.js
@@ -82,6 +82,8 @@ function themeReady() {
$('.import_text').html(fileText);
}
+ maxWidth = 280;
+
$('select').each(function() {
if ($(this).prop('multiple') != true) {
$(this).selectmenu({
@@ -104,7 +106,12 @@ function themeReady() {
});
minWidth+=80;
- $('#'+id+'-button').css('min-width', minWidth+'px').css('max-width', '400px').css('width','');
+
+ if (minWidth > maxWidth) {
+ minWidth = maxWidth;
+ }
+
+ $('#'+id+'-button').css('min-width', minWidth+'px').css('max-width', maxWidth+'px').css('width','');
$('#'+id+'-menu').css('max-height', '250px');
});
}else{
diff --git a/include/themes/modern/main.css b/include/themes/modern/main.css
index 00f1255c85..f3c59b19d4 100755
--- a/include/themes/modern/main.css
+++ b/include/themes/modern/main.css
@@ -1,5 +1,20 @@
/* main styles */
+::-webkit-scrollbar {
+ width: 8px;
+}
+
+::-webkit-scrollbar-track {
+ -webkit-box-shadow: inset 0 0 6px rgba(22,22,6,0.7);
+ border-radius: 6px;
+}
+
+::-webkit-scrollbar-thumb {
+ border-radius: 6px;
+ background: rgba(49,68,43,0.8);
+ -webkit-box-shadow: inset 0 0 4px rgba(49,68,43,0.5);
+}
+
html, body {
height: 100%;
width: 100%;
@@ -14,6 +29,15 @@ body, table, tr, td, textarea {
color: #000000;
}
+textarea {
+ padding: 5px;
+ width: 400px;
+ height: 100px;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
+
body {
background-color: snow;
background-repeat: repeat-y;
@@ -26,7 +50,7 @@ table {
}
td, th {
- padding: 2px;
+ padding: 0px;
margin: 0px;
}
@@ -35,6 +59,16 @@ img {
vertical-align:middle;
}
+fieldset {
+ border: none;
+ padding: 0px;
+ margin: 0px;
+}
+
+.reindex_methods span {
+ font-size: 9px;
+}
+
/* links */
a, a:active, a:visited {
@@ -62,8 +96,15 @@ th i.fa {
z-index: 3;
}
-input, select {
- padding: 0.4em 0.4em 0.4em 0.4em;
+input {
+ padding: 0.4em;
+ font-size: 12px;
+ max-width: 400px;
+}
+
+select {
+ padding: 0.5em 0.5em 0.5em 0.5em;
+ font-size: 12px;
}
*:focus {
@@ -74,15 +115,6 @@ label {
white-space:nowrap;
}
-fieldset {
- border: none;
- padding: 0px;
- margin: 0px;
-}
-
-.reindex_methods span {
- font-size: 9px;
-}
.nowrap {
white-space:nowrap;
@@ -102,6 +134,8 @@ fieldset {
.center {
text-align:center !important;
+ margin-left:auto;
+ margin-right:auto;
}
.usermenudown {
@@ -170,6 +204,10 @@ fieldset {
}
.running {
+ color:orange;
+}
+
+.errored {
color:red;
}
@@ -708,6 +746,7 @@ ul#breadcrumbs {
}
.cactiContent {
+ clear: both;
width: 100%;
vertical-align: top;
padding-top: 56px;
@@ -1080,7 +1119,6 @@ legend {
background: -o-linear-gradient(top, rgba(76,76,76,1) 0%, rgba(89,89,89,1) 12%, rgba(102,102,102,1) 25%, rgba(71,71,71,1) 39%, rgba(44,44,44,1) 50%, rgba(0,0,0,1) 51%, rgba(17,17,17,1) 60%, rgba(43,43,43,1) 76%, rgba(28,28,28,1) 91%, rgba(19,19,19,1) 100%);
background: -ms-linear-gradient(top, rgba(76,76,76,1) 0%, rgba(89,89,89,1) 12%, rgba(102,102,102,1) 25%, rgba(71,71,71,1) 39%, rgba(44,44,44,1) 50%, rgba(0,0,0,1) 51%, rgba(17,17,17,1) 60%, rgba(43,43,43,1) 76%, rgba(28,28,28,1) 91%, rgba(19,19,19,1) 100%);
background: linear-gradient(to bottom, rgba(76,76,76,1) 0%, rgba(89,89,89,1) 12%, rgba(102,102,102,1) 25%, rgba(71,71,71,1) 39%, rgba(44,44,44,1) 50%, rgba(0,0,0,1) 51%, rgba(17,17,17,1) 60%, rgba(43,43,43,1) 76%, rgba(28,28,28,1) 91%, rgba(19,19,19,1) 100%);
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4c4c4c', endColorstr='#131313', GradientType=0 );
}
.templateHeader td {
@@ -1169,13 +1207,128 @@ legend {
.filterTable td:first-child {
width:55px;
+ min-width:55px;
}
-.formItemDescription {
+.filterTable td {
+ padding: 2px;
}
-.formItemName {
- font-weight:normal;
+.formRow {
+ display: table;
+ width: 100%;
+ line-height: 30px;
+}
+
+.formColumn {
+ float: left;
+ display: table-column;
+}
+
+.formColumnLeft {
+ float: left;
+ display: table-column;
+ width: 30%;
+}
+
+.formColumnRight {
+ float: left;
+ display: table-column;
+ width: 70%;
+}
+
+.formData {
+ display: inline-block;
+ float: left;
+}
+
+.formFieldName {
+ display: inline-block;
+ color: #444;
+ float: left;
+ text-align: left;
+ white-space: nowrap;
+ padding-left: 3px;
+}
+
+.formFieldDescription {
+ float: left;
+ text-align: left;
+}
+
+.formTooltip {
+ display: inline-block;
+ padding-left: 4px;
+}
+
+.formHeader {
+ float: left;
+ width: 100%;
+ text-align: left;
+ line-height: 20px;
+ background: rgba(138,179,105,1);
+ background: -moz-linear-gradient(top, rgba(138,179,105,1) 0%, rgba(63,117,15,1) 100%);
+ background: -webkit-linear-gradient(top, rgba(138,179,105,1) 0%, rgba(63,117,15,1) 100%);
+ background: -o-linear-gradient(top, rgba(138,179,105,1) 0%, rgba(63,117,15,1) 100%);
+ background: -ms-linear-gradient(top, rgba(138,179,105,1) 0%, rgba(63,117,15,1) 100%);
+}
+
+.formHeaderText {
+ padding-left: 3px;
+}
+
+.formHeaderAnchor {
+ float:right;
+ padding-right:4px;
+}
+
+.hostInfoHeader {
+ width: 100%;
+}
+
+@media screen and (max-width: 640px) {
+ .formRow {
+ display: table;
+ width: 100%;
+ line-height: 30px;
+ }
+
+ .formColumn {
+ float: left;
+ display: table-row;
+ }
+
+ .formColumnLeft {
+ float: left;
+ display: table-row;
+ width: 100%;
+ }
+
+ .formColumnRight {
+ float: left;
+ display: table-row;
+ width: 100%;
+ }
+
+ .formFieldName {
+ color: #444;
+ float: left;
+ text-align: left;
+ white-space: nowrap;
+ padding-left: 3px;
+ }
+
+ .formData {
+ float: left;
+ }
+
+ .hostInfoHeader {
+ overflow: hidden;
+ }
+
+ .queryAdd, .templateAdd, .navBar, #ping_results {
+ display: none;
+ }
}
.graphItem {
@@ -1278,7 +1431,7 @@ th.secondarySort {
background: linear-gradient(to bottom, rgba(138,179,105,1) 0%, rgba(63,117,15,1) 100%);
}
-.formRow {
+.tableRow {
line-height: 20px;
}
@@ -1567,6 +1720,11 @@ div#gtabs {
height: 30px;
}
+.maintabs {
+ overflow: hidden;
+ height: 25px;
+}
+
.tabs a, .maintabs a {
-moz-border-radius:5px 5px 0 0;
border-radius:5px 5px 0 0;
@@ -1790,6 +1948,10 @@ ul#nav {
border: transparent;
}
+.ui-button-text-only .ui-button-text {
+ padding: 0.4em;
+}
+
div.preformatted {
font-family: monospace;
white-space: pre;
diff --git a/include/themes/modern/main.js b/include/themes/modern/main.js
index fda795a3e8..e8d0c5ba36 100644
--- a/include/themes/modern/main.js
+++ b/include/themes/modern/main.js
@@ -73,6 +73,8 @@ function themeReady() {
$('.import_text').html(fileText);
}
+ maxWidth = 280;
+
$('select').each(function() {
if ($(this).prop('multiple') != true) {
$(this).selectmenu({
@@ -95,7 +97,12 @@ function themeReady() {
});
minWidth+=80;
- $('#'+id+'-button').css('min-width', minWidth+'px').css('max-width', '400px').css('width','');
+
+ if (minWidth > maxWidth) {
+ minWidth = maxWidth;
+ }
+
+ $('#'+id+'-button').css('min-width', minWidth+'px').css('max-width', maxWidth+'px').css('width','');
$('#'+id+'-menu').css('max-height', '250px');
});
}else{
diff --git a/include/themes/paper-plane/main.css b/include/themes/paper-plane/main.css
index 49f5290ead..8daa92e201 100644
--- a/include/themes/paper-plane/main.css
+++ b/include/themes/paper-plane/main.css
@@ -36,6 +36,16 @@ img {
vertical-align:middle;
}
+fieldset {
+ border: none;
+ padding: 0px;
+ margin: 0px;
+}
+
+.reindex_methods span {
+ font-size: 9px;
+}
+
/* links */
a, a:active, a:visited {
@@ -91,15 +101,6 @@ label {
white-space:nowrap;
}
-fieldset {
- border: none;
- padding: 0px;
- margin: 0px;
-}
-
-.reindex_methods span {
- font-size: 9px;
-}
.nowrap {
white-space:nowrap;
@@ -502,7 +503,7 @@ fieldset {
border: none;
}
-.odd.formRow{
+.odd.tableRow{
color: #000000;
background: none repeat scroll 0 0 #fbfdff;
}
@@ -511,7 +512,7 @@ fieldset {
border: none;
}
-.even.formRow{
+.even.tableRow{
color: #000000;
background: none repeat scroll 0 0 #FFFFFF;
}
@@ -522,12 +523,12 @@ fieldset {
#box-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
}
-.even-alternate.formRow{
+.even-alternate.tableRow{
color: #000000;
background: none repeat scroll 0 0 #FFFFFF;
}
-.formRow {
+.tableRow {
padding: 4px 5px !important;
}
@@ -996,11 +997,11 @@ legend {
background: none !important;
}
-#graph_view_preview2 .formRow{
+#graph_view_preview2 .tableRow{
background: none !important;
}
-#graph_view_tree_content2 .formRow{
+#graph_view_tree_content2 .tableRow{
background: none !important;
}
@@ -1183,13 +1184,125 @@ table.cactiTable {
.filterTable td:first-child {
width:55px;
+ min-width:55px;
}
-.formItemDescription {
+.filterTable td {
+ padding: 2px;
}
-.formItemName {
- font-weight:bold;
+.formRow {
+ display: table;
+ width: 100%;
+ line-height: 35px;
+}
+
+.formColumn {
+ float: left;
+ display: table-column;
+}
+
+.formColumnLeft {
+ float: left;
+ display: table-column;
+ width: 30%;
+}
+
+.formColumnRight {
+ float: left;
+ display: table-column;
+ width: 70%;
+}
+
+.formData {
+ display: inline-block;
+ float: left;
+}
+
+.formFieldName {
+ display: inline-block;
+ color: snow;
+ float: left;
+ text-align: left;
+ white-space: nowrap;
+ padding-left: 3px;
+}
+
+.formFieldDescription {
+ float: left;
+ text-align: left;
+}
+
+.formTooltip {
+ display: inline-block;
+}
+
+.formHeader {
+ float: left;
+ width: 100%;
+ text-align: left;
+ line-height: 25px;
+ text-transform: none;
+ background-image: -webkit-linear-gradient(top, #3a3b3c 0%, #100000 100%);
+ background-image: -moz-linear-gradient(top, #3a3b3c 0%, #100000 100%);
+ background-image: linear-gradient(to bottom, #3a3b3c 0%, #100000 100%);
+ background-repeat: repeat-x;
+ border-bottom: 1px solid #000;
+}
+
+.formHeaderAnchor {
+ float:right;
+ padding-right:4px;
+}
+
+.hostInfoHeader {
+ width: 100%;
+}
+
+@media screen and (max-width: 640px) {
+ .formRow {
+ display: table;
+ width: 100%;
+ line-height: 30px;
+ }
+
+ .formColumn {
+ float: left;
+ display: table-row;
+ }
+
+ .formColumnLeft {
+ float: left;
+ display: table-row;
+ width: 100%;
+ }
+
+ .formColumnRight {
+ float: left;
+ display: table-row;
+ width: 100%;
+ }
+
+ .formFieldName {
+ color: snow;
+ color: #000000;
+ float: left;
+ text-align: left;
+ white-space: nowrap;
+ padding-left: 3px;
+ }
+
+ .formData {
+ float: left;
+ }
+
+ .hostInfoHeader {
+ overflow: hidden;
+ }
+
+ .queryAdd, .templateAdd, .navBar, #ping_results {
+ display: none;
+ }
}
.graphItem {
@@ -1593,8 +1706,9 @@ div#gtabs {
.maintabs {
line-height: 32px;
float: left;
- width:50%;
- overflow:hidden;
+ width: 50%;
+ overflow: hidden;
+ height: 32px;
}
.maintabs a {
@@ -2012,4 +2126,4 @@ tr#realtime td:first-child {
.hostInfoHeader {
background: none repeat scroll 0 0 #fbfdff;
-}
\ No newline at end of file
+}
diff --git a/include/themes/paw/jquery-ui.css b/include/themes/paw/jquery-ui.css
index 275d9e1967..9df62f879c 100644
--- a/include/themes/paw/jquery-ui.css
+++ b/include/themes/paw/jquery-ui.css
@@ -637,6 +637,7 @@ button.ui-button::-moz-focus-inner {
position: relative;
text-decoration: none;
cursor: pointer;
+ vertical-align: middle;
}
.ui-selectmenu-button span.ui-icon {
right: 0.5em;
diff --git a/include/themes/paw/main.css b/include/themes/paw/main.css
index 6c913bdadc..5735712030 100644
--- a/include/themes/paw/main.css
+++ b/include/themes/paw/main.css
@@ -14,6 +14,17 @@ body {
overflow: hidden;
}
+textarea {
+ font-family: 'Segoe UI', 'Segoe UI Web Regular', 'Segoe UI Symbol', 'Helvetica Neue', 'BBAlpha Sans', 'S60 Sans', Arial, sans-serif;
+ font-size: 1.0em;
+ padding: 5px;
+ width: 400px;
+ height: 100px;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
+
table {
border-collapse: collapse; border-spacing: 0;
border: none;
@@ -21,7 +32,7 @@ table {
}
td, th {
- padding: 2px;
+ padding: 0px;
margin: 0px;
}
@@ -34,6 +45,16 @@ img {
vertical-align:middle;
}
+fieldset {
+ border: none;
+ padding: 0px;
+ margin: 0px;
+}
+
+.reindex_methods span {
+ font-size: 9px;
+}
+
/* links */
a, a:active, a:visited {
@@ -69,15 +90,6 @@ label {
white-space:nowrap;
}
-fieldset {
- border: none;
- padding: 0px;
- margin: 0px;
-}
-
-.reindex_methods span {
- font-size: 9px;
-}
.nowrap {
white-space:nowrap;
@@ -1026,13 +1038,122 @@ legend {
.filterTable td:first-child {
width:55px;
+ min-width:55px;
}
-.formItemDescription {
+.filterTable td {
+ padding: 2px;
}
-.formItemName {
- font-weight:bold;
+.formRow {
+ display: table;
+ width: 100%;
+ line-height: 40px;
+}
+
+.formColumn {
+ float: left;
+ display: table-column;
+}
+
+.formColumnLeft {
+ float: left;
+ display: table-column;
+ width: 30%;
+}
+
+.formColumnRight {
+ float: left;
+ display: table-column;
+ width: 70%;
+}
+
+.formData {
+ display: inline-block;
+ float: left;
+}
+
+.formFieldName {
+ display: inline-block;
+ color: #000000;
+ float: left;
+ text-align: left;
+ white-space: nowrap;
+ padding-left: 3px;
+}
+
+.formFieldDescription {
+ float: left;
+ text-align: left;
+}
+
+.formTooltip {
+ display: inline-block;
+}
+
+.formHeader {
+ float: left;
+ width: 100%;
+ text-align: left;
+ line-height: 25px;
+
+}
+
+.formHeaderAnchor {
+ float:right;
+ padding-right:4px;
+}
+
+.hostInfoHeader {
+ width: 100%;
+}
+
+@media screen and (max-width: 640px) {
+ .formRow {
+ display: table;
+ width: 100%;
+ line-height: 30px;
+ }
+
+ .formColumn {
+ float: left;
+ display: table-row;
+ color: #000000;
+ }
+
+ .formColumnLeft {
+ float: left;
+ display: table-row;
+ width: 100%;
+ color: #000000;
+ }
+
+ .formColumnRight {
+ float: left;
+ display: table-row;
+ width: 100%;
+ color: #000000;
+ }
+
+ .formFieldName {
+ color: snow;
+ float: left;
+ text-align: left;
+ white-space: nowrap;
+ padding-left: 3px;
+ }
+
+ .formData {
+ float: left;
+}
+
+ .hostInfoHeader {
+ overflow: hidden;
+ }
+
+ .queryAdd, .templateAdd, .navBar, #ping_results {
+ display: none;
+ }
}
.graphItem {
diff --git a/install/0_8_8h_to_1_0_0.php b/install/0_8_8h_to_1_0_0.php
index fb282d2a7d..68f8eb738b 100644
--- a/install/0_8_8h_to_1_0_0.php
+++ b/install/0_8_8h_to_1_0_0.php
@@ -1251,9 +1251,8 @@ function upgrade_to_1_0_0() {
db_install_add_column ('colors', array('name' => 'name', 'type' => 'varchar(40)', 'default' => '', 'after' => 'id'));
db_install_add_column ('colors', array('name' => 'read_only', 'type' => 'char(2)', 'default' => '', 'after' => 'hex'));
- if (file_exists(dirname(__FILE__) . '/import_colors.php')) {
- shell_exec('php -q ' . dirname(__FILE__) . '/import_colors.php');
- }
+ // import remaining colors into database
+ import_colors();
db_install_execute("ALTER TABLE settings MODIFY COLUMN value varchar(2048) NOT NULL default ''");
if (db_table_exists('settings_graphs', false)) {
diff --git a/install/1_1_4_to_1_1_5.php b/install/1_1_4_to_1_1_5.php
index d3d0357d83..dbfb2d7218 100644
--- a/install/1_1_4_to_1_1_5.php
+++ b/install/1_1_4_to_1_1_5.php
@@ -23,5 +23,5 @@
*/
function upgrade_to_1_1_5() {
- db_install_execute('ALTER TABLE data_input MODIFY COLUMN input_string varchar(512) default NULL');
+ //Queries failed in upgrade to 1.1.5 -> Moved to 1.1.6
}
diff --git a/install/1_1_5_to_1_1_6.php b/install/1_1_5_to_1_1_6.php
new file mode 100644
index 0000000000..94758bd13d
--- /dev/null
+++ b/install/1_1_5_to_1_1_6.php
@@ -0,0 +1,48 @@
+', $graph_template_graph['title'], $graph_title);
}elseif (!empty($_graph_template_id)) {
- $graph_template = db_fetch_row_prepared('SELECT * FROM graph_templates WHERE id = ?', array($_graph_template_id));
- $graph_template_graph = db_fetch_row_prepared('SELECT * FROM graph_templates_graph WHERE graph_template_id = ? AND local_graph_id=0', array($_graph_template_id));
+ $graph_template = db_fetch_row_prepared('SELECT *
+ FROM graph_templates
+ WHERE id = ?',
+ array($_graph_template_id));
- $graph_template_items = db_fetch_assoc_prepared('SELECT * FROM graph_templates_item WHERE graph_template_id = ? AND local_graph_id=0', array($_graph_template_id));
- $graph_template_inputs = db_fetch_assoc_prepared('SELECT * FROM graph_template_input WHERE graph_template_id = ?', array($_graph_template_id));
+ $graph_template_graph = db_fetch_row_prepared('SELECT *
+ FROM graph_templates_graph
+ WHERE graph_template_id = ?
+ AND local_graph_id=0',
+ array($_graph_template_id));
+
+ $graph_template_items = db_fetch_assoc_prepared('SELECT *
+ FROM graph_templates_item
+ WHERE graph_template_id = ?
+ AND local_graph_id=0',
+ array($_graph_template_id));
+
+ $graph_template_inputs = db_fetch_assoc_prepared('SELECT *
+ FROM graph_template_input
+ WHERE graph_template_id = ?',
+ array($_graph_template_id));
/* create new entry: graph_templates */
- $save['id'] = 0;
- $save['hash'] = get_hash_graph_template(0);
- $save['name'] = str_replace('', $graph_template['name'], $graph_title);
+ $save['id'] = 0;
+ $save['hash'] = get_hash_graph_template(0);
+ $save['name'] = str_replace('', $graph_template['name'], $graph_title);
+ $save['multiple'] = $graph_template['multiple'];
$graph_template_id = sql_save($save, 'graph_templates');
}
diff --git a/lib/auth.php b/lib/auth.php
index 01e0a23b86..52cbe4f813 100644
--- a/lib/auth.php
+++ b/lib/auth.php
@@ -665,16 +665,16 @@ function get_allowed_tree_content($tree_id, $parent = 0, $sql_where = '', $order
if ($sql_where != '') {
$sql_where = "WHERE gti.local_graph_id=0 AND gti.parent=$parent AND gti.graph_tree_id=$tree_id AND (" . $sql_where . ')';
- }else{
+ } else {
$sql_where = "WHERE gti.local_graph_id=0 AND gti.parent=$parent AND gti.graph_tree_id=$tree_id";
}
- if ($tree_id > 0) {
- $trees = array_rekey(
- get_allowed_trees(false, false, '', '', '', $total_rows, $user),
- 'id', 'name'
- );
+ $trees = array_rekey(
+ get_allowed_trees(false, false, '', '', '', $total_rows, $user),
+ 'id', 'name'
+ );
+ if ($tree_id > 0) {
if (sizeof($trees)) {
$sql_where .= ' AND gt.id IN (' . implode(', ', array_keys($trees)) . ')';
}
@@ -688,21 +688,13 @@ function get_allowed_tree_content($tree_id, $parent = 0, $sql_where = '', $order
ON h.id = gti.host_id
$sql_where
ORDER BY gti.position");
- }else{
- $trees = array_rekey(
- get_allowed_trees(false, false, '', '', '', $total_rows, $user),
- 'id', 'name'
- );
-
- if (sizeof($trees)) {
- $heirarchy = db_fetch_assoc("SELECT gt.id AS tree_id, '0' AS id, gt.name AS title, '0' AS host_id,
- '0' AS local_graph_id, '1' AS host_grouping_type, '' AS hostname
- FROM graph_tree AS gt
- WHERE enabled='on'
- AND gt.id IN (" . implode(', ', array_keys($trees)) . ")
- ORDER BY gt.sequence");
- }else{
- }
+ } elseif (sizeof($trees)) {
+ $heirarchy = db_fetch_assoc("SELECT gt.id AS tree_id, '0' AS id, gt.name AS title, '0' AS host_id,
+ '0' AS local_graph_id, '1' AS host_grouping_type, '' AS hostname
+ FROM graph_tree AS gt
+ WHERE enabled='on'
+ AND gt.id IN (" . implode(', ', array_keys($trees)) . ")
+ ORDER BY gt.sequence");
}
if (read_config_option('auth_method') != 0) {
@@ -713,20 +705,20 @@ function get_allowed_tree_content($tree_id, $parent = 0, $sql_where = '', $order
if (is_device_allowed($h['host_id'])) {
$new_heirarchy[] = $h;
}
- }elseif ($h['id'] == 0) {
+ } elseif ($h['id'] == 0) {
if (!is_tree_branch_empty($h['tree_id'], $h['id'])) {
if (is_tree_allowed($h['tree_id'])) {
$new_heirarchy[] = $h;
}
}
- }elseif (!is_tree_branch_empty($h['tree_id'], $h['id'])) {
+ } elseif (!is_tree_branch_empty($h['tree_id'], $h['id'])) {
$new_heirarchy[] = $h;
}
}
}
return $new_heirarchy;
- }else{
+ } else {
return $heirarchy;
}
}
@@ -740,20 +732,15 @@ function get_allowed_tree_header_graphs($tree_id, $leaf_id = 0, $sql_where = '',
$order_by = "ORDER BY $order_by";
}
- if (strlen($sql_where)) {
+ if ($sql_where != '') {
$sql_where = " AND ($sql_where)";
}
$sql_where = "WHERE (gti.graph_tree_id=$tree_id AND gti.parent=$leaf_id)" . $sql_where;
- $i = 0;
- $sql_having = '';
- $sql_select = '';
- $sql_join = '';
-
if ($user == -1) {
$auth_method = 0;
- }else{
+ } else {
$auth_method = read_config_option('auth_method');
}
@@ -761,14 +748,14 @@ function get_allowed_tree_header_graphs($tree_id, $leaf_id = 0, $sql_where = '',
if ($user == 0) {
if (isset($_SESSION['sess_user_id'])) {
$user = $_SESSION['sess_user_id'];
- }else{
+ } else {
return array();
}
}
if (read_config_option('graph_auth_method') == 1) {
$sql_operator = 'OR';
- }else{
+ } else {
$sql_operator = 'AND';
}
@@ -789,36 +776,41 @@ function get_allowed_tree_header_graphs($tree_id, $leaf_id = 0, $sql_where = '',
WHERE id = ?",
array($user)
);
-
+
+ $i = 0;
+ $sql_having = '';
+ $sql_select = '';
+ $sql_join = '';
+
foreach($policies as $policy) {
if ($policy['policy_graphs'] == 1) {
- $sql_having .= (strlen($sql_having) ? ' OR ':'') . "(user$i IS NULL";
- }else{
- $sql_having .= (strlen($sql_having) ? ' OR ':'') . "(user$i IS NOT NULL";
+ $sql_having .= ($sql_having != '' ? ' OR ':'') . "(user$i IS NULL";
+ } else {
+ $sql_having .= ($sql_having != '' ? ' OR ':'') . "(user$i IS NOT NULL";
}
$sql_join .= 'LEFT JOIN user_auth_' . ($policy['type'] == 'user' ? '':'group_') . "perms AS uap$i ON (gl.id=uap$i.item_id AND uap$i.type=1 AND uap$i." . $policy['type'] . "_id=" . $policy['id'] . ") ";
- $sql_select .= (strlen($sql_select) ? ', ':'') . "uap$i." . $policy['type'] . "_id AS user$i";
+ $sql_select .= ($sql_select != '' ? ', ':'') . "uap$i." . $policy['type'] . "_id AS user$i";
$i++;
if ($policy['policy_hosts'] == 1) {
$sql_having .= " OR (user$i IS NULL";
- }else{
+ } else {
$sql_having .= " OR (user$i IS NOT NULL";
}
$sql_join .= 'LEFT JOIN user_auth_' . ($policy['type'] == 'user' ? '':'group_') . "perms AS uap$i ON (gl.host_id=uap$i.item_id AND uap$i.type=3 AND uap$i." . $policy['type'] . "_id=" . $policy['id'] . ") ";
- $sql_select .= (strlen($sql_select) ? ', ':'') . "uap$i." . $policy['type'] . "_id AS user$i";
+ $sql_select .= ($sql_select != '' ? ', ':'') . "uap$i." . $policy['type'] . "_id AS user$i";
$i++;
if ($policy['policy_graph_templates'] == 1) {
$sql_having .= " $sql_operator user$i IS NULL))";
- }else{
+ } else {
$sql_having .= " $sql_operator user$i IS NOT NULL))";
}
$sql_join .= 'LEFT JOIN user_auth_' . ($policy['type'] == 'user' ? '':'group_') . "perms AS uap$i ON (gl.graph_template_id=uap$i.item_id AND uap$i.type=4 AND uap$i." . $policy['type'] . "_id=" . $policy['id'] . ") ";
- $sql_select .= (strlen($sql_select) ? ', ':'') . "uap$i." . $policy['type'] . "_id AS user$i";
+ $sql_select .= ($sql_select != '' ? ', ':'') . "uap$i." . $policy['type'] . "_id AS user$i";
$i++;
}
@@ -1221,14 +1213,9 @@ function get_allowed_trees($edit = false, $return_sql = false, $sql_where = '',
$order_by = "ORDER BY $order_by";
}
- $i = 0;
- $sql_where1 = '';
- $sql_select = '';
- $sql_join = '';
-
if ($user == -1) {
$auth_method = 0;
- }else{
+ } else {
$auth_method = read_config_option('auth_method');
}
@@ -1248,11 +1235,15 @@ function get_allowed_trees($edit = false, $return_sql = false, $sql_where = '',
WHERE uag.enabled = 'on' AND uagm.user_id = ?", array($user));
$policies[] = db_fetch_row_prepared("SELECT id, 'user' as type, policy_trees FROM user_auth WHERE id = ?", array($user));
+ $i = 0;
+ $sql_where1 = '';
+ $sql_join = '';
+
foreach($policies as $policy) {
if ($policy['policy_trees'] == '1') {
- $sql_where1 .= (strlen($sql_where1) ? ' OR':'') . " uap$i." . $policy['type'] . "_id IS NULL";
- }elseif ($policy['policy_trees'] == '2') {
- $sql_where1 .= (strlen($sql_where1) ? ' OR':'') . " uap$i." . $policy['type'] . "_id IS NOT NULL";
+ $sql_where1 .= ($sql_where1 != '' ? ' OR':'') . " uap$i." . $policy['type'] . "_id IS NULL";
+ } elseif ($policy['policy_trees'] == '2') {
+ $sql_where1 .= ($sql_where1 != '' ? ' OR':'') . " uap$i." . $policy['type'] . "_id IS NOT NULL";
}
$sql_join .= 'LEFT JOIN user_auth_' . ($policy['type'] == 'group' ? 'group_':'') . "perms AS uap$i
@@ -1261,9 +1252,9 @@ function get_allowed_trees($edit = false, $return_sql = false, $sql_where = '',
$i++;
}
- if (strlen($sql_where)) {
+ if ($sql_where != '') {
$sql_where = 'WHERE ' . ($edit == false ? '(gt.enabled="on") AND ':'') . '(' . $sql_where . ') AND (' . $sql_where1 . ')';
- }else{
+ } else {
$sql_where = 'WHERE ' . ($edit == false ? '(gt.enabled="on") AND ':'') . '(gt.enabled="on") AND (' . $sql_where1 . ')';
}
@@ -1276,7 +1267,7 @@ function get_allowed_trees($edit = false, $return_sql = false, $sql_where = '',
if ($return_sql) {
return $sql;
- }else{
+ } else {
$trees = db_fetch_assoc($sql);
$total_rows = db_fetch_cell("SELECT COUNT(gt.id)
@@ -1284,16 +1275,16 @@ function get_allowed_trees($edit = false, $return_sql = false, $sql_where = '',
$sql_join
$sql_where");
}
- }else{
- if (strlen($sql_where)) {
+ } else {
+ if ($sql_where != '') {
$sql_where = "WHERE enabled='on' AND $sql_where";
- }else{
+ } else {
$sql_where = "WHERE enabled='on'";
}
if ($return_sql) {
return "SELECT id, name FROM graph_tree $sql_where $order_by";
- }else{
+ } else {
$trees = db_fetch_assoc("SELECT id, name FROM graph_tree AS gt $sql_where $order_by");
$total_rows = db_fetch_cell("SELECT COUNT(*) FROM graph_tree AS gt $sql_where");
}
diff --git a/lib/data_query.php b/lib/data_query.php
index e26821ed5b..a5e1a7326d 100644
--- a/lib/data_query.php
+++ b/lib/data_query.php
@@ -26,14 +26,14 @@ function run_data_query($host_id, $snmp_query_id) {
global $config, $input_types;
/* don't run/rerun the query if the host is down, or disabled */
- $status = db_fetch_row_prepared('SELECT status, disabled FROM host WHERE id = ?', array($host_id));
+ $status = db_fetch_row_prepared('SELECT status, disabled, poller_id FROM host WHERE id = ?', array($host_id));
if (!sizeof($status)) {
return false;
- }elseif ($status['status'] == HOST_DOWN || $status['disabled'] == 'on') {
+ } elseif ($status['status'] == HOST_DOWN || $status['disabled'] == 'on') {
return true;
}
- $poller_id = db_fetch_cell_prepared('SELECT poller_id FROM host WHERE id = ?', array($host_id));
+ $poller_id = $status['poller_id'];
if ($poller_id != $config['poller_id']) {
$hostname = db_fetch_cell_prepared('SELECT hostname FROM poller WHERE id = ?', array($poller_id));
@@ -70,7 +70,9 @@ function run_data_query($host_id, $snmp_query_id) {
ON snmp_query.data_input_id=data_input.id
WHERE snmp_query.id = ?', array($snmp_query_id));
- if (isset($input_types[$type_id])) query_debug_timer_offset('data_query', "Found type = '" . $type_id . "' [" . $input_types[$type_id] . "].");
+ if (isset($input_types[$type_id])) {
+ query_debug_timer_offset('data_query', "Found type = '" . $type_id . "' [" . $input_types[$type_id] . "].");
+ }
if ($type_id == DATA_INPUT_TYPE_SNMP_QUERY) {
$result = query_snmp_host($host_id, $snmp_query_id);
@@ -105,22 +107,23 @@ function run_data_query($host_id, $snmp_query_id) {
dl.snmp_index, dtd.local_data_id, dtd.data_input_id,
did.data_template_data_id, did.data_input_field_id, did.value
FROM data_local AS dl
- LEFT JOIN data_template_data AS dtd
- ON dl.id=dtd.local_data_id
- LEFT JOIN data_input_fields AS dif
+ INNER JOIN data_template_data AS dtd
+ ON dl.id = dtd.local_data_id
+ INNER JOIN data_input_fields AS dif
ON dtd.data_input_id = dif.data_input_id
LEFT JOIN data_input_data AS did
ON dtd.id = did.data_template_data_id
AND dif.id = did.data_input_field_id
- WHERE dif.type_code="output_type"
+ WHERE dif.type_code = "output_type"
AND dl.snmp_query_id = ?
AND dl.host_id = ?',
array($host_id, $snmp_query_id));
+ $bestDataQueryIndexType = get_best_data_query_index_type($host_id, $snmp_query_id);
if (sizeof($data_queries)) {
foreach($data_queries as $data_query) {
/* build array required for function call */
- $data_query['snmp_index_on'] = get_best_data_query_index_type($host_id, $snmp_query_id);
+ $data_query['snmp_index_on'] = $bestDataQueryIndexType;
/* as we request the output_type, 'value' gives the snmp_query_graph_id */
$data_query['snmp_query_graph_id'] = $data_query['value'];
@@ -1054,7 +1057,9 @@ function update_data_source_data_query_cache($local_data_id, $host_id = '', $dat
FROM data_template_data
WHERE data_template_data.local_data_id = ?', array($local_data_id)));
- if (empty($field)) { return; }
+ if (empty($field)) {
+ return;
+ }
if (empty($data_query_id)) {
$data_query_id = db_fetch_cell_prepared('SELECT snmp_query_id FROM snmp_query_graph WHERE id = ?', array($field['output_type']));
@@ -1205,7 +1210,8 @@ function get_ordered_index_type_list($host_id, $data_query_id, $data_query_index
FROM host_snmp_cache
WHERE host_id = ?
AND snmp_query_id = ?
- AND field_name = ? AND $sql_or",
+ AND field_name = ?
+ AND $sql_or",
array($host_id, $data_query_id, $field_name));
}
@@ -1378,18 +1384,18 @@ function verify_index_order($raw_xml) {
*/
function update_snmp_index_order($data_query) {
if (sizeof($data_query)) {
- $data_input_field = array_rekey(db_fetch_assoc_prepared('SELECT
+ $data_input_field = array_rekey(db_fetch_assoc_prepared("SELECT
data_input_fields.id,
- data_input_fields.type_code
- FROM (snmp_query,data_input,data_input_fields)
- WHERE snmp_query.data_input_id=data_input.id
- AND data_input.id=data_input_fields.data_input_id
- AND (data_input_fields.type_code="index_type"
- OR data_input_fields.type_code="index_value"
- OR data_input_fields.type_code="output_type")
- AND snmp_query.id = ?',
+ data_input_fields.type_code
+ FROM snmp_query
+ INNER JOIN data_input
+ ON snmp_query.data_input_id = data_input.id
+ INNER JOIN data_input_fields
+ ON data_input.id = data_input_fields.data_input_id
+ WHERE data_input_fields.type_code IN('index_type', 'index_value', 'output_type')
+ AND snmp_query.id = ?",
array($data_query['snmp_query_id'])), 'type_code', 'id');
-
+
$snmp_cache_value = db_fetch_cell_prepared('SELECT field_value
FROM host_snmp_cache
WHERE host_id = ?
@@ -1397,25 +1403,23 @@ function update_snmp_index_order($data_query) {
AND field_name = ?
AND snmp_index = ?',
array($data_query['host_id'], $data_query['snmp_query_id'], $data_query['snmp_index_on'], $data_query['snmp_index']));
-
- /* save the value to index on (ie. ifindex, ifip, etc) */
+
db_execute_prepared('REPLACE INTO data_input_data
(data_input_field_id, data_template_data_id, t_value, value)
- VALUES (?, ?, "", ?)',
- array($data_input_field['index_type'], $data_query['data_template_data_id'], $data_query['snmp_index_on']));
-
- /* save the actual value (ie. 3, 192.168.1.101, etc) */
- db_execute_prepared('REPLACE INTO data_input_data
- (data_input_field_id,data_template_data_id,t_value,value)
- VALUES (?, ?, "", ?)',
- array($data_input_field['index_value'], $data_query['data_template_data_id'], $snmp_cache_value));
-
- /* set the expected output type (ie. bytes, errors, packets) */
- db_execute_prepared('REPLACE INTO data_input_data
- (data_input_field_id,data_template_data_id,t_value,value)
- VALUES (?, ?, "", ?)',
- array($data_input_field['output_type'], $data_query['data_template_data_id'], $data_query['snmp_query_graph_id']));
-
+ VALUES
+ (?, ?, "", ?),
+ (?, ?, "", ?),
+ (?, ?, "", ?)',
+ array(
+ /* save the value to index on (ie. ifindex, ifip, etc) */
+ $data_input_field['index_type'], $data_query['data_template_data_id'], $data_query['snmp_index_on'],
+ /* save the actual value (ie. 3, 192.168.1.101, etc) */
+ $data_input_field['index_value'], $data_query['data_template_data_id'], $snmp_cache_value,
+ /* set the expected output type (ie. bytes, errors, packets) */
+ $data_input_field['output_type'], $data_query['data_template_data_id'], $data_query['snmp_query_graph_id']
+ )
+ );
+
/* now that we have put data into the 'data_input_data' table, update the snmp cache for ds's */
update_data_source_data_query_cache($data_query['local_data_id']);
}
diff --git a/lib/functions.php b/lib/functions.php
index 0fe12e0e78..9145e7021d 100644
--- a/lib/functions.php
+++ b/lib/functions.php
@@ -1768,16 +1768,6 @@ function get_web_browser() {
}
}
-/* get_graph_tree_array - returns a list of graph trees taking permissions into account if
- necessary
- @arg $return_sql - (bool) Whether to return the SQL to create the dropdown rather than an array
- @arg $force_refresh - (bool) Force the refresh of the array from the database
- @arg $edit - (bool) Shows the content even though the graph may not be published
- @returns - (array) an array containing a list of graph trees */
-function get_graph_tree_array($return_sql = false, $force_refresh = false, $edit = false) {
- return get_allowed_trees($edit, $return_sql);
-}
-
/* draw_login_status - provides a consistent login status page for all pages that use it */
function draw_login_status($using_guest_account = false) {
global $config;
diff --git a/lib/html.php b/lib/html.php
index 2ae3793772..06028a7945 100644
--- a/lib/html.php
+++ b/lib/html.php
@@ -107,73 +107,9 @@ function html_graph_area(&$graph_array, $no_graphs_message = '', $extra_url_args
print $header;
}
- $start = true;
foreach ($graph_array as $graph) {
- if (isset($graph['graph_template_name'])) {
- if (isset($prev_graph_template_name)) {
- if ($prev_graph_template_name != $graph['graph_template_name']) {
- $print = true;
- $prev_graph_template_name = $graph['graph_template_name'];
- }else{
- $print = false;
- }
- }else{
- $print = true;
- $prev_graph_template_name = $graph['graph_template_name'];
- }
-
- if ($print) {
- print "\n";
- $i = 0;
- }
- }elseif (isset($graph['data_query_name'])) {
- if (isset($prev_data_query_name)) {
- if ($prev_data_query_name != $graph['data_query_name']) {
- $print = true;
- $prev_data_query_name = $graph['data_query_name'];
- }else{
- $print = false;
- }
- }else{
- $print = true;
- $prev_data_query_name = $graph['data_query_name'];
- }
-
- if ($print) {
- if (!$start) {
- while(($i % $columns) != 0) {
- print " \n";
- $i++;
- }
-
- print " \n";
- }
-
- print "\n";
- $i = 0;
- }
-
- if (!isset($prev_sort_field_value) || $prev_sort_field_value != $graph['sort_field_value']){
- $prev_sort_field_value = $graph['sort_field_value'];
- print "\n";
- $i = 0;
- $j = 0;
- }
- }
-
if ($i == 0) {
- print "\n";
- $start = false;
+ print " \n";
}
?>
@@ -195,24 +131,19 @@ function html_graph_area(&$graph_array, $no_graphs_message = '', $extra_url_args
\n";
- $start = true;
}
}
- if (!$start) {
- while(($i % $columns) != 0) {
- print " ";
- $i++;
- }
-
- print " \n";
+ while(($i % $columns) != 0) {
+ print " ";
+ $i++;
}
+
+ print "\n";
}else{
if ($no_graphs_message != '') {
print "$no_graphs_message ";
@@ -293,7 +224,7 @@ function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = '', $extr
}
if ($i == 0) {
- print "\n";
+ print " \n";
$start = false;
}
@@ -459,6 +390,13 @@ function html_header_sort($header_items, $sort_column, $sort_direction, $last_it
$i = 1;
foreach ($header_items as $db_column => $display_array) {
+ $isSort = '';
+ if (isset($display_array['nohide'])) {
+ $nohide = 'nohide';
+ }else{
+ $nohide = '';
+ }
+
if (array_key_exists('display', $display_array)) {
$display_text = $display_array['display'];
if ($sort_column == $db_column) {
@@ -491,8 +429,6 @@ function html_header_sort($header_items, $sort_column, $sort_direction, $last_it
}else{
$direction = 'ASC';
}
-
- $isSort = false;
}
}
@@ -539,7 +475,6 @@ function html_header_sort($header_items, $sort_column, $sort_direction, $last_it
}
$display_text = $display_array[0];
- $isSort = false;
}
$align = 'left';
@@ -555,9 +490,9 @@ function html_header_sort($header_items, $sort_column, $sort_direction, $last_it
}
if (($db_column == '') || (substr_count($db_column, 'nosort'))) {
- print '' . $display_text . " \n";
+ print '' . $display_text . " \n";
}else{
- print '";
+ print ' ";
print "
\n";
}
@@ -615,7 +550,14 @@ function html_header_sort_checkbox($header_items, $sort_column, $sort_direction,
print " \n";
@@ -771,11 +725,23 @@ function html_header_checkbox($header_items, $include_form = true, $form_action
print "