From 7a655974d8600d8d905875de090e3a5306bfba10 Mon Sep 17 00:00:00 2001 From: fBrignoli Date: Thu, 5 Jan 2012 10:54:42 +0000 Subject: [PATCH] [*] BO : HelpAccess helper git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12179 b9a71923-0436-4b27-9f14-aed3839534dd --- admin-dev/ajax.php | 17 +--- admin-dev/themes/default/css/admin.css | 3 +- .../themes/default/img/process-icon-help.png | Bin 0 -> 2616 bytes admin-dev/themes/default/template/header.tpl | 2 +- .../template/helper/help_access/button.tpl | 15 ++++ admin-dev/themes/default/template/toolbar.tpl | 22 +++-- classes/AdminController.php | 33 +++---- classes/HelpAccess.php | 81 +++++++----------- classes/helper/HelperForm.php | 7 -- classes/helper/HelperHelpAccess.php | 76 ++++++++++++++++ classes/helper/HelperList.php | 7 -- js/helpAccess.js | 48 +++++------ 12 files changed, 179 insertions(+), 132 deletions(-) create mode 100644 admin-dev/themes/default/img/process-icon-help.png create mode 100644 admin-dev/themes/default/template/helper/help_access/button.tpl create mode 100644 classes/helper/HelperHelpAccess.php diff --git a/admin-dev/ajax.php b/admin-dev/ajax.php index abc02b7dc..5cdd245c5 100644 --- a/admin-dev/ajax.php +++ b/admin-dev/ajax.php @@ -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')) { /* PrestaShop demo mode */ @@ -654,8 +642,8 @@ if (Tools::isSubmit('saveHook')) $i++; } $value = rtrim($value, ','); - $res &= Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'hook_module` - (id_module, id_shop, id_hook, position) + $res &= Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'hook_module` + (id_module, id_shop, id_hook, position) VALUES '.$value); } @@ -1014,3 +1002,4 @@ if (Tools::isSubmit('getZones')) $array = array('hasError' => false, 'errors' => '', 'data' => $html); die(Tools::jsonEncode($html)); } + diff --git a/admin-dev/themes/default/css/admin.css b/admin-dev/themes/default/css/admin.css index f932fc7ee..dc501486f 100644 --- a/admin-dev/themes/default/css/admin.css +++ b/admin-dev/themes/default/css/admin.css @@ -26,7 +26,7 @@ select[disabled="disabled"], input[disabled="disabled"],textarea[disabled="disab /*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: -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;} @@ -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-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-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;} diff --git a/admin-dev/themes/default/img/process-icon-help.png b/admin-dev/themes/default/img/process-icon-help.png new file mode 100644 index 0000000000000000000000000000000000000000..c003c0df03723818ad451aced085d8776923a48d GIT binary patch literal 2616 zcmV-83di+{P)AgaQ$Q7wryLUe=#Hp zy4?;&pG*+I=$+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BFW?x9-~2ec8~DEA2E`5aS7MHz^Q;Qv{x9AA094LaEn3Y)yUrF9$k3#3QVJ_SxBy z8!KvKq{Dim0QCc2O`_Xno_(h4GP-sB#MWKAc`4h?Zb(_dS%!}i)XC(4A2RiHo709= zSp*+#Z$NWx9VXsZjZi4GX~TvMPkoCM!VC5FvxikwG~G6768>Gg7$@G?huDZwuv71l zDJZ^o>g!eqTJ8%CY!r0C^v**B|w40eCCQQ;t)lVLQ(of|o5U3mq1m039eY|=Msu&Q9j#{w- zoqP8pU<<%U0r-7B>W)qve(wmrJaeYLBb{#NF<+AbvG{|#lsw$n^g%^Q>3W+iJu_qa zObFCA1&XHh&*H?!jH6pLxzBWxkj&TmvT0Nwe;=tuODJ+XWxpOSuV!BRKmb&`B8TTU`a-s6wM(8!S!^U|% zP2@uKYVb7DK7uTnbh*7~Wl(Wu69L{i10qmf)DlCcqoc+FDd zXm86g?5nvG7e4u9)1Mm}-sGLq8c4+fm!BTNx-bl$*SQmJ?ik6iBa*as*p1~={Z%)? zH+m#I6*rheEmMm?;;H93%yeF+I&VSpQX85(JKz49)A9SBY_@ek7Zr!N0$jbdaAQ@p zfLXt}b9DVdImrZ)A8xVPH@@p~ojMx`u+M@acD}lrohvVApM^@;*+7sTrvFyUwr6PV zG?MX_uKNn(T6{$meta_title} - PrestaShop™ {if $display_header} '; - } - return $content; - } } diff --git a/classes/helper/HelperForm.php b/classes/helper/HelperForm.php index 4b853cedd..195fc2fe9 100644 --- a/classes/helper/HelperForm.php +++ b/classes/helper/HelperForm.php @@ -141,13 +141,6 @@ class HelperFormCore extends Helper $this->tpl->assign(array( 'title' => $this->title, '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, 'toolbar_fix' => $this->toolbar_fix, 'submit_action' => $this->submit_action, diff --git a/classes/helper/HelperHelpAccess.php b/classes/helper/HelperHelpAccess.php new file mode 100644 index 000000000..b1ddbd060 --- /dev/null +++ b/classes/helper/HelperHelpAccess.php @@ -0,0 +1,76 @@ + +* @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; + } +} \ No newline at end of file diff --git a/classes/helper/HelperList.php b/classes/helper/HelperList.php index f16cb75b3..d4dd9fc78 100644 --- a/classes/helper/HelperList.php +++ b/classes/helper/HelperList.php @@ -589,13 +589,6 @@ class HelperListCore extends Helper 'show_toolbar' => $this->show_toolbar, 'toolbar_fix' => $this->toolbar_fix, '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, 'currentIndex' => $this->currentIndex, 'action' => $action, diff --git a/js/helpAccess.js b/js/helpAccess.js index a8d6cdc4e..d65f1acbf 100644 --- a/js/helpAccess.js +++ b/js/helpAccess.js @@ -1,25 +1,23 @@ -$(document).ready(function(){ - if($('.help-context')) - { - $.ajax({ - type: 'POST', - url: 'index.php', - data: { - 'ajax' : '1', - 'action' : 'helpAccess', - 'item' : class_name, - 'isoUser' : iso_user, - 'country' : country_iso_code, - 'version' : _PS_VERSION_ - }, - async : true, - success: function(msg) { - if(msg.status == 'ok' && msg.content != 'none') - { - $(".help-context").html(msg.content); - $(".help-context").fadeIn("slow").show(); - } - } - }); - } -}); \ No newline at end of file +function getHelpButton(label){ + var button = ''; + $.ajax({ + type: 'POST', + url: 'index.php', + data: { + 'ajax' : 1, + 'action' : 'helpAccess', + 'item' : label, + 'isoUser' : iso_user, + 'country' : country_iso_code, + 'version' : _PS_VERSION_ + }, + dataType: "json", + async : false, + success: function(msg) { + if(msg.content != 'none' && msg.content != '') + button = msg.content; + } + }); + + return button; +} \ No newline at end of file