diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 64a2f3b92f..5862e29aed 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2014-08-11 Miguel de Dios <miguel.dedios@artica.es> + + * include/help/clippy/godmode_agentes_modificar_agente.php, + include/help/clippy/homepage.php, + include/help/clippy/godmode_agentes_configurar_agente.php, + include/functions_clippy.php: wip in the clippy. + 2014-08-11 Vanessa Gil <vanessa.gil@artica.es> * godmode/agentes/agent_template.php: Fixed bug in FF diff --git a/pandora_console/include/functions_clippy.php b/pandora_console/include/functions_clippy.php index 2f296896a8..ad7c9f52cf 100644 --- a/pandora_console/include/functions_clippy.php +++ b/pandora_console/include/functions_clippy.php @@ -28,12 +28,96 @@ function clippy_start($sec2) { $sec2 = str_replace('/', '_', $sec2); - //~ html_debug_print($sec2, true); - - if (is_file("include/help/clippy/" . $sec2 . ".php")) { - require("include/help/clippy/" . $sec2 . ".php"); + if ($sec2 != 'homepage') { + if (is_file("include/help/clippy/" . $sec2 . ".php")) { + require("include/help/clippy/" . $sec2 . ".php"); + + clippy_start_page(); + } - clippy_start_page(); + //Add homepage for all pages for to show the "task sugestions" + require("include/help/clippy/homepage.php"); + clippy_start_page_homepage(); + } + else { + require("include/help/clippy/homepage.php"); + clippy_start_page_homepage(); } } + +function clippy_clean_help() { + set_cookie('clippy', null); +} + +function clippy_write_javascript_helps_steps($helps) { + global $config; + + $clippy = get_cookie('clippy', false); + set_cookie('clippy', null); + + + //Get the help steps from a task + $steps = $helps[$clippy]['steps']; + if (empty($steps)) { + //Get the first by default + $temp = reset($helps); + $steps = $temp['steps']; + } + + $conf = $helps[$clippy]['conf']; + if (empty($conf)) { + //Get the first by default + $temp = reset($helps); + $conf = $temp['conf']; + } + + $name_obj_tour = 'intro'; + if (!empty($conf['name_obj_tour'])) { + $name_obj_tour = $conf['name_obj_tour']; + } + + $autostart = true; + if (!is_null($conf['autostart'])) { + $autostart = $conf['autostart']; + } + + $other_js = ''; + if (!empty($conf['other_js'])) { + $other_js = $conf['other_js']; + } + + ?> + <script type="text/javascript"> + var <?php echo $name_obj_tour; ?> = null; + + $(document).ready(function() { + <?php echo $name_obj_tour; ?> = introJs(); + + <?php echo $name_obj_tour; ?>.setOptions({ + steps: <?php echo json_encode($steps); ?>, + showBullets: <?php echo json_encode($conf['showBullets']); ?>, + showStepNumbers: <?php echo json_encode($conf['showStepNumbers']); ?>, + }); + + <?php + if (!empty($conf['next_help'])) { + ?> + clippy_set_help('<?php echo $conf['next_help']; ?>'); + <?php + } + ?> + + <?php + if ($autostart) { + ?> + <?php echo $name_obj_tour; ?>.start(); + <?php + } + ?> + }); + + <?php echo $other_js; ?> + </script> + <?php +} ?> \ No newline at end of file diff --git a/pandora_console/include/help/clippy/godmode_agentes_configurar_agente.php b/pandora_console/include/help/clippy/godmode_agentes_configurar_agente.php index 5cba2d007a..a2f1fd2bc1 100644 --- a/pandora_console/include/help/clippy/godmode_agentes_configurar_agente.php +++ b/pandora_console/include/help/clippy/godmode_agentes_configurar_agente.php @@ -20,134 +20,107 @@ */ function clippy_start_page() { - global $config; + $helps = array(); - $clippy = get_cookie('clippy', false); - set_cookie('clippy', null); - - switch ($clippy) { - case 'choose_tabs_modules': - $steps = array(); - $steps[] = array( - 'element'=> '#clippy', - 'intro' => __('Now you must go to modules, don\'t worry I teach you.') - ); - $steps[] = array( - 'element'=> "img[alt='Modules']", - 'intro' => __('Please click in this tab.') - ); - break; - case 'create_module': - $steps = array(); - $steps[] = array( - 'element'=> '#clippy', - 'intro' => __('Now you must create the module, don\'t worry I teach you.') - ); - $steps[] = array( - 'element'=> "#moduletype", - 'intro' => __('Choose the network server module.') - ); - $steps[] = array( - 'element'=> "input[name='updbutton']", - 'intro' => __('And click in this button.') - ); - break; - case 'create_module_second_step': - $steps = array(); - $steps[] = array( - 'element'=> '#clippy', - 'intro' => __('We are going to fill the form.') - ); - $steps[] = array( - 'element'=> "#network_component_group", - 'intro' => __('Please choose the Network Management.') - ); - $steps[] = array( - 'element'=> "#network_component", - 'intro' => __('And choose the component with the name "Host Alive".') - ); - $steps[] = array( - 'element'=> "input[name='name']", - 'intro' => __('You can change the name.') - ); - $steps[] = array( - 'element'=> "input[name='ip_target']", - 'intro' => __('Check if this IP is the address of your machine.') - ); - $steps[] = array( - 'element'=> "input[name='crtbutton']", - 'intro' => __('And only to finish it is clicking this button.') - ); - break; - case 'create_module_third_step': - $steps = array(); - $steps[] = array( - 'element'=> '#clippy', - 'intro' => __('Now, your module is just created.<br/> And the status color is <b>blue</b>.<br/>This meaning of blue status is the module is not executed for first time.<br/>In the next seconds if there is not a problem, the status color will change to red or green.') - ); - break; - } + //================================================================== + //Help tour about the monitoring with a ping (step 3) + //------------------------------------------------------------------ + $helps['monitoring_server_step_3'] = array(); + $helps['monitoring_server_step_3']['steps'] = array(); + $helps['monitoring_server_step_3']['steps'][] = array( + 'element'=> '#clippy', + 'intro' => __('Now you must go to modules, don\'t worry I teach you.') + ); + $helps['monitoring_server_step_3']['steps'][] = array( + 'element'=> "img[alt='Modules']", + 'intro' => __('Please click in this tab.') + ); + $helps['monitoring_server_step_3']['conf'] = array(); + $helps['monitoring_server_step_3']['conf']['showBullets'] = 0; + $helps['monitoring_server_step_3']['conf']['showStepNumbers'] = 0; + $helps['monitoring_server_step_3']['conf']['next_help'] = 'monitoring_server_step_4'; + //================================================================== + //================================================================== + //Help tour about the monitoring with a ping (step 4) + //------------------------------------------------------------------ + $helps['monitoring_server_step_4'] = array(); + $helps['monitoring_server_step_4']['steps'] = array(); + $helps['monitoring_server_step_4']['steps'][] = array( + 'element'=> '#clippy', + 'intro' => __('Now you must create the module, don\'t worry I teach you.') + ); + $helps['monitoring_server_step_4']['steps'][] = array( + 'element'=> "#moduletype", + 'intro' => __('Choose the network server module.') + ); + $helps['monitoring_server_step_4']['steps'][] = array( + 'element'=> "input[name='updbutton']", + 'intro' => __('And click in this button.') + ); + $helps['monitoring_server_step_4']['conf'] = array(); + $helps['monitoring_server_step_4']['conf']['showBullets'] = 0; + $helps['monitoring_server_step_4']['conf']['showStepNumbers'] = 0; + $helps['monitoring_server_step_4']['conf']['next_help'] = 'monitoring_server_step_5'; + //================================================================== - ?> - <script type="text/javascript"> - var steps = <?php echo json_encode($steps); ?>; - var intro = null; - - $(document).ready(function() { - intro = introJs(); - - - <?php - switch ($clippy) { - case 'choose_tabs_modules': - ?> - intro.setOptions({ - steps: steps, - showBullets: false, - showStepNumbers: false - }); - clippy_set_help('create_module'); - intro.start(); - <?php - break; - case 'create_module': - ?> - intro.setOptions({ - steps: steps, - showBullets: false, - showStepNumbers: false - }); - clippy_set_help('create_module_second_step'); - intro.start(); - <?php - break; - case 'create_module_second_step': - ?> - intro.setOptions({ - steps: steps, - showBullets: false, - showStepNumbers: false - }); - clippy_set_help('create_module_third_step'); - intro.start(); - <?php - break; - case 'create_module_third_step': - ?> - intro.setOptions({ - steps: steps, - showBullets: false, - showStepNumbers: false - }); - intro.start(); - <?php - break; - } - ?> - }); - </script> - <?php + + //================================================================== + //Help tour about the monitoring with a ping (step 5) + //------------------------------------------------------------------ + $helps['monitoring_server_step_5'] = array(); + $helps['monitoring_server_step_5']['steps'] = array(); + $helps['monitoring_server_step_5']['steps'][] = array( + 'element'=> '#clippy', + 'intro' => __('Now you must create the module, don\'t worry I teach you.') + ); + $helps['monitoring_server_step_5']['steps'][] = array( + 'element'=> '#clippy', + 'intro' => __('We are going to fill the form.') + ); + $helps['monitoring_server_step_5']['steps'][] = array( + 'element'=> "#network_component_group", + 'intro' => __('Please choose the Network Management.') + ); + $helps['monitoring_server_step_5']['steps'][] = array( + 'element'=> "#network_component", + 'intro' => __('And choose the component with the name "Host Alive".') + ); + $helps['monitoring_server_step_5']['steps'][] = array( + 'element'=> "input[name='name']", + 'intro' => __('You can change the name.') + ); + $helps['monitoring_server_step_5']['steps'][] = array( + 'element'=> "input[name='ip_target']", + 'intro' => __('Check if this IP is the address of your machine.') + ); + $helps['monitoring_server_step_5']['steps'][] = array( + 'element'=> "input[name='crtbutton']", + 'intro' => __('And only to finish it is clicking this button.') + ); + $helps['monitoring_server_step_5']['conf'] = array(); + $helps['monitoring_server_step_5']['conf']['showBullets'] = 0; + $helps['monitoring_server_step_5']['conf']['showStepNumbers'] = 0; + $helps['monitoring_server_step_5']['conf']['next_help'] = 'monitoring_server_step_6'; + //================================================================== + + + //================================================================== + //Help tour about the monitoring with a ping (step 6) + //------------------------------------------------------------------ + $helps['monitoring_server_step_6'] = array(); + $helps['monitoring_server_step_6']['steps'] = array(); + $helps['monitoring_server_step_6']['steps'][] = array( + 'element'=> '#clippy', + 'intro' => __('Now, your module is just created.<br/> And the status color is <b>blue</b>.<br/>This meaning of blue status is the module is not executed for first time.<br/>In the next seconds if there is not a problem, the status color will change to red or green.') + ); + $helps['monitoring_server_step_6']['conf'] = array(); + $helps['monitoring_server_step_6']['conf']['showBullets'] = 0; + $helps['monitoring_server_step_6']['conf']['showStepNumbers'] = 0; + //================================================================== + + + clippy_write_javascript_helps_steps($helps); } ?> \ No newline at end of file diff --git a/pandora_console/include/help/clippy/godmode_agentes_modificar_agente.php b/pandora_console/include/help/clippy/godmode_agentes_modificar_agente.php index 0948758f61..c0fbff9b68 100644 --- a/pandora_console/include/help/clippy/godmode_agentes_modificar_agente.php +++ b/pandora_console/include/help/clippy/godmode_agentes_modificar_agente.php @@ -20,81 +20,52 @@ */ function clippy_start_page() { - global $config; - $clippy = get_cookie('clippy', false); - set_cookie('clippy', null); + $helps = array(); - switch ($clippy) { - case 'monitoring_server': - $steps = array(); - $steps[] = array( - 'element'=> '#clippy', - 'intro' => __('I show how to monitoring a server.') - ); - $steps[] = array( - 'element'=> 'input[name="search"]', - 'intro' => __('Please type a agent to save the modules for monitoring a server.') - ); - $steps[] = array( - 'element'=> 'input[name="srcbutton"]', - 'intro' => __('Maybe if you typped correctly the name, you can see the agent.') - ); - break; - case 'choose_agent': - $steps = array(); - $steps[] = array( - 'element'=> '#clippy', - 'intro' => __('Please choose the agent that you have searched.') - ); - $steps[] = array( - 'element'=> '#agent_list', - 'intro' => __('Choose the agent, please click in the name.') - ); - break; - } + //================================================================== + //Help tour about the monitoring with a ping (step 1) + //------------------------------------------------------------------ + $helps['monitoring_server_step_1'] = array(); + $helps['monitoring_server_step_1']['steps'] = array(); + $helps['monitoring_server_step_1']['steps'][] = array( + 'element'=> '#clippy', + 'intro' => __('I show how to monitoring a server.') + ); + $helps['monitoring_server_step_1']['steps'][] = array( + 'element'=> 'input[name="search"]', + 'intro' => __('Please type a agent to save the modules for monitoring a server.') + ); + $helps['monitoring_server_step_1']['steps'][] = array( + 'element'=> 'input[name="srcbutton"]', + 'intro' => __('Maybe if you typped correctly the name, you can see the agent.') + ); + $helps['monitoring_server_step_1']['conf'] = array(); + $helps['monitoring_server_step_1']['conf']['showBullets'] = 0; + $helps['monitoring_server_step_1']['conf']['showStepNumbers'] = 1; + $helps['monitoring_server_step_1']['conf']['next_help'] = 'monitoring_server_step_2'; + //================================================================== + //================================================================== + //Help tour about the monitoring with a ping (step 2) + //------------------------------------------------------------------ + $helps['monitoring_server_step_2'] = array(); + $helps['monitoring_server_step_2']['steps'] = array(); + $helps['monitoring_server_step_2']['steps'][] = array( + 'element'=> '#clippy', + 'intro' => __('Please choose the agent that you have searched.') + ); + $helps['monitoring_server_step_2']['steps'][] = array( + 'element'=> '#agent_list', + 'intro' => __('Choose the agent, please click in the name.') + ); + $helps['monitoring_server_step_2']['conf'] = array(); + $helps['monitoring_server_step_2']['conf']['showBullets'] = 0; + $helps['monitoring_server_step_2']['conf']['showStepNumbers'] = 0; + $helps['monitoring_server_step_2']['conf']['next_help'] = 'monitoring_server_step_3'; + //================================================================== - ?> - <script type="text/javascript"> - var steps = <?php echo json_encode($steps); ?>; - var intro = null; - - $(document).ready(function() { - intro = introJs(); - - - <?php - switch ($clippy) { - case 'monitoring_server': - ?> - intro.setOptions({ - steps: steps, - showBullets: false, - showStepNumbers: true - }); - - clippy_set_help('choose_agent'); - intro.start(); - <?php - break; - case 'choose_agent': - ?> - intro.setOptions({ - steps: steps, - showBullets: false, - showStepNumbers: false - }); - - clippy_set_help('choose_tabs_modules'); - intro.start(); - <?php - break; - } - ?> - }); - </script> - <?php + clippy_write_javascript_helps_steps($helps); } ?> \ No newline at end of file diff --git a/pandora_console/include/help/clippy/homepage.php b/pandora_console/include/help/clippy/homepage.php index 7458a03755..31c24237a4 100644 --- a/pandora_console/include/help/clippy/homepage.php +++ b/pandora_console/include/help/clippy/homepage.php @@ -19,20 +19,28 @@ * @subpackage Clippy */ -function clippy_start_page() { +function clippy_start_page_homepage() { global $config; - $steps = array(); - $steps[] = array( + clippy_clean_help(); + + $helps = array(); + + //================================================================== + //Help tour with the some task for to help the user. + //------------------------------------------------------------------ + $helps['homepage'] = array(); + $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.') ); - $steps[] = array( + $helps['homepage']['steps'][] = array( 'element'=> '#clippy', 'intro' => __('What task do you want to do?') . '<br/><br/>' . '<ul style="text-align: left; margin-left: 3px; list-style-type: disc;">' . '<li>' . - "<a href='javascript: clippy_go_link_show_help(\"index.php?sec=gagente&sec2=godmode/agentes/modificar_agente\", \"monitoring_server\");'>" . + "<a href='javascript: clippy_go_link_show_help(\"index.php?sec=gagente&sec2=godmode/agentes/modificar_agente\", \"monitoring_server_step_1\");'>" . //'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&clippy=monitoring_server">' . __('Monitoring a server Linux/Windows with a pandora agent') . '</a>' . @@ -41,29 +49,23 @@ function clippy_start_page() { '<li>' . __('Monitoring a Windows server with remote WMI ') . '</li>' . '</ul>' ); + $helps['homepage']['conf'] = array(); + $helps['homepage']['conf']['showBullets'] = 0; + $helps['homepage']['conf']['showStepNumbers'] = 0; + $helps['homepage']['conf']['name_obj_tour'] = 'intro_homepage'; + $helps['homepage']['conf']['other_js'] = " + function show_clippy() { + intro_homepage.start(); + } + "; + if ($config['logged']) { + $helps['homepage']['conf']['autostart'] = true; + } + else { + $helps['homepage']['conf']['autostart'] = false; + } + //================================================================== - ?> - <script type="text/javascript"> - var steps = <?php echo json_encode($steps); ?>; - var intro = null; - - $(document).ready(function() { - intro = introJs(); - - intro.setOptions({ - steps: steps, - showBullets: false, - showStepNumbers: false - }); - <?php - if ($config['logged']) { - ?> - intro.start(); - <?php - } - ?> - }); - </script> - <?php + clippy_write_javascript_helps_steps($helps); } ?> \ No newline at end of file