2014-08-08 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/help/clippy/godmode_agentes_modificar_agente.php,
include/help/clippy/homepage.php,
include/help/clippy/godmode_agentes_configurar_agente.php,
include/javascript/intro.js,
include/javascript/introjs.css,
include/javascript/clippy.js,
include/functions_ui.php,
include/functions_clippy.php,
index.php,
general/header.php: first version of the new feature a annoying
clippy such as the lovely micro$oft mascot.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10393 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-08-08 17:11:00 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2019-02-27 13:41:26 +01:00
|
|
|
* Pandora FMS - http://pandorafms.com
|
|
|
|
* ==================================================
|
2020-11-27 13:52:35 +01:00
|
|
|
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
2019-02-27 13:41:26 +01:00
|
|
|
* Please see http://pandorafms.org for full contribution list
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License
|
|
|
|
* as published by the Free Software Foundation; version 2
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2019-01-30 16:18:44 +01:00
|
|
|
* @package Include
|
2014-08-08 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/help/clippy/godmode_agentes_modificar_agente.php,
include/help/clippy/homepage.php,
include/help/clippy/godmode_agentes_configurar_agente.php,
include/javascript/intro.js,
include/javascript/introjs.css,
include/javascript/clippy.js,
include/functions_ui.php,
include/functions_clippy.php,
index.php,
general/header.php: first version of the new feature a annoying
clippy such as the lovely micro$oft mascot.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10393 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-08-08 17:11:00 +02:00
|
|
|
* @subpackage Clippy
|
|
|
|
*/
|
|
|
|
|
2019-02-27 13:41:26 +01:00
|
|
|
// Begin.
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Starts clippy.
|
|
|
|
*
|
|
|
|
* @param string $sec2 Section.
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2019-02-27 13:41:26 +01:00
|
|
|
* @return void
|
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function clippy_start($sec2)
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
if ($sec2 === false) {
|
|
|
|
$sec2 = 'homepage';
|
|
|
|
}
|
|
|
|
|
|
|
|
$sec2 = str_replace('/', '_', $sec2);
|
|
|
|
|
2019-02-27 13:41:26 +01:00
|
|
|
// Avoid some case the other parameters in the url.
|
2019-01-30 16:18:44 +01:00
|
|
|
if (strstr($sec2, '&') !== false) {
|
|
|
|
$chunks = explode('&', $sec2);
|
|
|
|
$sec2 = $chunks[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($sec2 != 'homepage') {
|
|
|
|
if (is_file('include/help/clippy/'.$sec2.'.php')) {
|
|
|
|
include 'include/help/clippy/'.$sec2.'.php';
|
|
|
|
|
|
|
|
$tours = clippy_start_page();
|
|
|
|
clippy_write_javascript_helps_steps($tours);
|
|
|
|
}
|
|
|
|
|
2019-02-27 13:41:26 +01:00
|
|
|
// Add homepage for all pages for to show the "task sugestions".
|
2019-01-30 16:18:44 +01:00
|
|
|
include 'include/help/clippy/homepage.php';
|
|
|
|
|
|
|
|
$tours = clippy_start_page_homepage();
|
|
|
|
clippy_write_javascript_helps_steps($tours);
|
|
|
|
} else {
|
|
|
|
include 'include/help/clippy/homepage.php';
|
|
|
|
|
|
|
|
$tours = clippy_start_page_homepage();
|
|
|
|
clippy_write_javascript_helps_steps($tours);
|
|
|
|
}
|
2014-08-11 16:30:09 +02:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2019-02-27 13:41:26 +01:00
|
|
|
/**
|
|
|
|
* Undocumented function
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function clippy_clean_help()
|
|
|
|
{
|
|
|
|
set_cookie('clippy', null);
|
2014-08-11 16:30:09 +02:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2019-02-27 13:41:26 +01:00
|
|
|
/**
|
|
|
|
* Undocumented function
|
|
|
|
*
|
|
|
|
* @param something $tours Tour.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function clippy_write_javascript_helps_steps($tours)
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
$first_step_by_default = false;
|
|
|
|
if (isset($tours['first_step_by_default'])) {
|
|
|
|
$first_step_by_default = $tours['first_step_by_default'];
|
|
|
|
}
|
|
|
|
|
2019-02-27 13:41:26 +01:00
|
|
|
// For the help context instead the clippy.
|
2019-01-30 16:18:44 +01:00
|
|
|
$help_context = false;
|
|
|
|
if (isset($tours['help_context'])) {
|
|
|
|
$help_context = $tours['help_context'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($help_context) {
|
|
|
|
$name_obj_js_tour = '{clippy_obj}';
|
|
|
|
} else {
|
|
|
|
$name_obj_js_tour = 'intro';
|
|
|
|
}
|
|
|
|
|
|
|
|
$clippy = get_cookie('clippy', false);
|
|
|
|
set_cookie('clippy', null);
|
|
|
|
|
2019-02-27 13:41:26 +01:00
|
|
|
// Get the help steps from a task.
|
2019-01-30 16:18:44 +01:00
|
|
|
$steps = null;
|
|
|
|
if (isset($tours['tours'][$clippy])) {
|
|
|
|
$steps = $tours['tours'][$clippy]['steps'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($first_step_by_default) {
|
|
|
|
if (empty($steps)) {
|
2019-02-27 13:41:26 +01:00
|
|
|
// Get the first by default.
|
2019-01-30 16:18:44 +01:00
|
|
|
$temp = reset($tours['tours']);
|
|
|
|
$steps = $temp['steps'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($help_context) {
|
|
|
|
foreach ($steps as $iterator => $step) {
|
|
|
|
$init_step_context = false;
|
|
|
|
if (isset($step['init_step_context'])) {
|
|
|
|
$init_step_context = $step['init_step_context'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($init_step_context) {
|
|
|
|
unset($steps[$iterator]['init_step_context']);
|
|
|
|
$steps[$iterator]['element'] = '{clippy}';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$conf = null;
|
|
|
|
if (isset($tours['tours'][$clippy])) {
|
|
|
|
$conf = $tours['tours'][$clippy]['conf'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($first_step_by_default) {
|
|
|
|
if (empty($conf)) {
|
2019-02-27 13:41:26 +01:00
|
|
|
// Get the first by default.
|
2019-01-30 16:18:44 +01:00
|
|
|
$temp = reset($tours['tours']);
|
|
|
|
$conf = $temp['conf'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($steps)) {
|
|
|
|
foreach ($steps as $iterator => $element) {
|
|
|
|
$steps[$iterator]['intro'] = "<div id='clippy_head_title'>".__('%s assistant', get_product_name()).'</div>'.$steps[$iterator]['intro'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($conf['name_obj_js_tour'])) {
|
|
|
|
$name_obj_js_tour = $conf['name_obj_js_tour'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$autostart = true;
|
2019-02-27 13:41:26 +01:00
|
|
|
if (isset($conf['autostart'])) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$autostart = $conf['autostart'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$other_js = '';
|
|
|
|
if (!empty($conf['other_js'])) {
|
|
|
|
$other_js = $conf['other_js'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$exit_js = '';
|
|
|
|
if (!empty($conf['exit_js'])) {
|
|
|
|
$exit_js = $conf['exit_js'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$complete_js = '';
|
|
|
|
if (!empty($conf['complete_js'])) {
|
|
|
|
$complete_js = $conf['complete_js'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$show_bullets = 0;
|
|
|
|
if (!empty($conf['show_bullets'])) {
|
|
|
|
$show_bullets = (int) $conf['show_bullets'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$show_step_numbers = 0;
|
|
|
|
if (!empty($conf['show_step_numbers'])) {
|
|
|
|
$show_step_numbers = (int) $conf['show_step_numbers'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$doneLabel = __('End wizard');
|
|
|
|
if (!empty($conf['done_label'])) {
|
|
|
|
$doneLabel = $conf['done_label'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$skipLabel = __('End wizard');
|
|
|
|
if (!empty($conf['skip_label'])) {
|
|
|
|
$skipLabel = $conf['skip_label'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$help_context = false;
|
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
|
|
|
var <?php echo $name_obj_js_tour; ?> = null;
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
<?php echo $name_obj_js_tour; ?> = introJs();
|
|
|
|
|
|
|
|
<?php echo $name_obj_js_tour; ?>.setOptions({
|
2019-02-27 13:41:26 +01:00
|
|
|
steps: <?php echo json_encode($steps); ?>,
|
|
|
|
showBullets:
|
|
|
|
<?php
|
|
|
|
if ($show_bullets) {
|
|
|
|
echo 'true';
|
|
|
|
} else {
|
|
|
|
echo 'false';
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
,
|
|
|
|
showStepNumbers:
|
|
|
|
<?php
|
|
|
|
if ($show_step_numbers) {
|
|
|
|
echo 'true';
|
|
|
|
} else {
|
|
|
|
echo 'false';
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
,
|
2019-01-30 16:18:44 +01:00
|
|
|
nextLabel: "<?php echo __('Next →'); ?>",
|
|
|
|
prevLabel: "<?php echo __('← Back'); ?>",
|
|
|
|
skipLabel: "<?php echo $skipLabel; ?>",
|
|
|
|
doneLabel: "<?php echo $doneLabel; ?>",
|
|
|
|
exitOnOverlayClick: false,
|
|
|
|
exitOnEsc: true, //false,
|
|
|
|
})
|
|
|
|
.oncomplete(function(value) {
|
|
|
|
<?php echo $complete_js; ?>;
|
|
|
|
})
|
|
|
|
.onexit(function(value) {
|
|
|
|
<?php echo $exit_js; ?>;
|
|
|
|
|
|
|
|
exit = confirm("<?php echo __('Do you want to exit the help tour?'); ?>");
|
|
|
|
return exit;
|
|
|
|
});
|
|
|
|
|
2019-02-27 13:41:26 +01:00
|
|
|
<?php
|
|
|
|
if (!empty($conf['next_help'])) {
|
|
|
|
?>
|
2019-01-30 16:18:44 +01:00
|
|
|
clippy_set_help('<?php echo $conf['next_help']; ?>');
|
2019-02-27 13:41:26 +01:00
|
|
|
<?php
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
2019-02-27 13:41:26 +01:00
|
|
|
?>
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2019-02-27 13:41:26 +01:00
|
|
|
<?php
|
|
|
|
if ($autostart) {
|
|
|
|
echo $name_obj_js_tour;
|
|
|
|
?>
|
|
|
|
.start();
|
|
|
|
<?php
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
2019-02-27 13:41:26 +01:00
|
|
|
?>
|
2019-01-30 16:18:44 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
<?php echo $other_js; ?>
|
|
|
|
</script>
|
|
|
|
<?php
|
|
|
|
}
|
2014-08-08 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/help/clippy/godmode_agentes_modificar_agente.php,
include/help/clippy/homepage.php,
include/help/clippy/godmode_agentes_configurar_agente.php,
include/javascript/intro.js,
include/javascript/introjs.css,
include/javascript/clippy.js,
include/functions_ui.php,
include/functions_clippy.php,
index.php,
general/header.php: first version of the new feature a annoying
clippy such as the lovely micro$oft mascot.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10393 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-08-08 17:11:00 +02:00
|
|
|
}
|
2014-08-12 18:31:27 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2019-02-27 13:41:26 +01:00
|
|
|
/**
|
|
|
|
* Undocumented function
|
|
|
|
*
|
|
|
|
* @param string $help Help.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function clippy_context_help($help=null)
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
if ($config['tutorial_mode'] == 'expert') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$id = uniqid('id_');
|
|
|
|
|
|
|
|
$return = '';
|
|
|
|
|
2020-06-19 12:01:20 +02:00
|
|
|
include_once $config['homedir'].'/include/help/clippy/'.$help.'.php';
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
ob_start();
|
|
|
|
$function = 'clippy_'.$help;
|
|
|
|
$tours = $function();
|
|
|
|
clippy_write_javascript_helps_steps($tours);
|
|
|
|
$code = ob_get_clean();
|
|
|
|
|
|
|
|
$code = str_replace('{clippy}', '#'.$id, $code);
|
|
|
|
$code = str_replace('{clippy_obj}', 'intro_'.$id, $code);
|
|
|
|
|
2019-05-29 17:02:01 +02:00
|
|
|
$return = $code.'<div id="'.$id.'" style="display: inline-block;"><a onclick="show_'.$id.'();" href="javascript: void(0);" >'.html_print_image(
|
2019-01-30 16:18:44 +01:00
|
|
|
'images/clippy_icon.png',
|
|
|
|
true
|
2019-02-27 13:41:26 +01:00
|
|
|
).'</a></div>
|
2019-01-30 16:18:44 +01:00
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
function show_'.$id.'() {
|
|
|
|
if (intro_'.$id.'.started()) {
|
|
|
|
started = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
started = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (started == 0)
|
|
|
|
intro_'.$id.'.start();
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
(function pulse_'.$id.'() {
|
|
|
|
$("#'.$id.' img")
|
|
|
|
.delay(100)
|
|
|
|
.animate({\'opacity\': 1})
|
|
|
|
.delay(400)
|
|
|
|
.animate({\'opacity\': 0}, pulse_'.$id.');
|
|
|
|
})();
|
|
|
|
|
|
|
|
//$("#'.$id.' img").pulsate ();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
';
|
|
|
|
|
|
|
|
return $return;
|
2014-08-12 18:31:27 +02:00
|
|
|
}
|