Commit 00684956 by pupi1985

Add email field type to forms

parent 1a9496fd
...@@ -1917,6 +1917,7 @@ function qa_set_up_notify_fields(&$qa_content, &$fields, $basetype, $login_email ...@@ -1917,6 +1917,7 @@ function qa_set_up_notify_fields(&$qa_content, &$fields, $basetype, $login_email
$fields['notify']['tight'] = true; $fields['notify']['tight'] = true;
$fields['email'] = array( $fields['email'] = array(
'type' => 'email',
'id' => $fieldprefix . 'email_display', 'id' => $fieldprefix . 'email_display',
'tags' => 'name="' . $fieldprefix . 'email" id="' . $fieldprefix . 'email"', 'tags' => 'name="' . $fieldprefix . 'email" id="' . $fieldprefix . 'email"',
'value' => qa_html($inemail), 'value' => qa_html($inemail),
......
...@@ -279,7 +279,7 @@ $qa_content['form_profile'] = array( ...@@ -279,7 +279,7 @@ $qa_content['form_profile'] = array(
'value' => qa_html(isset($inemail) ? $inemail : $useraccount['email']), 'value' => qa_html(isset($inemail) ? $inemail : $useraccount['email']),
'error' => isset($errors['email']) ? qa_html($errors['email']) : 'error' => isset($errors['email']) ? qa_html($errors['email']) :
($pending_confirmation ? qa_insert_login_links(qa_lang_html('users/email_please_confirm')) : null), ($pending_confirmation ? qa_insert_login_links(qa_lang_html('users/email_please_confirm')) : null),
'type' => $pending_confirmation ? 'text' : ($isblocked ? 'static' : 'text'), 'type' => $pending_confirmation ? 'email' : ($isblocked ? 'static' : 'email'),
), ),
'messages' => array( 'messages' => array(
......
...@@ -132,7 +132,7 @@ $qa_content['form'] = array( ...@@ -132,7 +132,7 @@ $qa_content['form'] = array(
'fields' => array( 'fields' => array(
'message' => array( 'message' => array(
'type' => $feedbacksent ? 'static' : '', 'type' => $feedbacksent ? 'static' : 'text',
'label' => qa_lang_html_sub('misc/feedback_message', qa_opt('site_title')), 'label' => qa_lang_html_sub('misc/feedback_message', qa_opt('site_title')),
'tags' => 'name="message" id="message"', 'tags' => 'name="message" id="message"',
'value' => qa_html(@$inmessage), 'value' => qa_html(@$inmessage),
...@@ -141,14 +141,14 @@ $qa_content['form'] = array( ...@@ -141,14 +141,14 @@ $qa_content['form'] = array(
), ),
'name' => array( 'name' => array(
'type' => $feedbacksent ? 'static' : '', 'type' => $feedbacksent ? 'static' : 'text',
'label' => qa_lang_html('misc/feedback_name'), 'label' => qa_lang_html('misc/feedback_name'),
'tags' => 'name="name"', 'tags' => 'name="name"',
'value' => qa_html(isset($inname) ? $inname : @$userprofile['name']), 'value' => qa_html(isset($inname) ? $inname : @$userprofile['name']),
), ),
'email' => array( 'email' => array(
'type' => $feedbacksent ? 'static' : '', 'type' => $feedbacksent ? 'static' : 'email',
'label' => qa_lang_html('misc/feedback_email'), 'label' => qa_lang_html('misc/feedback_email'),
'tags' => 'name="email"', 'tags' => 'name="email"',
'value' => qa_html(isset($inemail) ? $inemail : qa_get_logged_in_email()), 'value' => qa_html(isset($inemail) ? $inemail : qa_get_logged_in_email()),
......
...@@ -89,6 +89,7 @@ $qa_content['form'] = array( ...@@ -89,6 +89,7 @@ $qa_content['form'] = array(
'fields' => array( 'fields' => array(
'email_handle' => array( 'email_handle' => array(
'type' => qa_opt('allow_login_email_only') ? 'email' : 'text',
'label' => qa_opt('allow_login_email_only') ? qa_lang_html('users/email_label') : qa_lang_html('users/email_handle_label'), 'label' => qa_opt('allow_login_email_only') ? qa_lang_html('users/email_label') : qa_lang_html('users/email_handle_label'),
'tags' => 'name="emailhandle" id="emailhandle"', 'tags' => 'name="emailhandle" id="emailhandle"',
'value' => qa_html(@$inemailhandle), 'value' => qa_html(@$inemailhandle),
......
...@@ -150,6 +150,7 @@ $qa_content['form'] = array( ...@@ -150,6 +150,7 @@ $qa_content['form'] = array(
'fields' => array( 'fields' => array(
'email_handle' => array( 'email_handle' => array(
'type' => qa_opt('allow_login_email_only') ? 'email' : 'text',
'label' => qa_opt('allow_login_email_only') ? qa_lang_html('users/email_label') : qa_lang_html('users/email_handle_label'), 'label' => qa_opt('allow_login_email_only') ? qa_lang_html('users/email_label') : qa_lang_html('users/email_handle_label'),
'tags' => 'name="emailhandle" id="emailhandle" dir="auto"', 'tags' => 'name="emailhandle" id="emailhandle" dir="auto"',
'value' => qa_html(@$inemailhandle), 'value' => qa_html(@$inemailhandle),
......
...@@ -169,6 +169,7 @@ $qa_content['form'] = array( ...@@ -169,6 +169,7 @@ $qa_content['form'] = array(
), ),
'email' => array( 'email' => array(
'type' => 'email',
'label' => qa_lang_html('users/email_label'), 'label' => qa_lang_html('users/email_label'),
'tags' => 'name="email" id="email" dir="auto"', 'tags' => 'name="email" id="email" dir="auto"',
'value' => qa_html(@$inemail), 'value' => qa_html(@$inemail),
......
...@@ -550,7 +550,7 @@ if (!QA_FINAL_EXTERNAL_USERS) { ...@@ -550,7 +550,7 @@ if (!QA_FINAL_EXTERNAL_USERS) {
$htmlemail = qa_html(isset($inemail) ? $inemail : $useraccount['email']); $htmlemail = qa_html(isset($inemail) ? $inemail : $useraccount['email']);
$qa_content['form_profile']['fields']['email'] = array( $qa_content['form_profile']['fields']['email'] = array(
'type' => $userediting ? 'text' : 'static', 'type' => $userediting ? 'email' : 'static',
'label' => qa_lang_html('users/email_label'), 'label' => qa_lang_html('users/email_label'),
'tags' => 'name="email"', 'tags' => 'name="email"',
'value' => $userediting ? $htmlemail : ('<a href="mailto:' . $htmlemail . '">' . $htmlemail . '</a>'), 'value' => $userediting ? $htmlemail : ('<a href="mailto:' . $htmlemail . '">' . $htmlemail . '</a>'),
......
...@@ -278,7 +278,7 @@ if (qa_db_connection(false) !== null && !@$pass_failure_from_install) { ...@@ -278,7 +278,7 @@ if (qa_db_connection(false) !== null && !@$pass_failure_from_install) {
$fields = array( $fields = array(
'handle' => array('label' => 'Username:', 'type' => 'text'), 'handle' => array('label' => 'Username:', 'type' => 'text'),
'password' => array('label' => 'Password:', 'type' => 'password'), 'password' => array('label' => 'Password:', 'type' => 'password'),
'email' => array('label' => 'Email address:', 'type' => 'text'), 'email' => array('label' => 'Email address:', 'type' => 'email'),
); );
$buttons = array('super' => 'Set up the Super Administrator'); $buttons = array('super' => 'Set up the Super Administrator');
} }
......
...@@ -1181,6 +1181,10 @@ class qa_html_theme_base ...@@ -1181,6 +1181,10 @@ class qa_html_theme_base
$this->form_image($field, $style); $this->form_image($field, $style);
break; break;
case 'email':
$this->form_email($field, $style);
break;
case 'custom': case 'custom':
$this->output_raw(@$field['html']); $this->output_raw(@$field['html']);
break; break;
...@@ -1375,6 +1379,11 @@ class qa_html_theme_base ...@@ -1375,6 +1379,11 @@ class qa_html_theme_base
$this->output('<div class="qa-form-' . $style . '-image">' . @$field['html'] . '</div>'); $this->output('<div class="qa-form-' . $style . '-image">' . @$field['html'] . '</div>');
} }
public function form_email($field, $style)
{
$this->output('<input ' . @$field['tags'] . ' type="email" value="' . @$field['value'] . '" class="qa-form-' . $style . '-email"/>');
}
public function form_text_single_row($field, $style) public function form_text_single_row($field, $style)
{ {
$this->output('<input ' . @$field['tags'] . ' type="text" value="' . @$field['value'] . '" class="qa-form-' . $style . '-text"/>'); $this->output('<input ' . @$field['tags'] . ' type="text" value="' . @$field['value'] . '" class="qa-form-' . $style . '-text"/>');
......
...@@ -152,8 +152,8 @@ h2 {font-size:22px; color:#c659ab; padding-top:12px; clear:both;} ...@@ -152,8 +152,8 @@ h2 {font-size:22px; color:#c659ab; padding-top:12px; clear:both;}
.qa-form-tall-ok {color:#090; font-size:18px; padding:6px; text-align:center;} .qa-form-tall-ok {color:#090; font-size:18px; padding:6px; text-align:center;}
.qa-form-tall-label {background:url(form-cell-bg.png) repeat-y scroll left top transparent; border-top:6px solid #fff; color:#253845; padding:8px; font-size:14px;} .qa-form-tall-label {background:url(form-cell-bg.png) repeat-y scroll left top transparent; border-top:6px solid #fff; color:#253845; padding:8px; font-size:14px;}
.qa-form-tall-data {background:url(form-cell-bg.png) repeat-y scroll left top transparent; padding:8px; width:480px;} .qa-form-tall-data {background:url(form-cell-bg.png) repeat-y scroll left top transparent; padding:8px; width:480px;}
.qa-form-tall-text,.qa-form-tall-number {padding:3px;} .qa-form-tall-text,.qa-form-tall-number,.qa-form-tall-email {padding:3px;}
.qa-form-tall-text {width:480px; border:1px solid #999; font-size:16px;} .qa-form-tall-text,.qa-form-tall-email {width:480px; border:1px solid #999; font-size:16px;}
.qa-form-tall-number {width:48px; border:1px solid #999;} .qa-form-tall-number {width:48px; border:1px solid #999;}
.qa-form-tall-checkbox {float:left; margin-right:4px;} .qa-form-tall-checkbox {float:left; margin-right:4px;}
.qa-form-tall-image {text-align:center; margin-top:12px;} .qa-form-tall-image {text-align:center; margin-top:12px;}
...@@ -174,8 +174,8 @@ h2 {font-size:22px; color:#c659ab; padding-top:12px; clear:both;} ...@@ -174,8 +174,8 @@ h2 {font-size:22px; color:#c659ab; padding-top:12px; clear:both;}
.qa-form-wide-ok {color:#090; font-size:18px; padding:6px; text-align:center;} .qa-form-wide-ok {color:#090; font-size:18px; padding:6px; text-align:center;}
.qa-form-wide-label {border-bottom:2px solid #FFF; color:#253845; padding:10px; font-size:14px; font-weight:normal; white-space: nowrap;} .qa-form-wide-label {border-bottom:2px solid #FFF; color:#253845; padding:10px; font-size:14px; font-weight:normal; white-space: nowrap;}
.qa-form-wide-data {border-bottom:2px solid #FFF; padding:6px 10px;} .qa-form-wide-data {border-bottom:2px solid #FFF; padding:6px 10px;}
.qa-form-wide-text,.qa-form-wide-number {padding:3px;} .qa-form-wide-text,.qa-form-wide-number,.qa-form-wide-email {padding:3px;}
.qa-form-wide-text {width:320px; border:1px solid #999;} .qa-form-wide-text,.qa-form-wide-email {width:320px; border:1px solid #999;}
.qa-form-wide-number {width:48px; border:1px solid #999; vertical-align:middle;} .qa-form-wide-number {width:48px; border:1px solid #999; vertical-align:middle;}
.qa-form-wide-error {display:inline-block; color:#c00; font-size:11px; margin-left:6px;} .qa-form-wide-error {display:inline-block; color:#c00; font-size:11px; margin-left:6px;}
.qa-form-wide-note {font-size:10px; margin-left:4px; color:#666;} .qa-form-wide-note {font-size:10px; margin-left:4px; color:#666;}
......
...@@ -153,8 +153,8 @@ h2 {font-size:16px; padding-top:12px; clear:both;} ...@@ -153,8 +153,8 @@ h2 {font-size:16px; padding-top:12px; clear:both;}
.qa-form-tall-ok {background:#efe; border:1px solid #090; color:#090; font-size:18px; padding:6px; text-align:center;} .qa-form-tall-ok {background:#efe; border:1px solid #090; color:#090; font-size:18px; padding:6px; text-align:center;}
.qa-form-tall-label {color:#253845; padding:12px 8px 2px 8px; font-size:13px; font-weight:bold;} .qa-form-tall-label {color:#253845; padding:12px 8px 2px 8px; font-size:13px; font-weight:bold;}
.qa-form-tall-data {padding:0 8px 6px 8px; width:480px;} .qa-form-tall-data {padding:0 8px 6px 8px; width:480px;}
.qa-form-tall-text,.qa-form-tall-number {padding:3px;} .qa-form-tall-text,.qa-form-tall-number,.qa-form-tall-email {padding:3px;}
.qa-form-tall-text {width:480px; border:1px solid #658296;} .qa-form-tall-text,.qa-form-tall-email {width:480px; border:1px solid #658296;}
.qa-form-tall-number {width:48px; border:1px solid #658296;} .qa-form-tall-number {width:48px; border:1px solid #658296;}
.qa-form-tall-checkbox {float:left; margin-right:6px;} .qa-form-tall-checkbox {float:left; margin-right:6px;}
.qa-form-tall-image {text-align:center; margin-top:12px;} .qa-form-tall-image {text-align:center; margin-top:12px;}
...@@ -173,8 +173,8 @@ h2 {font-size:16px; padding-top:12px; clear:both;} ...@@ -173,8 +173,8 @@ h2 {font-size:16px; padding-top:12px; clear:both;}
.qa-form-wide-ok {background:#efe; border:1px solid #090; color:#090; font-size:16px; padding:6px; text-align:center;} .qa-form-wide-ok {background:#efe; border:1px solid #090; color:#090; font-size:16px; padding:6px; text-align:center;}
.qa-form-wide-label {color:#253845; padding:6px 10px; font-size:13px; font-weight:bold; white-space: nowrap;} .qa-form-wide-label {color:#253845; padding:6px 10px; font-size:13px; font-weight:bold; white-space: nowrap;}
.qa-form-wide-data {padding:6px 10px;} .qa-form-wide-data {padding:6px 10px;}
.qa-form-wide-text,.qa-form-wide-number {padding:3px;} .qa-form-wide-text,.qa-form-wide-number,.qa-form-wide-email {padding:3px;}
.qa-form-wide-text {width:320px; border:1px solid #658296;} .qa-form-wide-text,.qa-form-wide-email {width:320px; border:1px solid #658296;}
.qa-form-wide-number {width:48px; border:1px solid #658296; vertical-align:middle;} .qa-form-wide-number {width:48px; border:1px solid #658296; vertical-align:middle;}
.qa-form-wide-error {display:inline-block; background:#fee; border:1px solid #c00; color:#c00; font-size:11px; margin-left:6px; padding:.5em;} .qa-form-wide-error {display:inline-block; background:#fee; border:1px solid #c00; color:#c00; font-size:11px; margin-left:6px; padding:.5em;}
.qa-form-wide-note {font-size:10px; margin-left:4px;} .qa-form-wide-note {font-size:10px; margin-left:4px;}
......
...@@ -1236,11 +1236,11 @@ div.header-banner { ...@@ -1236,11 +1236,11 @@ div.header-banner {
margin-top: 0; margin-top: 0;
} }
.qa-form-tall-text, .qa-form-tall-number { .qa-form-tall-text, .qa-form-tall-number, .qa-form-tall-email {
padding: 3px; padding: 3px;
} }
.qa-form-tall-text { .qa-form-tall-text, .qa-form-tall-email {
background: #fff; background: #fff;
color: #666; color: #666;
width: 100%; width: 100%;
...@@ -1376,11 +1376,11 @@ div.header-banner { ...@@ -1376,11 +1376,11 @@ div.header-banner {
padding: 6px 10px; padding: 6px 10px;
} }
.qa-form-wide-text, .qa-form-wide-number { .qa-form-wide-text, .qa-form-wide-number, .qa-form-wide-email {
padding: 3px; padding: 3px;
} }
.qa-form-wide-text { .qa-form-wide-text, .qa-form-wide-email {
background: #fff; background: #fff;
width: 320px; width: 320px;
border: 1px solid #ccc; border: 1px solid #ccc;
......
...@@ -12,9 +12,11 @@ class qa_html_theme extends qa_html_theme_base ...@@ -12,9 +12,11 @@ class qa_html_theme extends qa_html_theme_base
if (!qa_is_logged_in()) { if (!qa_is_logged_in()) {
if (isset($this->content['navigation']['user']['login']) && !QA_FINAL_EXTERNAL_USERS) { if (isset($this->content['navigation']['user']['login']) && !QA_FINAL_EXTERNAL_USERS) {
$login = $this->content['navigation']['user']['login']; $login = $this->content['navigation']['user']['login'];
$emailOnly = qa_opt('allow_login_email_only');
$inputType = $emailOnly ? 'email' : 'text';
$this->output( $this->output(
'<form class="qam-login-form" action="'.$login['url'].'" method="post">', '<form class="qam-login-form" action="'.$login['url'].'" method="post">',
'<input type="text" class="qam-login-text" name="emailhandle" dir="auto" placeholder="'.trim(qa_lang_html(qa_opt('allow_login_email_only') ? 'users/email_label' : 'users/email_handle_label'), ':').'"/>', '<input type="' . $inputType . '" class="qam-login-text" name="emailhandle" dir="auto" placeholder="'.trim(qa_lang_html($emailOnly ? 'users/email_label' : 'users/email_handle_label'), ':').'"/>',
'<input type="password" class="qam-login-text" name="password" dir="auto" placeholder="'.trim(qa_lang_html('users/password_label'), ':').'"/>', '<input type="password" class="qam-login-text" name="password" dir="auto" placeholder="'.trim(qa_lang_html('users/password_label'), ':').'"/>',
'<div class="qam-rememberbox"><input type="checkbox" name="remember" id="qam-rememberme" value="1"/>', '<div class="qam-rememberbox"><input type="checkbox" name="remember" id="qam-rememberme" value="1"/>',
'<label for="qam-rememberme" class="qam-remember">'.qa_lang_html('users/remember').'</label></div>', '<label for="qam-rememberme" class="qam-remember">'.qa_lang_html('users/remember').'</label></div>',
......
...@@ -1821,7 +1821,7 @@ input[type="submit"], button { ...@@ -1821,7 +1821,7 @@ input[type="submit"], button {
margin-top: 0; margin-top: 0;
} }
.qa-form-tall-text { .qa-form-tall-text,.qa-form-tall-email {
width: 100%; width: 100%;
} }
...@@ -1909,7 +1909,7 @@ input[type="submit"], button { ...@@ -1909,7 +1909,7 @@ input[type="submit"], button {
.qa-form-wide-data { .qa-form-wide-data {
padding-left: 5px; padding-left: 5px;
} }
.qa-form-wide-text { .qa-form-wide-text,.qa-form-wide-email {
width: 100%; width: 100%;
} }
......
...@@ -182,9 +182,11 @@ class qa_html_theme extends qa_html_theme_base ...@@ -182,9 +182,11 @@ class qa_html_theme extends qa_html_theme_base
if (!qa_is_logged_in()) { if (!qa_is_logged_in()) {
if (isset($this->content['navigation']['user']['login']) && !QA_FINAL_EXTERNAL_USERS) { if (isset($this->content['navigation']['user']['login']) && !QA_FINAL_EXTERNAL_USERS) {
$login = $this->content['navigation']['user']['login']; $login = $this->content['navigation']['user']['login'];
$emailOnly = qa_opt('allow_login_email_only');
$inputType = $emailOnly ? 'email' : 'text';
$this->output( $this->output(
'<form action="' . $login['url'] . '" method="post">', '<form action="' . $login['url'] . '" method="post">',
'<input type="text" name="emailhandle" dir="auto" placeholder="' . trim(qa_lang_html(qa_opt('allow_login_email_only') ? 'users/email_label' : 'users/email_handle_label'), ':') . '"/>', '<input type="' . $inputType . '" name="emailhandle" dir="auto" placeholder="' . trim(qa_lang_html($emailOnly ? 'users/email_label' : 'users/email_handle_label'), ':') . '"/>',
'<input type="password" name="password" dir="auto" placeholder="' . trim(qa_lang_html('users/password_label'), ':') . '"/>', '<input type="password" name="password" dir="auto" placeholder="' . trim(qa_lang_html('users/password_label'), ':') . '"/>',
'<div><input type="checkbox" name="remember" id="qam-rememberme" value="1"/>', '<div><input type="checkbox" name="remember" id="qam-rememberme" value="1"/>',
'<label for="qam-rememberme">' . qa_lang_html('users/remember') . '</label></div>', '<label for="qam-rememberme">' . qa_lang_html('users/remember') . '</label></div>',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment