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 50ae58aabd
commit 9087beb4de
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> 2012-09-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_graph.php * include/functions_graph.php
@ -61,6 +66,7 @@
in metaconsole. in metaconsole.
2012-09-07 Miguel de Dios <miguel.dedios@artica.es> 2012-09-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: fixed the ui_get_full_url function, * include/functions_ui.php: fixed the ui_get_full_url function,
because sometimes added two times the php script name. 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 } //If the attribute was already processed, skip
/* /*
* Remember, this next code have a $$ that for example there is a var as * Remember, this next code have a $$ that for example there is a var as
* $a = 'john' then $$a is a var $john . * $a = 'john' then $$a is a var $john .
* *
* In this case is use for example for $name and $atribute = 'name' . * In this case is use for example for $name and $atribute = 'name' .
* *
*/ */
/* Exact operator because we want to show "0" on the value */ /* Exact operator because we want to show "0" on the value */
if ($$attribute !== '') { 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 * @param bool Whether to return the relative URL or the absolute URL. Returns
* relative by default * relative by default
* @param bool Whether to add POST values to the URL. * @param bool Whether to add POST values to the URL.
*/ */
function ui_get_url_refresh ($params = false, $relative = true, $add_post = true) { function ui_get_url_refresh ($params = false, $relative = true, $add_post = true) {
// Agent selection filters and refresh // Agent selection filters and refresh
global $config; 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>'; $buffer .= '</ul></div>';
} }
else { else {
if ($options != ""){ if ($options != "") {
$buffer .= '<div id="menu_tab"><ul class="mn"><li class="nomn">'; $buffer .= '<div id="menu_tab"><ul class="mn"><li class="nomn">';
$buffer .= $options; $buffer .= $options;
$buffer .= '</li></ul></div>'; $buffer .= '</li></ul></div>';
} }
} }
$buffer .= '</div>'; //<br /><br /><br />'; $buffer .= '</div>'; //<br /><br /><br />';
if (!$return) if (!$return)
echo $buffer; echo $buffer;
return $buffer; return $buffer;
} }

View File

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