// AdminProducts informations fix, saveAndStay fix,
[+] BO : if json, ajax-layout.tpl can generate json with conf, _errors, warnings, informations and page var // HelpAccess improvement // now Product does not require quantity anymore
This commit is contained in:
@@ -341,6 +341,21 @@ class AdminControllerCore extends Controller
|
||||
return (!empty($token) && $token === $this->token);
|
||||
}
|
||||
|
||||
public function ajaxProcessHelpAccess()
|
||||
{
|
||||
$this->json = true;
|
||||
$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))
|
||||
$this->content = HelpAccess::getHelp($item, $isoUser, $country, $version);
|
||||
else
|
||||
$this->content = 'none';
|
||||
$this->display = 'content';
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo uses redirectAdmin only if !$this->ajax
|
||||
*/
|
||||
@@ -589,7 +604,8 @@ class AdminControllerCore extends Controller
|
||||
if (Tools::isSubmit('submitAdd'.$this->table.'AndBackToParent'))
|
||||
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=4&token='.$token;
|
||||
// Default behavior (save and back)
|
||||
$this->redirect_after = self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=4&token='.$token;
|
||||
if (empty($this->redirect_after))
|
||||
$this->redirect_after = self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=4&token='.$token;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -901,6 +917,7 @@ class AdminControllerCore extends Controller
|
||||
'desc' => $this->l('Add new')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -983,6 +1000,13 @@ class AdminControllerCore extends Controller
|
||||
|
||||
public function displayAjax()
|
||||
{
|
||||
if($this->json)
|
||||
{
|
||||
$this->context->smarty->assign(array(
|
||||
'json' => true,
|
||||
'status' => $this->status,
|
||||
));
|
||||
}
|
||||
$this->layout = 'layout-ajax.tpl';
|
||||
return $this->display();
|
||||
}
|
||||
@@ -1024,12 +1048,32 @@ class AdminControllerCore extends Controller
|
||||
$page = $this->content;
|
||||
|
||||
if ($conf = Tools::getValue('conf'))
|
||||
$this->context->smarty->assign('conf', $this->_conf[(int)$conf]);
|
||||
if ($this->json)
|
||||
$this->context->smarty->assign('conf', Tools::jsonEncode($this->_conf[(int)$conf]));
|
||||
else
|
||||
$this->context->smarty->assign('conf', $this->_conf[(int)$conf]);
|
||||
|
||||
$this->context->smarty->assign('errors', $this->_errors);
|
||||
$this->context->smarty->assign('warnings', $this->warnings);
|
||||
$this->context->smarty->assign('informations', $this->informations);
|
||||
$this->context->smarty->assign('confirmations', $this->confirmations);
|
||||
|
||||
if ($this->json)
|
||||
$this->context->smarty->assign('errors', Tools::jsonEncode($this->_errors));
|
||||
else
|
||||
$this->context->smarty->assign('errors', $this->_errors);
|
||||
|
||||
if ($this->json)
|
||||
$this->context->smarty->assign('warnings', Tools::jsonEncode($this->warnings));
|
||||
else
|
||||
$this->context->smarty->assign('warnings', $this->warnings);
|
||||
|
||||
|
||||
if ($this->json)
|
||||
$this->context->smarty->assign('informations', Tools::jsonEncode($this->informations));
|
||||
else
|
||||
$this->context->smarty->assign('informations', $this->informations);
|
||||
|
||||
if ($this->json)
|
||||
$this->context->smarty->assign('confirmations', Tools::jsonEncode($this->confirmations));
|
||||
else
|
||||
$this->context->smarty->assign('confirmations', $this->confirmations);
|
||||
|
||||
$this->context->smarty->assign('page', $page);
|
||||
$this->context->smarty->display($this->layout);
|
||||
@@ -1407,6 +1451,8 @@ class AdminControllerCore extends Controller
|
||||
// @todo : move that in Helper
|
||||
$helper->title = $this->toolbar_title;
|
||||
$helper->toolbar_btn = $this->toolbar_btn;
|
||||
|
||||
$helper->ps_help_context = !Configuration::get('PS_NO_HELP_CONTEXT');
|
||||
$helper->show_toolbar = $this->show_toolbar;
|
||||
$helper->toolbar_fix = $this->toolbar_fix;
|
||||
$helper->override_folder = $this->tpl_folder;
|
||||
@@ -1697,6 +1743,7 @@ class AdminControllerCore extends Controller
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
{
|
||||
$this->action = 'new';
|
||||
$this->action = 'Informations';
|
||||
$this->display = 'add';
|
||||
}
|
||||
else
|
||||
@@ -2008,7 +2055,7 @@ class AdminControllerCore extends Controller
|
||||
if (!Tools::getValue($this->identifier) || ($field != 'passwd' && $field != 'no-picture'))
|
||||
$this->_errors[] = $this->l('the field').
|
||||
' <b>'.call_user_func(array($class_name, 'displayFieldName'), $field, $class_name).'</b> '.
|
||||
$this->l('is required');
|
||||
$this->l('is required ZZZ');
|
||||
|
||||
/* Checking for multilingual required fields */
|
||||
foreach ($rules['requiredLang'] as $field_lang)
|
||||
|
||||
@@ -69,6 +69,8 @@ abstract class ControllerCore
|
||||
* @var bool If ajax parameter is detected in request, set this flag to true
|
||||
*/
|
||||
protected $ajax = false;
|
||||
protected $json = false;
|
||||
protected $status = '';
|
||||
|
||||
protected $redirect_after = null;
|
||||
/**
|
||||
|
||||
+10
-2
@@ -82,11 +82,18 @@ class HelpAccessCore
|
||||
}
|
||||
|
||||
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);
|
||||
print_r($infos);
|
||||
if (array_key_exists('image', $infos) && $infos['image'] != 'none')
|
||||
{
|
||||
echo '
|
||||
$content .= '
|
||||
<a class="help-button" href="#" onclick="showHelp(\''.HelpAccess::URL.'\',\''.$label.'\',\''.$iso_lang.'\',\''.$ps_version.'\',\''.$infos['version'].'\',\''.$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>
|
||||
@@ -95,7 +102,7 @@ class HelpAccessCore
|
||||
|
||||
|
||||
if (!empty($infos['tooltip']))
|
||||
echo ' <script type="text/javascript">
|
||||
$content .= ' <script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("a.help-button").cluetip({
|
||||
splitTitle: "|",
|
||||
@@ -108,6 +115,7 @@ class HelpAccessCore
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ class HelperCore
|
||||
public $identifier;
|
||||
public $token;
|
||||
public $toolbar_btn;
|
||||
public $ps_help_context;
|
||||
public $title;
|
||||
public $show_toolbar = true;
|
||||
public $context;
|
||||
|
||||
@@ -138,6 +138,13 @@ 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,
|
||||
|
||||
@@ -564,6 +564,13 @@ 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,
|
||||
|
||||
Reference in New Issue
Block a user