Initial commit

This commit is contained in:
2020-10-07 10:37:15 +02:00
commit ce5f440392
28157 changed files with 4429172 additions and 0 deletions

View File

@@ -0,0 +1,295 @@
<?php
/**
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
namespace OnBoarding;
use Module;
use PrestaShopBundle\Service\Routing\Router;
class Configuration
{
/**
* Module Dependency
*/
const MODULE_MBO = 'ps_mbo';
const FAKE_ID = 123456789;
private $translator;
public function __construct($translator)
{
$this->translator = $translator;
}
public function getConfiguration(Router $router)
{
$contextLink = \Context::getContext()->link;
$productFormUrlPattern = $this->generateSfBaseUrl(
$router,
'admin_product_form',
['id' => static::FAKE_ID]
);
$data = [
'templates' => [
'lost',
'popup',
'tooltip',
],
'steps' => [
'groups' => [
[
'steps' => [
[
'type' => 'popup',
'text' => [
'type' => 'template',
'src' => 'welcome',
],
'options' => [
'savepoint',
'hideFooter',
],
'page' => $contextLink->getAdminLink('AdminDashboard'),
],
],
],
[
'title' => $this->translator->trans('Let\'s create your first product', [], 'Modules.Welcome.Admin'),
'subtitle' => [
'1' => $this->translator->trans('What do you want to tell about it? Think about what your customers want to know.', [], 'Modules.Welcome.Admin'),
'2' => $this->translator->trans('Add clear and attractive information. Don\'t worry, you can edit it later :)', [], 'Modules.Welcome.Admin'),
],
'steps' => [
[
'type' => 'tooltip',
'text' => $this->translator->trans('Give your product a catchy name.', [], 'Modules.Welcome.Admin'),
'options' => [
'savepoint',
],
'page' => [
$router->generate('admin_product_new'),
$productFormUrlPattern,
],
'selector' => '#form_step1_name_1',
'position' => 'right',
],
[
'type' => 'tooltip',
'text' => $this->translator->trans('Fill out the essential details in this tab. The other tabs are for more advanced information.', [], 'Modules.Welcome.Admin'),
'page' => $productFormUrlPattern,
'selector' => '#tab_step1',
'position' => 'right',
],
[
'type' => 'tooltip',
'text' => $this->translator->trans('Add one or more pictures so your product looks tempting!', [], 'Modules.Welcome.Admin'),
'page' => $productFormUrlPattern,
'selector' => '#product-images-dropzone',
'position' => 'right',
],
[
'type' => 'tooltip',
'text' => $this->translator->trans('How much do you want to sell it for?', [], 'Modules.Welcome.Admin'),
'page' => $productFormUrlPattern,
'selector' => '.right-column > .row > .col-md-12 > .form-group:nth-child(4) > .row > .col-md-6:first-child > .input-group',
'position' => 'left',
'action' => [
'selector' => '#product_form_save_go_to_catalog_btn',
'action' => 'click',
],
],
[
'type' => 'tooltip',
'text' => $this->translator->trans('Yay! You just created your first product. Looks good, right?', [], 'Modules.Welcome.Admin'),
'page' => $this->generateSfBaseUrl($router, 'admin_product_catalog'),
'selector' => '#product_catalog_list table tr:first-child td:nth-child(3)',
'position' => 'left',
],
],
],
[
'title' => $this->translator->trans('Give your shop its own identity', [], 'Modules.Welcome.Admin'),
'subtitle' => [
'1' => $this->translator->trans('How do you want your shop to look? What makes it so special?', [], 'Modules.Welcome.Admin'),
'2' => $this->translator->trans('Customize your theme or choose the best design from our theme catalog.', [], 'Modules.Welcome.Admin'),
],
'steps' => [
[
'type' => 'tooltip',
'text' => $this->translator->trans('A good way to start is to add your own logo here!', [], 'Modules.Welcome.Admin'),
'options' => [
'savepoint',
],
'page' => $contextLink->getAdminLink('AdminThemes'),
'selector' => '#form_shop_logos_header_logo',
'position' => 'right',
],
[
'type' => 'tooltip',
'text' => $this->translator->trans('If you want something really special, have a look at the theme catalog!', [], 'Modules.Welcome.Admin'),
'page' => $contextLink->getAdminLink('AdminThemesCatalog'),
'selector' => '.addons-theme-one:first-child',
'position' => 'right',
],
],
],
],
],
];
$paymentSteps = [
'title' => $this->translator->trans('Get your shop ready for payments', [], 'Modules.Welcome.Admin'),
'subtitle' => [
'1' => $this->translator->trans('How do you want your customers to pay you?', [], 'Modules.Welcome.Admin'),
],
'steps' => [
[
'type' => 'tooltip',
'text' => $this->translator->trans('These payment methods are already available to your customers.', [], 'Modules.Welcome.Admin'),
'options' => [
'savepoint',
],
'page' => $contextLink->getAdminLink('AdminPayment'),
'selector' => '.modules_list_container_tab:first tr:first-child .text-muted, .card:eq(0) .text-muted:eq(0)',
'position' => 'right',
],
],
];
if (Module::isInstalled(self::MODULE_MBO) && Module::isEnabled(self::MODULE_MBO)) {
$paymentSteps['subtitle']['2'] = $this->translator->trans(
'Adapt your offer to your market: add the most popular payment methods for your customers!',
[],
'Modules.Welcome.Admin'
);
$paymentSteps['steps'][] = [
'type' => 'tooltip',
'text' => $this->translator->trans('And you can choose to add other payment methods from here!', [], 'Modules.Welcome.Admin'),
'page' => $contextLink->getAdminLink('AdminPayment'),
'selector' => '.panel:eq(1) table tr:eq(0) td:eq(1), .card:eq(1) .module-item-list div:eq(0) div:eq(1)',
'position' => 'top',
];
}
$data['steps']['groups'][] = $paymentSteps;
$shippingSteps = [
'title' => $this->translator->trans('Choose your shipping solutions', [], 'Modules.Welcome.Admin'),
'subtitle' => [
'1' => $this->translator->trans('How do you want to deliver your products?', [], 'Modules.Welcome.Admin'),
],
'steps' => [
[
'type' => 'tooltip',
'text' => $this->translator->trans('Here are the shipping methods available on your shop today.', [], 'Modules.Welcome.Admin'),
'options' => [
'savepoint',
],
'page' => $contextLink->getAdminLink('AdminCarriers'),
'selector' => '#table-carrier tr:eq(2) td:eq(3)',
'position' => 'right',
],
],
];
if (Module::isInstalled(self::MODULE_MBO) && Module::isEnabled(self::MODULE_MBO)) {
$shippingSteps['subtitle']['2'] = $this->translator->trans(
'Select the shipping solutions the most likely to suit your customers! Create your own carrier or add a ready-made module.',
[],
'Modules.Welcome.Admin'
);
$shippingSteps['steps'][] = [
'type' => 'tooltip',
'text' => $this->translator->trans('You can offer more delivery options by setting up additional carriers', [], 'Modules.Welcome.Admin'),
'page' => $contextLink->getAdminLink('AdminCarriers'),
'selector' => '.modules_list_container_tab tr:eq(0) .text-muted',
'position' => 'right',
];
}
$data['steps']['groups'][] = $shippingSteps;
$moduleSteps = [
'title' => $this->translator->trans('Improve your shop with modules', [], 'Modules.Welcome.Admin'),
'subtitle' => [
'1' => $this->translator->trans('Add new features and manage existing ones thanks to modules.', [], 'Modules.Welcome.Admin'),
'2' => $this->translator->trans('Some modules are already pre-installed, others may be free or paid modules - browse our selection and find out what is available!', [], 'Modules.Welcome.Admin'),
],
'steps' => [
[
'type' => 'tooltip',
'text' => $this->translator->trans('Discover our module selection in the first tab. Manage your modules on the second one and be aware of notifications in the third tab.', [], 'Modules.Welcome.Admin'),
'options' => [
'savepoint',
],
'page' => $router->generate('admin_module_catalog'),
'selector' => '.page-head-tabs .tab:eq(0)',
'position' => 'right',
],
[
'type' => 'popup',
'text' => [
'type' => 'template',
'src' => 'end',
],
'options' => [
'savepoint',
'hideFooter',
],
'page' => $this->generateSfBaseUrl($router, 'admin_module_catalog'),
],
],
];
$data['steps']['groups'][] = $moduleSteps;
return $data;
}
/**
* generate url pattern to recognize the route as the current step url
* here we replace the route specific parameters with wildcard to allow regexp matching
*
* @param \PrestaShopBundle\Service\Routing\Router $router
* @param $controller
* @param array $fakeParameters
*
* @return mixed|string
*/
protected function generateSfBaseUrl(Router $router, $controller, $fakeParameters = [])
{
$url = $router->getGenerator()->generate($controller, $fakeParameters);
$url = substr($url, strlen(basename(__PS_BASE_URI__)) + 1);
$url = str_replace('/' . basename(_PS_ADMIN_DIR_) . '/', '', $url);
$url = str_replace(array_values($fakeParameters), '.+', $url);
return $url;
}
}

View File

@@ -0,0 +1,240 @@
<?php
/**
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
namespace OnBoarding;
use Configuration as LegacyConfiguration;
use PrestaShopBundle\Service\Routing\Router;
/**
* OnBoarding main class.
*/
class OnBoarding
{
/** @var array */
private $configuration;
/** @var Translator */
private $translator;
private $smarty;
private $module;
/**
* OnBoarding constructor.
*
* @param Translator $translator Twig environment needed to manage the templates
*/
public function __construct($translator, $smarty, $module, Router $router)
{
$this->translator = $translator;
$this->smarty = $smarty;
$this->module = $module;
$this->loadConfiguration($router);
}
/**
* Show the OnBoarding module content.
*/
public function showModuleContent()
{
$templates = array();
foreach ($this->configuration['templates'] as $template) {
$templates[] = array(
'name' => $template,
'content' => str_replace(array("\n", "\r", "\t"), "", $this->getTemplateContent("templates/$template")),
);
}
echo $this->getTemplateContent('content', array(
'currentStep' => $this->getCurrentStep(),
'totalSteps' => $this->getTotalSteps(),
'percent_real' => ($this->getCurrentStep() / $this->getTotalSteps()) * 100,
'percent_rounded' => round(($this->getCurrentStep() / $this->getTotalSteps())*100),
'isShutDown' => $this->isShutDown(),
'steps' => $this->configuration['steps'],
'jsonSteps' => json_encode($this->configuration['steps']),
'templates' => $templates,
));
}
/**
* Show the OnBoarding content for the nav bar.
*/
public function showModuleContentForNavBar($link)
{
echo $this->getTemplateContent('navbar', array(
'currentStep' => $this->getCurrentStep(),
'totalSteps' => $this->getTotalSteps(),
'percent_real' => ($this->getCurrentStep() / $this->getTotalSteps()) * 100,
'percent_rounded' => round(($this->getCurrentStep() / $this->getTotalSteps())*100),
'link' => $link->getAdminLink('AdminWelcome'),
));
}
/**
* Set the current step.
*
* @param int $step Current step ID
*
* @return bool Success of the configuration update
*/
public function setCurrentStep($step)
{
return LegacyConfiguration::updateValue('ONBOARDINGV2_CURRENT_STEP', $step);
}
/**
* Set the shut down status.
*
* @param bool $status Onboarding shut downed or not
*
* @return bool Success of the configuration update
*/
public function setShutDown($status)
{
return LegacyConfiguration::updateValue('ONBOARDINGV2_SHUT_DOWN', $status);
}
/**
* Return true if the OnBoarding is finished.
*
* @return bool True if the OnBoarding is finished
*/
public function isFinished()
{
return $this->getCurrentStep() >= $this->getTotalSteps();
}
/**
* Load all the steps with the localized texts.
*
* @param string $configPath Path where the configuration can be loaded
*/
private function loadConfiguration(Router $router)
{
$configuration = new Configuration($this->translator);
$configuration = $configuration->getConfiguration($router);
foreach ($configuration['steps']['groups'] as &$currentGroup) {
if (isset($currentGroup['title'])) {
$currentGroup['title'] = $this->getTextFromSettings($currentGroup['title']);
}
if (isset($currentGroup['subtitle'])) {
foreach ($currentGroup['subtitle'] as &$subtitle) {
$subtitle = $this->getTextFromSettings($subtitle);
}
}
foreach ($currentGroup['steps'] as &$currentStep) {
$currentStep['text'] = $this->getTextFromSettings($currentStep['text']);
}
}
$this->configuration = $configuration;
}
/**
* Return a text from step text configuration.
*
* @param array $text Step text configuration
*
* @return string|null Text if it exists
*/
private function getTextFromSettings($text)
{
if (is_array($text)) {
switch ($text['type']) {
case 'template':
return $this->getTemplateContent('contents/'.$text['src']);
}
}
return $text;
}
/**
* Echoes a template.
*
* @param string $templateName Template name
*/
public function showTemplate($templateName)
{
echo $this->getTemplateContent($templateName);
}
/**
* Return a template.
*
* @param string $templateName Template name
* @param array $additionnalParameters Additionnal parameters to inject on the Twig template
*
* @return string Parsed template
*/
private function getTemplateContent($templateName, $additionnalParameters = array())
{
$this->smarty->assign($additionnalParameters);
return $this->module->fetch(__DIR__.'/../views/'.$templateName.'.tpl');
}
/**
* Return the current step.
*
* @return int Current step
*/
private function getCurrentStep()
{
return (int)LegacyConfiguration::get('ONBOARDINGV2_CURRENT_STEP');
}
/**
* Return the steps count.
*
* @return int Steps count
*/
private function getTotalSteps()
{
$total = 0;
if (null != $this->configuration) {
foreach ($this->configuration['steps']['groups'] as &$group) {
$total += count($group['steps']);
}
}
return $total;
}
/**
* Return the shut down status.
*
* @return bool Shut down status
*/
private function isShutDown()
{
return (int)LegacyConfiguration::get('ONBOARDINGV2_SHUT_DOWN');
}
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>welcome</name>
<displayName><![CDATA[Welcome]]></displayName>
<version><![CDATA[6.0.0]]></version>
<description><![CDATA[Help the user to create his first product.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[]]></tab>
<is_configurable>0</is_configurable>
<need_instance>1</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>welcome</name>
<displayName><![CDATA[Bienvenue]]></displayName>
<version><![CDATA[6.0.0]]></version>
<description><![CDATA[Accompagne l&#039;utilisateur dans la cr&eacute;ation de son premier produit.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[]]></tab>
<is_configurable>0</is_configurable>
<need_instance>1</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,45 @@
<?php
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
require_once(_PS_MODULE_DIR_.'/welcome/welcome.php');
class AdminWelcomeController extends ModuleAdminController
{
public function postProcess()
{
if (!isset($_POST['action'])) {
throw new Exception('The action to call is not defined.');
}
if (!isset($_POST['value'])) {
throw new Exception('The value to set is not defined.');
}
$onBoarding = new Welcome();
$onBoarding->apiCall($_POST['action'], $_POST['value']);
die('0');
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@@ -0,0 +1,3 @@
import '../scss/module.scss';
require('expose?OnBoarding!./src/OnBoarding.js');

View File

@@ -0,0 +1,567 @@
/**
* OnBoarding main class.
*/
class OnBoarding
{
/**
* Constructor.
*
* @param {int} currentStep Current step ID
* @param {object} steps All steps configuration
* @param {boolean} isShutDown Did the OnBoarding is shut down ?
* @param {string} apiLocation OnBoarding API location
* @param {string} baseAdminDir Base PrestaShop admin directory
*/
constructor(currentStep, steps, isShutDown, apiLocation, baseAdminDir)
{
this.currentStep = currentStep;
this.steps = steps;
this.isShutDown = isShutDown;
this.apiLocation = apiLocation;
this.baseAdminDir = baseAdminDir;
this.templates = [];
}
/**
* Add a template used by the steps.
*
* @param {string} name Name of the template
* @param {string} content Content of the template
*/
addTemplate(name, content)
{
this.templates[name] = content;
}
/**
* Display the needed elements for the current step.
*/
showCurrentStep()
{
$('.onboarding-navbar').toggleClass('displayed', this.isShutDown == true);
$('.onboarding-advancement').toggle(this.isShutDown == false);
$('.onboarding-popup').remove();
$('.onboarding-tooltip').remove();
var onBoardingHeight = $('.onboarding-navbar.displayed').innerHeight();
// Fix the menu scroll
if ($('#nav-sidebar').length) {
$('#nav-sidebar').css('padding-bottom', (onBoardingHeight + 50) + 'px');
} else {
$('nav.nav-bar ul.main-menu').css('margin-bottom', onBoardingHeight + 'px');
}
if (!this.isShutDown) {
var step = this.getStep(this.currentStep);
if (OnBoarding.isCurrentPage(step.page)) {
this.prependTemplate(step.type, step.text);
if (step.type == 'tooltip') {
this.placeToolTip(step);
}
$('.onboarding-advancement').toggle($.inArray('hideFooter', step.options) === -1);
this.updateAdvancement();
} else {
$('.onboarding-advancement').toggle(false);
this.setShutDown(true);
//this.prependTemplate('lost');
}
}
}
/**
* Prepend a template to a body and add the content to its '.content' element.
*
* @param {string} templateName Template name
* @param {string} content Content to add
*/
prependTemplate(templateName, content = '')
{
var newContent = $(this.templates[templateName]);
if (content != '') {
newContent.find('.content').html(content);
}
var body = $('body').prepend(newContent);
}
/**
* Move to the next step.
*/
gotoNextStep()
{
this.gotoStep(this.currentStep + 1);
}
/**
* Go to a step defined by its index.
*
* @param {int} stepIndex Step index
*/
gotoStep(stepIndex)
{
this.save({action: 'setCurrentStep', value: stepIndex}, ((error) => {
if (!error) {
var currentStep = this.getStep(this.currentStep);
var nextStep = this.getStep(stepIndex);
if (null == nextStep) {
$(".onboarding-popup").remove();
$(".onboarding-navbar").remove();
$(".onboarding-tooltip").remove();
return;
}
if (null != currentStep.action) {
$(currentStep.action.selector)[currentStep.action.action]();
} else {
this.currentStep++;
if (!OnBoarding.isCurrentPage(nextStep.page)) {
window.location.href = this.getRedirectUrl(nextStep);
} else {
this.showCurrentStep();
}
}
}
}));
}
getTokenAsString(redirectUrl) {
var separator;
if (-1 !== redirectUrl.indexOf('?')) {
separator = '&';
} else {
separator = '?';
}
var queryString = window.location.search.substr(1);
var tokens = OnBoarding.getSecurityTokens(queryString, redirectUrl);
var tokenAsString = separator;
if (tokens._token !== undefined) {
tokenAsString = tokenAsString + '&_token=' + tokens._token
}
return tokenAsString;
}
getRedirectUrl(nextStep) {
var redirectUrl;
if (Array.isArray(nextStep.page)) {
redirectUrl = nextStep.page[0];
} else {
redirectUrl = nextStep.page;
}
return redirectUrl + this.getTokenAsString(redirectUrl);
}
static parseQueryString(queryString)
{
var queryStringParts = queryString.split('&');
var queryParams = {};
var parts;
var i;
for (i = 0; i < queryStringParts.length; i++) {
parts = queryStringParts[i].split('=');
queryParams[parts[0]] = parts[1];
}
return queryParams;
}
/**
* Get security tokens from URL and navigation menu
*
* @param queryString
* @param redirectUrl
* @returns {{}}
*/
static getSecurityTokens(queryString, redirectUrl) {
var queryParams = OnBoarding.parseQueryString(queryString);
var tokens = {};
if (typeof queryParams['_token'] !== 'undefined') {
tokens._token = queryParams['_token'];
}
return tokens;
}
/**
* Stop the OnBoarding
*/
stop()
{
this.save({action: 'setCurrentStep', value: this.getTotalSteps()}, (error) => {
if (!error) {
$(".onboarding-advancement").remove();
$(".onboarding-navbar").remove();
$(".onboarding-popup").remove();
$(".onboarding-tooltip").remove();
}
});
}
/**
* Goto the last save point step.
*/
gotoLastSavePoint()
{
var lastSavePointStep = 0;
var stepCount = 0;
this.steps.groups.forEach((group) => {
group.steps.forEach((step) => {
if (stepCount <= this.currentStep && $.inArray('savepoint', step.options) != -1) {
lastSavePointStep = stepCount;
}
stepCount++;
});
});
this.gotoStep(lastSavePointStep);
}
/**
* Return a group configuration for a step ID.
*
* @param {int} stepID Step ID
*
* @return {object} Group configuration
*/
getGroupForStep(stepID)
{
return this.getElementForStep(stepID, 'group');
}
/**
* Return the current group ID.
*
* @return {int} Current group
*/
getCurrentGroupID()
{
let currentGroupID = 0;
let currentStepID = 0;
let returnValue = 0;
this.steps.groups.forEach((group) => {
group.steps.forEach(() => {
if (currentStepID == this.currentStep) {
returnValue = currentGroupID;
}
currentStepID++;
});
currentGroupID++;
});
return returnValue;
}
/**
* Get current step ID on the group.
*
* @return {int} Step ID
*/
getCurrentStepIDOnGroup()
{
var currentStepID = 0;
var stepID = 0;
var stepIDOnGroup = 0;
this.steps.groups.forEach((group) => {
stepIDOnGroup = 0;
group.steps.forEach(() => {
if (currentStepID == this.currentStep) {
stepID = stepIDOnGroup;
}
stepIDOnGroup++;
currentStepID++;
});
});
return stepID;
}
/**
* Get the step configuration for a step ID.
*
* @param {int} stepID Step ID
*
* @return {object} Step configuration
*/
getStep(stepID)
{
return this.getElementForStep(stepID, 'step');
}
/**
* Return the element configuration fot a step or a group.
*
* @param {int} stepID Step ID for the element to get
* @param {string} elementType Element type (step or group)
*
* @returns {(object|null)} Element configuration if it exists
*/
getElementForStep(stepID, elementType)
{
var currentStepID = 0;
var element = null;
this.steps.groups.forEach((group) => {
group.steps.forEach((step) => {
if (currentStepID == stepID) {
if ('step' == elementType) {
element = step;
} else if ('group' == elementType) {
element = group;
}
}
currentStepID++;
});
});
return element;
}
/**
* Call the save ajax api of the module.
*
* @param {object} settings Settings to save via POST
* @param {function} callback Callback function called after the execution
*/
save(settings, callback)
{
$.ajax({
method: "POST",
url: this.apiLocation,
data: settings
}).done((result) => {
callback('0' != result);
}).fail(() => {
callback(true);
});
}
/**
* Update the advancement footer.
*/
updateAdvancement()
{
var advancementFooter = $('.onboarding-advancement');
var advancementNav = $('.onboarding-navbar');
var totalSteps = 0;
this.steps.groups.forEach((group, index) => {
var positionOnChunk = Math.min((this.currentStep + 1) - totalSteps, group.steps.length);
advancementFooter.find('.group-' + index + ' .advancement').css(
'width',
((positionOnChunk / group.steps.length)*100)+"%"
);
totalSteps += group.steps.length;
if (positionOnChunk == group.steps.length) {
let id = advancementFooter.find('.group-' + index + ' .id');
if (!id.hasClass('-done')) {
id.addClass('-done');
}
}
});
advancementFooter.find('.group-title').html(
(this.getCurrentGroupID() + 1) + '/' + this.getTotalGroups()
+ " - "
+ this.getGroupForStep(this.currentStep).title
);
if (this.getGroupForStep(this.currentStep).subtitle) {
if (this.getGroupForStep(this.currentStep).subtitle[1]) {
advancementFooter.find('.step-title-1').html(
'<i class="material-icons">check</i> '
+ this.getGroupForStep(this.currentStep).subtitle[1]
);
}
if (this.getGroupForStep(this.currentStep).subtitle[2]) {
advancementFooter.find('.step-title-2').html(
'<i class="material-icons">check</i> '
+ this.getGroupForStep(this.currentStep).subtitle[2]
);
}
}
var totalAdvancement = this.currentStep / this.getTotalSteps();
advancementNav.find('.text').find('.text-right').html(Math.floor(totalAdvancement * 100) + '%');
advancementNav.find('.progress-bar').width((totalAdvancement * 100) + '%');
}
/**
* Return the total steps count.
*
* @return {int} Total steps.
*/
getTotalSteps()
{
var total = 0;
this.steps.groups.forEach((group) => {
total += group.steps.length;
});
return total;
}
/**
* Return the total groups count.
*
* @return {int} Total groups.
*/
getTotalGroups()
{
return this.steps.groups.length;
}
/**
* Shut down or reactivate the onBoarding.
*
* @param {boolean} value True to shut down, false to activate.
*/
setShutDown(value)
{
this.isShutDown = value ? 1 : 0;
if (1 === this.isShutDown) {
$('.onboarding-advancement').toggle(false);
$('.onboarding-navbar').toggleClass('displayed', true);
$('.onboarding-popup').remove();
$('.onboarding-tooltip').remove();
}
this.save({action: 'setShutDown', value: this.isShutDown}, ((error) => {
if (!error) {
if (0 === this.isShutDown) {
if (OnBoarding.isCurrentPage(this.getStep(this.currentStep).page)) {
this.showCurrentStep();
} else {
this.gotoLastSavePoint();
}
}
}
}));
};
/**
* Return true if the url correspond to the current page.
*
* @param {(string|Array)} url Url to test
*
* @return {boolean} True if the url correspond to the current page
*/
static isCurrentPage(url)
{
var currentPage = window.location.href;
if (!$.isArray(url)) {
url = [String(url)];
}
var isCurrentUrl = false;
url.forEach((currentUrl) => {
// replace special chars for correct regexp testing
currentUrl = currentUrl.replace(/[\?\$]/g, "\\$&");
var urlRegexp = new RegExp(currentUrl, 'i');
if (urlRegexp.test(currentPage)) {
isCurrentUrl = true;
}
});
return isCurrentUrl;
}
/**
* Show a tooltip for a step.
*
* @param {object} step Step configuration
*/
placeToolTip(step)
{
this.tooltipElement = $(step.selector);
this.tooltip = $(".onboarding-tooltip");
this.tooltip.hide();
if (!this.tooltipElement.is(":visible")) {
setTimeout(() => {
this.placeToolTip(step);
}, 100);
if (this.tooltipPlacementInterval != undefined) {
clearInterval(this.tooltipPlacementInterval);
}
return;
} else {
this.tooltipPlacementInterval = setInterval(() => {
this.updateToolTipPosition(step);
}, 100);
}
this.tooltip.show();
this.tooltip.addClass('-'+step.position);
this.tooltip.data('position', step.position);
var currentStepIDOnGroup = this.getCurrentStepIDOnGroup();
var groupStepsCount = this.getGroupForStep(this.currentStep).steps.length;
this.tooltip.find(".count").html((currentStepIDOnGroup + 1) + '/' + groupStepsCount);
var bullsContainer = this.tooltip.find(".bulls");
for (var idStep = 0; idStep < groupStepsCount; idStep++) {
var newElement = $('<div></div>').addClass('bull');
if (idStep < currentStepIDOnGroup) {
newElement.addClass('-done');
}
if (idStep == currentStepIDOnGroup) {
newElement.addClass('-current');
}
bullsContainer.append(newElement);
}
setTimeout(function() {
if (this.tooltipElement.offset().top > ((screen.height / 2) - 200)) {
window.scrollTo(0, this.tooltipElement.offset().top - ((screen.height / 2) - 200));
}
}.bind(this), 200);
this.updateToolTipPosition();
}
/**
* Update the position of the tooltip.
*/
updateToolTipPosition()
{
var middleX = this.tooltipElement.offset().top - (this.tooltipElement.outerHeight() / 2) - (this.tooltip.outerHeight() / 2);
var middleY = this.tooltipElement.offset().top + (this.tooltipElement.outerHeight() / 2) - (this.tooltip.outerHeight() / 2);
var topY = this.tooltipElement.offset().top + (this.tooltipElement.outerHeight() / 2) - (this.tooltip.outerHeight() / 2);
var leftX = this.tooltipElement.offset().left - this.tooltip.outerWidth();
var rightX = this.tooltipElement.offset().left + this.tooltipElement.outerWidth();
switch (this.tooltip.data('position')) {
case 'right':
this.tooltip.css({left: rightX, top: middleY});
break;
case 'left':
this.tooltip.css({left: leftX, top: middleY});
break;
case 'top':
this.tooltip.css({left: middleX, top: topY});
break;
}
}
}
module.exports = OnBoarding;

BIN
modules/welcome/logo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,96 @@
@import "settings";
.onboarding-advancement {
font-family: Open Sans,sans-serif; // Forced because of old theme
font-weight: normal; // Forced because of old theme
position: fixed;
background: $background-color;
height: rem(110px);
bottom: 0;
right: 0;
left: rem(210px);
z-index: $minimum-z-index - 1;
.btn-primary {
background: $primary-color;
background: $primary-color !important; // Forced because of old theme
}
.col-md-8 { // Forced because of old theme
padding-left: rem(15px);
}
.group-title {
font-weight: bold; // Forced because of old theme
font-family: Open Sans,sans-serif; // Forced because of old theme
color: $dark-color;
font-size: rem(16px);
margin-top: rem(10px);
}
.step-title {
font-size: rem(14px); // Forced because of old theme
line-height: rem(20px); // Forced because of old theme
.material-icons {
color: $primary-color;
font-size: rem(18px);
vertical-align: bottom;
margin-bottom: rem(1px);
}
}
.onboarding-button-next {
position: absolute;
right: rem(10px);
top: rem(20px);
}
.onboarding-button-shut-down {
position: absolute;
right: rem(10px);
bottom: rem(30px);
color: $dark-color;
font-size: rem(11px);
cursor: pointer;
}
> .advancement-groups {
width: 100%;
> .group {
float: left;
height: rem(10px);
background: $dark-color;
position: relative;
}
> .group > .advancement {
height: rem(10px);
background: $primary-color;
@include transition(all 0.8s);
}
> .group > .id {
position: absolute;
box-sizing: border-box;
background-color: $dark-color;
border: rem(1px) solid $background-color;
border-radius: rem(20px);
text-align: center;
vertical-align: middle;
line-height: rem(20px);
height: rem(20px);
width: rem(20px);
color: white;
font-size: rem(12px);
right: rem(-1px);
top: rem(-5px);
z-index: 1;
}
> .group > .id.-done {
background-color: $primary-color;
}
}
}

View File

@@ -0,0 +1,74 @@
.page-sidebar-closed {
.onboarding-navbar.displayed {
display: none;
}
}
.onboarding-navbar {
display: none;
}
.onboarding-navbar.displayed {
display: block;
font-weight: normal;
box-sizing: border-box;
width: $size-navbar-width;
padding: rem(10px);
padding-bottom: rem(35px); // Forced because of old theme
background: $navbar-footer-color;
position: fixed;
bottom: 0;
font-size: rem(11px);
text-align: center;
> .text {
text-align: left;
color: $navbar-text-color;
padding-bottom: rem(10px);
}
.onboarding-button-resume { // Forced because of old theme
background: #1e2024;
color: #95a7ad;
}
.btn {
background: $navbar-progress-secondary-color;
color: $navbar-text-color;
text-transform: uppercase; // Forced because of old theme
margin: 0 auto;
font-size: rem(10px);
padding: rem(6px) rem(15px);
&:hover { // Forced because of old theme
color: #95a7ad !important; // Forced because of old theme
}
}
.btn.-small {
margin-top: rem(2px);
font-size: rem(8px);
padding: rem(4px);
text-transform: none;
background: $navbar-footer-color;
font-size: rem(10px) !important; // Forced because of old theme
text-transform: none; // Forced because of old theme
color: #95a7ad !important; // Forced because of old theme
&:hover { // Forced because of old theme
color: #95a7ad !important;; // Forced because of old theme
text-decoration: underline; // Forced because of old theme
}
}
> .btn.-small:hover {
text-decoration: underline;
}
> .progress {
border-radius: $navbar-progress-size;
height: $navbar-progress-size;
background: $navbar-progress-secondary-color;
}
> .progress > .bar {
border-radius: $navbar-progress-size;
background: $navbar-progress-primary-color;
height: $navbar-progress-size;
}
}

View File

@@ -0,0 +1,185 @@
.onboarding-popup {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba($dark-color, 0.5);
z-index: $minimum-z-index;
> .content {
position: absolute;
width: $popup-width;
left: 50%;
margin-left: -$popup-width / 2;
top: 2.5rem;
padding: 0;
background: white;
box-shadow: rem(2px) rem(2px) rem(3px) 0 rgba(0, 0, 0, 0.1);
}
}
.onboarding-welcome {
.welcome {
background: url('../images/preston-clouds.png') top no-repeat;
background-size: rem(560px) rem(164px);
padding-top: 164px;
height: rem(52px);
color: black;
font-size: rem(24px);
text-align: center;
margin-bottom: 0;
}
> .content {
padding-bottom: rem(90px);
min-height: rem(200px);
font-size: rem(14px);
background: url('../images/balloons.png') bottom no-repeat;
background-size: rem(240px) rem(81px);
margin-top: 2.5rem;
display: flex;
flex-direction: column;
p {
display: flex;
text-align: center;
align-self: center;
width: rem(400px);
}
}
.started {
display: flex;
font-weight: 600;
font-size: rem(17px);
justify-content: center;
}
> .content {
margin-bottom: rem(20px);
}
> .material-icons {
color: $background-tertiary-color;
position: absolute;
top: rem(10px);
right: rem(15px);
cursor: pointer;
font-size: rem(30px);
}
.buttons {
display: flex;
justify-content: center;
margin-bottom: rem(25px);
}
.btn-primary.blue-balloon {
background-color: $blue-balloon;
}
.btn-tertiary-outline {
background: none;
color: $blue-balloon;
border: 2px solid $blue-balloon;
text-transform: uppercase;
box-sizing: border-box;
padding: 9px 16px;
margin-right: 20px;
}
}
.onboarding-popup {
h2 {
font-size: rem(24px);
}
#onboarding-welcome {
&.modal-header {
padding: rem(24px);
.close {
color: #000;
font-size: 2.5rem;
margin-top: -14px;
margin-right: -5px;
opacity: 0.4;
}
}
.btn {
background-color: $blue-balloon;
font-size: rem(15px);
font-weight: normal;
letter-spacing: normal;
}
.link-container {
.close {
color: #000;
font-size: 40px;
margin-top: -15px;
}
.starter-guide,
.video-tutorial,
.forum,
.training {
width: rem(150px);
height: rem(130px);
}
.starter-guide {
background: url('../images/starter-guide.png') no-repeat;
}
.video-tutorial {
background: url('../images/video-tutorial.png') no-repeat;
}
.forum {
background: url('../images/forum.png') no-repeat;
}
.training {
background: url('../images/training.png') no-repeat;
}
.final-link {
border-width: 0;
color: #363a41;
display: block;
font-weight: 600;
justify-content: center;
padding: 0;
position: relative;
margin-left: auto;
margin-right: auto;
text-align: center;
width: rem(150px);
&:hover {
box-shadow: rem(2px) rem(2px) rem(4px) 0 rgba(0, 0, 0, 0.25);
}
.link {
bottom: 0;
line-height: 16px;
position: absolute;
padding: 10px;
display: block;
text-align: center;
width: 100%;
}
}
}
}
}

View File

@@ -0,0 +1,24 @@
$navbar-footer-color: #292c32;
$navbar-progress-secondary-color: #1e2024;
$navbar-progress-primary-color: #fbb000;
$navbar-text-color: #95a7ad;
$popup-width: rem(560px);
$navbar-progress-size: rem(8px);
$minimum-z-index: 1500;
$background-color: #dff5f9;
$primary-color: #25b9d7;
$dark-color: #363a41;
$dark-light-color: #6c868e;
$background-secondary-color: #bbcdd2;
$background-tertiary-color: #6c868e;
$blue-balloon: #2eacce;
$tooltip-border: rem(1px) solid;
$tooltip-radius: rem(5px);
$size-navbar-width: 210px;

View File

@@ -0,0 +1,149 @@
.onboarding-tooltip {
@mixin addTriangle($size, $color) {
left: 100%;
top: 50%;
border: $size solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-left-color: $color;
margin-top: -$size;
}
@mixin addTriangleDown($size, $color) {
@include addTriangle($size, $color);
left: 50%;
top: 100%;
margin-top: 0;
transform: rotate(90deg);
}
@mixin addPreston($url, $width, $height, $offset) {
content: " ";
position: absolute;
top: rem(10px);
width: $width;
height: $height;
background: url($url) no-repeat;
background-size: $width $height;
left: $offset;
z-index: 1;
}
font-family: Open Sans,sans-serif; // Forced because of old theme
font-size: rem(14px); // Forced because of old theme
position: absolute;
box-sizing: border-box;
opacity: 1;
padding: rem(10px) rem(10px) rem(50px) rem(38px);
width: rem(290px);
min-height: rem(150px);
z-index: $minimum-z-index + 2;
background: $background-color;
border-radius: $tooltip-radius;
border: $tooltip-border $primary-color;
&.-left {
margin-left: rem(-12px);
> .content {
&:before {
@include addPreston('../images/preston-right.png', rem(88px), rem(153px), rem(-61px));
}
}
&:after {
@include addTriangle(rem(12px), $background-color);
}
&:before {
@include addTriangle(rem(13px), $primary-color);
}
}
&.-right {
margin-left: rem(69px);
> .content {
&:before {
@include addPreston('../images/preston-left.png', rem(104px), rem(153px), rem(-70px));
}
}
}
&.-top {
margin-top: rem(-43px);
margin-left: rem(45px);
> .content {
&:before {
@include addPreston('../images/preston-right.png', rem(104px), rem(153px), rem(-70px));
}
}
&:after {
@include addTriangleDown(rem(12px), $dark-color);
}
&:before {
@include addTriangleDown(rem(13px), $primary-color);
}
}
> .btn-primary {
text-transform: uppercase;
position: absolute;
bottom: rem(5px);
right: rem(5px);
padding: /* rem(3px) */ 0 rem(8px);
background: $primary-color; // Forced because of old theme
color: white; // Forced because of old theme
font-size: rem(12px); // Forced because of old theme
border-radius: rem(3px); // Forced because of old theme
border: none; // Forced because of old theme
vertical-align: middle; // Forced because of old theme
height: rem(25px); // Forced because of old theme
line-height: rem(25px); // Forced because of old theme
}
}
.onboarding-tooltipsteps {
position: absolute;
height: rem(40px);
line-height: rem(40px);
vertical-align: middle;
bottom: 0;
left: 0;
right: 0;
background: $dark-color;
padding-left: rem(50px);
> .total {
color: $primary-color;
font-size: rem(10px);
}
> .bulls {
text-align: center;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
> .bulls > .bull {
height: rem(6px);
width: rem(6px);
border-radius: rem(6px);
background: $background-secondary-color;
display: inline-block;
margin: 0 rem(1px) rem(1px) rem(1px);
}
> .bulls > .bull.-current {
background: $primary-color;
}
> .bulls > .bull.-done {
background: $dark-light-color;
}
}

View File

@@ -0,0 +1,65 @@
@import "~bourbon/app/assets/stylesheets/bourbon";
@import "settings";
@import 'advancement';
@import 'navbar';
@import 'tooltip';
@import 'popup';
#onboarding-welcome {
.final-link {
display: block;
border: 1px solid #BBCDD2;
border-radius: rem(3px);
padding: rem(20px);
margin: rem(7px) 0;
text-decoration: none;
> i {
color: #BBCDD2;
font-size: rem(64px);
margin-bottom: rem(24px);
}
}
}
.btn {
&.with-spinner {
position: relative;
}
&.with-spinner.animated {
border-color: white;
background: white;
outline-color: white;
&:hover {
border-color: white;
background: white;
}
&:after {
position: absolute;
width: rem(30px);
height: rem(30px);
left: 50%;
top: 50%;
margin: {
top: rem(-15px);
left: rem(-15px);
}
display: block;
border: 3px solid $primary-color;
border-top-color: transparent;
border-radius: rem(50px);
background: transparent;
content: '';
-webkit-animation:spin 4s linear infinite;
-moz-animation:spin 4s linear infinite;
animation:spin 4s linear infinite;
}
}
}
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }

10
modules/welcome/vendor/.htaccess vendored Normal file
View File

@@ -0,0 +1,10 @@
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

7
modules/welcome/vendor/autoload.php vendored Normal file
View File

@@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit3e8f95d9b4b1dbdd6f7eb126a99fd4d2::getLoader();

View File

@@ -0,0 +1,413 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative) {
return false;
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if ($file === null && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if ($file === null) {
// Remember that this class does not exist.
return $this->classMap[$class] = false;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
if (0 === strpos($class, $prefix)) {
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

21
modules/welcome/vendor/composer/LICENSE vendored Normal file
View File

@@ -0,0 +1,21 @@
Copyright (c) 2015 Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,9 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -0,0 +1,10 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'OnBoarding\\' => array($baseDir . '/OnBoarding'),
);

View File

@@ -0,0 +1,45 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit3e8f95d9b4b1dbdd6f7eb126a99fd4d2
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit3e8f95d9b4b1dbdd6f7eb126a99fd4d2', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit3e8f95d9b4b1dbdd6f7eb126a99fd4d2', 'loadClassLoader'));
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
return $loader;
}
}

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,80 @@
{*
2007-2016 PrestaShop
NOTICE OF LICENSE
This source file is subject to the Academic Free License (AFL 3.0)
that is bundled with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://opensource.org/licenses/afl-3.0.php
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@prestashop.com so we can send you a copy immediately.
DISCLAIMER
Do not edit or add to this file if you wish to upgrade PrestaShop to newer
versions in the future. If you wish to customize PrestaShop for your
needs please refer to http://www.prestashop.com for more information.
@author PrestaShop SA <contact@prestashop.com>
@copyright 2007-2016 PrestaShop SA
@license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
International Registered Trademark & Property of PrestaShop SA
*}
<div class="onboarding-advancement" style="display: none">
<div class="advancement-groups">
{foreach from=$steps.groups item=group key=k}
<div class="group group-{$k}" style="width: {math equation="(x / y) * 100" x=$group.steps|@count y=$totalSteps}%;">
<div class="advancement" style="width: {$percent_real}%;"></div>
<div class="id">{$k+1}</div>
</div>
{/foreach}
</div>
<div class="col-md-8">
<h4 class="group-title"></h4>
<div class="step-title step-title-1"></div>
<div class="step-title step-title-2"></div>
</div>
<button class="btn btn-primary onboarding-button-next">{l s='Continue' d='Modules.Welcome.Admin'}</button>
<a class="onboarding-button-shut-down">{l s='Skip this tutorial' d='Modules.Welcome.Admin'}</a>
</div>
<script type="text/javascript">
var onBoarding;
$(function(){
onBoarding = new OnBoarding({$currentStep}, {$jsonSteps nofilter}, {$isShutDown}, "{$link}", baseAdminDir);
{foreach from=$templates item=template}
onBoarding.addTemplate('{$template['name']}', '{$template['content']}');
{/foreach}
onBoarding.showCurrentStep();
var body = $("body");
body.delegate(".onboarding-button-next", "click", function(){
if ($(this).is('.with-spinner')) {
if (!$(this).is('.animated')) {
$(this).addClass('animated');
onBoarding.gotoNextStep();
}
} else {
onBoarding.gotoNextStep();
}
}).delegate(".onboarding-button-shut-down", "click", function(){
onBoarding.setShutDown(true);
}).delegate(".onboarding-button-resume", "click", function(){
onBoarding.setShutDown(false);
}).delegate(".onboarding-button-goto-current", "click", function(){
onBoarding.gotoLastSavePoint();
}).delegate(".onboarding-button-stop", "click", function(){
onBoarding.stop();
});
});
</script>

View File

@@ -0,0 +1,74 @@
{*
2007-2016 PrestaShop
NOTICE OF LICENSE
This source file is subject to the Academic Free License (AFL 3.0)
that is bundled with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://opensource.org/licenses/afl-3.0.php
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@prestashop.com so we can send you a copy immediately.
DISCLAIMER
Do not edit or add to this file if you wish to upgrade PrestaShop to newer
versions in the future. If you wish to customize PrestaShop for your
needs please refer to http://www.prestashop.com for more information.
@author PrestaShop SA <contact@prestashop.com>
@copyright 2007-2016 PrestaShop SA
@license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
International Registered Trademark & Property of PrestaShop SA
*}
<div id="onboarding-welcome" class="modal-body">
<div class="col-12">
<button class="onboarding-button-next pull-right close" type="button">&times;</button>
<h2 class="text-center text-md-center">{l s='Over to you!' d='Modules.Welcome.Admin'}</h2>
</div>
<div class="col-12">
<p class="text-center text-md-center">
{l s='You\'ve seen the essential, but there\'s a lot more to explore.' d='Modules.Welcome.Admin'}<br />
{l s='Some ressources can help you go further:' d='Modules.Welcome.Admin'}
</p>
<div class="container-fluid">
<div class="row">
<div class="col-md-6 justify-content-center text-center text-md-center link-container">
<a class="final-link" href="http://doc.prestashop.com/display/PS17/Getting+Started" target="_blank">
<div class="starter-guide"></div>
<span class="link">{l s='Starter Guide' d='Modules.Welcome.Admin'}</span>
</a>
</div>
<div class="col-md-6 text-center text-md-center link-container">
<a class="final-link" href="https://www.prestashop.com/forums/" target="_blank">
<div class="forum"></div>
<span class="link">{l s='Forum' d='Modules.Welcome.Admin'}</span>
</a>
</div>
</div>
<div class="row">
<div class="col-md-6 text-center text-md-center link-container">
<a class="final-link" href="https://www.prestashop.com/en/training-prestashop" target="_blank">
<div class="training"></div>
<span class="link">{l s='Training' d='Modules.Welcome.Admin'}</span>
</a>
</div>
<div class="col-md-6 text-center text-md-center link-container">
<a class="final-link" href="https://www.youtube.com/user/prestashop" target="_blank">
<div class="video-tutorial"></div>
<span class="link">{l s='Video tutorial' d='Modules.Welcome.Admin'}</span>
</a>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<div class="col-12">
<div class="text-center text-md-center">
<button class="btn btn-primary onboarding-button-next">{l s='I\'m ready' d='Modules.Welcome.Admin'}</button>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,41 @@
{*
2007-2016 PrestaShop
NOTICE OF LICENSE
This source file is subject to the Academic Free License (AFL 3.0)
that is bundled with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://opensource.org/licenses/afl-3.0.php
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@prestashop.com so we can send you a copy immediately.
DISCLAIMER
Do not edit or add to this file if you wish to upgrade PrestaShop to newer
versions in the future. If you wish to customize PrestaShop for your
needs please refer to http://www.prestashop.com for more information.
@author PrestaShop SA <contact@prestashop.com>
@copyright 2007-2016 PrestaShop SA
@license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
International Registered Trademark & Property of PrestaShop SA
*}
<div class="onboarding-welcome">
<i class="material-icons onboarding-button-shut-down">close</i>
<p class="welcome">{l s='Welcome to your shop!' d='Modules.Welcome.Admin'}</p>
<div class="content">
<p>{l s='Hi! My name is Preston and I\'m here to show you around.' d='Modules.Welcome.Admin'}</p>
<p>{l s='You will discover a few essential steps before you can launch your shop:' d='Modules.Welcome.Admin'}
{l s='Create your first product, customize your shop, configure shipping and payments...' d='Modules.Welcome.Admin'}</p>
</div>
<div class="started">
<p>{l s='Let\'s get started!' d='Modules.Welcome.Admin'}</p>
</div>
<div class="buttons">
<button class="btn btn-tertiary-outline btn-lg onboarding-button-shut-down">{l s='Later' d='Modules.Welcome.Admin'}</button>
<button class="blue-balloon btn btn-primary btn-lg with-spinner onboarding-button-next">{l s='Start' d='Modules.Welcome.Admin'}</button>
</div>
</div>

View File

@@ -0,0 +1,42 @@
{*
2007-2016 PrestaShop
NOTICE OF LICENSE
This source file is subject to the Academic Free License (AFL 3.0)
that is bundled with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://opensource.org/licenses/afl-3.0.php
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@prestashop.com so we can send you a copy immediately.
DISCLAIMER
Do not edit or add to this file if you wish to upgrade PrestaShop to newer
versions in the future. If you wish to customize PrestaShop for your
needs please refer to http://www.prestashop.com for more information.
@author PrestaShop SA <contact@prestashop.com>
@copyright 2007-2016 PrestaShop SA
@license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
International Registered Trademark & Property of PrestaShop SA
*}
<div class="onboarding-navbar bootstrap">
<div class="row text">
<div class="col-md-8">
{l s='Launch your shop!' d='Modules.Welcome.Admin'}
</div>
<div class="col-md-4 text-right text-md-right">{$percent_rounded}%</div>
</div>
<div class="progress">
<div class="bar" role="progressbar" style="width:{$percent_real}%;"></div>
</div>
<div>
<button class="btn btn-main btn-sm onboarding-button-resume">{l s='Resume' d='Modules.Welcome.Admin'}</button>
</div>
<div>
<a class="btn -small btn-main btn-sm onboarding-button-stop">{l s='Stop the OnBoarding' d='Modules.Welcome.Admin'}</a>
</div>
</div>

View File

@@ -0,0 +1,38 @@
{*
2007-2016 PrestaShop
NOTICE OF LICENSE
This source file is subject to the Academic Free License (AFL 3.0)
that is bundled with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://opensource.org/licenses/afl-3.0.php
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@prestashop.com so we can send you a copy immediately.
DISCLAIMER
Do not edit or add to this file if you wish to upgrade PrestaShop to newer
versions in the future. If you wish to customize PrestaShop for your
needs please refer to http://www.prestashop.com for more information.
@author PrestaShop SA <contact@prestashop.com>
@copyright 2007-2016 PrestaShop SA
@license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
International Registered Trademark & Property of PrestaShop SA
*}
<div class="onboarding onboarding-popup bootstrap">
<div class="content">
<p>{l s='Hey! Are you lost?' d='Modules.Welcome.Admin'}</p>
<p>{l s='To continue, click here:' d='Modules.Welcome.Admin'}</p>
<div class="text-center">
<button class="btn btn-primary onboarding-button-goto-current">{l s='Continue' d='Modules.Welcome.Admin'}</button>
</div>
<p>{l s='If you want to stop the tutorial for good, click here:' d='Modules.Welcome.Admin'}</p>
<div class="text-center">
<button class="btn btn-alert onboarding-button-stop">{l s='Quit the Welcome tutorial' d='Modules.Welcome.Admin'}</button>
</div>
</div>
</div>

View File

@@ -0,0 +1,28 @@
{*
2007-2016 PrestaShop
NOTICE OF LICENSE
This source file is subject to the Academic Free License (AFL 3.0)
that is bundled with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://opensource.org/licenses/afl-3.0.php
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@prestashop.com so we can send you a copy immediately.
DISCLAIMER
Do not edit or add to this file if you wish to upgrade PrestaShop to newer
versions in the future. If you wish to customize PrestaShop for your
needs please refer to http://www.prestashop.com for more information.
@author PrestaShop SA <contact@prestashop.com>
@copyright 2007-2016 PrestaShop SA
@license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
International Registered Trademark & Property of PrestaShop SA
*}
<div class="onboarding-popup bootstrap">
<div class="content"></div>
</div>

View File

@@ -0,0 +1,34 @@
{*
2007-2016 PrestaShop
NOTICE OF LICENSE
This source file is subject to the Academic Free License (AFL 3.0)
that is bundled with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://opensource.org/licenses/afl-3.0.php
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@prestashop.com so we can send you a copy immediately.
DISCLAIMER
Do not edit or add to this file if you wish to upgrade PrestaShop to newer
versions in the future. If you wish to customize PrestaShop for your
needs please refer to http://www.prestashop.com for more information.
@author PrestaShop SA <contact@prestashop.com>
@copyright 2007-2016 PrestaShop SA
@license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
International Registered Trademark & Property of PrestaShop SA
*}
<div class="onboarding-tooltip">
<div class="content"></div>
<div class="onboarding-tooltipsteps">
<div class="total">{l s='Step' d='Modules.Welcome.Admin'} <span class="count">1/5</span></div>
<div class="bulls">
</div>
</div>
<button class="btn btn-primary btn-xs onboarding-button-next">{l s='Next' d='Modules.Welcome.Admin'}</button>
</div>

View File

@@ -0,0 +1,48 @@
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: [
'./js/module.js'
],
output: {
path: './public',
filename: 'module.js'
},
module: {
loaders: [{
test: path.join(__dirname, 'js'),
loader: 'babel',
query: {
presets: ['es2015']
}
}, {
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style', 'css!sass')
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css?sourceMap!postcss!sass?sourceMap')
}, {
test: /.(png|woff(2)?|eot|ttf|svg)(\?[a-z0-9=\.]+)?$/,
loader: 'file-loader?name=[hash].[ext]'
}]
},
plugins: [
new ExtractTextPlugin('module.css'),
new webpack.optimize.UglifyJsPlugin({
sourceMap: false,
compress: {
sequences: true,
conditionals: true,
booleans: true,
if_return: true,
join_vars: true,
drop_console: true
},
output: {
comments: false
}
})
]
};

191
modules/welcome/welcome.php Normal file
View File

@@ -0,0 +1,191 @@
<?php
/**
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_VERSION_'))
exit;
require_once __DIR__.'/vendor/autoload.php';
use \OnBoarding\OnBoarding;
use PrestaShop\PrestaShop\Adapter\SymfonyContainer;
/**
* OnBoarding module entry class.
*/
class Welcome extends Module
{
const CLASS_NAME = 'AdminWelcome';
/**
* @var OnBoarding
*/
private $onBoarding;
/**
* Module's constructor.
*/
public function __construct()
{
$this->name = 'welcome';
$this->version = '6.0.0';
$this->author = 'PrestaShop';
parent::__construct();
$this->displayName = $this->trans('Welcome', array(), 'Modules.Welcome.Admin');
$this->description = $this->trans('Help the user to create his first product.', array(), 'Modules.Welcome.Admin');
$this->ps_versions_compliancy = [
'min' => '1.7.6.0',
'max' => _PS_VERSION_,
];
// If the symfony container is not available this constructor will fail
// This can happen during the upgrade process
if (null == SymfonyContainer::getInstance()) {
return;
}
if (Module::isInstalled($this->name)) {
$this->onBoarding = new OnBoarding(
$this->getTranslator(),
$this->smarty,
$this,
SymfonyContainer::getInstance()->get('router')
);
if (Tools::getIsset('resetonboarding')) {
$this->onBoarding->setShutDown(false);
$this->onBoarding->setCurrentStep(0);
}
}
}
/**
* Module installation.
*
* @return bool Success of the installation
*/
public function install()
{
return parent::install()
&& $this->installTab()
&& $this->registerHook('displayAdminNavBarBeforeEnd')
&& $this->registerHook('displayAdminAfterHeader')
&& $this->registerHook('displayBackOfficeHeader');
}
public function installTab()
{
$tab = new Tab();
$tab->active = 1;
$tab->class_name = static::CLASS_NAME;
$tab->name = array();
foreach (Language::getLanguages(true) as $lang) {
$tab->name[$lang['id_lang']] = "Welcome";
}
$tab->module = $this->name;
return $tab->add();
}
public function uninstallTab()
{
$id_tab = (int)Tab::getIdFromClassName(static::CLASS_NAME);
if ($id_tab) {
$tab = new Tab($id_tab);
return $tab->delete();
} else {
return false;
}
}
/**
* Uninstall the module.
*
* @return bool Success of the uninstallation
*/
public function uninstall()
{
$this->onBoarding->setCurrentStep(0);
$this->uninstallTab();
return parent::uninstall();
}
/**
* Hook called when the backoffice header is displayed.
*/
public function hookDisplayBackOfficeHeader()
{
if (!$this->onBoarding->isFinished()) {
$this->context->controller->addCSS($this->_path.'public/module.css', 'all');
$this->context->controller->addJS($this->_path.'public/module.js', 'all');
}
}
/**
* Hook called after the header of the backoffice.
*/
public function hookDisplayAdminAfterHeader()
{
if (!$this->onBoarding->isFinished()) {
$this->onBoarding->showModuleContent();
}
}
/**
* Hook called before the end of the nav bar.
*/
public function hookDisplayAdminNavBarBeforeEnd()
{
if (!$this->onBoarding->isFinished()) {
$this->onBoarding->showModuleContentForNavBar($this->context->link);
}
}
/**
* Execute an API like action for the OnBoarding.
*
* @param string $action Action to perform
* @param mixed $value Value to assign to the action
*
* @throws Exception
*/
public function apiCall($action, $value)
{
switch ($action) {
case 'setCurrentStep':
if (!$this->onBoarding->setCurrentStep($value)) {
throw new Exception('The current step cannot be saved.');
}
break;
case 'setShutDown':
if (!$this->onBoarding->setShutDown($value)) {
throw new Exception('The shut down status cannot be saved.');
}
break;
}
}
}