[*] BO : HelpAccess helper
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12179 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
1 parent
e5535f61c0
commit
7a655974d8
12 files changed
+179
-132
No files matched your search
+3
-14
@@ -543,18 +543,6 @@ if (Tools::isSubmit('toggleScreencast'))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tools::isSubmit('helpAccess'))
|
|
||||||
{
|
|
||||||
$item = Tools::getValue('item');
|
|
||||||
$isoUser = Tools::getValue('isoUser');
|
|
||||||
$country = Tools::getValue('country');
|
|
||||||
$version = Tools::getValue('version');
|
|
||||||
|
|
||||||
if (isset($item) AND isset($isoUser) AND isset($country))
|
|
||||||
die(HelpAccess::displayHelp($item, $isoUser, $country, $version));
|
|
||||||
die('{nohelp}');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Tools::isSubmit('getHookableList'))
|
if (Tools::isSubmit('getHookableList'))
|
||||||
{
|
{
|
||||||
/* PrestaShop demo mode */
|
/* PrestaShop demo mode */
|
||||||
@@ -654,8 +642,8 @@ if (Tools::isSubmit('saveHook'))
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$value = rtrim($value, ',');
|
$value = rtrim($value, ',');
|
||||||
$res &= Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'hook_module`
|
$res &= Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'hook_module`
|
||||||
(id_module, id_shop, id_hook, position)
|
(id_module, id_shop, id_hook, position)
|
||||||
VALUES '.$value);
|
VALUES '.$value);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1014,3 +1002,4 @@ if (Tools::isSubmit('getZones'))
|
|||||||
$array = array('hasError' => false, 'errors' => '', 'data' => $html);
|
$array = array('hasError' => false, 'errors' => '', 'data' => $html);
|
||||||
die(Tools::jsonEncode($html));
|
die(Tools::jsonEncode($html));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ select[disabled="disabled"], input[disabled="disabled"],textarea[disabled="disab
|
|||||||
|
|
||||||
/*BUTTON*/
|
/*BUTTON*/
|
||||||
.button{
|
.button{
|
||||||
background: #e3e3e3 url('../img/bg-button-degrade.png') repeat-x scroll left top;
|
background: #e3e3e3 url('../img/bg-button-degrade.png') repeat-x scroll left top;
|
||||||
background: -moz-linear-gradient(center top , #F9F9F9, #E3E3E3) repeat scroll 0 0 transparent;
|
background: -moz-linear-gradient(center top , #F9F9F9, #E3E3E3) repeat scroll 0 0 transparent;
|
||||||
background: -webkit-gradient(linear, center top ,center bottom, from(#F9F9F9), to(#E3E3E3)) repeat scroll 0 0 transparent;
|
background: -webkit-gradient(linear, center top ,center bottom, from(#F9F9F9), to(#E3E3E3)) repeat scroll 0 0 transparent;
|
||||||
border-color: #CCCCCC #BBBBBB #A0A0A0;border-left: 1px solid #BBBBBB;border-radius: 3px 3px 3px 3px;border-right: 1px solid #BBBBBB;border-style: solid;border-width: 1px;color: #000000;margin: 0; outline: medium none;padding: 3px 8px;text-align: center;vertical-align: middle;white-space: nowrap; text-shadow:0 1px 0 #fff;}
|
border-color: #CCCCCC #BBBBBB #A0A0A0;border-left: 1px solid #BBBBBB;border-radius: 3px 3px 3px 3px;border-right: 1px solid #BBBBBB;border-style: solid;border-width: 1px;color: #000000;margin: 0; outline: medium none;padding: 3px 8px;text-align: center;vertical-align: middle;white-space: nowrap; text-shadow:0 1px 0 #fff;}
|
||||||
@@ -203,6 +203,7 @@ a.module_toggle_all{color: #268CCD;}
|
|||||||
.toolbarBox .process-icon-new.add_product{ background-image: url('../img/process-icon-addProduct.png');}
|
.toolbarBox .process-icon-new.add_product{ background-image: url('../img/process-icon-addProduct.png');}
|
||||||
.toolbarBox .process-icon-partialRefund{ background-image: url('../img/process-icon-partial-refund.png');}
|
.toolbarBox .process-icon-partialRefund{ background-image: url('../img/process-icon-partial-refund.png');}
|
||||||
.toolbarBox .process-icon-standardRefund{ background-image: url('../img/process-icon-standard-refund.png');}
|
.toolbarBox .process-icon-standardRefund{ background-image: url('../img/process-icon-standard-refund.png');}
|
||||||
|
.toolbarBox .process-icon-help{ background-image: url('../img/process-icon-help.png');}
|
||||||
|
|
||||||
div.fix-toolbar {border-bottom: 1px solid #E0E0E0;position:fixed;top:0;opacity:0.9;z-index:1;}
|
div.fix-toolbar {border-bottom: 1px solid #E0E0E0;position:fixed;top:0;opacity:0.9;z-index:1;}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
@@ -31,7 +31,7 @@
|
|||||||
<title>{$meta_title} - PrestaShop™</title>
|
<title>{$meta_title} - PrestaShop™</title>
|
||||||
{if $display_header}
|
{if $display_header}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var class_name = '{$class_name}';
|
var help_class_name = '{$controller_name}';
|
||||||
var iso_user = '{$iso_user}';
|
var iso_user = '{$iso_user}';
|
||||||
var country_iso_code = '{$country_iso_code}';
|
var country_iso_code = '{$country_iso_code}';
|
||||||
var _PS_VERSION_ = '{$smarty.const._PS_VERSION_}';
|
var _PS_VERSION_ = '{$smarty.const._PS_VERSION_}';
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<li class="help-context-{$label|escape:'htmlall':'UTF-8'}" style="display:none">
|
||||||
|
<a id="desc-{$label|escape:'htmlall':'UTF-8'}-help"
|
||||||
|
class="toolbar_btn"
|
||||||
|
href="#"
|
||||||
|
onclick="showHelp('{$help_base_url|escape:'htmlall':'UTF-8'}',
|
||||||
|
'{$label|escape:'htmlall':'UTF-8'}',
|
||||||
|
'{$iso_lang|escape:'htmlall':'UTF-8'}',
|
||||||
|
'{$version|escape:'htmlall':'UTF-8'}',
|
||||||
|
'{$doc_version|escape:'htmlall':'UTF-8'}',
|
||||||
|
'{$country|escape:'htmlall':'UTF-8'}');"
|
||||||
|
title="{$tooltip|escape:'htmlall':'UTF-8'}">
|
||||||
|
<span class="process-icon-help"></span>
|
||||||
|
<div>{l s='Help'}</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
@@ -23,7 +23,6 @@
|
|||||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*}
|
*}
|
||||||
|
|
||||||
{block name=toolbarBox}
|
{block name=toolbarBox}
|
||||||
<ul class="cc_button">
|
<ul class="cc_button">
|
||||||
{foreach from=$toolbar_btn item=btn key=k}
|
{foreach from=$toolbar_btn item=btn key=k}
|
||||||
@@ -34,17 +33,22 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{if isset($ps_help_context) && $ps_help_context}
|
|
||||||
<li class="help-context" style="display:none">
|
|
||||||
<a id="desc-{$table}-help" class="toolbar_btn" href="#" title="{l s='Help'}">
|
|
||||||
<span class="process-icon-help"></span>
|
|
||||||
<div>{l s='Help'}</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{/if}
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<script language="javascript">
|
<script language="javascript">
|
||||||
|
if (helpboxes > 0)
|
||||||
|
{
|
||||||
|
$(document).ready(function (){
|
||||||
|
button = getHelpButton(help_class_name);
|
||||||
|
|
||||||
|
if (button != '')
|
||||||
|
{
|
||||||
|
$('ul.cc_button').append(button);
|
||||||
|
$('.help-context-'+help_class_name).fadeIn("fast").show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
//get reference on save link
|
//get reference on save link
|
||||||
btn_save = $('span[class~="process-icon-save"]').parent();
|
btn_save = $('span[class~="process-icon-save"]').parent();
|
||||||
|
|||||||
+14
-19
@@ -375,7 +375,10 @@ class AdminControllerCore extends Controller
|
|||||||
$version = Tools::getValue('version');
|
$version = Tools::getValue('version');
|
||||||
|
|
||||||
if (isset($item) && isset($iso_user) && isset($country))
|
if (isset($item) && isset($iso_user) && isset($country))
|
||||||
$this->content = HelpAccess::getHelp($item, $iso_user, $country, $version);
|
{
|
||||||
|
$helper = new HelperHelpAccess($item, $iso_user, $country, $version);
|
||||||
|
$this->content = $helper->generate();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$this->content = 'none';
|
$this->content = 'none';
|
||||||
$this->display = 'content';
|
$this->display = 'content';
|
||||||
@@ -1218,20 +1221,8 @@ class AdminControllerCore extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multishop
|
// Multishop
|
||||||
$is_multishop = Shop::isFeatureActive();// && Context::shop() != Shop::CONTEXT_ALL;
|
$is_multishop = Shop::isFeatureActive();
|
||||||
/*if ($is_multishop)
|
|
||||||
{
|
|
||||||
if (Context::shop() == Shop::CONTEXT_GROUP)
|
|
||||||
{
|
|
||||||
$shop_context = 'group';
|
|
||||||
$shop_name = $this->context->shop->getGroup()->name;
|
|
||||||
}
|
|
||||||
else if (Context::shop() == Shop::CONTEXT_SHOP)
|
|
||||||
{
|
|
||||||
$shop_context = 'shop';
|
|
||||||
$shop_name = $this->context->shop->name;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Quick access
|
// Quick access
|
||||||
$quick_access = QuickAccess::getQuickAccesses($this->context->language->id);
|
$quick_access = QuickAccess::getQuickAccesses($this->context->language->id);
|
||||||
@@ -1303,7 +1294,7 @@ class AdminControllerCore extends Controller
|
|||||||
'img_dir' => _PS_IMG_,
|
'img_dir' => _PS_IMG_,
|
||||||
'iso' => $this->context->language->iso_code,
|
'iso' => $this->context->language->iso_code,
|
||||||
'class_name' => $this->className,
|
'class_name' => $this->className,
|
||||||
'iso_user' => $this->context->language->id,
|
'iso_user' => $this->context->language->iso_code,
|
||||||
'country_iso_code' => $this->context->country->iso_code,
|
'country_iso_code' => $this->context->country->iso_code,
|
||||||
'version' => _PS_VERSION_,
|
'version' => _PS_VERSION_,
|
||||||
'autorefresh_notifications' => Configuration::get('PS_ADMIN_REFRESH_NOTIFICATION'),
|
'autorefresh_notifications' => Configuration::get('PS_ADMIN_REFRESH_NOTIFICATION'),
|
||||||
@@ -1334,7 +1325,8 @@ class AdminControllerCore extends Controller
|
|||||||
'tabs' => $tabs,
|
'tabs' => $tabs,
|
||||||
'install_dir_exists' => file_exists(_PS_ADMIN_DIR_.'/../install'),
|
'install_dir_exists' => file_exists(_PS_ADMIN_DIR_.'/../install'),
|
||||||
'is_multishop' => $is_multishop,
|
'is_multishop' => $is_multishop,
|
||||||
'pic_dir' => _THEME_PROD_PIC_DIR_
|
'pic_dir' => _THEME_PROD_PIC_DIR_,
|
||||||
|
'controller_name' => Tools::getValue('controller'),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1438,7 +1430,9 @@ class AdminControllerCore extends Controller
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
$helper = new HelperList();
|
$helper = new HelperList();
|
||||||
|
|
||||||
$this->setHelperDisplay($helper);
|
$this->setHelperDisplay($helper);
|
||||||
|
$this->tpl_list_vars['img_dir'] = 'toto';
|
||||||
$helper->tpl_vars = $this->tpl_list_vars;
|
$helper->tpl_vars = $this->tpl_list_vars;
|
||||||
$helper->tpl_delete_link_vars = $this->tpl_delete_link_vars;
|
$helper->tpl_delete_link_vars = $this->tpl_delete_link_vars;
|
||||||
// Check if list templates have been overriden
|
// Check if list templates have been overriden
|
||||||
@@ -1542,7 +1536,6 @@ class AdminControllerCore extends Controller
|
|||||||
$helper->title = $this->toolbar_title;
|
$helper->title = $this->toolbar_title;
|
||||||
$helper->toolbar_btn = $this->toolbar_btn;
|
$helper->toolbar_btn = $this->toolbar_btn;
|
||||||
|
|
||||||
$helper->ps_help_context = !Configuration::get('PS_NO_HELP_CONTEXT');
|
|
||||||
$helper->show_toolbar = $this->show_toolbar;
|
$helper->show_toolbar = $this->show_toolbar;
|
||||||
$helper->toolbar_fix = $this->toolbar_fix;
|
$helper->toolbar_fix = $this->toolbar_fix;
|
||||||
$helper->override_folder = $this->tpl_folder;
|
$helper->override_folder = $this->tpl_folder;
|
||||||
@@ -1590,9 +1583,11 @@ class AdminControllerCore extends Controller
|
|||||||
_PS_JS_DIR_.'tools.js',
|
_PS_JS_DIR_.'tools.js',
|
||||||
_PS_JS_DIR_.'ajax.js',
|
_PS_JS_DIR_.'ajax.js',
|
||||||
_PS_JS_DIR_.'notifications.js',
|
_PS_JS_DIR_.'notifications.js',
|
||||||
_PS_JS_DIR_.'helpAccess.js',
|
|
||||||
_PS_JS_DIR_.'toolbar.js'
|
_PS_JS_DIR_.'toolbar.js'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if (Configuration::get('PS_HELPBOX'))
|
||||||
|
$this->addJS(_PS_JS_DIR_.'helpAccess.js');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* use translations files to replace english expression.
|
* use translations files to replace english expression.
|
||||||
|
|||||||
+32
-49
@@ -30,10 +30,13 @@ class HelpAccessCore
|
|||||||
{
|
{
|
||||||
const URL = 'http://help.prestashop.com';
|
const URL = 'http://help.prestashop.com';
|
||||||
|
|
||||||
protected static $_images = array(0 => 'none',
|
/**
|
||||||
1 => 'help2.png',
|
* Store in the local database that the user has seen a specific help page
|
||||||
2 => 'help-new.png');
|
*
|
||||||
|
* @static
|
||||||
|
* @param $label
|
||||||
|
* @param $version
|
||||||
|
*/
|
||||||
public static function trackClick($label, $version)
|
public static function trackClick($label, $version)
|
||||||
{
|
{
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('
|
||||||
@@ -42,6 +45,13 @@ class HelpAccessCore
|
|||||||
');
|
');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the last version seen of a help page seen by the user
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @param $label
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public static function getVersion($label)
|
public static function getVersion($label)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->getValue('
|
return Db::getInstance()->getValue('
|
||||||
@@ -50,14 +60,26 @@ class HelpAccessCore
|
|||||||
');
|
');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch information from the help website in order to know:
|
||||||
|
* - if the help page exists
|
||||||
|
* - his version
|
||||||
|
* - the associated tooltip
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @param $label
|
||||||
|
* @param $iso_lang
|
||||||
|
* @param $country
|
||||||
|
* @param $version
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public static function retrieveInfos($label, $iso_lang, $country, $version)
|
public static function retrieveInfos($label, $iso_lang, $country, $version)
|
||||||
{
|
{
|
||||||
$image = self::$_images[0];
|
|
||||||
$tooltip = '';
|
|
||||||
$url = HelpAccess::URL.'/documentation/renderIcon?label='.$label.'&iso_lang='.$iso_lang.'&country='.$country.'&version='.$version;
|
$url = HelpAccess::URL.'/documentation/renderIcon?label='.$label.'&iso_lang='.$iso_lang.'&country='.$country.'&version='.$version;
|
||||||
|
$tooltip = '';
|
||||||
|
|
||||||
$ctx = @stream_context_create(array('http' => array('timeout' => 10)));
|
$ctx = @stream_context_create(array('http' => array('timeout' => 10)));
|
||||||
|
|
||||||
$res = @file_get_contents($url, 0, $ctx);
|
$res = @file_get_contents($url, 0, $ctx);
|
||||||
|
|
||||||
$infos = preg_split('/\|/', $res);
|
$infos = preg_split('/\|/', $res);
|
||||||
@@ -66,51 +88,12 @@ class HelpAccessCore
|
|||||||
$version = trim($infos[0]);
|
$version = trim($infos[0]);
|
||||||
if (!empty($version))
|
if (!empty($version))
|
||||||
{
|
{
|
||||||
$image = self::$_images[1];
|
|
||||||
|
|
||||||
if (sizeof($infos) > 1)
|
if (sizeof($infos) > 1)
|
||||||
$tooltip = trim('|'.$infos[1]);
|
$tooltip = trim($infos[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$last_version = HelpAccess::getVersion($label);
|
return array('version' => $version, 'tooltip' => $tooltip);
|
||||||
|
|
||||||
if (!empty($version) && $version != $last_version)
|
|
||||||
$image = self::$_images[2];
|
|
||||||
|
|
||||||
return array('version' => $version, 'image' => $image, 'tooltip' => $tooltip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function displayHelp($label, $iso_lang, $country, $ps_version)
|
|
||||||
{
|
|
||||||
echo HelpAccess::getHelp($label, $iso_lang, $country, $ps_version);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public static function getHelp($label, $iso_lang, $country, $ps_version)
|
|
||||||
{
|
|
||||||
$content = '';
|
|
||||||
$infos = HelpAccess::retrieveInfos($label, $iso_lang, $country, $ps_version);
|
|
||||||
if (array_key_exists('image', $infos) && $infos['image'] != 'none')
|
|
||||||
{
|
|
||||||
$content .= '
|
|
||||||
<a class="help-button" href="#" onclick="showHelp(\''.HelpAccess::URL.'\',\''.Tools::safeOutput($label).'\',\''.Tools::safeOutput($iso_lang).'\',\''.Tools::safeOutput($ps_version).'\',\''.Tools::safeOutput($infos['version']).'\',\''.Tools::safeOutput($country).'\');" title="'.Tools::htmlentitiesUTF8($infos['tooltip']).'">
|
|
||||||
<img id="help-'.$label.'" src="../img/admin/'.Tools::htmlentitiesUTF8($infos['image']).'" alt="" class="middle" style="margin-top: -5px"/> '.Tools::displayError('HELP').'
|
|
||||||
</a>';
|
|
||||||
if (!empty($infos['tooltip']))
|
|
||||||
$content .= ' <script type="text/javascript">
|
|
||||||
$(document).ready(function() {
|
|
||||||
$("a.help-button").cluetip({
|
|
||||||
splitTitle: "|",
|
|
||||||
cluetipClass: "help-button",
|
|
||||||
showTitle: false,
|
|
||||||
arrows: true,
|
|
||||||
dropShadow: false,
|
|
||||||
positionBy: "auto"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>';
|
|
||||||
}
|
|
||||||
return $content;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,13 +141,6 @@ class HelperFormCore extends Helper
|
|||||||
$this->tpl->assign(array(
|
$this->tpl->assign(array(
|
||||||
'title' => $this->title,
|
'title' => $this->title,
|
||||||
'toolbar_btn' => $this->toolbar_btn,
|
'toolbar_btn' => $this->toolbar_btn,
|
||||||
|
|
||||||
'ps_help_context' => $this->ps_help_context,
|
|
||||||
'class_name' => get_class($this->context->controller),
|
|
||||||
'iso_user' => $this->context->language->id,
|
|
||||||
'country_iso_code' => $this->context->country->iso_code,
|
|
||||||
'version' => _PS_VERSION_,
|
|
||||||
|
|
||||||
'show_toolbar' => $this->show_toolbar,
|
'show_toolbar' => $this->show_toolbar,
|
||||||
'toolbar_fix' => $this->toolbar_fix,
|
'toolbar_fix' => $this->toolbar_fix,
|
||||||
'submit_action' => $this->submit_action,
|
'submit_action' => $this->submit_action,
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* 2007-2011 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-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision$
|
||||||
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
class HelperHelpAccess extends Helper
|
||||||
|
{
|
||||||
|
public $label;
|
||||||
|
public $iso_lang;
|
||||||
|
public $country;
|
||||||
|
public $ps_version;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct($label, $iso_lang, $country, $ps_version)
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->base_folder = 'helper/help_access/';
|
||||||
|
|
||||||
|
$this->tpl = $this->createTemplate('button.tpl');
|
||||||
|
$this->label = $label;
|
||||||
|
$this->iso_lang = $iso_lang;
|
||||||
|
$this->country = $country;
|
||||||
|
$this->ps_version = $ps_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string|void
|
||||||
|
*/
|
||||||
|
public function generate()
|
||||||
|
{
|
||||||
|
$info = HelpAccess::retrieveInfos($this->label, $this->iso_lang, $this->country, $this->ps_version);
|
||||||
|
$content = '';
|
||||||
|
|
||||||
|
if (array_key_exists('version', $info) && $info['version'] != '')
|
||||||
|
{
|
||||||
|
$tpl_vars['label'] = $this->label;
|
||||||
|
$tpl_vars['iso_lang'] = $this->iso_lang;
|
||||||
|
$tpl_vars['country'] = $this->country;
|
||||||
|
$tpl_vars['version'] = $this->ps_version;
|
||||||
|
$tpl_vars['doc_version'] = $info['version'];
|
||||||
|
$tpl_vars['help_base_url'] = HelpAccess::URL;
|
||||||
|
$tpl_vars['tooltip'] = $info['tooltip'];
|
||||||
|
|
||||||
|
$this->tpl->assign($tpl_vars);
|
||||||
|
|
||||||
|
$content = parent::generate();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -589,13 +589,6 @@ class HelperListCore extends Helper
|
|||||||
'show_toolbar' => $this->show_toolbar,
|
'show_toolbar' => $this->show_toolbar,
|
||||||
'toolbar_fix' => $this->toolbar_fix,
|
'toolbar_fix' => $this->toolbar_fix,
|
||||||
'toolbar_btn' => $this->toolbar_btn,
|
'toolbar_btn' => $this->toolbar_btn,
|
||||||
|
|
||||||
'ps_help_context' => $this->ps_help_context,
|
|
||||||
'class_name' => get_class($this->context->controller),
|
|
||||||
'iso_user' => $this->context->language->id,
|
|
||||||
'country_iso_code' => $this->context->country->iso_code,
|
|
||||||
'version' => _PS_VERSION_,
|
|
||||||
|
|
||||||
'table' => $this->table,
|
'table' => $this->table,
|
||||||
'currentIndex' => $this->currentIndex,
|
'currentIndex' => $this->currentIndex,
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
|
|||||||
+23
-25
@@ -1,25 +1,23 @@
|
|||||||
$(document).ready(function(){
|
function getHelpButton(label){
|
||||||
if($('.help-context'))
|
var button = '';
|
||||||
{
|
$.ajax({
|
||||||
$.ajax({
|
type: 'POST',
|
||||||
type: 'POST',
|
url: 'index.php',
|
||||||
url: 'index.php',
|
data: {
|
||||||
data: {
|
'ajax' : 1,
|
||||||
'ajax' : '1',
|
'action' : 'helpAccess',
|
||||||
'action' : 'helpAccess',
|
'item' : label,
|
||||||
'item' : class_name,
|
'isoUser' : iso_user,
|
||||||
'isoUser' : iso_user,
|
'country' : country_iso_code,
|
||||||
'country' : country_iso_code,
|
'version' : _PS_VERSION_
|
||||||
'version' : _PS_VERSION_
|
},
|
||||||
},
|
dataType: "json",
|
||||||
async : true,
|
async : false,
|
||||||
success: function(msg) {
|
success: function(msg) {
|
||||||
if(msg.status == 'ok' && msg.content != 'none')
|
if(msg.content != 'none' && msg.content != '')
|
||||||
{
|
button = msg.content;
|
||||||
$(".help-context").html(msg.content);
|
}
|
||||||
$(".help-context").fadeIn("slow").show();
|
});
|
||||||
}
|
|
||||||
}
|
return button;
|
||||||
});
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
Reference in new issue
Block a user