[*] BO #PSFV-94 : update of the displayform method by helperForm in AdminOrderMessageController
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9328 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
1 parent
205e54c31c
commit
cf8cb50631
7 files changed
+238
-130
No files matched your search
@@ -1,86 +0,0 @@
|
|||||||
<?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: 6844 $
|
|
||||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
|
||||||
*/
|
|
||||||
|
|
||||||
class AdminOrderMessage extends AdminTab
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->table = 'order_message';
|
|
||||||
$this->className = 'OrderMessage';
|
|
||||||
$this->lang = true;
|
|
||||||
$this->edit = true;
|
|
||||||
$this->delete = true;
|
|
||||||
|
|
||||||
$this->fieldsDisplay = array(
|
|
||||||
'id_order_message' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
|
||||||
'name' => array('title' => $this->l('Name'), 'width' => 140),
|
|
||||||
'message' => array('title' => $this->l('Message'), 'width' => 600, 'maxlength' => 300));
|
|
||||||
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function displayForm($isMainTab = true)
|
|
||||||
{
|
|
||||||
parent::displayForm();
|
|
||||||
|
|
||||||
if (!($obj = $this->loadObject(true)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<form action="'.self::$currentIndex.'&token='.$this->token.'&submitAdd'.$this->table.'=1" method="post">
|
|
||||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
|
||||||
<fieldset><legend><img src="../img/admin/email.gif" />'.$this->l('Order messages').'</legend>
|
|
||||||
<label>'.$this->l('Name:').' </label>
|
|
||||||
<div class="margin-form">';
|
|
||||||
foreach ($this->_languages as $language)
|
|
||||||
echo '
|
|
||||||
<div id="name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
|
||||||
<input type="text" size="53" name="name_'.$language['id_lang'].'" value="'.$this->getFieldValue($obj, 'name', (int)($language['id_lang'])).'" /><sup> *</sup>
|
|
||||||
</div>';
|
|
||||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name¤message', 'name');
|
|
||||||
echo '</div>
|
|
||||||
<div class="clear"></div><br />
|
|
||||||
<label>'.$this->l('Message:').' </label>
|
|
||||||
<div class="margin-form">';
|
|
||||||
foreach ($this->_languages as $language)
|
|
||||||
echo '
|
|
||||||
<div id="message_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
|
||||||
<textarea rows="15" cols="50" name="message_'.$language['id_lang'].'">'.$this->getFieldValue($obj, 'message', (int)($language['id_lang'])).'</textarea><sup> *</sup>
|
|
||||||
</div>';
|
|
||||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name¤message', 'message');
|
|
||||||
echo '</div>
|
|
||||||
<div class="clear"></div><br />
|
|
||||||
<div class="margin-form">
|
|
||||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
|
||||||
</div>
|
|
||||||
<div class="small"><sup>*</sup> '.$this->l('Required fields').'</div>
|
|
||||||
</fieldset>
|
|
||||||
</form>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -28,10 +28,10 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var vat_number = {$vat_number};
|
var vat_number = {$vat_number};
|
||||||
var module_dir = '{$module_dir}';
|
var module_dir = '{$module_dir}';
|
||||||
|
var id_language = {$defaultFormLanguage};
|
||||||
|
var languages = new Array();
|
||||||
|
|
||||||
$(document).ready(function() {ldelim}
|
$(document).ready(function() {ldelim}
|
||||||
var id_language = {$defaultFormLanguage};
|
|
||||||
var languages = new Array();
|
|
||||||
{foreach $languages as $k => $language}
|
{foreach $languages as $k => $language}
|
||||||
languages[{$k}] = {ldelim}
|
languages[{$k}] = {ldelim}
|
||||||
id_lang: {$language.id_lang},
|
id_lang: {$language.id_lang},
|
||||||
@@ -41,13 +41,15 @@
|
|||||||
{/foreach}
|
{/foreach}
|
||||||
displayFlags(languages, id_language, {$allowEmployeeFormLang});
|
displayFlags(languages, id_language, {$allowEmployeeFormLang});
|
||||||
|
|
||||||
if ($('#id_country') && $('#id_state'))
|
{if isset($fields_value.id_state)}
|
||||||
{ldelim}
|
if ($('#id_country') && $('#id_state'))
|
||||||
ajaxStates({$fields_value.id_state});
|
{ldelim}
|
||||||
$('#id_country').change(function() {ldelim}
|
ajaxStates({$fields_value.id_state});
|
||||||
ajaxStates();
|
$('#id_country').change(function() {ldelim}
|
||||||
{rdelim});
|
ajaxStates();
|
||||||
{rdelim}
|
{rdelim});
|
||||||
|
{rdelim}
|
||||||
|
{/if}
|
||||||
{rdelim});
|
{rdelim});
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="../js/form.js"></script>
|
<script type="text/javascript" src="../js/form.js"></script>
|
||||||
@@ -72,13 +74,44 @@
|
|||||||
<label>{$input.label} </label>
|
<label>{$input.label} </label>
|
||||||
<div class="margin-form">
|
<div class="margin-form">
|
||||||
{if $input.type == 'text'}
|
{if $input.type == 'text'}
|
||||||
<input type="text"
|
{if isset($input.lang) && isset($input.attributeLang)}
|
||||||
name="{$input.name}"
|
{foreach $languages as $language}
|
||||||
id="{$input.name}"
|
<div id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
|
||||||
value="{$fields_value[$input.name]}"
|
<input type="text"
|
||||||
{if isset($input.size)}size="{$input.size}"{/if}
|
name="{$input.name}_{$language.id_lang}"
|
||||||
{if isset($input.class)}class="{$input.class}"{/if}
|
value="{$fields_value[$input.name][$language.id_lang]}"
|
||||||
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if} />
|
{if isset($input.size)}size="{$input.size}"{/if}
|
||||||
|
{if isset($input.class)}class="{$input.class}"{/if}
|
||||||
|
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if} />
|
||||||
|
</div>
|
||||||
|
{/foreach}
|
||||||
|
{if count($languages) > 1}
|
||||||
|
<div class="displayed_flag">
|
||||||
|
<img src="../img/l/{$defaultFormLanguage}.jpg"
|
||||||
|
class="pointer"
|
||||||
|
id="language_current_{$input.name}"
|
||||||
|
onclick="toggleLanguageFlags(this);" />
|
||||||
|
</div>
|
||||||
|
<div id="languages_{$input.name}" class="language_flags">
|
||||||
|
{l s='Choose language:'}<br /><br />
|
||||||
|
{foreach $languages as $language}
|
||||||
|
<img src="../img/l/{$language.id_lang}.jpg"
|
||||||
|
class="pointer"
|
||||||
|
alt="{$language.name}"
|
||||||
|
title="{$language.name}"
|
||||||
|
onclick="changeLanguage('{$input.name}', '{$input.attributeLang}', {$language.id_lang}, '{$language.iso_code}');" />
|
||||||
|
{/foreach}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{else}
|
||||||
|
<input type="text"
|
||||||
|
name="{$input.name}"
|
||||||
|
id="{$input.name}"
|
||||||
|
value="{$fields_value[$input.name]}"
|
||||||
|
{if isset($input.size)}size="{$input.size}"{/if}
|
||||||
|
{if isset($input.class)}class="{$input.class}"{/if}
|
||||||
|
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if} />
|
||||||
|
{/if}
|
||||||
{elseif $input.type == 'select'}
|
{elseif $input.type == 'select'}
|
||||||
<select name="{$input.name}" id="{$input.name}" {if isset($input.onchange)}onchange="{$input.onchange}"{/if}>
|
<select name="{$input.name}" id="{$input.name}" {if isset($input.onchange)}onchange="{$input.onchange}"{/if}>
|
||||||
{if isset($input.options.optiongroup)}
|
{if isset($input.options.optiongroup)}
|
||||||
@@ -108,7 +141,33 @@
|
|||||||
<label {if isset($input.class)}class="{$input.class}"{/if} for="{$value.id}"> {$value.label}</label>
|
<label {if isset($input.class)}class="{$input.class}"{/if} for="{$value.id}"> {$value.label}</label>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{elseif $input.type == 'textarea'}
|
{elseif $input.type == 'textarea'}
|
||||||
<textarea name="{$input.name}" id="{$input.name}" cols="{$input.cols}" rows="{$input.rows}">{$fields_value[$input.name]}</textarea>
|
{if isset($input.lang) && isset($input.attributeLang)}
|
||||||
|
{foreach $languages as $language}
|
||||||
|
<div id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
|
||||||
|
<textarea cols="{$input.cols}" rows="{$input.rows}" name="{$input.name}_{$language.id_lang}">{$fields_value[$input.name][$language.id_lang]}</textarea>
|
||||||
|
</div>
|
||||||
|
{/foreach}
|
||||||
|
{if count($languages) > 1}
|
||||||
|
<div class="displayed_flag">
|
||||||
|
<img src="../img/l/{$defaultFormLanguage}.jpg"
|
||||||
|
class="pointer"
|
||||||
|
id="language_current_{$input.name}"
|
||||||
|
onclick="toggleLanguageFlags(this);" />
|
||||||
|
</div>
|
||||||
|
<div id="languages_{$input.name}" class="language_flags">
|
||||||
|
{l s='Choose language:'}<br /><br />
|
||||||
|
{foreach $languages as $language}
|
||||||
|
<img src="../img/l/{$language.id_lang}.jpg"
|
||||||
|
class="pointer"
|
||||||
|
alt="{$language.name}"
|
||||||
|
title="{$language.name}"
|
||||||
|
onclick="changeLanguage('{$input.name}', '{$input.attributeLang}', {$language.id_lang}, '{$language.iso_code}');" />
|
||||||
|
{/foreach}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{else}
|
||||||
|
<textarea name="{$input.name}" id="{$input.name}" cols="{$input.cols}" rows="{$input.rows}">{$fields_value[$input.name]}</textarea>
|
||||||
|
{/if}
|
||||||
{elseif $input.type == 'checkbox'}
|
{elseif $input.type == 'checkbox'}
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
@@ -132,6 +191,7 @@
|
|||||||
{if $input.name == 'id_state'}
|
{if $input.name == 'id_state'}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
<div class="clear"></div>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{elseif $key == 'submit'}
|
{elseif $key == 'submit'}
|
||||||
<div class="margin-form">
|
<div class="margin-form">
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
{$errors|count} {l s='errors'}
|
{$errors|count} {l s='errors'}
|
||||||
<br/>
|
<br/>
|
||||||
<ol>
|
<ol>
|
||||||
{foreach from=$errors item=$error}
|
{foreach $errors as $error}
|
||||||
<li>{$error}</li>
|
<li>{$error}</li>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</ol>
|
</ol>
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
<a id="linkHide" href="#" style="text-decoration:underline;display:none">{l s='Hide warning'}</a>
|
<a id="linkHide" href="#" style="text-decoration:underline;display:none">{l s='Hide warning'}</a>
|
||||||
</span>
|
</span>
|
||||||
<ul style="display:none;" id="seeMore">
|
<ul style="display:none;" id="seeMore">
|
||||||
{foreach $warnings item=warning}
|
{foreach $warnings as $warning}
|
||||||
<li>{$warning}</li>
|
<li>{$warning}</li>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ class AdminControllerCore extends Controller
|
|||||||
public $warnings = array();
|
public $warnings = array();
|
||||||
public $informations = array();
|
public $informations = array();
|
||||||
|
|
||||||
|
public $_languages = array();
|
||||||
|
public $default_form_language;
|
||||||
|
public $allow_employee_form_lang;
|
||||||
|
|
||||||
public $content_only = false;
|
public $content_only = false;
|
||||||
public $layout = 'layout.tpl';
|
public $layout = 'layout.tpl';
|
||||||
|
|
||||||
@@ -135,7 +139,14 @@ class AdminControllerCore extends Controller
|
|||||||
|
|
||||||
protected $is_dnd_identifier = false;
|
protected $is_dnd_identifier = false;
|
||||||
|
|
||||||
protected $identifiersDnd = array('id_product' => 'id_product', 'id_category' => 'id_category_to_move','id_cms_category' => 'id_cms_category_to_move', 'id_cms' => 'id_cms', 'id_attribute' => 'id_attribute');
|
protected $identifiersDnd = array(
|
||||||
|
'id_product' => 'id_product',
|
||||||
|
'id_category' => 'id_category_to_move',
|
||||||
|
'id_cms_category' => 'id_cms_category_to_move',
|
||||||
|
'id_cms' => 'id_cms',
|
||||||
|
'id_attribute' => 'id_attribute'
|
||||||
|
);
|
||||||
|
|
||||||
protected $view;
|
protected $view;
|
||||||
protected $edit;
|
protected $edit;
|
||||||
protected $delete;
|
protected $delete;
|
||||||
@@ -575,7 +586,6 @@ class AdminControllerCore extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Display form
|
* Display form
|
||||||
* TODO to be removed
|
|
||||||
*/
|
*/
|
||||||
public function displayForm($firstCall = true)
|
public function displayForm($firstCall = true)
|
||||||
{
|
{
|
||||||
@@ -908,6 +918,7 @@ class AdminControllerCore extends Controller
|
|||||||
|
|
||||||
if (isset($this->fields_form))
|
if (isset($this->fields_form))
|
||||||
{
|
{
|
||||||
|
$this->getlanguages();
|
||||||
$helper = new HelperForm();
|
$helper = new HelperForm();
|
||||||
// Check if form template has been overriden
|
// Check if form template has been overriden
|
||||||
if (file_exists($this->context->smarty->template_dir.'/'.$this->tpl_folder.'form.tpl'))
|
if (file_exists($this->context->smarty->template_dir.'/'.$this->tpl_folder.'form.tpl'))
|
||||||
@@ -916,6 +927,9 @@ class AdminControllerCore extends Controller
|
|||||||
$helper->token = $this->token;
|
$helper->token = $this->token;
|
||||||
$helper->table = $this->table;
|
$helper->table = $this->table;
|
||||||
$helper->id = $obj->id;
|
$helper->id = $obj->id;
|
||||||
|
$helper->languages = $this->_languages;
|
||||||
|
$helper->default_form_language = $this->default_form_language;
|
||||||
|
$helper->allow_employee_form_lang = $this->allow_employee_form_lang;
|
||||||
$helper->fields_value = $this->getFieldsValue($obj);
|
$helper->fields_value = $this->getFieldsValue($obj);
|
||||||
$this->content .= $helper->generateForm($this->fields_form);
|
$this->content .= $helper->generateForm($this->fields_form);
|
||||||
}
|
}
|
||||||
@@ -1329,11 +1343,34 @@ class AdminControllerCore extends Controller
|
|||||||
$this->_listTotal = Db::getInstance()->getValue('SELECT FOUND_ROWS() AS `'._DB_PREFIX_.$this->table.'`');
|
$this->_listTotal = Db::getInstance()->getValue('SELECT FOUND_ROWS() AS `'._DB_PREFIX_.$this->table.'`');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getlanguages()
|
||||||
|
{
|
||||||
|
$cookie = $this->context->cookie;
|
||||||
|
$this->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||||
|
if ($this->allow_employee_form_lang && !$cookie->employee_form_lang)
|
||||||
|
$cookie->employee_form_lang = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||||
|
$use_lang_from_cookie = false;
|
||||||
|
$this->_languages = Language::getLanguages(false);
|
||||||
|
if ($this->allow_employee_form_lang)
|
||||||
|
foreach ($this->_languages as $lang)
|
||||||
|
if ($cookie->employee_form_lang == $lang['id_lang'])
|
||||||
|
$use_lang_from_cookie = true;
|
||||||
|
if (!$use_lang_from_cookie)
|
||||||
|
$this->default_form_language = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||||
|
else
|
||||||
|
$this->default_form_language = (int)$cookie->employee_form_lang;
|
||||||
|
}
|
||||||
|
|
||||||
public function getFieldsValue($obj)
|
public function getFieldsValue($obj)
|
||||||
{
|
{
|
||||||
foreach ($this->fields_form['input'] as $input)
|
foreach ($this->fields_form['input'] as $input)
|
||||||
if (empty($this->fields_value[$input['name']]))
|
if (empty($this->fields_value[$input['name']]))
|
||||||
$this->fields_value[$input['name']] = $this->getFieldValue($obj, $input['name']);
|
if (isset($input['lang']) && $input['lang'])
|
||||||
|
foreach ($this->_languages as $language)
|
||||||
|
$this->fields_value[$input['name']][$language['id_lang']] = $this->getFieldValue($obj, $input['name'], $language['id_lang']);
|
||||||
|
else
|
||||||
|
$this->fields_value[$input['name']] = $this->getFieldValue($obj, $input['name']);
|
||||||
|
|
||||||
return $this->fields_value;
|
return $this->fields_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-18
@@ -45,6 +45,10 @@ class HelperFormCore extends Helper
|
|||||||
|
|
||||||
public $token;
|
public $token;
|
||||||
|
|
||||||
|
public $languages = null;
|
||||||
|
public $default_form_language = null;
|
||||||
|
public $allow_employee_form_lang = null;
|
||||||
|
|
||||||
public static $currentIndex;
|
public static $currentIndex;
|
||||||
|
|
||||||
public $tpl = 'form.tpl';
|
public $tpl = 'form.tpl';
|
||||||
@@ -58,29 +62,14 @@ class HelperFormCore extends Helper
|
|||||||
|
|
||||||
public function displayForm()
|
public function displayForm()
|
||||||
{
|
{
|
||||||
$cookie = $this->context->cookie;
|
|
||||||
$allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
|
||||||
if ($allow_employee_form_lang && !$cookie->employee_form_lang)
|
|
||||||
$cookie->employee_form_lang = (int)Configuration::get('PS_LANG_DEFAULT');
|
|
||||||
$use_lang_from_cookie = false;
|
|
||||||
$languages = Language::getLanguages(false);
|
|
||||||
if ($allow_employee_form_lang)
|
|
||||||
foreach ($languages as $lang)
|
|
||||||
if ($cookie->employee_form_lang == $lang['id_lang'])
|
|
||||||
$use_lang_from_cookie = true;
|
|
||||||
if (!$use_lang_from_cookie)
|
|
||||||
$default_form_language = (int)Configuration::get('PS_LANG_DEFAULT');
|
|
||||||
else
|
|
||||||
$default_form_language = (int)$cookie->employee_form_lang;
|
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'firstCall' => $this->first_call,
|
'firstCall' => $this->first_call,
|
||||||
'current' => self::$currentIndex,
|
'current' => self::$currentIndex,
|
||||||
'token' => $this->token,
|
'token' => $this->token,
|
||||||
'table' => $this->table,
|
'table' => $this->table,
|
||||||
'defaultFormLanguage' => $default_form_language,
|
'languages' => $this->languages,
|
||||||
'languages' => $languages,
|
'defaultFormLanguage' => $this->default_form_language,
|
||||||
'allowEmployeeFormLang' => $allow_employee_form_lang,
|
'allowEmployeeFormLang' => $this->allow_employee_form_lang,
|
||||||
'form_id' => $this->id,
|
'form_id' => $this->id,
|
||||||
'back' => Tools::getValue('back'),
|
'back' => Tools::getValue('back'),
|
||||||
'fields' => $this->fields_form,
|
'fields' => $this->fields_form,
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
<?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: 8971 $
|
||||||
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*/
|
||||||
|
|
||||||
|
class AdminOrderMessageController extends AdminController
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->table = 'order_message';
|
||||||
|
$this->className = 'OrderMessage';
|
||||||
|
$this->lang = true;
|
||||||
|
$this->edit = true;
|
||||||
|
$this->delete = true;
|
||||||
|
$this->requiredDatabase = true;
|
||||||
|
|
||||||
|
$this->context = Context::getContext();
|
||||||
|
|
||||||
|
if (!Tools::getValue('realedit'))
|
||||||
|
$this->deleted = false;
|
||||||
|
|
||||||
|
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||||
|
|
||||||
|
$this->fieldsDisplay = array(
|
||||||
|
'id_order_message' => array(
|
||||||
|
'title' => $this->l('ID'),
|
||||||
|
'align' => 'center',
|
||||||
|
'width' => 25
|
||||||
|
),
|
||||||
|
'name' => array(
|
||||||
|
'title' => $this->l('Name'),
|
||||||
|
'width' => 140
|
||||||
|
),
|
||||||
|
'message' => array(
|
||||||
|
'title' => $this->l('Message'),
|
||||||
|
'width' => 600,
|
||||||
|
'maxlength' => 300
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->fields_form = array(
|
||||||
|
'legend' => array(
|
||||||
|
'title' => $this->l('Order messages'),
|
||||||
|
'image' => '../img/admin/email.gif'
|
||||||
|
),
|
||||||
|
'input' => array(
|
||||||
|
array(
|
||||||
|
'type' => 'text',
|
||||||
|
'lang' => true,
|
||||||
|
'attributeLang' => 'name¤message',
|
||||||
|
'label' => $this->l('Name:'),
|
||||||
|
'name' => 'name',
|
||||||
|
'size' => 53,
|
||||||
|
'required' => true
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'type' => 'textarea',
|
||||||
|
'lang' => true,
|
||||||
|
'attributeLang' => 'name¤message',
|
||||||
|
'label' => $this->l('Message:'),
|
||||||
|
'name' => 'message',
|
||||||
|
'cols' => 50,
|
||||||
|
'rows' => 15,
|
||||||
|
'required' => true
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'submit' => array(
|
||||||
|
'title' => $this->l(' Save '),
|
||||||
|
'class' => 'button'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initContent()
|
||||||
|
{
|
||||||
|
if ($this->display != 'edit' && $this->display != 'add')
|
||||||
|
$this->display = 'list';
|
||||||
|
|
||||||
|
parent::initContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
+4
-4
@@ -134,11 +134,11 @@ function changeLanguage(field, fieldsString, id_language_new, iso_code)
|
|||||||
var fields = fieldsString.split('¤');
|
var fields = fieldsString.split('¤');
|
||||||
for (var i = 0; i < fields.length; ++i)
|
for (var i = 0; i < fields.length; ++i)
|
||||||
{
|
{
|
||||||
getE(fields[i] + '_' + id_language).style.display = 'none';
|
$('#'+fields[i]+'_'+id_language).hide();
|
||||||
getE(fields[i] + '_' + id_language_new).style.display = 'block';
|
$('#'+fields[i]+'_'+id_language_new).show();
|
||||||
getE('language_current_' + fields[i]).src = '../img/l/' + id_language_new + '.jpg';
|
$('#'+'language_current_'+fields[i]).attr('src', '../img/l/' + id_language_new + '.jpg');
|
||||||
}
|
}
|
||||||
getE('languages_' + field).style.display = 'none';
|
$('#languages_' + field).hide();
|
||||||
id_language = id_language_new;
|
id_language = id_language_new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user