From 353246f9f6d4e54224db03f70554a4c648ee1606 Mon Sep 17 00:00:00 2001 From: marcos Date: Fri, 18 Oct 2019 10:30:19 +0200 Subject: [PATCH] first changed to welcome window --- .../new_installation_welcome_window.php | 77 ++++ pandora_console/general/register.php | 12 + .../godmode/wizards/Wizard.main.php | 67 ++- .../NewInstallationWelcomeWindow.class.php | 423 ++++++++++++++++++ pandora_console/include/javascript/pandora.js | 127 +++--- .../new_installation_welcome_window.css | 144 ++++++ 6 files changed, 780 insertions(+), 70 deletions(-) create mode 100644 pandora_console/general/new_installation_welcome_window.php create mode 100644 pandora_console/include/class/NewInstallationWelcomeWindow.class.php create mode 100644 pandora_console/include/styles/new_installation_welcome_window.css diff --git a/pandora_console/general/new_installation_welcome_window.php b/pandora_console/general/new_installation_welcome_window.php new file mode 100644 index 0000000000..5509292bc9 --- /dev/null +++ b/pandora_console/general/new_installation_welcome_window.php @@ -0,0 +1,77 @@ + '[NewInstallationWelcomeWindow]'.$e->getMessage() ]); + exit; + } else { + echo '[NewInstallationWelcomeWindow]'.$e->getMessage(); + } + + // Stop this execution, but continue 'globally'. + return; +} + +// Ajax controller. +if (is_ajax()) { + $method = get_parameter('method', ''); + + if (method_exists($welcome_actions, $method) === true) { + if ($welcome_actions->ajaxMethod($method) === true) { + $welcome_actions->{$method}(); + } else { + $welcome_actions->error('Unavailable method.'); + } + } else { + $welcome_actions->error('Method not found. ['.$method.']'); + } + + + // Stop any execution. + exit; +} else { + // Run. + $welcome_actions->run(); +} diff --git a/pandora_console/general/register.php b/pandora_console/general/register.php index b1d58aada4..a938e4983d 100644 --- a/pandora_console/general/register.php +++ b/pandora_console/general/register.php @@ -30,6 +30,7 @@ global $config; require_once $config['homedir'].'/include/functions_update_manager.php'; +require_once $config['homedir'].'/include/class/NewInstallationWelcomeWindow.class.php'; if (is_ajax()) { @@ -122,6 +123,8 @@ if (is_ajax()) { exit(); } + + ui_require_css_file('register'); $initial = isset($config['initial_wizard']) !== true @@ -170,6 +173,15 @@ if (!$config['disabled_newsletter']) { } } +$welcome = !$registration && $initial; +$welcome = true; +if ($welcome && users_is_admin()) { + $welcome = new NewInstallationWelcomeWindow( + 'general/new_installation_welcome_window' + ); + $welcome->run(); +} + $newsletter = null; ?> diff --git a/pandora_console/godmode/wizards/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php index cb29d78c06..5ffeb716d9 100644 --- a/pandora_console/godmode/wizards/Wizard.main.php +++ b/pandora_console/godmode/wizards/Wizard.main.php @@ -404,13 +404,42 @@ class Wizard /** * Print a block of inputs. + * Example, using direct to 'anidate' inputs directly to wrapper: + * [ + * 'wrapper' => 'div', + * 'block_id' => 'example_id', + * 'class' => 'your class', + * 'direct' => 1, + * 'block_content' => [ + * [ + * 'arguments' => [ + * 'label' => __('Sugesstion'), + * 'type' => 'button', + * 'attributes' => 'class="sub ok btn_sug"', + * 'name' => 'option_1', + * 'id' => 'option_1', + * 'script' => 'change_option1()', + * ], + * ], + * [ + * 'arguments' => [ + * 'label' => __('Something is not quite right'), + * 'type' => 'button', + * 'attributes' => 'class="sub ok btn_something"', + * 'name' => 'option_2', + * 'id' => 'option_2', + * 'script' => 'change_option2()', + * ], + * ], + * ], + * ]. * * @param array $input Definition of target block to be printed. * @param boolean $return Return as string or direct output. * * @return string HTML content. */ - public function printBlock(array $input, bool $return=false) + public function printBlock(array $input, bool $return=false, bool $not_direct=false) { $output = ''; if ($input['hidden'] == 1) { @@ -424,33 +453,47 @@ class Wizard } if (is_array($input['block_content']) === true) { + $not_direct = (bool) $input['direct']; + // Print independent block of inputs. + $output .= '
  • '; + if ($input['wrapper']) { - $output .= '
  • '; $output .= '<'.$input['wrapper'].' id="'.$input['block_id'].'" class="'.$class.'">'; - } else { - $output .= '
  • '; } - $output .= '
  • '; + if (!$not_direct) { + $output .= ''; } + + if ($input['wrapper']) { + $output .= ''; + } + + $output .= ''; } else { if ($input['arguments']['type'] != 'hidden') { - $output .= '
  • '; + if (!$not_direct) { + $output .= '
  • '; + } + $output .= ''; $output .= $this->printInput($input['arguments']); // Allow dynamic content. $output .= $input['extra']; - $output .= '
  • '; + if (!$not_direct) { + $output .= ''; + } } else { $output .= $this->printInput($input['arguments']); // Allow dynamic content. diff --git a/pandora_console/include/class/NewInstallationWelcomeWindow.class.php b/pandora_console/include/class/NewInstallationWelcomeWindow.class.php new file mode 100644 index 0000000000..9f4f0202f5 --- /dev/null +++ b/pandora_console/include/class/NewInstallationWelcomeWindow.class.php @@ -0,0 +1,423 @@ + 'noaccess']); + } + + include 'general/noaccess.php'; + exit; + } + + return in_array($method, $this->AJAXMethods); + } + + + /** + * Constructor. + * + * @param string $ajax_controller Controller. + * + * @return object + */ + public function __construct($ajax_controller) + { + $this->ajaxController = $ajax_controller; + return $this; + } + + + /** + * Main method. + * + * @return void + */ + public function run() + { + ui_require_css_file('new_installation_welcome_window'); + + echo '