mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
MDL-9652 rename new password reveal to unmask
This commit is contained in:
parent
fb01314b0e
commit
54bb33eb10
13 changed files with 27 additions and 27 deletions
|
@ -1426,9 +1426,9 @@ class admin_setting_configtext extends admin_setting {
|
|||
|
||||
}
|
||||
|
||||
class admin_setting_configpasswordreveal extends admin_setting_configtext {
|
||||
class admin_setting_configpasswordunmask extends admin_setting_configtext {
|
||||
|
||||
function admin_setting_configpasswordreveal($name, $visiblename, $description, $defaultsetting, $paramtype=PARAM_RAW) {
|
||||
function admin_setting_configpasswordunmask($name, $visiblename, $description, $defaultsetting, $paramtype=PARAM_RAW) {
|
||||
parent::admin_setting_configtext($name, $visiblename, $description, $defaultsetting, $paramtype);
|
||||
}
|
||||
|
||||
|
@ -1439,14 +1439,14 @@ class admin_setting_configpasswordreveal extends admin_setting_configtext {
|
|||
$current = $this->get_setting();
|
||||
}
|
||||
$id = 'id_s_'.$this->name;
|
||||
$reveal = get_string('revealpassword', 'form');
|
||||
$revealjs = '<script type="text/javascript">
|
||||
$unmask = get_string('unmaskpassword', 'form');
|
||||
$unmaskjs = '<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
document.write(\'<div class="reveal"><input id="'.$id.'reveal" value="1" type="checkbox" onclick="revealPassword(\\\''.$id.'\\\')"/><label for="'.$id.'reveal">'.addslashes_js($reveal).'<\/label><\/div>\');
|
||||
document.write(\'<div class="unmask"><input id="'.$id.'unmask" value="1" type="checkbox" onclick="unmaskPassword(\\\''.$id.'\\\')"/><label for="'.$id.'unmask">'.addslashes_js($unmask).'<\/label><\/div>\');
|
||||
//]]>
|
||||
</script>';
|
||||
return format_admin_setting($this->name, $this->visiblename,
|
||||
'<input type="password" class="form-text" id="id_s_'.$this->name.'" name="s_'.$this->name.'" value="'.s($current).'" />'.$revealjs,
|
||||
'<input type="password" class="form-text" id="id_s_'.$this->name.'" name="s_'.$this->name.'" value="'.s($current).'" />'.$unmaskjs,
|
||||
$this->description);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,25 +7,25 @@ global $CFG;
|
|||
require_once($CFG->libdir.'/form/password.php');
|
||||
|
||||
/**
|
||||
* HTML class for a password type element with reveal option
|
||||
* HTML class for a password type element with unmask option
|
||||
*
|
||||
* @author Petr Skoda
|
||||
* @access public
|
||||
*/
|
||||
class MoodleQuickForm_passwordreveal extends MoodleQuickForm_password {
|
||||
class MoodleQuickForm_passwordunmask extends MoodleQuickForm_password {
|
||||
|
||||
function toHtml() {
|
||||
if ($this->_flagFrozen) {
|
||||
return $this->getFrozenHtml();
|
||||
} else {
|
||||
$id = $this->getAttribute('id');
|
||||
$reveal = get_string('revealpassword', 'form');
|
||||
$revealjs = '<script type="text/javascript">
|
||||
$unmask = get_string('unmaskpassword', 'form');
|
||||
$unmaskjs = '<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
document.write(\'<div class="reveal"><input id="'.$id.'reveal" value="1" type="checkbox" onclick="revealPassword(\\\''.$id.'\\\')"/><label for="'.$id.'reveal">'.addslashes_js($reveal).'<\/label><\/div>\');
|
||||
document.write(\'<div class="unmask"><input id="'.$id.'unmask" value="1" type="checkbox" onclick="unmaskPassword(\\\''.$id.'\\\')"/><label for="'.$id.'unmask">'.addslashes_js($unmask).'<\/label><\/div>\');
|
||||
//]]>
|
||||
</script>';
|
||||
return $this->_getTabs() . '<input' . $this->_getAttrString($this->_attributes) . ' />'.$revealjs;
|
||||
return $this->_getTabs() . '<input' . $this->_getAttrString($this->_attributes) . ' />'.$unmaskjs;
|
||||
}
|
||||
} //end func toHtml
|
||||
|
|
@ -1590,7 +1590,7 @@ MoodleQuickForm::registerElementType('checkbox', "$CFG->libdir/form/checkbox.php
|
|||
MoodleQuickForm::registerElementType('file', "$CFG->libdir/form/file.php", 'MoodleQuickForm_file');
|
||||
MoodleQuickForm::registerElementType('group', "$CFG->libdir/form/group.php", 'MoodleQuickForm_group');
|
||||
MoodleQuickForm::registerElementType('password', "$CFG->libdir/form/password.php", 'MoodleQuickForm_password');
|
||||
MoodleQuickForm::registerElementType('passwordreveal', "$CFG->libdir/form/passwordreveal.php", 'MoodleQuickForm_passwordreveal');
|
||||
MoodleQuickForm::registerElementType('passwordunmask', "$CFG->libdir/form/passwordunmask.php", 'MoodleQuickForm_passwordunmask');
|
||||
MoodleQuickForm::registerElementType('radio', "$CFG->libdir/form/radio.php", 'MoodleQuickForm_radio');
|
||||
MoodleQuickForm::registerElementType('select', "$CFG->libdir/form/select.php", 'MoodleQuickForm_select');
|
||||
MoodleQuickForm::registerElementType('text', "$CFG->libdir/form/text.php", 'MoodleQuickForm_text');
|
||||
|
|
|
@ -280,9 +280,9 @@ function showAdvancedOnClick(button, hidetext, showtext){
|
|||
return false;
|
||||
}
|
||||
|
||||
function revealPassword(id) {
|
||||
function unmaskPassword(id) {
|
||||
var pw = document.getElementById(id);
|
||||
var chb = document.getElementById(id+'reveal');
|
||||
var chb = document.getElementById(id+'unmask');
|
||||
|
||||
try {
|
||||
// first try IE way - it can not set name attribute later
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue