diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index d8974a78f2..fc8a973063 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2013-04-29 Sergio Martin + + * include/functions.php + include/javascript/pandora_modules.js + include/javascript/pandora.js + index.php + ajax.php: Added a simple system of interchange of + data from php to javascript with invisible divs. + Fixed ajax call of server plugin components macros + for bug 3612145 + 2013-04-26 Sergio Martin * include/styles/pandora.css: Fix aesthetical issues diff --git a/pandora_console/ajax.php b/pandora_console/ajax.php index 86ddd62386..dc89b85d05 100644 --- a/pandora_console/ajax.php +++ b/pandora_console/ajax.php @@ -49,7 +49,6 @@ if (isset ($_GET["loginhash"])) { // Check user check_login (); - define ('AJAX', true); /* Enterprise support */ diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index dd66c160de..908c86bf74 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1738,5 +1738,12 @@ function is_snapshot_data ($data){ return 0; } +/** +* Create an invisible div with a provided ID and value to +* can retrieve it from javascript with function get_php_value(value) +*/ +function set_js_value($name, $value) { + html_print_div(array('id' => 'php_to_js_value_' . $name, 'content' => $value, 'hidden' => true)); +} ?> diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index a33b7db628..a33c089fff 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -791,3 +791,8 @@ function hidded_sidebar(position, menuW, menuH, icon_width, top_dist, autotop, r break; } } + +// Function that recover a previously stored value from php code +function get_php_value(value) { + return $('#php_to_js_value_' + value).html(); +} diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index f137fe5d5d..94f8f7f4e4 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -620,7 +620,7 @@ function load_plugin_macros_fields(row_model_id) { jQuery.ajax ({ data: params.join ("&"), type: 'POST', - url: action="ajax.php", + url: action = get_php_value('absolute_homeurl') + "ajax.php", async: false, timeout: 10000, dataType: 'json', diff --git a/pandora_console/index.php b/pandora_console/index.php index 9a5493b04d..23ac29ee51 100644 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -560,6 +560,6 @@ echo ''; $run_time = format_numeric (microtime (true) - $config['start_time'], 3); echo "\n\n"; -// Hidden div to forced title -html_print_div(array('id' => 'forced_title_layer', 'class' => 'forced_title_layer', 'hidden' => true)); +// Values from PHP to be recovered from JAVASCRIPT +require('include/php_to_js_values.php'); ?>