Skip to content
Snippets Groups Projects
Commit 20587314 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

Merge pull request #246 from splitbrain/profileform_improvements

HTML5isation of some forms
parents 96e3411f 2586f61f
No related branches found
No related tags found
No related merge requests found
......@@ -1024,7 +1024,7 @@ function updateprofile() {
if($conf['profileconfirm']) {
if(!$auth->checkPass($_SERVER['REMOTE_USER'], $INPUT->post->str('oldpass'))) {
msg($lang['badlogin'], -1);
msg($lang['badpassconfirm'], -1);
return false;
}
}
......
......@@ -1318,19 +1318,22 @@ function html_register(){
global $conf;
global $INPUT;
$base_attrs = array('size'=>50,'required'=>'required');
$email_attrs = $base_attrs + array('type'=>'email','class'=>'edit');
print p_locale_xhtml('register');
print '<div class="centeralign">'.NL;
$form = new Doku_Form(array('id' => 'dw__register'));
$form->startFieldset($lang['btn_register']);
$form->addHidden('do', 'register');
$form->addHidden('save', '1');
$form->addElement(form_makeTextField('login', $INPUT->post->str('login'), $lang['user'], '', 'block', array('size'=>'50')));
$form->addElement(form_makeTextField('login', $INPUT->post->str('login'), $lang['user'], '', 'block', $base_attrs));
if (!$conf['autopasswd']) {
$form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', array('size'=>'50')));
$form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size'=>'50')));
$form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', $base_attrs));
$form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', $base_attrs));
}
$form->addElement(form_makeTextField('fullname', $INPUT->post->str('fullname'), $lang['fullname'], '', 'block', array('size'=>'50')));
$form->addElement(form_makeTextField('email', $INPUT->post->str('email'), $lang['email'], '', 'block', array('size'=>'50')));
$form->addElement(form_makeTextField('fullname', $INPUT->post->str('fullname'), $lang['fullname'], '', 'block', $base_attrs));
$form->addElement(form_makeField('email','email', $INPUT->post->str('email'), $lang['email'], '', 'block', $email_attrs));
$form->addElement(form_makeButton('submit', '', $lang['btn_register']));
$form->endFieldset();
html_form('register', $form);
......@@ -1353,10 +1356,10 @@ function html_updateprofile(){
global $auth;
print p_locale_xhtml('updateprofile');
print '<div class="centeralign">'.NL;
$fullname = $INPUT->post->str('fullname', $INFO['userinfo']['name'], true);
$email = $INPUT->post->str('email', $INFO['userinfo']['mail'], true);
print '<div class="centeralign">'.NL;
$form = new Doku_Form(array('id' => 'dw__register'));
$form->startFieldset($lang['profile']);
$form->addHidden('do', 'profile');
......@@ -1365,9 +1368,9 @@ function html_updateprofile(){
$attr = array('size'=>'50');
if (!$auth->canDo('modName')) $attr['disabled'] = 'disabled';
$form->addElement(form_makeTextField('fullname', $fullname, $lang['fullname'], '', 'block', $attr));
$attr = array('size'=>'50');
$attr = array('size'=>'50', 'class'=>'edit');
if (!$auth->canDo('modMail')) $attr['disabled'] = 'disabled';
$form->addElement(form_makeTextField('email', $email, $lang['email'], '', 'block', $attr));
$form->addElement(form_makeField('email','email', $email, $lang['email'], '', 'block', $attr));
$form->addElement(form_makeTag('br'));
if ($auth->canDo('modPass')) {
$form->addElement(form_makePasswordField('newpass', $lang['newpass'], '', 'block', array('size'=>'50')));
......@@ -1375,10 +1378,11 @@ function html_updateprofile(){
}
if ($conf['profileconfirm']) {
$form->addElement(form_makeTag('br'));
$form->addElement(form_makePasswordField('oldpass', $lang['oldpass'], '', 'block', array('size'=>'50')));
$form->addElement(form_makePasswordField('oldpass', $lang['oldpass'], '', 'block', array('size'=>'50', 'required' => 'required')));
}
$form->addElement(form_makeButton('submit', '', $lang['btn_save']));
$form->addElement(form_makeButton('reset', '', $lang['btn_reset']));
$form->endFieldset();
html_form('updateprofile', $form);
print '</div>'.NL;
......
......@@ -717,6 +717,29 @@ if (!class_exists('setting_email')) {
$this->_local = $input;
return true;
}
function html(&$plugin, $echo=false) {
$value = '';
$disable = '';
if ($this->is_protected()) {
$value = $this->_protected;
$disable = 'disabled="disabled"';
} else {
if ($echo && $this->_error) {
$value = $this->_input;
} else {
$value = is_null($this->_local) ? $this->_default : $this->_local;
}
}
$multiple = $this->_multiple ? 'multiple="multiple"' : '';
$key = htmlspecialchars($this->_key);
$value = htmlspecialchars($value);
$label = '<label for="config___'.$key.'">'.$this->prompt($plugin).'</label>';
$input = '<input id="config___'.$key.'" name="config['.$key.']" type="email" class="edit" value="'.$value.'" '.$multiple.' '.$disable.'/>';
return array($label,$input);
}
}
}
......
......@@ -311,6 +311,9 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
if($name == 'userpass'){
$fieldtype = 'password';
$autocomp = 'autocomplete="off"';
}elseif($name == 'usermail'){
$fieldtype = 'email';
$autocomp = '';
}else{
$fieldtype = 'text';
$autocomp = '';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment