2012-04-18 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/functions_html.php
	 include/styles/pandora.css
	 include/javascript/jquery.pandora.js
	 include/functions_config.php
	 include/functions_ui.php
	 extensions/update_manager.php
	 extensions/update_manager/load_updatemanager.php
	 extensions/update_manager/lib/functions.ajax.php
	 extensions/update_manager/settings.php
	 operation/system_alert.php
	 general/login_page.php
	 godmode/setup/setup.php: Changed layout in modal windows for 
	 license information also changed several styles.
	 
	 Merged from branches.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2012-04-18 08:08:04 +00:00
parent 63d96bf549
commit 8ecadd3c90
13 changed files with 193 additions and 37 deletions

View File

@ -1,3 +1,21 @@
2012-04-18 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_html.php
include/styles/pandora.css
include/javascript/jquery.pandora.js
include/functions_config.php
include/functions_ui.php
extensions/update_manager.php
extensions/update_manager/load_updatemanager.php
extensions/update_manager/lib/functions.ajax.php
extensions/update_manager/settings.php
operation/system_alert.php
general/login_page.php
godmode/setup/setup.php: Changed layout in modal windows for
license information also changed several styles.
Merged from branches.
2012-04-17 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php, extensions/net_tools.php: cleaned

View File

@ -40,11 +40,37 @@ if (is_ajax ()) {
}
if ($get_license_info) {
include_once("include/functions_db.php");
enterprise_include_once('include/functions_license.php');
enterprise_hook('license_show_info');
// If Pandora enterprise check license
$is_enteprise = enterprise_hook('license_show_info');
// If Open show info
if ($is_enteprise === ENTERPRISE_NOT_HOOK){
$table->width = '98%';
$table->data = array ();
$table->style = array();
$table->style[0] = 'text-align: left';
echo '<div style="float: left; margin-top: 40px; margin-left: 20px; margin-right: 20px;">';
html_print_image('images/noaccess.png', false);
echo '</div>';
$table->data[0][0] = '<strong>'.__('Expires').'</strong>';
$table->data[0][1] = __('Never');
$table->data[1][0] = '<strong>'.__('Platform Limit').'</strong>';
$table->data[1][1] = __('Unlimited');
$table->data[2][0] = '<strong>'.__('Current Platform Count').'</strong>';
$count_agents = db_get_value_sql ('SELECT count(*) FROM tagente');
$table->data[2][1] = $count_agents;
$table->data[3][0] = '<strong>'.__('License Mode').'</strong>';
$table->data[3][1] = __('Open Source Version');
echo '<div style="width: 80%; margin-top: 30px; margin-left: 20px">';
html_print_table ($table);
echo '</div>';
}
}
return;
@ -170,7 +196,7 @@ function pandora_update_manager_login () {
}
}
else {
require(
require_once(
"extensions/update_manager/lib/functions.ajax.php");
$result = update_pandora_get_packages_online_ajax(false);

View File

@ -14,6 +14,30 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
function check_keygen_online() {
global $config;
require_once($config["homedir"] .
"/extensions/update_manager/lib/functions.php");
global $conf_update_pandora;
if (empty($conf_update_pandora))
$conf_update_pandora = update_pandora_get_conf();
require_once ($config["homedir"] .
"/extensions/update_manager/lib/libupdate_manager_client.php");
require_once ($config["homedir"] .
"/extensions/update_manager/lib/libupdate_manager.php");
require_once ($config["homedir"] .
"/extensions/update_manager/load_updatemanager.php");
$last = get_parameter('last', 0);
db_clean_cache();
$settings = um_db_load_settings ();
return check_keygen ($settings);
}
function update_pandora_get_packages_online_ajax($ajax = true) {
global $config;

View File

@ -25,21 +25,42 @@ if (! extension_loaded ('mysql'))
require_once ('lib/libupdate_manager.php');
function check_keygen ($settings) {
global $config;
if ($settings->customer_key != FREE_USER) {
if (! file_exists ($settings->keygen_path)) {
return ui_print_error_message( array('title' => __("Keygen error"),
'message' => __('Pandora Console updates need a valid keygen file. Keygen file does not exists'),
'no_close' => true, 'force_style' => 'color: #000000 !important'), '', true);
}
if (! is_executable ($settings->keygen_path)) {
return ui_print_error_message( array('title' => __("Keygen error"),
'message' => __('Pandora Console updates need a valid keygen file. Keygen file is not executable'),
'no_close' => true, 'force_style' => 'color: #000000 !important'), '', true);
}
}
return '';
}
function get_user_key ($settings) {
global $config;
if ($settings->customer_key != FREE_USER) {
if (! file_exists ($settings->keygen_path)) {
echo '<h3 class="error">';
/*echo '<h3 class="error">';
echo __('Keygen file does not exists');
echo '</h3>';
echo '</h3>';*/
return '';
}
if (! is_executable ($settings->keygen_path)) {
echo '<h3 class="error">';
/*echo '<h3 class="error">';
echo __('Keygen file is not executable');
echo '</h3>';
echo '</h3>';*/
return '';
}

View File

@ -22,7 +22,7 @@ if (! check_acl ($config['id_user'], 0, 'PM')) {
return;
}
include ("extensions/update_manager/lib/functions.php");
include_once ("extensions/update_manager/lib/functions.php");
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
$config['dbpass'], $config['dbname']);
@ -67,10 +67,10 @@ $table->data = array ();
$table->data[0][0] = '<strong>'.__('Customer key').'</strong>';
$table->data[0][1] = html_print_input_text ('keys[customer_key]', $settings->customer_key, '', 40, 255, true);
if (defined('PANDORA_ENTERPRISE')) {
$table->data[0][1] .= '&nbsp;<a id="dialog_license_info" title="'.__("License Info").'" href="#">'.html_print_image('images/lock.png', true, array('class' => 'bot', 'title' => __('License info'))).'</a>';
$table->data[0][1] .= '<div id="dialog_show_license" style="display:none"></div>';
}
$table->data[0][1] .= '&nbsp;<a id="dialog_license_info" title="'.__("License Info").'" href="#">'.html_print_image('images/lock.png', true, array('class' => 'bot', 'title' => __('License info'))).'</a>';
$table->data[0][1] .= '<div id="dialog_show_license" style="display:none"></div>';
$table->data[1][0] = '<strong>'.__('Update server host').'</strong>';
$table->data[1][1] = html_print_input_text ('keys[update_server_host]', $settings->update_server_host, '', 20, 255, true);

View File

@ -88,7 +88,7 @@ if (isset ($login_failed)) {
echo '<div style="position:absolute; top:0px; text-align: center; left:0%; right:0%; height:100px; width:330px; margin: 0 auto; ">';
echo '<div id="error_login">';
echo '<b>' . $config["auth_error"] . '</b>';
echo '<strong style="font-size: 10pt">' . $config["auth_error"] . '</strong>';
echo '</div>';
echo '<div id="error_login_icon">';

View File

@ -52,8 +52,11 @@ enterprise_include ('godmode/setup/setup.php');
ui_print_page_header (__('General configuration'), "", false, "", true);
$table->width = '98%';
$table->width = '100%';
$table->data = array ();
$table->size = array();
$table->size[0] = '45%';
$table->size[1] = '55%';
// Current config["language"] could be set by user, not taken from global setup !
@ -90,12 +93,12 @@ $sources["sql"] = __('Database');
$table->data[9][1] = html_print_select ($sources, 'timesource', $config["timesource"], '', '', '', true);
$table->data[10][0] = __('Automatic check for updates');
$table->data[10][1] = __('Yes').'&nbsp;'.html_print_radio_button ('autoupdate', 1, '', $config["autoupdate"], true).'&nbsp;&nbsp;';
$table->data[10][1] .= __('No').'&nbsp;'.html_print_radio_button ('autoupdate', 0, '', $config["autoupdate"], true);
$table->data[10][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('autoupdate', 1, '', $config["autoupdate"], true).'&nbsp;&nbsp;';
$table->data[10][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('autoupdate', 0, '', $config["autoupdate"], true);
$table->data[11][0] = __('Enforce https');
$table->data[11][1] = __('Yes').'&nbsp;'.html_print_radio_button_extended ('https', 1, '', $config["https"], false, "if (! confirm ('" . __('If SSL is not properly configured you will lose access to Pandora FMS Console. Do you want to continue?') . "')) return false", '', true) .'&nbsp;&nbsp;';
$table->data[11][1] .= __('No').'&nbsp;'.html_print_radio_button ('https', 0, '', $config["https"], true);
$table->data[11][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button_extended ('https', 1, '', $config["https"], false, "if (! confirm ('" . __('If SSL is not properly configured you will lose access to Pandora FMS Console. Do you want to continue?') . "')) return false", '', true) .'&nbsp;&nbsp;';
$table->data[11][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('https', 0, '', $config["https"], true);
$table->data[14][0] = __('Attachment store') . ui_print_help_tip (__("Directory where temporary data is stored."), true);
$table->data[14][1] = html_print_input_text ('attachment_store', $config["attachment_store"], '', 50, 255, true);
@ -109,12 +112,12 @@ $table->data[16][0] = __('API password') .
$table->data[16][1] = html_print_input_text('api_password', $config['api_password'], '', 25, 255, true);
$table->data[17][0] = __('Enable GIS features in Pandora Console');
$table->data[17][1] = __('Yes').'&nbsp;'.html_print_radio_button ('activate_gis', 1, '', $config["activate_gis"], true).'&nbsp;&nbsp;';
$table->data[17][1] .= __('No').'&nbsp;'.html_print_radio_button ('activate_gis', 0, '', $config["activate_gis"], true);
$table->data[17][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('activate_gis', 1, '', $config["activate_gis"], true).'&nbsp;&nbsp;';
$table->data[17][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('activate_gis', 0, '', $config["activate_gis"], true);
$table->data[18][0] = __('Enable Integria incidents in Pandora Console');
$table->data[18][1] = __('Yes').'&nbsp;'.html_print_radio_button ('integria_enabled', 1, '', $config["integria_enabled"], true).'&nbsp;&nbsp;';
$table->data[18][1] .= __('No').'&nbsp;'.html_print_radio_button ('integria_enabled', 0, '', $config["integria_enabled"], true);
$table->data[18][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('integria_enabled', 1, '', $config["integria_enabled"], true).'&nbsp;&nbsp;';
$table->data[18][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('integria_enabled', 0, '', $config["integria_enabled"], true);
$table->data[19][0] = __('Enable Netflow');
$table->data[19][1] = __('Yes').'&nbsp;'.html_print_radio_button ('activate_netflow', 1, '', $config["activate_netflow"], true).'&nbsp;&nbsp;';
@ -201,6 +204,15 @@ $table->data[26][0] = __('Sound for Monitor warning');
$table->data[26][1] = html_print_select($sounds, 'sound_warning', $config['sound_warning'], 'replaySound(\'warning\');', '', '', true);
$table->data[26][1] .= ' <a href="javascript: toggleButton(\'warning\');">' . html_print_image("images/control_play.png", true, array("id" => "button_sound_warning", "style" => "vertical-align: middle;", "width" => "16")) . '</a>';
$table->data[26][1] .= '<div id="layer_sound_warning"></div>';
$table->data[27][0] = __('License information');
$license_info = db_get_value_sql ('SELECT value FROM tupdate_settings WHERE `key`="customer_key"');
if ($license_info === false)
$license_info = '';
$table->data[27][1] = html_print_input_text ('license_info_key', $license_info, '', 40, 255, true);
$table->data[27][1] .= '&nbsp;<a id="dialog_license_info" title="'.__("License Info").'" href="#">'.html_print_image('images/lock.png', true, array('class' => 'bot', 'title' => __('License info'))).'</a>';
$table->data[27][1] .= '<div id="dialog_show_license" style="display:none"></div>';
?>
<script type="text/javascript">
function toggleButton(type) {
@ -233,11 +245,13 @@ $(document).ready (function () {
</script>
<?php
enterprise_hook ('setup');
echo '<form id="form_setup" method="post">';
html_print_input_hidden ('update_config', 1);
html_print_table ($table);
echo "<fieldset>";
echo "<legend>" . __('General options') . "</legend>";
html_print_input_hidden ('update_config', 1);
html_print_table ($table);
echo "</fieldset>";
enterprise_hook ('setup');
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button (__('Update'), 'update_button', false, 'class="sub upd"');
echo '</div>';

View File

@ -215,6 +215,18 @@ function config_update_config () {
$config['relative_path'] = get_parameter('relative_path', $config['relative_path']);
}
# Update of Pandora FMS license
$update_manager_installed = db_get_value('value', 'tconfig', 'token', 'update_manager_installed');
if ($update_manager_installed == 1) {
if (isset($_POST['license_info_key'])){
$values = array("value" => get_parameter('license_info_key'));
$where = array("key" => 'customer_key');
$update_manage_settings_result = db_process_sql_update('tupdate_settings', $values, $where);
}
}
}
/**
@ -726,10 +738,34 @@ function config_check (){
$config["alert_cnt"]++;
$_SESSION["alert_msg"] .= ui_print_info_message(
array('title' => __("New update of Pandora Console"),
'message' => __('There is a new update please go to menu operation and into extensions go to Update Manager for more details.'),
'message' => __('There is a new update please go to menu operation and into extensions <a style="font-weight:bold;" href="index.php?sec=extensions&sec2=extensions/update_manager">go to Update Manager</a> for more details.'),
'no_close' => true, 'force_style' => 'color: #000000 !important'), '', true);
}
}
if (enterprise_installed()) {
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
$config['dbpass'], $config['dbname']);
$settings = um_db_load_settings ();
$result_check_keygen = check_keygen($settings);
if (!empty($result_check_keygen)) {
$config["alert_cnt"]++;
$_SESSION["alert_msg"] .= $result_check_keygen;
}
}
else {
require_once("extensions/update_manager/lib/functions.ajax.php");
$result_check_keygen = check_keygen_online();
if (!empty($result_check_keygen)) {
$config["alert_cnt"]++;
$_SESSION["alert_msg"] .= $result_check_keygen;
}
}
}
?>

View File

@ -837,6 +837,7 @@ function html_print_textarea ($name, $rows, $columns, $value = '', $attributes =
* $table->titlestyle - Title style
* $table->titleclass - Title class
* $table->styleTable - Table style
* $table->caption - Table title
* @param bool Whether to return an output string or echo now
*
* @return string HTML code if return parameter is true.
@ -954,6 +955,9 @@ function html_print_table (&$table, $return = false) {
$output .= ' cellpadding="'.$table->cellpadding.'" cellspacing="'.$table->cellspacing.'"';
$output .= ' border="'.$table->border.'" class="'.$table->class.'" id="'.$tableid.'">';
$countcols = 0;
if (!empty($table->caption)) {
$output .= '<caption style="text-align: left"><h4>' . $table->caption . '</h4></caption>';
}
if (!empty ($table->head)) {
$countcols = count ($table->head);
$output .= '<thead><tr>';

View File

@ -215,7 +215,7 @@ function ui_print_message ($message, $class = '', $attributes = '', $return = fa
</tr>
<tr>
<td></td>
<td>' . $text_message . '</td>
<td style="color:#000000">' . $text_message . '</td>
<td></td>
</tr>
</table>';

View File

@ -91,7 +91,7 @@ $(document).ready (function () {
resizable: true,
draggable: true,
modal: true,
height: 200,
height: 250,
width: 600,
overlay: {
opacity: 0.5,
@ -125,7 +125,7 @@ $(document).ready (function () {
},
bgiframe: jQuery.browser.msie,
width: 500,
height: 180
height: 190
})
.show ();
},

View File

@ -1175,11 +1175,26 @@ ol.steps li.visited {
}
fieldset {
border: 2px solid #E9F3D2;
padding: 0 0 0 10px;
width: 90%;
margin-bottom: 15px;
background-color:#fafafa;
border: 1px solid #f2f2f2;
padding:0.5em;
margin-top:0.5em;
margin-right: -1px;
margin-bottom:1em;
position:relative;
}
fieldset legend {
font-size:1.3em;
font-weight:bold;
#color:#3f4e2f;
color:#000;
#top:-2em;
}
fieldset .databox {
border: 0px solid;
}
fieldset legend span,
span#latest_value {
font-style:italic;

View File

@ -2,8 +2,6 @@
// TODO: Poner esto resizable y dragable: http://jqueryui.com/demos/dialog
echo "<div style='margin-top: 10px; width: 100%; height: 250px; overflow: auto; margin-left: 0px; text-align: left;'>";
echo $_SESSION["alert_msg"];
echo "</div>";
?>