Merge remote-tracking branch 'origin/develop' into ent-6802-super-8
Conflicts: .gitlab-ci.yml pandora_console/pandoradb.sql
This commit is contained in:
commit
1da5534484
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.759-220211
|
||||
Version: 7.0NG.759-220215
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.759-220211"
|
||||
pandora_version="7.0NG.759-220215"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1015,7 +1015,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.759';
|
||||
use constant AGENT_BUILD => '220211';
|
||||
use constant AGENT_BUILD => '220215';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.759
|
||||
%define release 220211
|
||||
%define release 220215
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.759
|
||||
%define release 220211
|
||||
%define release 220215
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.759"
|
||||
PI_BUILD="220211"
|
||||
PI_BUILD="220215"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{220211}
|
||||
{220215}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.759 Build 220211")
|
||||
#define PANDORA_VERSION ("7.0NG.759 Build 220215")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.759(Build 220211))"
|
||||
VALUE "ProductVersion", "(7.0NG.759(Build 220215))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.759-220211
|
||||
Version: 7.0NG.759-220215
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.759-220211"
|
||||
pandora_version="7.0NG.759-220215"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -1120,7 +1120,7 @@ function resource_registration_extension_main()
|
|||
}
|
||||
|
||||
echo '<div class=notify>';
|
||||
echo __('This extension makes registering resource templates easier.').' '.__('Here you can upload a resource template in .ptr format.').' '.__('Please refer to our documentation for more information on how to obtain and use %s resources.', get_product_name()).' '.'<br> <br>'.__('You can get more resurces in our <a href="http://pandorafms.com/Library/Library/">Public Resource Library</a>');
|
||||
echo __('This extension makes registering resource templates easier.').' '.__('Here you can upload a resource template in .ptr format.').' '.__('Please refer to our documentation for more information on how to obtain and use %s resources.', get_product_name()).' '.'<br> <br>'.__('You can get more resurces in our <a href="https://pandorafms.com/Library/Library/">Public Resource Library</a>');
|
||||
echo '</div>';
|
||||
|
||||
echo '<br /><br />';
|
||||
|
|
|
@ -14,4 +14,6 @@ SOURCE procedures/alertEvents.sql;
|
|||
CALL `migrateEventRanges`();
|
||||
DROP PROCEDURE `migrateEventRanges`;
|
||||
|
||||
ALTER TABLE `tautoconfig` ADD COLUMN `disabled` TINYINT DEFAULT 0;
|
||||
|
||||
COMMIT;
|
|
@ -2187,6 +2187,7 @@ CREATE TABLE IF NOT EXISTS `tautoconfig` (
|
|||
`name` varchar(100) NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`description` text,
|
||||
`disabled` TINYINT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ if ($prediction_available) {
|
|||
$modules['predictionserver'] = __('Create a new prediction server module');
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true || $web_available === '1') {
|
||||
if (is_metaconsole() === true || $web_available >= '1') {
|
||||
$modules['webserver'] = __('Create a new web Server module');
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ echo '</table>';
|
|||
if (!$config['disable_help']) {
|
||||
echo '<div class="disable_help">';
|
||||
echo '<strong>';
|
||||
echo "<a class='color-black-grey invert_filter' target='_blank' href='http://pandorafms.com/Library/Library/'>".__('Get more modules on Monitoring Library').'</a>';
|
||||
echo "<a class='color-black-grey invert_filter' target='_blank' href='https://pandorafms.com/Library/Library/'>".__('Get more modules on Monitoring Library').'</a>';
|
||||
echo '</strong>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
|
|
@ -468,21 +468,12 @@ foreach ($listConnectionTemp as $connectionTemp) {
|
|||
}
|
||||
|
||||
$table->data[1][0] = __('Add Map connection').$iconError;
|
||||
$table->data[1][1] = "<table class='no-class' border='0' id='map_connection'>
|
||||
<tr>
|
||||
<td >
|
||||
".html_print_select($listConnection, 'map_connection_list', '', '', '', '0', true)."
|
||||
</td>
|
||||
<td >
|
||||
<a href='javascript: addConnectionMap();'>".html_print_image(
|
||||
$table->data[1][1] = ".html_print_select($listConnection, 'map_connection_list', '', '', '', '0', true)."
|
||||
< / td > < td > < a href = 'javascript: addConnectionMap();' > ".html_print_image(
|
||||
'images/add.png',
|
||||
true,
|
||||
['class' => 'invert_filter']
|
||||
)."</a>
|
||||
<input type='hidden' name='map_connection_list' value='' id='map_connection_list' />
|
||||
<input type='hidden' name='layer_list' value='' id='layer_list' />
|
||||
</td>
|
||||
</tr> ".gis_add_conection_maps_in_form($map_connection_list).'
|
||||
)." < / a > < input type = 'hidden' name = 'map_connection_list' value = '' id = 'map_connection_list' / > < input type = 'hidden' name = 'layer_list' value = '' id = 'layer_list' / > < / td > < / tr > (".gis_add_conection_maps_in_form($map_connection_list).'
|
||||
</table>';
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
|
||||
|
@ -558,9 +549,9 @@ $table->data = [];
|
|||
$table->data[0][0] = '<h4>'.__('List of layers').'</h4>';
|
||||
$table->data[0][1] = '<div class="right">'.html_print_button(__('New layer'), 'new_layer', false, 'newLayer();', 'class="sub add "', true).'</div>';
|
||||
|
||||
$table->data[1][0] = '<table class="databox" border="0" cellpadding="4" cellspacing="4" id="list_layers"></table>';
|
||||
$table->data[1][1] = '<div id="form_layer" class="invisible">
|
||||
<table id="form_layer_table" class="" border="0" cellpadding="4" cellspacing="4">
|
||||
$table->data[1][0] = '<table class="databox' border='0' cellpadding='4' cellspacing='4' id='list_layers"></table>';
|
||||
$table->data[1][1] = '<div id="form_layer' class='invisible'>
|
||||
<table id='form_layer_table' class="" border='0' cellpadding='4' cellspacing='4">
|
||||
<tr>
|
||||
<td>'.__('Layer name').':</td>
|
||||
<td>'.html_print_input_text('layer_name_form', '', '', 20, 40, true).'</td>
|
||||
|
@ -603,7 +594,7 @@ $table->data[1][1] .= '</td>
|
|||
<tr>
|
||||
<td colspan="4">
|
||||
<h4>'.__('List of Agents to be shown in the layer').'</h4>
|
||||
<table class="databox" border="0" cellpadding="4" cellspacing="4" id="list_agents">
|
||||
<table class="databox' border='0' cellpadding='4' cellspacing='4' id='list_agents">
|
||||
</table>
|
||||
</td>
|
||||
</tr>';
|
||||
|
@ -637,18 +628,18 @@ $table->data[1][1] .= '<tr><td colspan="4"><hr /></td></tr>
|
|||
<td colspan="3">'.$agent_for_group_input.'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" align="right">'.$add_group_btn.'</td>
|
||||
<td colspan="4' align='right">'.$add_group_btn.'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<h4>'.__('List of groups to be shown in the layer').'</h4>
|
||||
<table class="databox" border="0" cellpadding="4" cellspacing="4" id="list_groups">
|
||||
<table class="databox' border='0' cellpadding='4' cellspacing='4' id='list_groups">
|
||||
</table>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
$table->data[1][1] .= '<tr>
|
||||
<td align="right" colspan="4">'.html_print_button(__('Save Layer'), 'save_layer', false, 'javascript:saveNewLayer();', 'class="sub wand"', true).'
|
||||
<td align="right' colspan='4">'.html_print_button(__('Save Layer'), 'save_layer', false, 'javascript:saveNewLayer();', 'class="sub wand"', true).'
|
||||
'.html_print_input_hidden('current_edit_layer_id', '', true).'
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -658,7 +649,7 @@ $table->data[1][1] .= '<tr>
|
|||
html_print_table($table);
|
||||
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<div class="action - buttons' style=')width: '.$table->width.'">';
|
||||
switch ($action) {
|
||||
case 'save_new':
|
||||
case 'edit_map':
|
||||
|
@ -683,12 +674,12 @@ echo '</form>';
|
|||
// -------------------------INI CHUNKS---------------------------------------
|
||||
?>
|
||||
|
||||
<table style="visibility: hidden;">
|
||||
<tbody id="chunk_map_connection">
|
||||
<tr class="row_0">
|
||||
<table style="visibility: hidden;('>
|
||||
<tbody id='chunk_map_connection'>
|
||||
<tr class='row_0">
|
||||
<td><?php html_print_input_text('map_connection_name', $map_name, '', 20, 40, false, true); ?></td>
|
||||
<td><?php html_print_radio_button_extended('map_connection_default', '', '', true, false, 'changeDefaultConection(this.value)', ''); ?></td>
|
||||
<td><a id="delete_row" href="none">
|
||||
<td><a id="delete_row' href='none">
|
||||
<?php
|
||||
html_print_image(
|
||||
'images/cross.png',
|
||||
|
@ -711,36 +702,43 @@ ui_require_jquery_file('cluetip');
|
|||
ui_require_jquery_file('pandora.controls');
|
||||
ui_require_jquery_file('json');
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<script type="text / javascript'>
|
||||
|
||||
function active_button_add_agent() {
|
||||
$("#button-add_agent").prop("disabled", false);
|
||||
$(')
|
||||
// button-add_agent").prop("disabled", false);
|
||||
}
|
||||
|
||||
function addAgentClick (event) {
|
||||
var $layerFormAgentIdInput = $("#hidden-agent_id");
|
||||
var $layerFormAgentAliasInput = $("#text-agent_alias");
|
||||
|
||||
function addAgentClick(event)
|
||||
{
|
||||
var $layerFormAgentIdInput = $('#hidden-agent_id');
|
||||
var $layerFormAgentAliasInput = $('#text-agent_alias');
|
||||
|
||||
var agentId = Number.parseInt($layerFormAgentIdInput.val());
|
||||
var agentAlias = $layerFormAgentAliasInput.val();
|
||||
var layerId = $("input#hidden-current_edit_layer_id").val();
|
||||
var layerId = $('input#hidden-current_edit_layer_id').val();
|
||||
|
||||
if (Number.isNaN(agentId) || agentId === 0 || agentAlias.length === 0) return;
|
||||
if (Number.isNaN(agentId) || agentId === 0 || agentAlias.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
addAgentRow(layerId, agentId, agentAlias);
|
||||
|
||||
// Clear agent inputs
|
||||
$layerFormAgentIdInput.val("");
|
||||
$layerFormAgentAliasInput.val("");
|
||||
$layerFormAgentIdInput.val('');
|
||||
$layerFormAgentAliasInput.val('');
|
||||
|
||||
$("#button-add_agent").prop("disabled", true);
|
||||
$('#button-add_agent').prop('disabled', true);
|
||||
}
|
||||
|
||||
function toggleAddGroupBtn () {
|
||||
var groupId = Number.parseInt($("select#layer_group_id").val());
|
||||
|
||||
function toggleAddGroupBtn()
|
||||
{
|
||||
var groupId = Number.parseInt($('select#layer_group_id').val());
|
||||
var existGroupId = $("table#list_groups tr.groups_list_item[data-group-id='" + groupId + "']").length > 0;
|
||||
var agentId = Number.parseInt($("input#hidden-agent_id_for_data").val());
|
||||
var agentAlias = $("input#text-agent_alias_for_data").val();
|
||||
var agentId = Number.parseInt($('input#hidden-agent_id_for_data').val());
|
||||
var agentAlias = $('input#text-agent_alias_for_data').val();
|
||||
|
||||
var enabled = (
|
||||
!existGroupId
|
||||
|
@ -751,17 +749,19 @@ function toggleAddGroupBtn () {
|
|||
&& agentAlias.length > 0
|
||||
);
|
||||
|
||||
$("#button-add_group").prop("disabled", !enabled);
|
||||
$('#button-add_group').prop('disabled', !enabled);
|
||||
}
|
||||
|
||||
function addGroupClick (event) {
|
||||
var $layerFormGroupIdInput = $("select#layer_group_id");
|
||||
var $layerFormAgentIdInput = $("input#hidden-agent_id_for_data");
|
||||
var $layerFormAgentAliasInput = $("input#text-agent_alias_for_data");
|
||||
|
||||
var layerId = $("input#hidden-current_edit_layer_id").val();
|
||||
function addGroupClick(event)
|
||||
{
|
||||
var $layerFormGroupIdInput = $('select#layer_group_id');
|
||||
var $layerFormAgentIdInput = $('input#hidden-agent_id_for_data');
|
||||
var $layerFormAgentAliasInput = $('input#text-agent_alias_for_data');
|
||||
|
||||
var layerId = $('input#hidden-current_edit_layer_id').val();
|
||||
var groupId = Number.parseInt($layerFormGroupIdInput.val());
|
||||
var groupName = $layerFormGroupIdInput.find(":selected").text();
|
||||
var groupName = $layerFormGroupIdInput.find(':selected').text();
|
||||
var agentId = Number.parseInt($layerFormAgentIdInput.val());
|
||||
var agentAlias = $layerFormAgentAliasInput.val();
|
||||
|
||||
|
@ -774,46 +774,61 @@ function addGroupClick (event) {
|
|||
&& agentAlias.length > 0
|
||||
);
|
||||
|
||||
if (!valid) return;
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
addGroupRow(layerId, groupId, groupName, agentId, agentAlias);
|
||||
|
||||
// Clear inputs
|
||||
// $layerFormGroupIdInput.val(0);
|
||||
$layerFormAgentIdInput.val("");
|
||||
$layerFormAgentAliasInput.val("");
|
||||
$layerFormAgentIdInput.val('');
|
||||
$layerFormAgentAliasInput.val('');
|
||||
|
||||
$("#button-add_group").prop("disabled", true);
|
||||
$('#button-add_group').prop('disabled', true);
|
||||
}
|
||||
|
||||
function moveLayerRowUpOnClick (event) {
|
||||
|
||||
function moveLayerRowUpOnClick(event)
|
||||
{
|
||||
var $row = $(event.currentTarget).parent().parent();
|
||||
$row.insertBefore($row.prev());
|
||||
}
|
||||
|
||||
function moveLayerRowDownOnClick (event) {
|
||||
|
||||
function moveLayerRowDownOnClick(event)
|
||||
{
|
||||
var $row = $(event.currentTarget).parent().parent();
|
||||
$row.insertAfter($row.next());
|
||||
}
|
||||
|
||||
function removeLayerRowOnClick (event) {
|
||||
|
||||
function removeLayerRowOnClick(event)
|
||||
{
|
||||
var $layerRow = $(event.currentTarget).parent().parent();
|
||||
var layerRowId = $layerRow.find("input.layer_id").val();
|
||||
var layerEditorId = $("input#hidden-current_edit_layer_id").val();
|
||||
if (layerRowId == layerEditorId) hideLayerEditor();
|
||||
var layerRowId = $layerRow.find('input.layer_id').val();
|
||||
var layerEditorId = $('input#hidden-current_edit_layer_id').val();
|
||||
if (layerRowId == layerEditorId) {
|
||||
hideLayerEditor();
|
||||
}
|
||||
|
||||
// Remove row
|
||||
$(event.currentTarget).parent().parent().remove();
|
||||
}
|
||||
|
||||
function hideLayerEditor () {
|
||||
|
||||
function hideLayerEditor()
|
||||
{
|
||||
// Clean editor
|
||||
cleanLayerEditor();
|
||||
// Hide editor
|
||||
$("div#form_layer").hide();
|
||||
$('div#form_layer').hide();
|
||||
}
|
||||
|
||||
function showLayerEditor (layerId) {
|
||||
var $layerSaveBtn = $("input#button-save_layer");
|
||||
|
||||
function showLayerEditor(layerId)
|
||||
{
|
||||
var $layerSaveBtn = $('input#button-save_layer');
|
||||
|
||||
// Clean editor
|
||||
cleanLayerEditor();
|
||||
|
@ -837,33 +852,39 @@ function showLayerEditor (layerId) {
|
|||
}
|
||||
|
||||
// Show editor (if hidden)
|
||||
$("div#form_layer").show();
|
||||
$('div#form_layer').show();
|
||||
}
|
||||
|
||||
function getLayerData (layerId) {
|
||||
var $layerRow = $("tr#layer_row_" + layerId);
|
||||
var layerName = $layerRow.find("input.layer_name").val();
|
||||
var layerVisible = $layerRow.find("input.layer_visible").val() == 1;
|
||||
var layerAgentsFromGroup = $layerRow.find("input.layer_agents_from_group").val();
|
||||
var layerAgents = $layerRow.find("input.layer_agent_alias").map(function () {
|
||||
|
||||
function getLayerData(layerId)
|
||||
{
|
||||
var $layerRow = $('tr#layer_row_' + layerId);
|
||||
var layerName = $layerRow.find('input.layer_name').val();
|
||||
var layerVisible = $layerRow.find('input.layer_visible').val() == 1;
|
||||
var layerAgentsFromGroup = $layerRow.find('input.layer_agents_from_group').val();
|
||||
var layerAgents = $layerRow.find('input.layer_agent_alias').map(
|
||||
function () {
|
||||
return {
|
||||
"id": $(this).data("agent-id"),
|
||||
"alias": $(this).val()
|
||||
'id': $(this).data('agent-id'),
|
||||
'alias': $(this).val()
|
||||
};
|
||||
}).get();
|
||||
var layerGroups = $layerRow.find("input.layer_group_id").map(function () {
|
||||
}
|
||||
).get();
|
||||
var layerGroups = $layerRow.find('input.layer_group_id').map(
|
||||
function () {
|
||||
var groupId = $(this).val();
|
||||
var groupName = $(this).siblings("input.layer_group_name[data-group-id='" + groupId + "']").val();
|
||||
var agentId = $(this).siblings("input.layer_agent_id_for_data[data-group-id='" + groupId + "']").val();
|
||||
var agentAlias = $(this).siblings("input.layer_agent_alias_for_data[data-group-id='" + groupId + "']").val();
|
||||
var groupName = $(this).siblings(("input.layer_group_name[data-group-id='" + groupId + "']")).val();
|
||||
var agentId = $(this).siblings(("input.layer_agent_id_for_data[data-group-id='" + groupId + "']")).val();
|
||||
var agentAlias = $(this).siblings(("input.layer_agent_alias_for_data[data-group-id='" + groupId + "']")).val();
|
||||
|
||||
return {
|
||||
"id": groupId,
|
||||
"name": groupName,
|
||||
"agentId": agentId,
|
||||
"agentAlias": agentAlias
|
||||
'id': groupId,
|
||||
'name': groupName,
|
||||
'agentId': agentId,
|
||||
'agentAlias': agentAlias
|
||||
};
|
||||
}).get();
|
||||
}
|
||||
).get();
|
||||
|
||||
return {
|
||||
id: layerId,
|
||||
|
@ -875,142 +896,185 @@ function getLayerData (layerId) {
|
|||
}
|
||||
}
|
||||
|
||||
function setLayerEditorData (data) {
|
||||
if (data == null) data = {};
|
||||
|
||||
function setLayerEditorData(data)
|
||||
{
|
||||
if (data == null) {
|
||||
data = {};
|
||||
}
|
||||
|
||||
// Set defaults
|
||||
data = {
|
||||
id: data.id || 0,
|
||||
name: data.name || "",
|
||||
name: data.name || '',
|
||||
visible: data.visible != null ? !!data.visible : true,
|
||||
agentsFromGroup: data.agentsFromGroup || -1,
|
||||
agents: data.agents || [],
|
||||
groups: data.groups || []
|
||||
}
|
||||
|
||||
var $layerFormIdInput = $("input#hidden-current_edit_layer_id");
|
||||
var $layerFormNameInput = $("input#text-layer_name_form");
|
||||
var $layerFormVisibleCheckbox = $("input#checkbox-layer_visible_form");
|
||||
var $layerFormAgentsFromGroupSelect = $("#layer_group_form");
|
||||
var $layerFormAgentInput = $("input#text-agent_alias");
|
||||
var $layerFormAgentButton = $("input#button-add_agent");
|
||||
var $layerFormAgentsListItems = $("tr.agents_list_item");
|
||||
var $layerFormGroupsListItems = $("tr.groups_list_item");
|
||||
var $layerFormIdInput = $('input#hidden-current_edit_layer_id');
|
||||
var $layerFormNameInput = $('input#text-layer_name_form');
|
||||
var $layerFormVisibleCheckbox = $('input#checkbox-layer_visible_form');
|
||||
var $layerFormAgentsFromGroupSelect = $('#layer_group_form');
|
||||
var $layerFormAgentInput = $('input#text-agent_alias');
|
||||
var $layerFormAgentButton = $('input#button-add_agent');
|
||||
var $layerFormAgentsListItems = $('tr.agents_list_item');
|
||||
var $layerFormGroupsListItems = $('tr.groups_list_item');
|
||||
|
||||
$layerFormIdInput.val(data.id);
|
||||
$layerFormNameInput.val(data.name);
|
||||
$layerFormVisibleCheckbox.prop("checked", data.visible);
|
||||
$(`#layer_group_form option[value=${data.agentsFromGroup}]`).attr('selected', 'selected');
|
||||
$layerFormVisibleCheckbox.prop('checked', data.visible);
|
||||
$(`#layer_group_form option[value=${data.agentsFromGroup
|
||||
}]`).attr('selected', 'selected');
|
||||
|
||||
|
||||
$(`#layer_group_form`).trigger('change');
|
||||
$layerFormAgentInput.val("");
|
||||
$layerFormAgentButton.prop("disabled", true);
|
||||
$layerFormAgentInput.val('');
|
||||
$layerFormAgentButton.prop('disabled', true);
|
||||
$layerFormAgentsListItems.remove();
|
||||
$layerFormGroupsListItems.remove();
|
||||
|
||||
var $tableAgents = $("table#list_agents");
|
||||
data.agents.forEach(function (agent) {
|
||||
var $tableAgents = $('table#list_agents');
|
||||
data.agents.foreach (function (agent) {
|
||||
addAgentRow(data.id, agent.id, agent.alias);
|
||||
});
|
||||
}) {
|
||||
}
|
||||
|
||||
var $tableGroups = $("table#list_groups");
|
||||
data.groups.forEach(function (group) {
|
||||
var $tableGroups = $('table#list_groups');
|
||||
data.groups.foreach (function (group) {
|
||||
addGroupRow(data.id, group.id, group.name, group.agentId, group.agentAlias);
|
||||
});
|
||||
}
|
||||
}) {
|
||||
}
|
||||
|
||||
function newLayer () {
|
||||
}
|
||||
|
||||
|
||||
function newLayer()
|
||||
{
|
||||
showLayerEditor(null);
|
||||
}
|
||||
}
|
||||
|
||||
function saveNewLayer () {
|
||||
var $layerFormNameInput = $("input#text-layer_name_form");
|
||||
var $layerFormVisibleCheckbox = $("input#checkbox-layer_visible_form");
|
||||
var $layerFormAgentsFromGroupSelect = $("select#layer_group_form");
|
||||
var $layerFormAgentsListItems = $("tr.agents_list_item > td > span.agent_alias");
|
||||
var $layerFormGroupsListItems = $("tr.groups_list_item");
|
||||
var newLayerId = "new_" + ($("tr.layer_row").length + 1);
|
||||
|
||||
addLayerRow(newLayerId, {
|
||||
function saveNewLayer()
|
||||
{
|
||||
var $layerFormNameInput = $('input#text-layer_name_form');
|
||||
var $layerFormVisibleCheckbox = $('input#checkbox-layer_visible_form');
|
||||
var $layerFormAgentsFromGroupSelect = $('select#layer_group_form');
|
||||
var $layerFormAgentsListItems = $('tr.agents_list_item > td > span.agent_alias');
|
||||
var $layerFormGroupsListItems = $('tr.groups_list_item');
|
||||
var newLayerId = ('new_' + ($('tr.layer_row').length + 1));
|
||||
|
||||
addLayerRow(
|
||||
newLayerId,
|
||||
{
|
||||
id: newLayerId,
|
||||
name: $layerFormNameInput.val(),
|
||||
visible: $layerFormVisibleCheckbox.prop("checked"),
|
||||
visible: $layerFormVisibleCheckbox.prop('checked'),
|
||||
agentsFromGroup: $layerFormAgentsFromGroupSelect.val(),
|
||||
agents: $layerFormAgentsListItems.map(function () {
|
||||
agents: $layerFormAgentsListItems.map(
|
||||
function () {
|
||||
return {
|
||||
"id": $(this).data("agent-id"),
|
||||
"alias": $(this).text()
|
||||
'id': $(this).data('agent-id'),
|
||||
'alias': $(this).text()
|
||||
};
|
||||
}).get(),
|
||||
groups: $layerFormGroupsListItems.map(function () {
|
||||
}
|
||||
).get(),
|
||||
groups: $layerFormGroupsListItems.map(
|
||||
function () {
|
||||
return {
|
||||
"id": $(this).data("group-id"),
|
||||
"name": $(this).data("group-name"),
|
||||
"agentId": $(this).data("agent-id"),
|
||||
"agentAlias": $(this).data("agent-alias")
|
||||
'id': $(this).data('group-id'),
|
||||
'name': $(this).data('group-name'),
|
||||
'agentId': $(this).data('agent-id'),
|
||||
'agentAlias': $(this).data('agent-alias')
|
||||
};
|
||||
}).get()
|
||||
});
|
||||
}
|
||||
}
|
||||
).get()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function cleanLayerEditor () {
|
||||
|
||||
function cleanLayerEditor()
|
||||
{
|
||||
// Clear editor events
|
||||
unbindLayerEditorEvents();
|
||||
// Add default data to the editor
|
||||
setLayerEditorData();
|
||||
}
|
||||
}
|
||||
|
||||
function bindLayerEditorEvents (layerId) {
|
||||
var $layerFormNameInput = $("input#text-layer_name_form");
|
||||
var $layerFormVisibleCheckbox = $("input#checkbox-layer_visible_form");
|
||||
var $layerFormAgentsFromGroupSelect = $("select#layer_group_form");
|
||||
|
||||
var $layerRow = $("tr#layer_row_" + layerId);
|
||||
function bindLayerEditorEvents(layerId)
|
||||
{
|
||||
var $layerFormNameInput = $('input#text-layer_name_form');
|
||||
var $layerFormVisibleCheckbox = $('input#checkbox-layer_visible_form');
|
||||
var $layerFormAgentsFromGroupSelect = $('select#layer_group_form');
|
||||
|
||||
if ($layerRow.length === 0) return;
|
||||
var $layerRow = $('tr#layer_row_' + layerId);
|
||||
|
||||
$layerFormNameInput.bind("change", function (event) {
|
||||
if ($layerRow.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$layerFormNameInput.bind(
|
||||
'change',
|
||||
function (event) {
|
||||
var name = event.currentTarget.value;
|
||||
$layerRow.find("span.layer_name").html(name);
|
||||
$layerRow.find("input.layer_name").val(name);
|
||||
});
|
||||
$layerFormVisibleCheckbox.bind("click", function (event) {
|
||||
var visible = $(event.currentTarget).prop("checked");
|
||||
$layerRow.find("input.layer_visible").val(visible ? 1 : 0);
|
||||
});
|
||||
$layerFormAgentsFromGroupSelect.bind("change", function (event) {
|
||||
$layerRow.find('span.layer_name').html(name);
|
||||
$layerRow.find('input.layer_name').val(name);
|
||||
}
|
||||
);
|
||||
$layerFormVisibleCheckbox.bind(
|
||||
'click',
|
||||
function (event) {
|
||||
var visible = $(event.currentTarget).prop('checked');
|
||||
$layerRow.find('input.layer_visible').val(visible ? 1 : 0);
|
||||
}
|
||||
);
|
||||
$layerFormAgentsFromGroupSelect.bind(
|
||||
'change',
|
||||
function (event) {
|
||||
var group = event.currentTarget.value;
|
||||
$layerRow.find("input.layer_agents_from_group").val(group);
|
||||
});
|
||||
}
|
||||
$layerRow.find('input.layer_agents_from_group').val(group);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function unbindLayerEditorEvents () {
|
||||
var $layerFormNameInput = $("input#text-layer_name_form");
|
||||
var $layerFormVisibleCheckbox = $("input#checkbox-layer_visible_form");
|
||||
var $layerFormAgentsFromGroupSelect = $("select#layer_group_form");
|
||||
|
||||
$layerFormNameInput.unbind("change");
|
||||
$layerFormVisibleCheckbox.unbind("click");
|
||||
function unbindLayerEditorEvents()
|
||||
{
|
||||
var $layerFormNameInput = $('input#text-layer_name_form');
|
||||
var $layerFormVisibleCheckbox = $('input#checkbox-layer_visible_form');
|
||||
var $layerFormAgentsFromGroupSelect = $('select#layer_group_form');
|
||||
|
||||
$layerFormNameInput.unbind('change');
|
||||
$layerFormVisibleCheckbox.unbind('click');
|
||||
$layerFormAgentsFromGroupSelect.val('-1');
|
||||
}
|
||||
}
|
||||
|
||||
function getAgentRow (layerId, agentId, agentAlias) {
|
||||
var $row = $("<tr class=\"agents_list_item\" />");
|
||||
var $nameCol = $("<td />");
|
||||
var $deleteCol = $("<td />");
|
||||
|
||||
var $agentAlias = $("<span class=\"agent_alias\" data-agent-id=\"" + agentId + "\">" + agentAlias + "</span>");
|
||||
var $removeBtn = $('<a class="delete_row" href="javascript:" <?php echo html_print_image('images/cross.png', false, ['class' => 'invert_filter']); ?> </a>');
|
||||
function getAgentRow(layerId, agentId, agentAlias)
|
||||
{
|
||||
var $row = $('<tr class="agents_list_item" />');
|
||||
var $nameCol = $('<td />');
|
||||
var $deleteCol = $('<td />');
|
||||
|
||||
$removeBtn.click(function (event) {
|
||||
var $layerRow = $("tr#layer_row_" + layerId);
|
||||
var $agentAlias = $('<span class="agent_alias" data-agent-id="' + agentId + '">' + agentAlias + '</span>');
|
||||
var $removeBtn = $('<a class="delete_row" href="javascript:" <?php echo html_print_image('images / cross.png', false, ['class' => 'invert_filter']); ?> </a>');
|
||||
|
||||
$removeBtn.click(
|
||||
function (event) {
|
||||
var $layerRow = $('tr#layer_row_' + layerId);
|
||||
|
||||
if ($layerRow.length > 0) {
|
||||
$layerRow.find("input.layer_agent_id[data-agent-id='" + agentId + "']").remove();
|
||||
$layerRow.find("input.layer_agent_alias[data-agent-id='" + agentId + "']").remove();
|
||||
$layerRow.find(("input.layer_agent_id[data-agent-id='" + agentId + "']")).remove();
|
||||
$layerRow.find(("input.layer_agent_alias[data-agent-id='" + agentId + "']")).remove();
|
||||
}
|
||||
|
||||
var $agentListItemRow = $(event.currentTarget).parent().parent();
|
||||
$agentListItemRow.remove();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
$nameCol.append($agentAlias);
|
||||
$deleteCol.append($removeBtn);
|
||||
|
@ -1018,57 +1082,66 @@ function getAgentRow (layerId, agentId, agentAlias) {
|
|||
$row.append($nameCol).append($deleteCol);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
function addAgentRow (layerId, agentId, agentAlias) {
|
||||
if (agentId == null || agentId == 0 || agentAlias.length === 0) return;
|
||||
|
||||
var $layerRow = $("tr#layer_row_" + layerId);
|
||||
if ($layerRow && $layerRow.find("input.layer_agent_id[value='" + agentId + "']").length === 0) {
|
||||
$layerRow
|
||||
.find("td:first-child")
|
||||
.append(getLayerAgentIdInput(layerId, agentId))
|
||||
.append(getLayerAgentAliasInput(layerId, agentId, agentAlias));
|
||||
}
|
||||
|
||||
$("table#list_agents").append(getAgentRow(layerId, agentId, agentAlias));
|
||||
}
|
||||
|
||||
function getLayerAgentIdInput (layerId, agentId) {
|
||||
return $("<input class=\"layer_agent_id\" type=\"hidden\" data-agent-id=\"" + agentId + "\" name=\"layers[" + layerId + "][agents][" + agentId + "][id]\" value=\"" + agentId + "\">");
|
||||
}
|
||||
function addAgentRow(layerId, agentId, agentAlias)
|
||||
{
|
||||
if (agentId == null || agentId == 0 || agentAlias.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
function getLayerAgentAliasInput (layerId, agentId, agentAlias) {
|
||||
return $("<input class=\"layer_agent_alias\" type=\"hidden\" data-agent-id=\"" + agentId + "\" name=\"layers[" + layerId + "][agents][" + agentId + "][alias]\" value=\"" + agentAlias + "\">");
|
||||
}
|
||||
var $layerRow = $('tr#layer_row_' + layerId);
|
||||
if ($layerRow && $layerRow.find(("input.layer_agent_id[value='" + agentId + "']")).length === 0) {
|
||||
$layerRow.find('td:first-child').append(getLayerAgentIdInput(layerId, agentId)).append(getLayerAgentAliasInput(layerId, agentId, agentAlias));
|
||||
}
|
||||
|
||||
function getGroupRow (layerId, groupId, groupName, agentId, agentAlias) {
|
||||
var $row = $("<tr class=\"groups_list_item\" data-group-id=\"" + groupId + "\" data-group-name=\"" + groupName + "\" data-agent-id=\"" + agentId + "\" data-agent-alias=\"" + agentAlias + "\" />");
|
||||
var $nameCol = $("<td />");
|
||||
var $deleteCol = $("<td />");
|
||||
$('table#list_agents').append(getAgentRow(layerId, agentId, agentAlias));
|
||||
}
|
||||
|
||||
var $groupName = $("<span class=\"group_desc\">"
|
||||
|
||||
function getLayerAgentIdInput(layerId, agentId)
|
||||
{
|
||||
return $('<input class="layer_agent_id" type="hidden" data-agent-id="' + agentId + '" name="layers[' + layerId + '][agents][' + agentId + '][id]" value="' + agentId + '">');
|
||||
}
|
||||
|
||||
|
||||
function getLayerAgentAliasInput(layerId, agentId, agentAlias)
|
||||
{
|
||||
return $('<input class="layer_agent_alias" type="hidden" data-agent-id="' + agentId + '" name="layers[' + layerId + '][agents][' + agentId + '][alias]" value="' + agentAlias + '">');
|
||||
}
|
||||
|
||||
|
||||
function getGroupRow(layerId, groupId, groupName, agentId, agentAlias)
|
||||
{
|
||||
var $row = $('<tr class="groups_list_item" data-group-id="' + groupId + '" data-group-name="' + groupName + '" data-agent-id="' + agentId + '" data-agent-alias="' + agentAlias + '" />');
|
||||
var $nameCol = $('<td />');
|
||||
var $deleteCol = $('<td />');
|
||||
|
||||
var $groupName = $('<span class="group_desc">'
|
||||
+ groupName
|
||||
+ " ("
|
||||
+ ' ('
|
||||
+ "<?php echo __('Using data from'); ?> "
|
||||
+ "<i>" + agentAlias + "</i>"
|
||||
+ ")"
|
||||
+ "</span>");
|
||||
var $removeBtn = $('<a class="delete_row" href="javascript:;"><?php echo html_print_image('images/cross.png', true, ['class' => 'invert_filter']); ?></a>');
|
||||
+ '<i>' + agentAlias + '</i>'
|
||||
+ ')'
|
||||
+ '</span>');
|
||||
var $removeBtn = $('<a class="delete_row" href="javascript:;"><?php echo html_print_image('images / cross.png', true, ['class' => 'invert_filter']); ?></a>');
|
||||
|
||||
$removeBtn.click(function (event) {
|
||||
var $layerRow = $("tr#layer_row_" + layerId);
|
||||
$removeBtn.click(
|
||||
function (event) {
|
||||
var $layerRow = $('tr#layer_row_' + layerId);
|
||||
|
||||
if ($layerRow.length > 0) {
|
||||
$layerRow.find("input.layer_group_id[data-group-id='" + groupId + "']").remove();
|
||||
$layerRow.find("input.layer_group_name[data-group-id='" + groupId + "']").remove();
|
||||
$layerRow.find("input.layer_agent_id_for_data[data-group-id='" + groupId + "']").remove();
|
||||
$layerRow.find("input.layer_agent_alias_for_data[data-group-id='" + groupId + "']").remove();
|
||||
$layerRow.find(("input.layer_group_id[data-group-id='" + groupId + "']")).remove();
|
||||
$layerRow.find(("input.layer_group_name[data-group-id='" + groupId + "']")).remove();
|
||||
$layerRow.find(("input.layer_agent_id_for_data[data-group-id='" + groupId + "']")).remove();
|
||||
$layerRow.find(("input.layer_agent_alias_for_data[data-group-id='" + groupId + "']")).remove();
|
||||
}
|
||||
|
||||
var $groupListItemRow = $(event.currentTarget).parent().parent();
|
||||
$groupListItemRow.remove();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
$nameCol.append($groupName);
|
||||
$deleteCol.append($removeBtn);
|
||||
|
@ -1076,134 +1149,146 @@ function getGroupRow (layerId, groupId, groupName, agentId, agentAlias) {
|
|||
$row.append($nameCol).append($deleteCol);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
function addGroupRow (layerId, groupId, groupName, agentId, agentAlias) {
|
||||
if (
|
||||
groupId == null ||
|
||||
groupId == 0 ||
|
||||
groupName.length === 0 ||
|
||||
agentId == null ||
|
||||
agentId == 0 ||
|
||||
agentAlias.length === 0
|
||||
) return;
|
||||
|
||||
var $layerRow = $("tr#layer_row_" + layerId);
|
||||
if ($layerRow && $layerRow.find("input.layer_group_id[value='" + groupId + "']").length === 0) {
|
||||
$layerRow
|
||||
.find("td:first-child")
|
||||
.append(getLayerGroupIdInput(layerId, groupId))
|
||||
.append(getLayerGroupNameInput(layerId, groupId, groupName))
|
||||
.append(getLayerAgentIdForDataInput(layerId, groupId, agentId))
|
||||
.append(getLayerAgentAliasForDataInput(layerId, groupId, agentAlias));
|
||||
}
|
||||
|
||||
$("table#list_groups").append(getGroupRow(layerId, groupId, groupName, agentId, agentAlias));
|
||||
}
|
||||
|
||||
function getLayerGroupIdInput (layerId, groupId) {
|
||||
return $("<input class=\"layer_group_id\" type=\"hidden\" data-group-id=\"" + groupId + "\" name=\"layers[" + layerId + "][groups][" + groupId + "][id]\" value=\"" + groupId + "\">");
|
||||
}
|
||||
function addGroupRow(layerId, groupId, groupName, agentId, agentAlias)
|
||||
{
|
||||
if (groupId == null
|
||||
|| groupId == 0
|
||||
|| groupName.length === 0
|
||||
|| agentId == null
|
||||
|| agentId == 0
|
||||
|| agentAlias.length === 0
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
function getLayerGroupNameInput (layerId, groupId, groupName) {
|
||||
return $("<input class=\"layer_group_name\" type=\"hidden\" data-group-id=\"" + groupId + "\" name=\"layers[" + layerId + "][groups][" + groupId + "][name]\" value=\"" + groupName + "\">");
|
||||
}
|
||||
var $layerRow = $('tr#layer_row_' + layerId);
|
||||
if ($layerRow && $layerRow.find(("input.layer_group_id[value='" + groupId + "']")).length === 0) {
|
||||
$layerRow.find('td:first-child').append(getLayerGroupIdInput(layerId, groupId)).append(getLayerGroupNameInput(layerId, groupId, groupName)).append(getLayerAgentIdForDataInput(layerId, groupId, agentId)).append(getLayerAgentAliasForDataInput(layerId, groupId, agentAlias));
|
||||
}
|
||||
|
||||
function getLayerAgentIdForDataInput (layerId, groupId, agentId) {
|
||||
return $("<input class=\"layer_agent_id_for_data\" type=\"hidden\" data-group-id=\"" + groupId + "\" name=\"layers[" + layerId + "][groups][" + groupId + "][agent_id]\" value=\"" + agentId + "\">");
|
||||
}
|
||||
$('table#list_groups').append(getGroupRow(layerId, groupId, groupName, agentId, agentAlias));
|
||||
}
|
||||
|
||||
function getLayerAgentAliasForDataInput (layerId, groupId, agentAlias) {
|
||||
return $("<input class=\"layer_agent_alias_for_data\" type=\"hidden\" data-group-id=\"" + groupId + "\" name=\"layers[" + layerId + "][groups][" + groupId + "][agent_alias]\" value=\"" + agentAlias + "\">");
|
||||
}
|
||||
|
||||
function getLayerRow (layerId, layerData) {
|
||||
var $row = $("<tr id=\"layer_row_" + layerId + "\" class=\"layer_row\" />");
|
||||
var $nameCol = $("<td />");
|
||||
var $sortCol = $("<td />");
|
||||
var $editCol = $("<td />");
|
||||
var $deleteCol = $("<td />");
|
||||
function getLayerGroupIdInput(layerId, groupId)
|
||||
{
|
||||
return $('<input class="layer_group_id" type="hidden" data-group-id="' + groupId + '" name="layers[' + layerId + '][groups][' + groupId + '][id]" value="' + groupId + '">');
|
||||
}
|
||||
|
||||
var $layerIdInput = $("<input class=\"layer_id\" type=\"hidden\" name=\"layer_ids[]\" value=\"" + layerId + "\">");
|
||||
var $layerNameInput = $("<input class=\"layer_name\" type=\"hidden\" name=\"layers[" + layerId + "][name]\" value=\"" + layerData.name + "\">");
|
||||
var $layerVisibleInput = $("<input class=\"layer_visible\" type=\"hidden\" name=\"layers[" + layerId + "][visible]\" value=\"" + (layerData.visible ? 1 : 0) + "\">");
|
||||
var $layerAgentsFromGroupInput = $("<input class=\"layer_agents_from_group\" type=\"hidden\" name=\"layers[" + layerId + "][agents_from_group]\" value=\"" + layerData.agentsFromGroup + "\">");
|
||||
|
||||
var $layerName = $("<span class=\"layer_name\">" + layerData.name + "</span>");
|
||||
var $sortUpBtn = $("<a class=\"up_arrow\" href=\"javascript:;\" />");
|
||||
var $sortDownBtn = $("<a class=\"down_arrow\" href=\"javascript:;\" />");
|
||||
var $editBtn = $('<a class="edit_layer" href="javascript:;"><?php echo html_print_image('images/config.png', true, ['class' => 'invert_filter']); ?></a>');
|
||||
var $removeBtn = $('<a class="delete_row" href="javascript:;"><?php echo html_print_image('images/cross.png', true, ['class' => 'invert_filter']); ?></a>');
|
||||
function getLayerGroupNameInput(layerId, groupId, groupName)
|
||||
{
|
||||
return $('<input class="layer_group_name" type="hidden" data-group-id="' + groupId + '" name="layers[' + layerId + '][groups][' + groupId + '][name]" value="' + groupName + '">');
|
||||
}
|
||||
|
||||
|
||||
function getLayerAgentIdForDataInput(layerId, groupId, agentId)
|
||||
{
|
||||
return $('<input class="layer_agent_id_for_data" type="hidden" data-group-id="' + groupId + '" name="layers[' + layerId + '][groups][' + groupId + '][agent_id]" value="' + agentId + '">');
|
||||
}
|
||||
|
||||
|
||||
function getLayerAgentAliasForDataInput(layerId, groupId, agentAlias)
|
||||
{
|
||||
return $('<input class="layer_agent_alias_for_data" type="hidden" data-group-id="' + groupId + '" name="layers[' + layerId + '][groups][' + groupId + '][agent_alias]" value="' + agentAlias + '">');
|
||||
}
|
||||
|
||||
|
||||
function getLayerRow(layerId, layerData)
|
||||
{
|
||||
var $row = $('<tr id="layer_row_' + layerId + '" class="layer_row" />');
|
||||
var $nameCol = $('<td />');
|
||||
var $sortCol = $('<td />');
|
||||
var $editCol = $('<td />');
|
||||
var $deleteCol = $('<td />');
|
||||
|
||||
var $layerIdInput = $('<input class="layer_id" type="hidden" name="layer_ids[]" value="' + layerId + '">');
|
||||
var $layerNameInput = $('<input class="layer_name" type="hidden" name="layers[' + layerId + '][name]" value="' + layerData.name + '">');
|
||||
var $layerVisibleInput = $('<input class="layer_visible" type="hidden" name="layers[' + layerId + '][visible]" value="' + (layerData.visible ? 1 : 0) + '">');
|
||||
var $layerAgentsFromGroupInput = $('<input class="layer_agents_from_group" type="hidden" name="layers[' + layerId + '][agents_from_group]" value="' + layerData.agentsFromGroup + '">');
|
||||
|
||||
var $layerName = $('<span class="layer_name">' + layerData.name + '</span>');
|
||||
var $sortUpBtn = $('<a class="up_arrow" href="javascript:;" />');
|
||||
var $sortDownBtn = $('<a class="down_arrow" href="javascript:;" />');
|
||||
var $editBtn = $('<a class="edit_layer" href="javascript:;"><?php echo html_print_image('images / config.png', true, ['class' => 'invert_filter']); ?></a>');
|
||||
var $removeBtn = $('<a class="delete_row" href="javascript:;"><?php echo html_print_image('images / cross.png', true, ['class' => 'invert_filter']); ?></a>');
|
||||
|
||||
$sortUpBtn.click(moveLayerRowUpOnClick);
|
||||
$sortDownBtn.click(moveLayerRowDownOnClick);
|
||||
$editBtn.click(function () { showLayerEditor(layerId); });
|
||||
$editBtn.click(
|
||||
function () {
|
||||
showLayerEditor(layerId);
|
||||
}
|
||||
);
|
||||
$removeBtn.click(removeLayerRowOnClick);
|
||||
|
||||
$nameCol
|
||||
.append($layerName)
|
||||
.append($layerIdInput)
|
||||
.append($layerNameInput)
|
||||
.append($layerVisibleInput)
|
||||
.append($layerAgentsFromGroupInput);
|
||||
$nameCol.append($layerName).append($layerIdInput).append($layerNameInput).append($layerVisibleInput).append($layerAgentsFromGroupInput);
|
||||
|
||||
if (layerData.agents && layerData.agents.length > 0) {
|
||||
layerData.agents.forEach(function (agent) {
|
||||
layerData.agents.foreach (function (agent) {
|
||||
$nameCol.append(getLayerAgentIdInput(layerId, agent.id));
|
||||
$nameCol.append(getLayerAgentAliasInput(layerId, agent.id, agent.alias));
|
||||
});
|
||||
}) {
|
||||
}
|
||||
}
|
||||
|
||||
if (layerData.groups && layerData.groups.length > 0) {
|
||||
layerData.groups.forEach(function (group) {
|
||||
layerData.groups.foreach (function (group) {
|
||||
$nameCol.append(getLayerGroupIdInput(layerId, group.id));
|
||||
$nameCol.append(getLayerGroupNameInput(layerId, group.id, group.name));
|
||||
$nameCol.append(getLayerAgentIdForDataInput(layerId, group.id, group.agentId));
|
||||
$nameCol.append(getLayerAgentAliasForDataInput(layerId, group.id, group.agentAlias));
|
||||
});
|
||||
}) {
|
||||
}
|
||||
}
|
||||
|
||||
$sortCol
|
||||
.append($sortUpBtn)
|
||||
.append($sortDownBtn);
|
||||
$editCol
|
||||
.append($editBtn);
|
||||
$deleteCol
|
||||
.append($removeBtn);
|
||||
$sortCol.append($sortUpBtn).append($sortDownBtn);
|
||||
$editCol.append($editBtn);
|
||||
$deleteCol.append($removeBtn);
|
||||
|
||||
$row
|
||||
.append($nameCol)
|
||||
.append($sortCol)
|
||||
.append($editCol)
|
||||
.append($deleteCol);
|
||||
$row.append($nameCol).append($sortCol).append($editCol).append($deleteCol);
|
||||
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
|
||||
function addLayerRow (layerId, layerData) {
|
||||
$("table#list_layers").append(getLayerRow(layerId, layerData));
|
||||
|
||||
function addLayerRow(layerId, layerData)
|
||||
{
|
||||
$('table#list_layers').append(getLayerRow(layerId, layerData));
|
||||
showLayerEditor(layerId);
|
||||
}
|
||||
}
|
||||
|
||||
function hightlightRow (layerId) {
|
||||
var highlightColor = "#E9F3D2";
|
||||
$("tr.layer_row").css("background", "");
|
||||
$("tr#layer_row_" + layerId).css("background", highlightColor);
|
||||
}
|
||||
|
||||
function existInvalidLayerNames () {
|
||||
function hightlightRow(layerId)
|
||||
{
|
||||
var highlightColor = '#E9F3D2';
|
||||
$('tr.layer_row').css('background', '');
|
||||
$('tr#layer_row_' + layerId).css('background', highlightColor);
|
||||
}
|
||||
|
||||
|
||||
function existInvalidLayerNames()
|
||||
{
|
||||
var exist = false;
|
||||
$("table#list_layers input.layer_name").each(function () {
|
||||
$('table#list_layers input.layer_name').each(
|
||||
function () {
|
||||
if ($(this).val().trim().length === 0) {
|
||||
exist = true;
|
||||
return false; // Break jQuery object each
|
||||
return false;
|
||||
// Break jQuery object each
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
return exist;
|
||||
}
|
||||
}
|
||||
|
||||
function onFormSubmit (event) {
|
||||
|
||||
function onFormSubmit(event)
|
||||
{
|
||||
// Validate layer names
|
||||
if (existInvalidLayerNames()) {
|
||||
event.preventDefault();
|
||||
|
@ -1211,25 +1296,31 @@ function onFormSubmit (event) {
|
|||
alert("<?php echo __('Empty layer names are not supported'); ?>");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save connection list
|
||||
$('#map_connection_list').val(connectionMaps.toString());
|
||||
}
|
||||
}
|
||||
|
||||
function onLayerGroupIdChange (event) {
|
||||
|
||||
function onLayerGroupIdChange(event)
|
||||
{
|
||||
// Clear agent inputs
|
||||
$("input#hidden-agent_id_for_data").val(0);
|
||||
$("input#text-agent_alias_for_data").val("");
|
||||
$('input#hidden-agent_id_for_data').val(0);
|
||||
$('input#text-agent_alias_for_data').val('');
|
||||
toggleAddGroupBtn();
|
||||
}
|
||||
}
|
||||
|
||||
// Bind events
|
||||
$("form#form_setup").submit(onFormSubmit);
|
||||
$("input#button-add_agent").click(addAgentClick);
|
||||
$("select#layer_group_id").change(onLayerGroupIdChange);
|
||||
$("input#button-add_group").click(addGroupClick);
|
||||
|
||||
// Populate layer list
|
||||
var layers = <?php echo json_encode($layer_list); ?>;
|
||||
// Bind events
|
||||
$('form#form_setup').submit(onFormSubmit);
|
||||
$('input#button-add_agent').click(addAgentClick);
|
||||
$('select#layer_group_id').change(onLayerGroupIdChange);
|
||||
$('input#button-add_group').click(addGroupClick);
|
||||
|
||||
// Populate layer list
|
||||
var layers = < ? php echo json_encode($layer_list);
|
||||
?>
|
||||
;
|
||||
layers.forEach(function (layer) {
|
||||
$("table#list_layers").append(
|
||||
getLayerRow(layer["id"], {
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
global $config;
|
||||
global $statusProcessInDB;
|
||||
|
||||
use PandoraFMS\Agent;
|
||||
use PandoraFMS\User;
|
||||
|
||||
check_login();
|
||||
|
@ -630,18 +631,7 @@ switch ($activeTab) {
|
|||
'message' => $message,
|
||||
];
|
||||
} else {
|
||||
// One item per module
|
||||
if (empty($name_modules)) {
|
||||
$statusProcessInDB = [
|
||||
'flag' => true,
|
||||
'message' => ui_print_error_message(
|
||||
__('No modules selected'),
|
||||
'',
|
||||
true
|
||||
),
|
||||
];
|
||||
} else {
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$agents_ids = [];
|
||||
foreach ($id_agents as $id_agent_id) {
|
||||
$server_and_agent = explode('|', $id_agent_id);
|
||||
|
@ -661,13 +651,10 @@ switch ($activeTab) {
|
|||
} else {
|
||||
$agents[0] = $id_agents;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($agents as $id_server => $id_agents) {
|
||||
// Any module
|
||||
if ($name_modules[0] == '0') {
|
||||
// Any module.
|
||||
if (empty($name_modules) === true || $name_modules[0] === '0') {
|
||||
$message .= visual_map_process_wizard_add_agents(
|
||||
$id_agents,
|
||||
$image,
|
||||
|
@ -705,19 +692,14 @@ switch ($activeTab) {
|
|||
} else {
|
||||
foreach ($name_modules as $mod) {
|
||||
foreach ($id_agents as $ag) {
|
||||
$id_module = agents_get_modules(
|
||||
$ag,
|
||||
['id_agente_modulo'],
|
||||
['nombre' => $mod]
|
||||
);
|
||||
$agent = new Agent($ag);
|
||||
$id_module = $agent->searchModules(
|
||||
['nombre' => $mod],
|
||||
1
|
||||
)->toArray()['id_agente_modulo'];
|
||||
|
||||
|
||||
|
||||
if (empty($id_module)) {
|
||||
if (empty($id_module) === true) {
|
||||
continue;
|
||||
} else {
|
||||
$id_module = reset($id_module);
|
||||
$id_module = $id_module['id_agente_modulo'];
|
||||
}
|
||||
|
||||
$id_modules[] = $id_module;
|
||||
|
|
|
@ -533,7 +533,7 @@ echo '</div>';
|
|||
echo '</form>';
|
||||
|
||||
// Trick for it have a traduct text for javascript.
|
||||
echo '<span id="any_text" class="invisible">'.__('Any').'</span>';
|
||||
echo '<span id="any_text" class="invisible">'.__('None').'</span>';
|
||||
echo '<span id="none_text" class="invisible">'.__('None').'</span>';
|
||||
echo '<span id="loading_text" class="invisible">'.__('Loading...').'</span>';
|
||||
?>
|
||||
|
|
|
@ -101,7 +101,7 @@ $output .= '<p id="description_task">';
|
|||
$output .= __($str);
|
||||
$output .= '<br><br>';
|
||||
$output .= __('You can get more plugins in our');
|
||||
$output .= '<a href="http://pandorafms.com/Library/Library/">';
|
||||
$output .= '<a href="https://pandorafms.com/Library/Library/">';
|
||||
$output .= ' '.__('Public Resource Library');
|
||||
$output .= '</a>';
|
||||
$output .= '</p>';
|
||||
|
|
|
@ -63,7 +63,7 @@ if (is_ajax() === true) {
|
|||
'searchAgent' => '',
|
||||
'statusAgent' => AGENT_STATUS_ALL,
|
||||
'searchModule' => '',
|
||||
'statusModule' => -1,
|
||||
'statusModule' => AGENT_MODULE_STATUS_ALL,
|
||||
'groupID' => 0,
|
||||
'tagID' => 0,
|
||||
];
|
||||
|
|
|
@ -932,7 +932,9 @@ class Tree
|
|||
$agents_aux = [];
|
||||
foreach ($agents as $iterator => $agent) {
|
||||
$this->processAgent($agents[$iterator], $server);
|
||||
if ($agents[$iterator]['counters']['total'] !== '0') {
|
||||
if ($agents[$iterator]['counters']['total'] !== '0'
|
||||
|| (bool) $this->filter['show_not_init_agents'] === true
|
||||
) {
|
||||
$agents_aux[] = $agents[$iterator];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC220211';
|
||||
$build_version = 'PC220215';
|
||||
$pandora_version = 'v7.0NG.759';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -1430,6 +1430,9 @@ function agents_get_group_agents(
|
|||
|
||||
|
||||
/**
|
||||
* @deprecated use \PandoraFMS\Agent::searchModules
|
||||
*
|
||||
*
|
||||
* Get all the modules in an agent. If an empty list is passed it will select all
|
||||
*
|
||||
* @param mixed Agent id to get modules. It can also be an array of agent id's, by default is null and this mean that use the ids of agents in user's groups.
|
||||
|
|
|
@ -14,6 +14,7 @@ Variables from PHP:
|
|||
- error_search
|
||||
*/
|
||||
|
||||
const REMOTE_MODULE_LIBRARY_URI = "https://pandorafms.com/library/";
|
||||
$(document).ready(function() {
|
||||
// Save categories in sessionStorage to avoid making the request to the API many times.
|
||||
function set_local_categories() {
|
||||
|
@ -100,8 +101,7 @@ $(document).ready(function() {
|
|||
// Get all categories from Module library.
|
||||
function get_all_categories() {
|
||||
$.ajax({
|
||||
url:
|
||||
"https://pandorafms.com/library/wp-json/wp/v2/categories?per_page=100",
|
||||
url: REMOTE_MODULE_LIBRARY_URI + "wp-json/wp/v2/categories?per_page=100",
|
||||
type: "GET",
|
||||
cache: false,
|
||||
crossDomain: true,
|
||||
|
@ -127,10 +127,9 @@ $(document).ready(function() {
|
|||
|
||||
var api_url = "";
|
||||
if (selector == "search") {
|
||||
api_url = "https://pandorafms.com/library/wp-json/wp/v2/posts?search=";
|
||||
api_url = REMOTE_MODULE_LIBRARY_URI + "wp-json/wp/v2/posts?search=";
|
||||
} else if (selector == "category") {
|
||||
api_url =
|
||||
"https://pandorafms.com/library/wp-json/wp/v2/posts/?categories=";
|
||||
api_url = REMOTE_MODULE_LIBRARY_URI + "wp-json/wp/v2/posts/?categories=";
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
|
@ -238,7 +237,7 @@ $(document).ready(function() {
|
|||
/* Print main page */
|
||||
function library_main() {
|
||||
$.ajax({
|
||||
url: "https://pandorafms.com/library/wp-json/wp/v2/pages/121",
|
||||
url: REMOTE_MODULE_LIBRARY_URI + "wp-json/wp/v2/pages/121",
|
||||
type: "GET",
|
||||
cache: false,
|
||||
crossDomain: true,
|
||||
|
@ -286,6 +285,8 @@ function library_main() {
|
|||
clean_page.splice(0, 1);
|
||||
|
||||
$.each(clean_page, function(i, v) {
|
||||
// Clean et_pb_blurb WP tags.
|
||||
v = v.replace(/([\[et_pb_blurb].*[\]](?=[A-z]))/g, "");
|
||||
var main_category = $(
|
||||
"#library_main_content div.library_main_category:nth-child(" + i + ")"
|
||||
);
|
||||
|
@ -314,7 +315,7 @@ function library_main() {
|
|||
// Get all data from one category. This is necessary to get the category name.
|
||||
function get_category(id) {
|
||||
$.ajax({
|
||||
url: "https://pandorafms.com/library/wp-json/wp/v2/categories/" + id,
|
||||
url: REMOTE_MODULE_LIBRARY_URI + "wp-json/wp/v2/categories/" + id,
|
||||
type: "GET",
|
||||
cache: false,
|
||||
contentType: "application/json",
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -549,7 +549,8 @@ class Agent extends Entity
|
|||
* @param array $filter Filters.
|
||||
* @param integer $limit Limit search results.
|
||||
*
|
||||
* @return array Of PandoraFMS\Module Modules found.
|
||||
* @return array|Module Of PandoraFMS\Module Modules
|
||||
* found or Module found is limit 1.
|
||||
*/
|
||||
public function searchModules(array $filter, int $limit=0)
|
||||
{
|
||||
|
@ -577,7 +578,10 @@ class Agent extends Entity
|
|||
} else {
|
||||
// Search in db.
|
||||
$return = Module::search($filter, $limit);
|
||||
if (is_array($return) === false) {
|
||||
|
||||
if (is_array($return) === false
|
||||
&& is_object($return) === false
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.759';
|
||||
$build = '220211';
|
||||
$build = '220215';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.759
|
||||
%define release 220211
|
||||
%define release 220215
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.759
|
||||
%define release 220211
|
||||
%define release 220215
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.759
|
||||
%define release 220211
|
||||
%define release 220215
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -3670,6 +3670,7 @@ CREATE TABLE IF NOT EXISTS `tautoconfig` (
|
|||
`name` VARCHAR(100) NOT NULL,
|
||||
`order` INT NOT NULL DEFAULT 0,
|
||||
`description` TEXT,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.759-220211
|
||||
Version: 7.0NG.759-220215
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.759-220211"
|
||||
pandora_version="7.0NG.759-220215"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.759";
|
||||
my $pandora_build = "220211";
|
||||
my $pandora_build = "220215";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.759";
|
||||
my $pandora_build = "220211";
|
||||
my $pandora_build = "220215";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.759
|
||||
%define release 220211
|
||||
%define release 220215
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.759
|
||||
%define release 220211
|
||||
%define release 220215
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.759"
|
||||
PI_BUILD="220211"
|
||||
PI_BUILD="220215"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.759 Build 220211";
|
||||
my $version = "7.0NG.759 Build 220215";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.759 Build 220211";
|
||||
my $version = "7.0NG.759 Build 220215";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue