2012-09-07 Miguel de Dios <miguel.dedios@artica.es>

* include/javascript/pandora.js, include/functions_ui.php,
	include/functions_html.php: cleaned source code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6947 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-09-10 15:51:47 +00:00
parent 77c493f2f8
commit 575b4a39ab
4 changed files with 103 additions and 98 deletions

View File

@ -1,3 +1,8 @@
2012-09-07 Miguel de Dios <miguel.dedios@artica.es>
* include/javascript/pandora.js, include/functions_ui.php,
include/functions_html.php: cleaned source code style.
2012-09-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_graph.php
@ -61,6 +66,7 @@
in metaconsole.
2012-09-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: fixed the ui_get_full_url function,
because sometimes added two times the php script name.

View File

@ -553,12 +553,12 @@ function html_print_input_text_extended ($name, $value, $id, $alt, $size, $maxle
} //If the attribute was already processed, skip
/*
* Remember, this next code have a $$ that for example there is a var as
* $a = 'john' then $$a is a var $john .
*
* In this case is use for example for $name and $atribute = 'name' .
*
*/
* Remember, this next code have a $$ that for example there is a var as
* $a = 'john' then $$a is a var $john .
*
* In this case is use for example for $name and $atribute = 'name' .
*
*/
/* Exact operator because we want to show "0" on the value */
if ($$attribute !== '') {

View File

@ -1857,7 +1857,7 @@ function ui_toggle($code, $name, $title = '', $hidde_default = true) {
* @param bool Whether to return the relative URL or the absolute URL. Returns
* relative by default
* @param bool Whether to add POST values to the URL.
*/
*/
function ui_get_url_refresh ($params = false, $relative = true, $add_post = true) {
// Agent selection filters and refresh
global $config;
@ -2016,7 +2016,7 @@ function ui_get_full_url ($url = '', $no_proxy = false, $add_name_php_file = fal
}
}
return $fullurl.$url;
return $fullurl . $url;
}
/**
@ -2092,18 +2092,18 @@ function ui_print_page_header ($title, $icon = "", $return = false, $help = "",
$buffer .= '</ul></div>';
}
else {
if ($options != ""){
if ($options != "") {
$buffer .= '<div id="menu_tab"><ul class="mn"><li class="nomn">';
$buffer .= $options;
$buffer .= '</li></ul></div>';
}
}
$buffer .= '</div>'; //<br /><br /><br />';
if (!$return)
echo $buffer;
return $buffer;
}

View File

@ -70,42 +70,42 @@ function agent_changed (event, id_agent, selected) {
$('#module').empty ();
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
jQuery.post ('ajax.php',
{"page": "operation/agentes/ver_agente",
"get_agent_modules_json": 1,
"id_agent": id_agent
},
function (data) {
$('#module').empty ();
if (typeof($(document).data('text_for_module')) != 'undefined') {
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true));
}
else {
if (typeof(data['any_text']) != 'undefined') {
$('#module').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true));
}
else {
var anyText = $("#any_text").html(); //Trick for catch the translate text.
if (anyText == null) {
anyText = 'Any';
}
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
}
}
jQuery.each (data, function (i, val) {
s = js_html_entity_decode (val['nombre']);
$('#module').append ($('<option></option>').html (s).attr ("value", val['id_agente_modulo']));
$('#module').fadeIn ('normal');
});
if (selected != undefined)
$('#module').attr ('value', selected);
$('#module').removeAttr('disabled');
},
"json"
);
{"page": "operation/agentes/ver_agente",
"get_agent_modules_json": 1,
"id_agent": id_agent
},
function (data) {
$('#module').empty ();
if (typeof($(document).data('text_for_module')) != 'undefined') {
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true));
}
else {
if (typeof(data['any_text']) != 'undefined') {
$('#module').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true));
}
else {
var anyText = $("#any_text").html(); //Trick for catch the translate text.
if (anyText == null) {
anyText = 'Any';
}
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
}
}
jQuery.each (data, function (i, val) {
s = js_html_entity_decode (val['nombre']);
$('#module').append ($('<option></option>').html (s).attr ("value", val['id_agente_modulo']));
$('#module').fadeIn ('normal');
});
if (selected != undefined)
$('#module').attr ('value', selected);
$('#module').removeAttr('disabled');
},
"json"
);
}
/**
@ -132,7 +132,6 @@ function isEmptyObject(obj) {
* @param selected Which module(s) have to be selected
*/
function agent_changed_by_multiple_agents (event, id_agent, selected) {
// Hack to add custom condition
if($("#hidden-custom_condition").val() != undefined) {
custom_condition = $("#hidden-custom_condition").val();
@ -225,9 +224,9 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
$('#module').removeAttr('disabled');
},
"json"
);
},
"json"
);
}
/**
@ -256,43 +255,43 @@ function agent_changed_by_multiple_agents_with_alerts (event, id_agent, selected
$('#module').empty ();
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
jQuery.post ('ajax.php',
{"page": "operation/agentes/ver_agente",
"get_agent_modules_alerts_json_for_multiple_agents": 1,
"template": template,
"id_agent[]": idAgents,
"selection_mode": selection_mode
},
function (data) {
$('#module').empty ();
if (typeof($(document).data('text_for_module')) != 'undefined') {
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true));
}
else {
if (typeof(data['any_text']) != 'undefined') {
$('#module').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true));
}
else {
var anyText = $("#any_text").html(); //Trick for catch the translate text.
if (anyText == null) {
anyText = 'Any';
}
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
}
}
jQuery.each (data, function (i, val) {
s = js_html_entity_decode(val);
$('#module').append ($('<option></option>').html (s).attr ("value", val));
$('#module').fadeIn ('normal');
});
if (selected != undefined)
$('#module').attr ('value', selected);
$('#module').removeAttr('disabled');
},
"json"
);
{"page": "operation/agentes/ver_agente",
"get_agent_modules_alerts_json_for_multiple_agents": 1,
"template": template,
"id_agent[]": idAgents,
"selection_mode": selection_mode
},
function (data) {
$('#module').empty ();
if (typeof($(document).data('text_for_module')) != 'undefined') {
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true));
}
else {
if (typeof(data['any_text']) != 'undefined') {
$('#module').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true));
}
else {
var anyText = $("#any_text").html(); //Trick for catch the translate text.
if (anyText == null) {
anyText = 'Any';
}
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
}
}
jQuery.each (data, function (i, val) {
s = js_html_entity_decode(val);
$('#module').append ($('<option></option>').html (s).attr ("value", val));
$('#module').fadeIn ('normal');
});
if (selected != undefined)
$('#module').attr ('value', selected);
$('#module').removeAttr('disabled');
},
"json"
);
}
/**
@ -415,7 +414,7 @@ function agent_changed_by_multiple_agents_id (event, id_agent, selected) {
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
}
}
jQuery.each (data, function (i, val) {
s = js_html_entity_decode(val['nombre']);
//$('#module').append ($('<option></option>').html (s).attr ("value", val));
@ -463,7 +462,7 @@ function agent_module_autocomplete (id_agent_name, id_agent_id, id_agent_module_
data: data_params,
async: false,
type: 'POST',
url: action= homedir_path + "/ajax.php",
url: action="ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
@ -582,12 +581,12 @@ function agent_autocomplete (id_agent_name, id_server_name, id_agent_id, metacon
//Check exist the field with id in the var id_agent_name.
if ($(id_agent_name).length == 0)
return;
// Correction over ajax call for metaconsole
ajax_path = '';
if (metaconsole_exec != undefined)
ajax_path = '../../';
$(id_agent_name).autocomplete({
minLength: 2,
source: function( request, response ) {
@ -781,7 +780,7 @@ function toggleBoth(name) {
}
else {
$('#'+name+'_manual').css('display','none');
}
}
}
/**
@ -802,8 +801,8 @@ function calculateSeconds(name) {
function period_select_update(name, seconds) {
$('#text-'+name+'_text').val(seconds);
adjustTextUnits(name);
calculateSeconds(name);
$('#'+name+'_manual').show();
calculateSeconds(name);
$('#'+name+'_manual').show();
$('#'+name+'_default').hide();
}
@ -827,7 +826,7 @@ function adjustTextUnits(name) {
$('#text-'+name+'_text').val(restPrev);
unitsSelected = true;
}
restPrev = rest;
});
@ -839,4 +838,4 @@ function adjustTextUnits(name) {
if($('#text-'+name+'_text').val() == 0) {
selectFirst(name+'_units');
}
}
}