2012-08-29 Sergio Martin <sergio.martin@artica.es>

* include/styles/pandora_legacy.css
	include/styles/pandora.css
	include/javascript/pandora_modules.js
	godmode/agentes/module_manager_editor_common.php
	godmode/agentes/configurar_agente.php
	godmode/agentes/module_manager_editor.php
	godmode/servers/plugin.php: Add macros to the local modules like
	the wizard or plugin modules. Fix some little bugs of interface




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6920 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2012-08-29 11:58:36 +00:00
parent d14eeb3887
commit 0c83c40a55
8 changed files with 113 additions and 13 deletions

View File

@ -1,3 +1,14 @@
2012-08-29 Sergio Martin <sergio.martin@artica.es>
* include/styles/pandora_legacy.css
include/styles/pandora.css
include/javascript/pandora_modules.js
godmode/agentes/module_manager_editor_common.php
godmode/agentes/configurar_agente.php
godmode/agentes/module_manager_editor.php
godmode/servers/plugin.php: Add macros to the local modules like
the wizard or plugin modules. Fix some little bugs of interface
2012-08-29 Miguel de Dios <miguel.dedios@artica.es> 2012-08-29 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql, * pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql,

View File

@ -711,6 +711,26 @@ if ($update_module || $create_module) {
} }
$macros = json_encode($macros); $macros = json_encode($macros);
$macros_for_data = config_agents_get_macros_data_conf($_POST);
$conf_array = explode("\n",$configuration_data);
foreach($conf_array as $line) {
if(preg_match("/^module_name\s*(.*)/", $line, $match)) {
$new_configuration_data .= "module_name $name\n";
}
// We delete from conf all the module macros starting with _field
else if(!preg_match("/^module_macro_field.*/", $line, $match)) {
$new_configuration_data .= "$line\n";
}
}
if($macros_for_data != '') {
// Add macros to configuration file
$new_configuration_data = str_replace('module_end', $macros_for_data."module_end", $new_configuration_data);
}
$configuration_data = $new_configuration_data;
} }
// Services are an enterprise feature, // Services are an enterprise feature,

View File

@ -367,13 +367,8 @@ echo '<h3 id="message" class="error invisible"></h3>';
echo '<form method="post" id="module_form">'; echo '<form method="post" id="module_form">';
html_print_table ($table_simple); html_print_table ($table_simple);
echo '<b><a href="#" id="show_advanced" onclick="$(\'div#advanced\').show ();$(this).remove (); return false">'; ui_toggle(html_print_table ($table_advanced, true), __('Advanced options'));
echo __('Advanced options').'&nbsp;' .html_print_image ("images/down.png", true, array ("title" => __('Advanced options')));
echo '</a></b>';
echo '<div id="advanced" style="display: none">';
html_print_table ($table_advanced);
echo '</div>';
// Submit // Submit
echo '<div class="action-buttons" style="width: '.$table_simple->width.'">'; echo '<div class="action-buttons" style="width: '.$table_simple->width.'">';
@ -459,8 +454,12 @@ $(document).ready (function () {
$("#simple-configuration_data").hide(); $("#simple-configuration_data").hide();
} }
else { else {
// If exists macros dont show configuration data because
// this visibility is controled by a form button
if($('#hidden-macros').val() == '') {
$("#simple-configuration_data").show(); $("#simple-configuration_data").show();
} }
}
} }

View File

@ -159,7 +159,22 @@ else
} }
if (!$edit) { if (!$edit) {
$table_simple->data[1][1] = '<em>'.modules_get_moduletype_description ($id_module_type).'</em>'; $sql = sprintf ('SELECT id_tipo, nombre
FROM ttipo_modulo
WHERE id_tipo = %s
ORDER BY descripcion',
$id_module_type);
$type_names = db_get_all_rows_sql($sql);
$type_names_hash = array();
foreach($type_names as $tn) {
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
}
$table_simple->data[1][1] = '<em>'.modules_get_moduletype_description ($id_module_type).' ('.$type_names_hash[$id_module_type].')</em>';
$table_simple->data[1][1] .= html_print_input_hidden('type_names',base64_encode(json_encode($type_names_hash)),true);
} }
else { else {
if (isset($id_module_type)) { if (isset($id_module_type)) {
@ -174,8 +189,25 @@ else {
WHERE categoria IN (%s) WHERE categoria IN (%s)
ORDER BY descripcion', ORDER BY descripcion',
implode (',', $categories)); implode (',', $categories));
$table_simple->data[1][1] = html_print_select_from_sql ($sql, 'id_module_type', $table_simple->data[1][1] = html_print_select_from_sql ($sql, 'id_module_type',
$idModuleType, '', '', '', true, false, false, $disabledBecauseInPolicy, false, false, 100); $idModuleType, '', '', '', true, false, false, $disabledBecauseInPolicy, false, false, 100);
// Store the relation between id and name of the types on a hidden field
$sql = sprintf ('SELECT id_tipo, nombre
FROM ttipo_modulo
WHERE categoria IN (%s)
ORDER BY descripcion',
implode (',', $categories));
$type_names = db_get_all_rows_sql($sql);
$type_names_hash = array();
foreach($type_names as $tn) {
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
}
$table_simple->data[1][1] .= html_print_input_hidden('type_names',base64_encode(json_encode($type_names_hash)),true);
} }
$table_simple->data[1][2] = __('Module group'); $table_simple->data[1][2] = __('Module group');

View File

@ -111,6 +111,8 @@ if (($create != "") OR ($view != "")) {
$table->colspan['plugin_desc'][1] = 3; $table->colspan['plugin_desc'][1] = 3;
$table->data['plugin_desc'] = $data; $table->data['plugin_desc'] = $data;
echo '<br>';
echo '<fieldset style="width:96%"><legend>'.__('General').'</legend>'; echo '<fieldset style="width:96%"><legend>'.__('General').'</legend>';
html_print_table($table); html_print_table($table);
echo '</fieldset>'; echo '</fieldset>';

View File

@ -98,6 +98,35 @@ function configure_modules_form () {
$("#text-unit").attr("value", (data["unit"] == '') ? '' : data["unit"]) $("#text-unit").attr("value", (data["unit"] == '') ? '' : data["unit"])
$("#component_loading").hide (); $("#component_loading").hide ();
$("#id_module_type").change (); $("#id_module_type").change ();
// Delete macro fields
$('.macro_field').remove();
$('#hidden-macros').val('');
var legend = '';
// If exist macros, load the fields
if(data["macros"] != '') {
$('#hidden-macros').val(Base64.encode(data["macros"]));
var obj = jQuery.parseJSON(data["macros"]);
$.each(obj, function(k,macro) {
add_macro_field(macro, 'simple-macro');
legend += macro['macro']+" = "+ macro['desc']+"<br>";
});
$('#configuration_data_legend').html(legend);
$('#simple-show_configuration_data').show();
$('#simple-hide_configuration_data').hide();
$('#configuration_data_legend').show();
$('#simple-configuration_data').hide();
}
else {
$('#simple-show_configuration_data').hide();
$('#simple-hide_configuration_data').hide();
$('#configuration_data_legend').hide();
$('#simple-configuration_data').show();
}
}, },
"json" "json"
); );
@ -169,6 +198,7 @@ function configure_modules_form () {
$("#id_module_group option[value="+data["id_module_group"]+"]").select (1); $("#id_module_group option[value="+data["id_module_group"]+"]").select (1);
$("#max_timeout").attr ("value", data["max_timeout"]); $("#max_timeout").attr ("value", data["max_timeout"]);
$("#id_plugin option[value="+data["id_plugin"]+"]").select (1); $("#id_plugin option[value="+data["id_plugin"]+"]").select (1);
$("#id_plugin").trigger('change');
$("#text-plugin_user").attr ("value", js_html_entity_decode (data["plugin_user"])); $("#text-plugin_user").attr ("value", js_html_entity_decode (data["plugin_user"]));
$("#password-plugin_pass").attr ("value", js_html_entity_decode (data["plugin_pass"])); $("#password-plugin_pass").attr ("value", js_html_entity_decode (data["plugin_pass"]));
$("#text-plugin_parameter").attr ("value", js_html_entity_decode (data["plugin_parameter"])); $("#text-plugin_parameter").attr ("value", js_html_entity_decode (data["plugin_parameter"]));

View File

@ -367,7 +367,7 @@ input.sub[disabled] {
input.next, input.upd, input.ok, input.wand, input.delete, input.cog, input.next, input.upd, input.ok, input.wand, input.delete, input.cog,
input.target, input.search, input.copy, input.add, input.graph, input.target, input.search, input.copy, input.add, input.graph,
input.percentile, input.binary, input.camera, input.config, input.percentile, input.binary, input.camera, input.config,
input.cancel { input.cancel, input.default {
padding-right: 21px; padding-right: 21px;
} }
@ -419,6 +419,9 @@ input.camera {
input.config { input.config {
background: #e5e5e5 url(../../images/config.png) no-repeat 98% 3px; background: #e5e5e5 url(../../images/config.png) no-repeat 98% 3px;
} }
input.default {
background: #e5e5e5 url(../../images/default_list.png) no-repeat 98% 3px;
}
#toolbox { #toolbox {

View File

@ -360,7 +360,7 @@ input.sub[disabled] {
input.next, input.upd, input.ok, input.wand, input.delete, input.cog, input.target, input.search, input.next, input.upd, input.ok, input.wand, input.delete, input.cog, input.target, input.search,
input.copy, input.add, input.graph, input.percentile, input.binary, input.copy, input.add, input.graph, input.percentile, input.binary,
input.camera, input.config, input.cancel { input.camera, input.config, input.cancel, input.default {
padding-right: 21px; padding-right: 21px;
} }
input.delete_min, input.graph_min, input.percentile_min, input.percentile_item_min, input.binary_min, input.delete_min, input.graph_min, input.percentile_min, input.percentile_item_min, input.binary_min,
@ -415,6 +415,9 @@ input.camera {
input.config { input.config {
background: #e5e5e5 url(../../images/config.png) no-repeat 98% 3px; background: #e5e5e5 url(../../images/config.png) no-repeat 98% 3px;
} }
input.default {
background: #e5e5e5 url(../../images/default_list.png) no-repeat 98% 3px;
}
input.delete_min { input.delete_min {
background: #e5e5e5 url(../../images/cross.png) no-repeat center; background: #e5e5e5 url(../../images/cross.png) no-repeat center;
} }