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
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @package Include
|
|
|
|
* @subpackage Clippy
|
|
|
|
*/
|
|
|
|
|
|
|
|
function clippy_start($sec2) {
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
if ($sec2 === false) {
|
|
|
|
$sec2 = 'homepage';
|
|
|
|
}
|
|
|
|
|
|
|
|
$sec2 = str_replace('/', '_', $sec2);
|
|
|
|
|
2014-08-26 Miguel de Dios <miguel.dedios@artica.es>
* godmode/alerts/configure_alert_action.php,
include/help/clippy/godmode_agentes_modificar_agente.php,
include/help/clippy/homepage.php,
include/help/clippy/module_unknow.php,
include/help/clippy/godmode_agentes_configurar_agente.php,
include/help/clippy/godmode_alerts_alert_actions.php,
include/help/clippy/operation_agentes_ver_agente.php,
include/help/clippy/godmode_alerts_configure_alert_action.php,
include/help/clippy/operation_agentes_status_monitor.php,
include/help/en/help_context_pandora_server_email.php,
include/functions_clippy.php, operation/menu.php,
operation/agentes/status_monitor.php: some changes suggested by
Carla.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10457 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-08-26 13:22:06 +02:00
|
|
|
//Avoid some case the other parameters in the url
|
|
|
|
if (strstr($sec2, "&") !== false) {
|
|
|
|
$chunks = explode("&", $sec2);
|
|
|
|
$sec2 = $chunks[0];
|
|
|
|
}
|
|
|
|
|
2014-08-11 16:30:09 +02:00
|
|
|
if ($sec2 != 'homepage') {
|
|
|
|
if (is_file("include/help/clippy/" . $sec2 . ".php")) {
|
|
|
|
require("include/help/clippy/" . $sec2 . ".php");
|
|
|
|
|
2014-08-14 11:26:04 +02:00
|
|
|
$tours = clippy_start_page();
|
|
|
|
clippy_write_javascript_helps_steps($tours);
|
2014-08-11 16:30:09 +02:00
|
|
|
}
|
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-11 16:30:09 +02:00
|
|
|
//Add homepage for all pages for to show the "task sugestions"
|
|
|
|
require("include/help/clippy/homepage.php");
|
2014-08-14 11:26:04 +02:00
|
|
|
|
|
|
|
$tours = clippy_start_page_homepage();
|
|
|
|
clippy_write_javascript_helps_steps($tours);
|
2014-08-11 16:30:09 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
require("include/help/clippy/homepage.php");
|
2014-08-14 11:26:04 +02:00
|
|
|
|
|
|
|
$tours = clippy_start_page_homepage();
|
|
|
|
clippy_write_javascript_helps_steps($tours);
|
2014-08-11 16:30:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function clippy_clean_help() {
|
|
|
|
set_cookie('clippy', null);
|
|
|
|
}
|
|
|
|
|
2014-08-14 11:26:04 +02:00
|
|
|
function clippy_write_javascript_helps_steps($tours) {
|
2014-08-12 13:41:55 +02:00
|
|
|
|
2014-08-11 16:30:09 +02:00
|
|
|
global $config;
|
|
|
|
|
2014-08-14 11:26:04 +02:00
|
|
|
$first_step_by_default = false;
|
|
|
|
if (isset($tours['first_step_by_default']))
|
|
|
|
$first_step_by_default = $tours['first_step_by_default'];
|
|
|
|
|
|
|
|
//For the help context instead the clippy
|
|
|
|
$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';
|
|
|
|
}
|
|
|
|
|
2014-08-11 16:30:09 +02:00
|
|
|
$clippy = get_cookie('clippy', false);
|
|
|
|
set_cookie('clippy', null);
|
|
|
|
|
2014-09-10 13:09:04 +02:00
|
|
|
|
2014-08-11 16:30:09 +02:00
|
|
|
//Get the help steps from a task
|
2014-09-10 13:09:04 +02:00
|
|
|
$steps = null;
|
|
|
|
if (isset($tours['tours'][$clippy])) {
|
|
|
|
$steps = $tours['tours'][$clippy]['steps'];
|
|
|
|
}
|
2014-08-14 11:26:04 +02:00
|
|
|
if ($first_step_by_default) {
|
2014-08-12 13:41:55 +02:00
|
|
|
if (empty($steps)) {
|
|
|
|
//Get the first by default
|
2014-08-14 11:26:04 +02:00
|
|
|
$temp = reset($tours['tours']);
|
2014-08-12 13:41:55 +02:00
|
|
|
$steps = $temp['steps'];
|
|
|
|
}
|
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-11 16:30:09 +02:00
|
|
|
|
2014-08-14 11:26:04 +02:00
|
|
|
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}';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-10 13:09:04 +02:00
|
|
|
$conf = null;
|
|
|
|
if (isset($tours['tours'][$clippy])) {
|
|
|
|
$conf = $tours['tours'][$clippy]['conf'];
|
|
|
|
}
|
2014-08-14 11:26:04 +02:00
|
|
|
if ($first_step_by_default) {
|
2014-08-12 13:41:55 +02:00
|
|
|
if (empty($conf)) {
|
|
|
|
//Get the first by default
|
2014-08-14 11:26:04 +02:00
|
|
|
$temp = reset($tours['tours']);
|
2014-08-12 13:41:55 +02:00
|
|
|
$conf = $temp['conf'];
|
|
|
|
}
|
2014-08-11 16:30:09 +02:00
|
|
|
}
|
|
|
|
|
2014-08-12 13:41:55 +02:00
|
|
|
if (!empty($steps)) {
|
2014-08-26 15:30:08 +02:00
|
|
|
foreach ($steps as $iterator => $element) {
|
|
|
|
$steps[$iterator]['intro'] =
|
|
|
|
"<div id='clippy_head_title'>" . __("Pandora FMS assistant") . "</div>" .
|
|
|
|
$steps[$iterator]['intro'];
|
|
|
|
}
|
|
|
|
|
2014-08-14 11:26:04 +02:00
|
|
|
if (!empty($conf['name_obj_js_tour'])) {
|
|
|
|
$name_obj_js_tour = $conf['name_obj_js_tour'];
|
2014-08-12 13:41:55 +02:00
|
|
|
}
|
2014-08-11 16:30:09 +02:00
|
|
|
|
2014-08-12 13:41:55 +02:00
|
|
|
$autostart = true;
|
|
|
|
if (!is_null($conf['autostart'])) {
|
|
|
|
$autostart = $conf['autostart'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$other_js = '';
|
|
|
|
if (!empty($conf['other_js'])) {
|
|
|
|
$other_js = $conf['other_js'];
|
|
|
|
}
|
|
|
|
|
2014-08-14 11:26:04 +02:00
|
|
|
$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'];
|
|
|
|
}
|
|
|
|
|
2014-09-02 16:42:59 +02:00
|
|
|
$doneLabel = __('End wizard');
|
|
|
|
if (!empty($conf['done_label'])) {
|
|
|
|
$doneLabel = $conf['done_label'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$skipLabel = __('End wizard');
|
|
|
|
if (!empty($conf['skip_label'])) {
|
|
|
|
$skipLabel = $conf['skip_label'];
|
|
|
|
}
|
|
|
|
|
2014-08-14 11:26:04 +02:00
|
|
|
$help_context = false;
|
2014-08-12 13:41:55 +02:00
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
2014-08-14 11:26:04 +02:00
|
|
|
var <?php echo $name_obj_js_tour; ?> = null;
|
2014-08-11 16:30:09 +02:00
|
|
|
|
2014-08-12 13:41:55 +02:00
|
|
|
$(document).ready(function() {
|
2014-08-14 11:26:04 +02:00
|
|
|
<?php echo $name_obj_js_tour; ?> = introJs();
|
2014-08-12 13:41:55 +02:00
|
|
|
|
2014-08-14 11:26:04 +02:00
|
|
|
<?php echo $name_obj_js_tour; ?>.setOptions({
|
2014-08-12 13:41:55 +02:00
|
|
|
steps: <?php echo json_encode($steps); ?>,
|
2014-09-22 13:36:33 +02:00
|
|
|
showBullets: <?php
|
|
|
|
if ($show_bullets)
|
|
|
|
echo "true";
|
|
|
|
else
|
|
|
|
echo "false";
|
|
|
|
?>,
|
|
|
|
showStepNumbers: <?php
|
|
|
|
if ($show_step_numbers)
|
|
|
|
echo "true";
|
|
|
|
else
|
|
|
|
echo "false";
|
|
|
|
?>,
|
2014-08-12 13:41:55 +02:00
|
|
|
nextLabel: "<?php echo __('Next →'); ?>",
|
|
|
|
prevLabel: "<?php echo __('← Back'); ?>",
|
2014-09-02 16:42:59 +02:00
|
|
|
skipLabel: "<?php echo $skipLabel; ?>",
|
|
|
|
doneLabel: "<?php echo $doneLabel; ?>",
|
2014-08-12 13:41:55 +02:00
|
|
|
exitOnOverlayClick: false,
|
|
|
|
exitOnEsc: true, //false,
|
|
|
|
})
|
2014-08-14 11:26:04 +02:00
|
|
|
.oncomplete(function(value) {
|
2014-09-02 16:42:59 +02:00
|
|
|
<?php echo $complete_js; ?>;
|
|
|
|
})
|
2014-08-12 13:41:55 +02:00
|
|
|
.onexit(function(value) {
|
2014-09-02 16:42:59 +02:00
|
|
|
<?php echo $exit_js; ?>;
|
|
|
|
|
|
|
|
exit = confirm("<?php echo __("Do you want to exit the help tour?"); ?>");
|
|
|
|
return exit;
|
|
|
|
});
|
2014-08-12 13:41:55 +02:00
|
|
|
|
|
|
|
<?php
|
|
|
|
if (!empty($conf['next_help'])) {
|
|
|
|
?>
|
|
|
|
clippy_set_help('<?php echo $conf['next_help']; ?>');
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
if ($autostart) {
|
|
|
|
?>
|
2014-08-14 11:26:04 +02:00
|
|
|
<?php echo $name_obj_js_tour; ?>.start();
|
2014-08-12 13:41:55 +02:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
});
|
2014-08-11 16:30:09 +02:00
|
|
|
|
2014-08-12 13:41:55 +02: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
|
|
|
|
|
|
|
function clippy_context_help($help = null) {
|
2014-08-14 13:25:46 +02:00
|
|
|
global $config;
|
|
|
|
|
|
|
|
if ($config['tutorial_mode'] == 'expert') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-08-12 18:31:27 +02:00
|
|
|
$id = uniqid("id_");
|
|
|
|
|
|
|
|
$return = '';
|
|
|
|
|
|
|
|
require_once("include/help/clippy/" . $help . ".php");
|
|
|
|
|
|
|
|
ob_start();
|
|
|
|
$function = "clippy_" . $help;
|
2014-08-14 11:26:04 +02:00
|
|
|
$tours = $function();
|
|
|
|
clippy_write_javascript_helps_steps($tours);
|
2014-08-12 18:31:27 +02:00
|
|
|
$code = ob_get_clean();
|
|
|
|
|
2014-08-14 11:26:04 +02:00
|
|
|
$code = str_replace('{clippy}', '#' . $id, $code);
|
|
|
|
$code = str_replace('{clippy_obj}', 'intro_' . $id, $code);
|
2014-08-12 18:31:27 +02:00
|
|
|
|
|
|
|
$return = $code .
|
|
|
|
'<div id="' . $id . '" style="display: inline;">' .
|
2014-08-14 11:26:04 +02:00
|
|
|
'<a onclick="show_' . $id . '();" href="javascript: void(0);" >' .
|
2014-08-12 18:31:27 +02:00
|
|
|
html_print_image(
|
|
|
|
"images/clippy_icon.png",
|
|
|
|
true) .
|
|
|
|
'</a>' .
|
|
|
|
'</div>
|
|
|
|
<script type="text/javascript">
|
2014-08-14 11:26:04 +02:00
|
|
|
|
|
|
|
function show_' . $id . '() {
|
|
|
|
if (intro_' . $id . '.started()) {
|
|
|
|
started = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
started = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (started == 0)
|
|
|
|
intro_' . $id . '.start();
|
|
|
|
}
|
|
|
|
|
2014-08-12 18:31:27 +02:00
|
|
|
$(document).ready(function() {
|
2015-06-08 11:05:19 +02:00
|
|
|
(function pulse_' . $id . '() {
|
2014-08-14 11:26:04 +02:00
|
|
|
$("#' . $id . ' img")
|
|
|
|
.delay(100)
|
|
|
|
.animate({\'opacity\': 1})
|
|
|
|
.delay(400)
|
|
|
|
.animate({\'opacity\': 0}, pulse_' . $id . ');
|
|
|
|
})();
|
|
|
|
|
|
|
|
//$("#' . $id . ' img").pulsate ();
|
2014-08-12 18:31:27 +02:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $return;
|
|
|
|
}
|
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
|
|
|
?>
|