diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 089b3ca1c8..154f9d9297 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2014-08-12 Miguel de Dios <miguel.dedios@artica.es> + + * general/header.php, godmode/setup/setup_general.php, + include/functions_clippy.php, include/functions_config.php, + include/help/clippy/homepage.php: wip in the clippy. + 2014-08-12 Sancho Lerena <slerena@artica.es> * pandoradb_data.sql: No more "welcome to Pandora FMS 5.0" diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 73e9bf45e8..be10dc4df6 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -122,16 +122,20 @@ config_check(); </script> <?php - $table->data[0]['clippy'] = - '<a href="javascript: show_clippy();">' . - html_print_image( - "images/heart_col.png", - true, - array("id" => 'clippy', - "class" => 'clippy', - "alt" => __('Clippy'), - 'title' => __('Clippy'))) . - '</a>'; + if ($config['tutorial_mode'] !== 'expert') { + $table->data[0]['clippy'] = + '<a href="javascript: show_clippy();">' . + html_print_image( + "images/heart_col.png", + true, + array("id" => 'clippy', + "class" => 'clippy', + "alt" => __('Clippy'), + 'title' => __('Clippy'))) . + '</a>'; + } + + $table->data[0][0] = $servers_link_open . $servers_check_img . $servers_link_close; diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index d83d176635..e980d16cf8 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -252,6 +252,17 @@ $table->data[31][1] .= __('No').' '.html_print_radio_button ('c $table->data[32][0] = __('Server logs directory') . ui_print_help_tip (__("Directory where the server logs are stored."), true); $table->data[32][1] = html_print_input_text ('server_log_dir', $config["server_log_dir"], '', 50, 255, true); +$modes_tutorial = array( + 'full' => __('Full mode'), + 'on_demand' => __('On demand'), + 'expert' => __('Expert') + ); +$table->data['tutorial_mode'][0] = __('Tutorial mode') . + ui_print_help_tip (__("Configuration of our clippy, 'full mode' show the icon in the header and the contextual helps and it is noise, 'on demand' it is equal to full but it is not noise and 'expert' the icons in the header and the context is not."), true); +$table->data['tutorial_mode'][1] = + html_print_select($modes_tutorial, 'tutorial_mode', + $config["tutorial_mode"], '', '', 0, true); + echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general&pure='.$config['pure'].'">'; echo "<fieldset>"; diff --git a/pandora_console/include/functions_clippy.php b/pandora_console/include/functions_clippy.php index ad7c9f52cf..3d11f642d2 100644 --- a/pandora_console/include/functions_clippy.php +++ b/pandora_console/include/functions_clippy.php @@ -97,7 +97,21 @@ function clippy_write_javascript_helps_steps($helps) { steps: <?php echo json_encode($steps); ?>, showBullets: <?php echo json_encode($conf['showBullets']); ?>, showStepNumbers: <?php echo json_encode($conf['showStepNumbers']); ?>, - }); + nextLabel: "<?php echo __('Next →'); ?>", + prevLabel: "<?php echo __('← Back'); ?>", + skipLabel: "<?php echo __('Skip'); ?>", + doneLabel: "<?php echo __('Done'); ?>", + exitOnOverlayClick: false, + exitOnEsc: true, //false, + }) + .onexit(function(value) { + console.log("onexit"); + return false; + }) + .oncomplete(function(value) { + console.log("oncomplete"); + + }); <?php if (!empty($conf['next_help'])) { diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index ca71979d33..c42801eabd 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -182,6 +182,8 @@ function config_update_config () { $error_update[] = __('Command Snapshot'); if (!config_update_value ('server_log_dir', get_parameter('server_log_dir'))) $error_update[] = __('Server logs directory'); + if (!config_update_value ('tutorial_mode', get_parameter('tutorial_mode'))) + $error_update[] = __('Tutorial mode'); break; case 'enterprise': if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) { @@ -887,7 +889,7 @@ function config_process_config () { if (!isset ($config['netflow_nfexpire'])) { config_update_value ( 'netflow_nfexpire', '/usr/bin/nfexpire'); } - + if (!isset ($config['netflow_max_resolution'])) { config_update_value ( 'netflow_max_resolution', '50'); } @@ -895,7 +897,7 @@ function config_process_config () { if (!isset ($config['netflow_disable_custom_lvfilters'])) { config_update_value ( 'netflow_disable_custom_lvfilters', 0); } - + if (!isset ($config['netflow_max_lifetime'])) { config_update_value ( 'netflow_max_lifetime', '5'); } @@ -944,7 +946,7 @@ function config_process_config () { if (!isset ($config['ldap_login_attr'])) { config_update_value ( 'ldap_login_attr', 'uid'); } - + if (!isset ($config['fallback_local_auth'])) { config_update_value ( 'fallback_local_auth', '0'); } @@ -1197,6 +1199,10 @@ function config_process_config () { config_update_value ('networkmap_max_width', 900); } + if (!isset($config['tutorial_mode'])) { + config_update_value ('tutorial_mode', 'full'); + } + /* Finally, check if any value was overwritten in a form */ config_update_config(); } diff --git a/pandora_console/include/help/clippy/homepage.php b/pandora_console/include/help/clippy/homepage.php index 31c24237a4..06c7641d94 100644 --- a/pandora_console/include/help/clippy/homepage.php +++ b/pandora_console/include/help/clippy/homepage.php @@ -22,6 +22,8 @@ function clippy_start_page_homepage() { global $config; + $clippy_is_annoying = (int)get_cookie('clippy_is_annoying', 0); + clippy_clean_help(); $helps = array(); @@ -33,7 +35,7 @@ function clippy_start_page_homepage() { $helps['homepage']['steps'] = array(); $helps['homepage']['steps'][] = array( 'element'=> '#clippy', - 'intro' => __('Could you help you?<br/><br/>I am Pandorin, the annoying clippy for Pandora. You could follow my advices for to make common and basic tasks in Pandora.') + 'intro' => __('Could I help you?<br/><br/>I am Pandorin, the annoying clippy for Pandora. You could follow my advices for to make common and basic tasks in Pandora.') ); $helps['homepage']['steps'][] = array( 'element'=> '#clippy', @@ -47,7 +49,13 @@ function clippy_start_page_homepage() { '</li>' . '<li>' . __('Monitoring a switch with remote SNMP') . '</li>' . '<li>' . __('Monitoring a Windows server with remote WMI ') . '</li>' . - '</ul>' + '</ul>' . + '<div style="text-align: left;">'. + html_print_checkbox_extended + ('clippy_is_annoying', 1, $clippy_is_annoying, false, + 'set_clippy_annoying()', '', true) . + __('Please the clippy is annoying, I don\'t want see.') . + '</div>' ); $helps['homepage']['conf'] = array(); $helps['homepage']['conf']['showBullets'] = 0; @@ -57,6 +65,18 @@ function clippy_start_page_homepage() { function show_clippy() { intro_homepage.start(); } + + function set_clippy_annoying() { + checked = $('input[name=\'clippy_is_annoying\']').is(':checked'); + intro_homepage.exit(); + + if (checked) { + document.cookie = 'clippy_is_annoying=1'; + } + else { + document.cookie = 'clippy_is_annoying=0'; + } + } "; if ($config['logged']) { $helps['homepage']['conf']['autostart'] = true; @@ -64,6 +84,15 @@ function clippy_start_page_homepage() { else { $helps['homepage']['conf']['autostart'] = false; } + + if ($config["tutorial_mode"] == 'on_demand') { + $helps['homepage']['conf']['autostart'] = false; + } + + if ($clippy_is_annoying === 1) { + $helps['homepage']['conf']['autostart'] = false; + } + //================================================================== clippy_write_javascript_helps_steps($helps);