2009-02-24 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/config_process.php: Added compact_header. If you want to save on server hits and increase performance (slightly) enable it. Page loads (on my system) ~500ms faster and feels faster since it doesn't block the page while waiting on css and javascript * include/functions_agents.php: Moved process_manage_config from configurar_agente. * include/functions_ui.php: Added compact_header functionality * include/functions_html.php: Fixed some id issues which caused manage_config to not work correctly. id's can't have [] in them. Also fixed the comparison for numeric (string to int) comparisons * include/styles/pandora.css: Moved @import to functions_ui.php * godmode/agentes/manage_config.php: Fixed ids and some validation * godmode/agentes/configurar_agente.php, godmode/agentes/agent_manager: Fixed HTML output and use functions for images * godmode/setup/setup.php: Added compact_header to setup git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1480 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
9618ed9a43
commit
0eda088209
|
@ -1,3 +1,28 @@
|
|||
2009-02-24 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||
|
||||
* include/config_process.php: Added compact_header. If you want to
|
||||
save on server hits and increase performance (slightly) enable it.
|
||||
Page loads (on my system) ~500ms faster and feels faster since it
|
||||
doesn't block the page while waiting on css and javascript
|
||||
|
||||
* include/functions_agents.php: Moved process_manage_config from
|
||||
configurar_agente.
|
||||
|
||||
* include/functions_ui.php: Added compact_header functionality
|
||||
|
||||
* include/functions_html.php: Fixed some id issues which caused
|
||||
manage_config to not work correctly. id's can't have [] in them.
|
||||
Also fixed the comparison for numeric (string to int) comparisons
|
||||
|
||||
* include/styles/pandora.css: Moved @import to functions_ui.php
|
||||
|
||||
* godmode/agentes/manage_config.php: Fixed ids and some validation
|
||||
|
||||
* godmode/agentes/configurar_agente.php, godmode/agentes/agent_manager:
|
||||
Fixed HTML output and use functions for images
|
||||
|
||||
* godmode/setup/setup.php: Added compact_header to setup
|
||||
|
||||
2009-02-24 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* include/functions_db.php: Fixed a bug in
|
||||
|
|
|
@ -55,7 +55,7 @@ if (isset($_GET["disk_conf_delete"])) {
|
|||
unlink ($filename['conf']);
|
||||
}
|
||||
|
||||
echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||
echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||
|
||||
$table->width = 650;
|
||||
$table->cellpadding = 4;
|
||||
|
@ -69,14 +69,16 @@ $table->data[0][0] = '<b>'.__('Agent name').'</b>'.print_help_tip (__("The agent
|
|||
$table->data[0][1] = print_input_text ('agente', $nombre_agente, '', 30, 100,true);
|
||||
|
||||
if (isset ($id_agente) && $id_agente != "") {
|
||||
$table->data[0][1] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">
|
||||
<img src="images/lupa.png" border="0" title="'.__('Agent detail').'"></a>';
|
||||
$table->data[0][1] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
|
||||
$table->data[0][1] .= print_image ("images/lupa.png", true, array ("border" => 0, "title" => __('Agent detail')));
|
||||
$table->data[0][1] .= '</a>';
|
||||
}
|
||||
|
||||
// Remote configuration available
|
||||
if (file_exists ($filename['md5'])) {
|
||||
$table->data[0][1] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agente.'&disk_conf='.$agent_md5.'">
|
||||
<img src="images/application_edit.png" border="0" title="'.__('This agent can be remotely configured').'"></a>'.print_help_tip (__('You can remotely edit this agent configuration'), true);
|
||||
$table->data[0][1] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agente.'&disk_conf='.$agent_md5.'">';
|
||||
$table->data[0][1] .= print_image ("images/application_edit.png", false, array ("border" => 0, "title" => __('This agent can be remotely configured')));
|
||||
$table->data[0][1] .= '</a>'.print_help_tip (__('You can remotely edit this agent configuration'), true);
|
||||
}
|
||||
|
||||
$table->data[1][0] = '<b>'.__('IP Address').'</b>';
|
||||
|
@ -150,7 +152,8 @@ $table->data[15][0] = '<b>'.__('Remote configuration').'</b>';
|
|||
if (file_exists ($filename['md5'])) {
|
||||
$table->data[15][1] = date ("F d Y H:i:s.", fileatime ($filename['md5']));
|
||||
// Delete remote configuration
|
||||
$table->data[15][1] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&disk_conf_delete=1&id_agente=$id_agente"><img src="images/cross.png" /></a>';
|
||||
$table->data[15][1] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&disk_conf_delete=1&id_agente='.$id_agente.'">';
|
||||
$table->data[15][1] .= print_image ("images/cross.png", true).'</a>';
|
||||
} else {
|
||||
$table->data[15][1] = '<i>'.__('Not available').'</i>';
|
||||
}
|
||||
|
@ -167,5 +170,5 @@ if ($new_agent) {
|
|||
print_input_hidden ('update_agent', 1);
|
||||
print_input_hidden ('id_agente', $id_agente);
|
||||
}
|
||||
echo '</div>';
|
||||
?>
|
||||
echo '</div></form>';
|
||||
?>
|
|
@ -187,70 +187,50 @@ if ($create_agent) {
|
|||
}
|
||||
|
||||
// Show tabs
|
||||
echo "<div id='menu_tab_frame'>";
|
||||
echo "<div id='menu_tab_left'><ul class='mn'>";
|
||||
echo "<li class='nomn'>";
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente'>
|
||||
<img src='images/setup.png' class='top'> ".substr(get_agent_name ($id_agente),0,21)."</a>";
|
||||
echo "</li>";
|
||||
echo "</ul></div>";
|
||||
$img_arr = array ("class" => "top", "width" => 16);
|
||||
|
||||
echo "<div id='menu_tab'><ul class='mn'>";
|
||||
echo '<div id="menu_tab_frame"><div id="menu_tab_left"><ul class="mn">';
|
||||
echo '<li class="nomn"><a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'">';
|
||||
print_image ("images/setup.png", false, $img_arr);
|
||||
echo ' '.mb_substr (get_agent_name ($id_agente),0,21).'</a>';
|
||||
echo "</li></ul></div>";
|
||||
|
||||
echo "<li class='nomn'>";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente'><img src='images/zoom.png' width='16' class='top'> ".__('View')."</a>";
|
||||
echo "</li>";
|
||||
echo '<div id="menu_tab"><ul class="mn"><li class="nomn">';
|
||||
echo '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
|
||||
print_image ("images/zoom.png", false, $img_arr);
|
||||
echo ' '.__('View').'</a></li>';
|
||||
|
||||
if ($tab == "main") {
|
||||
echo "<li class='nomn_high'>";
|
||||
} else {
|
||||
echo "<li class='nomn'>";
|
||||
}
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente=$id_agente'><img src='images/cog.png' width='16' class='top'> ".__('Setup')."</a>";
|
||||
echo "</li>";
|
||||
echo '<li class="'.($tab == "main" ? 'nomn_high' : 'nomn').'">';
|
||||
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agente.'">';
|
||||
print_image ("images/cog.png", false, $img_arr);
|
||||
echo ' '.__('Setup').'</a></li>';
|
||||
|
||||
if ($tab == "module") {
|
||||
echo "<li class='nomn_high'>";
|
||||
} else {
|
||||
echo "<li class='nomn'>";
|
||||
}
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente=$id_agente'><img src='images/lightbulb.png' width='16' class='top'> ".__('Modules')."</a>";
|
||||
echo "</li>";
|
||||
echo '<li class="'.($tab == "module" ? 'nomn_high' : 'nomn').'">';
|
||||
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
|
||||
print_image ("images/lightbulb.png", false, $img_arr);
|
||||
echo ' '.__('Modules').'</a></li>';
|
||||
|
||||
if ($tab == "alert") {
|
||||
echo "<li class='nomn_high'>";
|
||||
} else {
|
||||
echo "<li class='nomn'>";
|
||||
}
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=$id_agente'><img src='images/bell.png' width='16' class='top'> ". __('Alerts')."</a>";
|
||||
echo "</li>";
|
||||
echo '<li class="'.($tab == "alert" ? 'nomn_high' : 'nomn').'">';
|
||||
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
|
||||
print_image ("images/bell.png", false, $img_arr);
|
||||
echo ' '.__('Alerts').'</a></li>';
|
||||
|
||||
if ($tab == "template") {
|
||||
echo "<li class='nomn_high'>";
|
||||
} else {
|
||||
echo "<li class='nomn'>";
|
||||
}
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente=$id_agente'><img src='images/network.png' width='16' class='top' border=0> ".__('Net. Templates')."</a>";
|
||||
echo "</li>";
|
||||
echo '<li class="'.($tab == "template" ? 'nomn_high' : 'nomn').'">';
|
||||
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
|
||||
print_image ("images/network.png", false, $img_arr);
|
||||
echo ' '.__('Net. Templates').'</a></li>';
|
||||
|
||||
enterprise_hook ('inventory_tab');
|
||||
|
||||
echo "</ul>";
|
||||
echo "</div>";
|
||||
echo "</div>"; // menu_tab_frame
|
||||
echo "</ul></div></div>";
|
||||
|
||||
// Make some space between tabs and title
|
||||
// IE might not always show an empty div, added space
|
||||
echo "<div style='height: 25px'> </div>";
|
||||
echo '<div style="height: 25px;"> </div>';
|
||||
|
||||
// Show agent creation results
|
||||
if ($create_agent) {
|
||||
if (! $agent_created_ok) {
|
||||
echo "<h3 class='error'>".__('There was a problem creating agent')."</h3>";
|
||||
echo __('There was a problem creating agent_keepalive module');
|
||||
} else {
|
||||
echo "<h3 class='suc'>".__('Agent successfully created')."</h3>";
|
||||
}
|
||||
print_error_message ($agent_created_ok, __('Agent successfully created'), __('There was a problem creating the agent'));
|
||||
}
|
||||
|
||||
// Fix / Normalize module data
|
||||
|
@ -270,11 +250,7 @@ if (isset($_GET["fix_module"])){
|
|||
$error = " - ".__('No data to normalize');
|
||||
}
|
||||
|
||||
if ($result !== false) {
|
||||
echo '<h3 class="suc">'.__('Deleted data above').' '.$media.'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="error">'.__('Error normalizing module').$error.'</h3>';
|
||||
}
|
||||
print_error_message ($result, __('Deleted data above').' '.$media, __('Error normalizing module').' '.$error);
|
||||
}
|
||||
|
||||
// ================
|
||||
|
@ -343,16 +319,11 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter
|
|||
}
|
||||
}
|
||||
|
||||
if ((isset($agent_created_ok)) && ($agent_created_ok == 1)){
|
||||
$_GET["id_agente"] = $id_agente;
|
||||
}
|
||||
|
||||
// Read agent data
|
||||
// This should be at the end of all operation checks, to read the changess
|
||||
if (isset($_REQUEST["id_agente"])) {
|
||||
// This should be at the end of all operation checks, to read the changes - $id_agente doesn't have to be retrieved
|
||||
if ($id_agente > 0) {
|
||||
//This has been done in the beginning of the page, but if an agent was created, this id might change
|
||||
$id_agente = (int) get_parameter ('id_agente');
|
||||
$id_grupo = dame_id_grupo ($id_agente);
|
||||
$id_grupo = get_agent_group ($id_agente);
|
||||
if (give_acl ($config["id_user"], $id_grupo, "AW") != 1) {
|
||||
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation","Trying to admin an agent without access");
|
||||
require ("general/noaccess.php");
|
||||
|
@ -389,7 +360,7 @@ $edit_module = (bool) get_parameter ('edit_module');
|
|||
|
||||
// GET DATA for MODULE UPDATE OR MODULE INSERT
|
||||
if ($update_module || $create_module) {
|
||||
$id_grupo = dame_id_grupo ($id_agente);
|
||||
$id_grupo = get_agent_group ($id_agente);
|
||||
|
||||
if (! give_acl ($config["id_user"], $id_grupo, "AW")) {
|
||||
audit_db ($config["id_user"], $REMOTE_ADDR, "ACL Violation",
|
||||
|
|
|
@ -32,75 +32,6 @@ require_once ('include/functions_modules.php');
|
|||
|
||||
echo '<h2>'.__('Agent configuration'). ' » '. __('Configuration Management').'</h2>';
|
||||
|
||||
function process_manage_config ($source_id_agent, $destiny_id_agents) {
|
||||
if (empty ($source_id_agent)) {
|
||||
echo '<h3 class="error">'.__('No source agent to copy').'</h3>';
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty ($destiny_id_agents)) {
|
||||
echo '<h3 class="error">'.__('No destiny agent(s) to copy').'</h3>';
|
||||
return false;
|
||||
}
|
||||
|
||||
$copy_modules = (bool) get_parameter ('copy_modules');
|
||||
$copy_alerts = (bool) get_parameter ('copy_alerts');
|
||||
|
||||
if ($copy_modules) {
|
||||
$target_modules = (array) get_parameter ('target_modules', array ());
|
||||
if (empty ($target_modules)) {
|
||||
echo '<h3 class="error">'.__('No modules have been selected').'</h3>';
|
||||
return false;
|
||||
}
|
||||
|
||||
process_sql ('SET AUTOCOMMIT = 0');
|
||||
process_sql ('START TRANSACTION');
|
||||
$error = false;
|
||||
$alerts = array ();
|
||||
foreach ($destiny_id_agents as $id_destiny_agent) {
|
||||
foreach ($target_modules as $id_agent_module) {
|
||||
$result = copy_agent_module_to_agent ($id_agent_module,
|
||||
$id_destiny_agent);
|
||||
|
||||
if ($result === false) {
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
|
||||
$id_destiny_module = $result;
|
||||
if (! isset ($alerts[$id_agent_module]))
|
||||
$alerts[$id_agent_module] = get_alerts_agent_module ($id_agent_module,
|
||||
true);
|
||||
|
||||
if ($alerts[$id_agent_module] === false)
|
||||
continue;
|
||||
|
||||
if ($copy_alerts) {
|
||||
foreach ($alerts[$id_agent_module] as $alert) {
|
||||
$result = copy_alert_agent_module_to_agent_module ($alert['id'],
|
||||
$id_destiny_module);
|
||||
if ($result === false) {
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($error)
|
||||
break;
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
echo '<h3 class="error">'.__('There was an error copying the agent configuration, the copy has been cancelled').'</h3>';
|
||||
process_sql ('ROLLBACK');
|
||||
} else {
|
||||
echo '<h3 class="suc">'.__('Successfully copied').'</h3>';
|
||||
process_sql ('COMMIT');
|
||||
}
|
||||
process_sql ('SET AUTOCOMMIT = 1');
|
||||
}
|
||||
}
|
||||
|
||||
$source_id_group = (int) get_parameter ('source_id_group');
|
||||
$source_id_agent = (int) get_parameter ('source_id_agent');
|
||||
$destiny_id_group = (int) get_parameter ('destiny_id_group');
|
||||
|
@ -133,12 +64,12 @@ $table->data[0][1] = print_select ($groups, 'source_id_group', $source_id_group,
|
|||
false, '', '', true);
|
||||
$table->data[0][2] = __('Agent');
|
||||
$table->data[0][2] .= ' <span id="source_agent_loading" class="invisible">';
|
||||
$table->data[0][2] .= '<img src="images/spinner.gif" />';
|
||||
$table->data[0][2] .= print_image ("images/spinner.gif", true);
|
||||
$table->data[0][2] .= '</span>';
|
||||
$table->data[0][3] = print_select (get_group_agents ($source_id_group, false, "none"),
|
||||
'source_id_agent', $source_id_agent, false, __('Select'), 0, true);
|
||||
|
||||
echo '<form id="manage_config_form" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/manage_config">';
|
||||
echo '<form id="manage_config_form" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/manage_config">';
|
||||
|
||||
echo '<fieldset id="fieldset_source">';
|
||||
echo '<legend><span>'.__('Source');
|
||||
|
@ -156,22 +87,22 @@ if ($source_id_agent)
|
|||
$modules = get_agent_modules ($source_id_agent, 'nombre');
|
||||
|
||||
$table->data['operations'][0] = __('Operations');
|
||||
$table->data['operations'][1] = '<span class="with_modules"'.(empty ($modules) ? ' class="invisible"': '').'>';
|
||||
$table->data['operations'][1] = '<span class="with_modules'.(empty ($modules) ? ' invisible': '').'">';
|
||||
$table->data['operations'][1] .= print_checkbox ('copy_modules', 1, true, true);
|
||||
$table->data['operations'][1] .= print_label (__('Copy modules'), 'checkbox-copy_modules', true);
|
||||
$table->data['operations'][1] .= '</span><br />';
|
||||
|
||||
$table->data['operations'][1] .= '<span class="with_alerts"'.(empty ($alerts) ? ' class="invisible"': '').'>';
|
||||
$table->data['operations'][1] .= '<span class="with_alerts'.(empty ($alerts) ? ' invisible': '').'">';
|
||||
$table->data['operations'][1] .= print_checkbox ('copy_alerts', 1, true, true);
|
||||
$table->data['operations'][1] .= print_label (__('Copy alerts'), 'checkbox-copy_alerts', true);
|
||||
$table->data['operations'][1] .= '</span>';
|
||||
|
||||
$table->data[1][0] = __('Modules');
|
||||
$table->data[1][1] = '<span class="with_modules"'.(empty ($modules) ? ' class="invisible"': '').'>';
|
||||
$table->data[1][1] = '<span class="with_modules'.(empty ($modules) ? ' invisible': '').'">';
|
||||
$table->data[1][1] .= print_select ($modules,
|
||||
'target_modules[]', 0, false, '', '', true, true);
|
||||
$table->data[1][1] .= '</span>';
|
||||
$table->data[1][1] .= '<span class="without_modules"'.(! empty ($modules) ? ' class="invisible"': '').'>';
|
||||
$table->data[1][1] .= '<span class="without_modules'.(! empty ($modules) ? ' invisible': '').'">';
|
||||
$table->data[1][1] .= '<em>'.__('No modules for this agent').'</em>';
|
||||
$table->data[1][1] .= '</span>';
|
||||
|
||||
|
@ -186,16 +117,16 @@ foreach ($agent_alerts as $alert) {
|
|||
$name .= ' (<em>'.$modules[$alert['id_agent_module']].'</em>)';
|
||||
$alerts[$alert['id']] = $name;
|
||||
}
|
||||
$table->data[2][1] = '<span class="with_alerts"'.(empty ($alerts) ? ' class="invisible"': '').'>';
|
||||
$table->data[2][1] = '<span class="with_alerts'.(empty ($alerts) ? ' invisible': '').'">';
|
||||
$table->data[2][1] .= print_select ($alerts,
|
||||
'target_alerts[]', 0, false, '', '', true, true);
|
||||
$table->data[2][1] .= '</span>';
|
||||
$table->data[2][1] .= '<span class="without_alerts"'.(! empty ($modules) ? ' class="invisible"': '').'>';
|
||||
$table->data[2][1] .= '<span class="without_alerts'.(! empty ($modules) ? ' invisible': '').'">';
|
||||
$table->data[2][1] .= '<em>'.__('No alerts for this agent').'</em>';
|
||||
$table->data[2][1] .= '</span>';
|
||||
|
||||
echo '<div id="modules_loading" class="loading invisible">';
|
||||
echo '<img src="images/spinner.gif" />';
|
||||
print_image ("images/spinner.gif");
|
||||
echo __('Loading').'…';
|
||||
echo '</div>';
|
||||
|
||||
|
@ -213,7 +144,7 @@ $table->data[0][1] = print_select ($groups, 'destiny_id_group', $destiny_id_grou
|
|||
|
||||
$table->data[1][0] = __('Agent');
|
||||
$table->data[1][0] .= '<span id="destiny_agent_loading" class="invisible">';
|
||||
$table->data[1][0] .= '<img src="images/spinner.gif" />';
|
||||
$table->data[1][0] .= print_image ("images/spinner.gif", true);
|
||||
$table->data[1][0] .= '</span>';
|
||||
$table->data[1][1] = print_select (get_group_agents ($destiny_id_group, false, "none"),
|
||||
'destiny_id_agent[]', 0, false, '', '', true, true);
|
||||
|
@ -229,13 +160,13 @@ print_submit_button (__('Go'), 'go', false, 'class="sub next"');
|
|||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||
|
||||
require_jquery_file ('form');
|
||||
require_jquery_file ('pandora.controls');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
$("#source_id_group").pandoraSelectGroup ({
|
||||
agentSelect: "select#source_id_agent",
|
||||
|
@ -243,7 +174,7 @@ $(document).ready (function () {
|
|||
});
|
||||
|
||||
$("#destiny_id_group").pandoraSelectGroup ({
|
||||
agentSelect: "select#destiny_id_agent\\[\\]",
|
||||
agentSelect: "select#destiny_id_agent",
|
||||
loading: "#destiny_agent_loading",
|
||||
callbackPost: function (id, value, option) {
|
||||
if ($("#source_id_agent").fieldValue ().in_array (id)) {
|
||||
|
@ -259,10 +190,10 @@ $(document).ready (function () {
|
|||
return;
|
||||
}
|
||||
$("#modules_loading").show ();
|
||||
$("#target_modules\\[\\] option, #target_alerts\\[\\] option").remove ();
|
||||
$("#target_modules\\[\\], #target_alerts\\[\\]").disable ();
|
||||
$("#destiny_id_agent\\[\\] option").show ();
|
||||
$("#destiny_id_agent\\[\\] option[value="+id_agent+"]").hide ();
|
||||
$("#target_modules option, #target_alerts option").remove ();
|
||||
$("#target_modules, #target_alerts").disable ();
|
||||
$("#destiny_id_agent option").show ();
|
||||
$("#destiny_id_agent option[value="+id_agent+"]").hide ();
|
||||
var no_modules;
|
||||
var no_alerts;
|
||||
/* Get modules */
|
||||
|
@ -280,7 +211,7 @@ $(document).ready (function () {
|
|||
option = $("<option></option>")
|
||||
.attr ("value", val["id_agente_modulo"])
|
||||
.append (val["nombre"]);
|
||||
$("#target_modules\\[\\]").append (option);
|
||||
$("#target_modules").append (option);
|
||||
});
|
||||
|
||||
no_modules = false;
|
||||
|
@ -304,7 +235,7 @@ $(document).ready (function () {
|
|||
.append (" (")
|
||||
.append (module_name)
|
||||
.append (")");
|
||||
$("#target_alerts\\[\\]").append (option);
|
||||
$("#target_alerts").append (option);
|
||||
});
|
||||
no_alerts = false;
|
||||
}
|
||||
|
@ -339,7 +270,7 @@ $(document).ready (function () {
|
|||
$("#fieldset_destiny, #target_table-operations").show ();
|
||||
}
|
||||
$("#fieldset_targets").show ();
|
||||
$("#target_modules\\[\\], #target_alerts\\[\\]").enable ();
|
||||
$("#target_modules, #target_alerts").enable ();
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
@ -368,7 +299,7 @@ $(document).ready (function () {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($("#destiny_id_agent\\[\\]").fieldValue ().length == 0) {
|
||||
if ($("#destiny_id_agent").fieldValue ().length == 0) {
|
||||
$("#message").showMessage ("<?php echo __('No destiny agent(s) to copy') ?>");
|
||||
return false;
|
||||
}
|
||||
|
@ -377,4 +308,5 @@ $(document).ready (function () {
|
|||
return true;
|
||||
});
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -56,6 +56,7 @@ if ($update_settings) {
|
|||
$config["event_view_hr"] = (int) get_parameter ('event_view_hr', $config["event_view_hr"]);
|
||||
$config["style"] = substr ($config["style"], 0, strlen ($config["style"]) - 4);
|
||||
$config["https"] = (bool) get_parameter ('https', $config["https"]);
|
||||
$config["compact_header"] = (bool) get_parameter ('compact_header', $config["compact_header"]);
|
||||
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["remote_config"]."' WHERE token = 'remote_config'");
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["block_size"]."' WHERE token = 'block_size'");
|
||||
|
@ -77,6 +78,7 @@ if ($update_settings) {
|
|||
process_sql ("UPDATE tconfig SET VALUE='".$config["event_view_hr"]."' WHERE token = 'event_view_hr'");
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["loginhash_pwd"]."' WHERE token = 'loginhash_pwd'");
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["https"]."' WHERE token = 'https'");
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["compact_header"]."' WHERE token = 'compact_header'");
|
||||
}
|
||||
|
||||
echo "<h2>".__('Setup')." > ";
|
||||
|
@ -149,6 +151,9 @@ $table->data[18][1] = print_checkbox ('autoupdate', 1, $config["autoupdate"], tr
|
|||
$table->data[19][0] = __('Enforce https');
|
||||
$table->data[19][1] = print_checkbox ('https', 1, $config["https"], true);
|
||||
|
||||
$table->data[20][0] = __('Compact CSS and JS into header');
|
||||
$table->data[20][1] = print_checkbox ('compact_header', 1, $config["compact_header"], true);
|
||||
|
||||
enterprise_hook ('load_snmpforward_enterprise');
|
||||
|
||||
echo '<form id="form_setup" method="POST" action="index.php?sec=gsetup&sec2=godmode/setup/setup">';
|
||||
|
@ -158,10 +163,10 @@ echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
|||
print_submit_button (__('Update'), 'update_button', false, 'class="sub upd"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
?>
|
||||
|
||||
<link rel="stylesheet" href="include/styles/color-picker.css" type="text/css" />
|
||||
<script type="text/javascript" src="include/javascript/jquery.colorpicker.js"></script>
|
||||
require_css_file ("color-picker");
|
||||
require_jquery_file ("colorpicker");
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
$("#form_setup #text-graph_color1").attachColorPicker();
|
||||
|
|
|
@ -191,4 +191,12 @@ if (!isset ($config["https"])) {
|
|||
process_sql_insert ('tconfig', array ('token' => 'https',
|
||||
'value' => $config["https"]));
|
||||
}
|
||||
|
||||
if (!isset ($config["compact_header"])) {
|
||||
// Sets whether or not we want to enforce https. We don't want to go to a
|
||||
// potentially unexisting config by default
|
||||
$config["compact_header"] = false;
|
||||
process_sql_insert ('tconfig', array ('token' => 'compact_header',
|
||||
'value' => $config["compact_header"]));
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -123,4 +123,91 @@ function get_agent_alerts ($id_agent, $filter = false, $options = false) {
|
|||
|
||||
return array ('simple' => $simple_alerts, 'compounds' => $combined_alerts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the agents config from one agent to the other
|
||||
*
|
||||
* @param int $source_id_agent Agent id
|
||||
* @param mixed $destiny_id_agents Agent id or id's (array) to copy to
|
||||
* @param bool $modules Whether to copy modules as well (defaults to get_parameter ('copy_modules'))
|
||||
* @param bool $alerts Whether to copy alerts as well
|
||||
* @param array $target_modules Which modules to copy
|
||||
*
|
||||
* @return bool True in case of good, false in case of bad
|
||||
*/
|
||||
function process_manage_config ($source_id_agent, $destiny_id_agents, $copy_modules = false, $copy_alerts = false, $target_modules = false) {
|
||||
if (empty ($source_id_agent)) {
|
||||
echo '<h3 class="error">'.__('No source agent to copy').'</h3>';
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty ($destiny_id_agents)) {
|
||||
echo '<h3 class="error">'.__('No destiny agent(s) to copy').'</h3>';
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($copy_modules == false) {
|
||||
$copy_modules = (bool) get_parameter ('copy_modules', $copy_modules);
|
||||
}
|
||||
if ($copy_alerts == false) {
|
||||
$copy_alerts = (bool) get_parameter ('copy_alerts', $copy_alerts);
|
||||
}
|
||||
|
||||
if ($copy_modules) {
|
||||
if (empty ($target_modules)) {
|
||||
$target_modules = (array) get_parameter ('target_modules', $target_modules);
|
||||
}
|
||||
if (empty ($target_modules)) {
|
||||
echo '<h3 class="error">'.__('No modules have been selected').'</h3>';
|
||||
return false;
|
||||
}
|
||||
|
||||
process_sql ('SET AUTOCOMMIT = 0');
|
||||
process_sql ('START TRANSACTION');
|
||||
$error = false;
|
||||
$alerts = array ();
|
||||
foreach ($destiny_id_agents as $id_destiny_agent) {
|
||||
foreach ($target_modules as $id_agent_module) {
|
||||
$result = copy_agent_module_to_agent ($id_agent_module,
|
||||
$id_destiny_agent);
|
||||
|
||||
if ($result === false) {
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
|
||||
$id_destiny_module = $result;
|
||||
if (! isset ($alerts[$id_agent_module]))
|
||||
$alerts[$id_agent_module] = get_alerts_agent_module ($id_agent_module,
|
||||
true);
|
||||
|
||||
if ($alerts[$id_agent_module] === false)
|
||||
continue;
|
||||
|
||||
if ($copy_alerts) {
|
||||
foreach ($alerts[$id_agent_module] as $alert) {
|
||||
$result = copy_alert_agent_module_to_agent_module ($alert['id'],
|
||||
$id_destiny_module);
|
||||
if ($result === false) {
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($error)
|
||||
break;
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
echo '<h3 class="error">'.__('There was an error copying the agent configuration, the copy has been cancelled').'</h3>';
|
||||
process_sql ('ROLLBACK');
|
||||
} else {
|
||||
echo '<h3 class="suc">'.__('Successfully copied').'</h3>';
|
||||
process_sql ('COMMIT');
|
||||
}
|
||||
process_sql ('SET AUTOCOMMIT = 1');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function print_select ($fields, $name, $selected = '', $script = '', $nothing = '', $nothing_value = '0', $return = false, $multiple = false, $sort = true, $class = '', $disabled = false) {
|
||||
function print_select ($fields, $name, $selected = '', $script = '', $nothing = '', $nothing_value = 0, $return = false, $multiple = false, $sort = true, $class = '', $disabled = false) {
|
||||
$output = "\n";
|
||||
|
||||
static $idcounter = array ();
|
||||
|
@ -54,7 +54,7 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
|
|||
$attributes .= ' onchange="'.$script.'"';
|
||||
}
|
||||
if (!empty ($multiple)) {
|
||||
$attributes .= ' multiple="yes" size="10"';
|
||||
$attributes .= ' multiple="multiple" size="10"';
|
||||
}
|
||||
if (!empty ($class)) {
|
||||
$attributes .= ' class="'.$class.'"';
|
||||
|
@ -63,9 +63,12 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
|
|||
$attributes .= ' disabled="disabled"';
|
||||
}
|
||||
|
||||
$output .= '<select id="'.$name.'" name="'.$name.'"'.$attributes.'>';
|
||||
$output .= '<select id="'.str_replace (array ("[", "]"), '', $name).'" name="'.$name.'"'.$attributes.'>';
|
||||
|
||||
if ($nothing != '') {
|
||||
if ($nothing != '' || empty ($fields)) {
|
||||
if ($nothing == '') {
|
||||
$nothing = __('None');
|
||||
}
|
||||
$output .= '<option value="'.$nothing_value.'"';
|
||||
if ($nothing_value == $selected) {
|
||||
$output .= ' selected="selected"';
|
||||
|
@ -82,7 +85,9 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
|
|||
$output .= '<option value="'.$value.'"';
|
||||
if (is_array ($selected) && in_array ($value, $selected)) {
|
||||
$output .= ' selected="selected"';
|
||||
} elseif (!is_array ($selected) && $value === $selected) { //Needs type comparison otherwise if $selected = 0 and $value = "string" this would evaluate to true
|
||||
} elseif (is_numeric ($value) && is_numeric ($selected) && $value == $selected) { //This fixes string ($value) to int ($selected) comparisons
|
||||
$output .= ' selected="selected"';
|
||||
} elseif ($value === $selected) { //Needs type comparison otherwise if $selected = 0 and $value = "string" this would evaluate to true
|
||||
$output .= ' selected="selected"';
|
||||
}
|
||||
if ($label === '') {
|
||||
|
|
|
@ -566,63 +566,97 @@ function process_page_head ($string, $bitfield) {
|
|||
<meta name="keywords" content="pandora, monitoring, system, GPL, software" />
|
||||
<meta name="robots" content="index, follow" />
|
||||
<link rel="icon" href="images/pandora.ico" type="image/ico" />
|
||||
<link rel="stylesheet" href="include/styles/'.$config["style"].'.css" type="text/css" />
|
||||
<!--[if gte IE 6]>
|
||||
<link rel="stylesheet" href="include/styles/ie.css" type="text/css"/>
|
||||
<![endif]-->
|
||||
<script type="text/javascript" src="include/javascript/pandora.js"></script>
|
||||
<script type="text/javascript" src="include/javascript/jquery.js"></script>
|
||||
<script type="text/javascript" src="include/javascript/jquery.pandora.js"></script>';
|
||||
<![endif]-->';
|
||||
|
||||
if ($config["language"] != "en") {
|
||||
//Load translated strings
|
||||
echo '<script type="text/javascript" src="include/languages/time_'.$config['language'].'.js"></script>
|
||||
<script type="text/javascript" src="include/languages/date_'.$config['language'].'.js"></script>
|
||||
<script type="text/javascript" src="include/languages/countdown_'.$config['language'].'.js"></script>';
|
||||
//Load translated strings - load them last so they overload all the objects
|
||||
require_javascript_file ("time_".$config["language"]);
|
||||
require_javascript_file ("date".$config["language"]);
|
||||
require_javascript_file ("countdown_".$config["language"]);
|
||||
}
|
||||
$output .= "\n\t";
|
||||
|
||||
if (!empty ($config['css'])) {
|
||||
//We can't load empty and we loaded current style and ie
|
||||
$loaded = array ('', $config["style"], 'ie');
|
||||
foreach ($config['css'] as $name => $filename) {
|
||||
if (in_array ($name, $loaded))
|
||||
continue;
|
||||
|
||||
array_push ($loaded, $name);
|
||||
//Load CSS
|
||||
if (empty ($config['css'])) {
|
||||
$config['css'] = array (); //If it's empty, false or not init set array to empty just in case
|
||||
}
|
||||
|
||||
//Style should go first
|
||||
$config['css'] = array_merge (array ($config['style'] => "include/styles/".$config['style'].".css",
|
||||
"menu" => "include/styles/menu.css",
|
||||
"tip", "include/styles/tip.css"), $config['css']);
|
||||
|
||||
//We can't load empty and we loaded (conditionally) ie
|
||||
$loaded = array ('', 'ie');
|
||||
foreach ($config['css'] as $name => $filename) {
|
||||
if (in_array ($name, $loaded))
|
||||
continue;
|
||||
|
||||
array_push ($loaded, $name);
|
||||
if (!empty ($config["compact_header"])) {
|
||||
$output .= '<style type="text/css">';
|
||||
$style = file_get_contents ($config["homedir"]."/".$filename);
|
||||
$output .= str_replace ("../../images", "images", $style);
|
||||
$output .= '</style>';
|
||||
} else {
|
||||
$output .= '<link rel="stylesheet" href="'.$filename.'" type="text/css" />'."\n\t";
|
||||
}
|
||||
}
|
||||
//End load CSS
|
||||
|
||||
if (!empty ($config['js'])) {
|
||||
//Load other javascript
|
||||
//We can't load empty and we loaded wz_jsgraphics and pandora
|
||||
$loaded = array ('', 'pandora', 'date_'.$config['language'],
|
||||
'time_'.$config['language'], 'countdown_'.$config['language']);
|
||||
foreach ($config['js'] as $name => $filename) {
|
||||
if (in_array ($name, $loaded))
|
||||
continue;
|
||||
|
||||
array_push ($loaded, $name);
|
||||
$output .= '<script type="text/javascript" src="'.$filename.'"></script>'."\n\t";
|
||||
|
||||
}
|
||||
//Load JS
|
||||
if (empty ($config['js'])) {
|
||||
$config['js'] = array (); //If it's empty, false or not init set array to empty just in case
|
||||
}
|
||||
|
||||
if (!empty ($config['jquery'])) {
|
||||
//Load jQuery
|
||||
$loaded = array ('', 'pandora');
|
||||
//Pandora specific JavaScript should go first
|
||||
$config['js'] = array_merge (array ("pandora" => "include/javascript/pandora.js"), $config['js']);
|
||||
|
||||
//Then add each script as necessary
|
||||
foreach ($config['jquery'] as $name => $filename) {
|
||||
if (in_array ($name, $loaded))
|
||||
continue;
|
||||
//Load other javascript
|
||||
//We can't load empty
|
||||
$loaded = array ('');
|
||||
foreach ($config['js'] as $name => $filename) {
|
||||
if (in_array ($name, $loaded))
|
||||
continue;
|
||||
|
||||
array_push ($loaded, $name);
|
||||
array_push ($loaded, $name);
|
||||
if (!empty ($config["compact_header"])) {
|
||||
$output .= '<script type="text/javascript">/* <![CDATA[ */'."\n";
|
||||
$output .= file_get_contents ($config["homedir"]."/".$filename);
|
||||
$output .= "\n".'/* ]]> */</script>';
|
||||
} else {
|
||||
$output .= '<script type="text/javascript" src="'.$filename.'"></script>'."\n\t";
|
||||
}
|
||||
}
|
||||
//End load JS
|
||||
|
||||
//Load jQuery
|
||||
if (empty ($config['jquery'])) {
|
||||
$config['jquery'] = array (); //If it's empty, false or not init set array to empty just in case
|
||||
}
|
||||
|
||||
//Pandora specific jquery should go first
|
||||
$config['jquery'] = array_merge (array ("jquery" => "include/javascript/jquery.js", "pandora" => "include/javascript/jquery.pandora.js"), $config['jquery']);
|
||||
|
||||
|
||||
//Then add each script as necessary
|
||||
$loaded = array ('');
|
||||
foreach ($config['jquery'] as $name => $filename) {
|
||||
if (in_array ($name, $loaded))
|
||||
continue;
|
||||
|
||||
array_push ($loaded, $name);
|
||||
if (!empty ($config["compact_header"])) {
|
||||
$output .= '<script type="text/javascript">/* <![CDATA[ */'."\n";
|
||||
$output .= file_get_contents ($config["homedir"]."/".$filename);
|
||||
$output .= "\n".'/* ]]> */</script>';
|
||||
} else {
|
||||
$output .= '<script type="text/javascript" src="'.$filename.'"></script>'."\n\t";
|
||||
}
|
||||
}
|
||||
|
||||
$output .= $string;
|
||||
|
||||
return $output;
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
@import url(menu.css);
|
||||
@import url(tip.css);
|
||||
* {
|
||||
font-family: verdana, sans-serif;
|
||||
font-size: 8pt;
|
||||
|
|
Loading…
Reference in New Issue