1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-16 23:00:51 +03:00

Field email

This commit is contained in:
Denis Shakhov 2014-08-11 22:33:28 +07:00
parent a59afa1c6f
commit 7e3e1bcc9f
9 changed files with 51 additions and 42 deletions

View file

@ -227,7 +227,7 @@ class ActionSettings extends Action {
* Емайл корректен?
*/
if (!func_check(getRequestStr('invite_mail'),'mail')) {
$this->Message_AddError($this->Lang_Get('user.settings.invites.fields.email.notices.error'),$this->Lang_Get('error'));
$this->Message_AddError($this->Lang_Get('fields.email.notices.error'),$this->Lang_Get('error'));
$bError=true;
}
/**
@ -273,7 +273,7 @@ class ActionSettings extends Action {
$bError=true;
}
} else {
$this->Message_AddError($this->Lang_Get('user.settings.account.fields.email.notices.error'),$this->Lang_Get('error'));
$this->Message_AddError($this->Lang_Get('fields.email.notices.error'),$this->Lang_Get('error'));
$bError=true;
}
/**

View file

@ -93,7 +93,7 @@ class ActionSubscribe extends Action {
$sMail=$this->oUserCurrent->getMail();
}
if (!func_check($sMail,'mail')) {
$this->Message_AddError($this->Lang_Get('registration_mail_error'),$this->Lang_Get('error'));
$this->Message_AddError($this->Lang_Get('field.email.notices.error'),$this->Lang_Get('error'));
return ;
}
/**

View file

@ -1010,7 +1010,6 @@ return array(
'labels' => array(
'login' => 'Логин',
'password' => 'Пароль',
'mail' => 'E-mail',
'captcha' => 'Введите цифры и буквы',
),
@ -1427,10 +1426,8 @@ return array(
'fields' => array(
'email' => array(
'label' => 'E-mail',
'note' => 'Ваш реальный почтовый адрес, на него будут приходить уведомления',
'notices' => array(
'error' => 'Неверный формат e-mail',
'error_used' => 'Этот емайл уже занят',
'change_from_notice' => 'На вашу старую почту отправлено подтверждение для смены емайла',
'change_to_notice' => 'Спасибо! <br/> На ваш новый емайл адрес отправлено подтверждение для смены старого емайла.',
@ -1487,10 +1484,6 @@ return array(
'email' => array(
'label' => 'Пригласить по e-mail адресу',
'note' => 'На этот e-mail будет выслано приглашение для регистрации',
'notices' => array(
'error' => 'Неверный формат e-mail'
)
),
'submit' => array(
'text' => 'Отправить приглашение',
@ -1511,6 +1504,20 @@ return array(
),
),
/**
* Поля
*/
'field' => array(
'email' => array(
'label' => 'E-mail',
'notices' => array(
'error' => 'Неверный формат e-mail',
),
),
),
/**
* Настройки
*/
@ -1843,7 +1850,6 @@ return array(
* Temp
*/
'topic_create' => 'Написать',
'registration_mail_error' => 'Неверный формат e-mail', // TODO: Удалить, используется в ActionSubscribe
'draft_declension' => 'черновик;черновика;черновиков',
'blog_menu_create' => 'Блог',
'user_search_filter_all' => 'Все'

View file

@ -4,10 +4,7 @@
<form action="{router page='registration'}reactivation/" method="post" class="js-form-reactivation">
{* E-mail *}
{include 'components/field/field.text.tpl'
sName = 'mail'
aRules = [ 'required' => true, 'type' => 'email' ]
sLabel = $aLang.auth.reactivation.form.fields.mail.label}
{include 'components/field/field.email.tpl' sLabel=$aLang.auth.reactivation.form.fields.mail.label}
{include 'components/button/button.tpl' sName='submit_reactivation' sMods='primary' sText=$aLang.auth.reactivation.form.fields.submit.text}
</form>

View file

@ -18,10 +18,7 @@
sLabel = $aLang.auth.labels.login}
{* E-mail *}
{include 'components/field/field.text.tpl'
sName = 'mail'
aRules = [ 'required' => true, 'type' => 'email' ]
sLabel = $aLang.auth.labels.mail}
{include 'components/field/field.email.tpl'}
{* Пароль *}
{include 'components/field/field.text.tpl'

View file

@ -4,10 +4,7 @@
<form action="{router page='login'}reminder/" method="post" class="js-auth-reset-form">
{* E-mail *}
{include 'components/field/field.text.tpl'
sName = 'mail'
aRules = [ 'required' => true, 'type' => 'email' ]
sLabel = $aLang.auth.reset.form.fields.mail.label}
{include 'components/field/field.email.tpl' sLabel=$aLang.auth.reset.form.fields.mail.label}
{include 'components/button/button.tpl' sName='submit_reset' sMods='primary' sText=$aLang.auth.reset.form.fields.submit.text}
</form>

View file

@ -0,0 +1,11 @@
{**
* E-mail
*}
{extends './field.text.tpl'}
{block 'field_options' append}
{$name = $name|default:'mail'}
{$label = $label|default:{lang name='field.email.label'}}
{$_aRules = $_aRules|default:[ 'required' => true, 'type'=> 'email' ]}
{/block}

View file

@ -10,19 +10,23 @@
{* Название компонента *}
{$_sComponentName = 'field'}
{* Уникальный ID *}
{$_uid = $smarty.local.sId|default:($_sComponentName|cat:rand(0, 10e10))}
{block 'field_options'}
{* Уникальный ID *}
{$_uid = $smarty.local.sId|default:($_sComponentName|cat:rand(0, 10e10))}
{* Переменные *}
{$_sMods = $smarty.local.sMods}
{$_sValue = $smarty.local.sValue}
{$_sInputClasses = $smarty.local.sInputClasses}
{$_sInputAttributes = $smarty.local.sInputAttributes}
{$_aRules = $smarty.local.aRules}
{* Переменные *}
{$_sMods = $smarty.local.sMods}
{$_sValue = $smarty.local.sValue}
{$_sInputClasses = $smarty.local.sInputClasses}
{$_sInputAttributes = $smarty.local.sInputAttributes}
{$_aRules = $smarty.local.aRules}
{$name = $smarty.local.sName}
{$label = $smarty.local.sLabel}
{/block}
{* Правила валидации *}
{if $smarty.local.sEntity}
{field_make_rule entity=$smarty.local.sEntity field=$smarty.local.sEntityField|default:$smarty.local.sName scenario=$smarty.local.sEntityScenario assign=_aRules}
{field_make_rule entity=$smarty.local.sEntity field=$smarty.local.sEntityField|default:$name scenario=$smarty.local.sEntityScenario assign=_aRules}
{/if}
{**
@ -32,8 +36,8 @@
{strip}
{if $_sValue}
{$_sValue}
{elseif isset($_aRequest[$smarty.local.sName])}
{$_aRequest[$smarty.local.sName]}
{elseif isset($_aRequest[$name])}
{$_aRequest[$name]}
{/if}
{/strip}
{/function}
@ -45,7 +49,7 @@
id="{$_uid}"
class="{$_sComponentName}-input {$_sInputClasses}"
{if $bUseValue}value="{field_input_attr_value}"{/if}
{if $smarty.local.sName}name="{$smarty.local.sName}"{/if}
{if $name}name="{$name}"{/if}
{if $smarty.local.sPlaceholder}placeholder="{$smarty.local.sPlaceholder}"{/if}
{if $smarty.local.bIsDisabled}disabled{/if}
{foreach $_aRules as $sRule}
@ -60,8 +64,8 @@
{block 'field'}
<div class="{$_sComponentName} {mod name=$_sComponentName mods=$_sMods} clearfix {$smarty.local.sClasses} {block 'field_classes'}{/block}" {$smarty.local.sAttributes}>
{* Лэйбл *}
{if $smarty.local.sLabel}
<label for="{$_uid}" class="{$_sComponentName}-label">{$smarty.local.sLabel}</label>
{if $label}
<label for="{$_uid}" class="{$_sComponentName}-label">{$label}</label>
{/if}
{* Блок с инпутом *}

View file

@ -13,12 +13,9 @@
<legend>{lang name='user.settings.account.account'}</legend>
{* E-mail *}
{include 'components/field/field.text.tpl'
sName = 'mail'
aRules = [ 'required' => true, 'type'=> 'email' ]
{include 'components/field/field.email.tpl'
sValue = $user->getMail()|escape
sNote = {lang name='user.settings.account.fields.email.note'}
sLabel = {lang name='user.settings.account.fields.email.label'}}
sNote = {lang name='user.settings.account.fields.email.note'}}
</fieldset>