MDL-9652 rename new password reveal to unmask

This commit is contained in:
skodak 2007-04-30 18:03:19 +00:00
parent fb01314b0e
commit 54bb33eb10
13 changed files with 27 additions and 27 deletions

View File

@ -39,7 +39,7 @@ $temp->add(new admin_setting_configselect('bloglevel', get_string('bloglevel', '
0 => get_string('disableblogs','blog'))));
$temp->add(new admin_setting_configcheckbox('cronclionly', get_string('cronclionly', 'admin'), get_string('configcronclionly', 'admin'), 0));
$temp->add(new admin_setting_configpasswordreveal('cronremotepassword', get_string('cronremotepassword', 'admin'), get_string('configcronremotepassword', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configpasswordunmask('cronremotepassword', get_string('cronremotepassword', 'admin'), get_string('configcronremotepassword', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configcheckbox('passwordpolicy', get_string('passwordpolicy', 'admin'), get_string('configpasswordpolicy', 'admin'), 0));
$temp->add(new admin_setting_configtext('minpasswordlength', get_string('minpasswordlength', 'admin'), get_string('configminpasswordlength', 'admin'), 8, PARAM_INT));

View File

@ -19,7 +19,7 @@ $ADMIN->add('server', $temp, 0);
$temp = new admin_settingpage('mail', get_string('mail','admin'));
$temp->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'admin'), get_string('configsmtphosts', 'admin'), '', PARAM_HOST));
$temp->add(new admin_setting_configtext('smtpuser', get_string('smtpuser', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS));
$temp->add(new admin_setting_configpasswordreveal('smtppass', get_string('smtppass', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configpasswordunmask('smtppass', get_string('smtppass', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configtext('noreplyaddress', get_string('noreplyaddress', 'admin'), get_string('confignoreplyaddress', 'admin'), 'noreply@' . $_SERVER['HTTP_HOST'], PARAM_NOTAGS));
$temp->add(new admin_setting_configtext('allowemailaddresses', get_string('allowemailaddresses', 'admin'), get_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS));
$temp->add(new admin_setting_configtext('denyemailaddresses', get_string('denyemailaddresses', 'admin'), get_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS));

View File

@ -277,7 +277,7 @@ class course_edit_form extends moodleform {
$mform->setHelpButton('visible', array('courseavailability', get_string('availability')), true);
$mform->setDefault('visible', 1);
$mform->addElement('passwordreveal', 'password', get_string('enrolmentkey'), 'size="25"');
$mform->addElement('passwordunmask', 'password', get_string('enrolmentkey'), 'size="25"');
$mform->setHelpButton('password', array('enrolmentkey', get_string('enrolmentkey')), true);
$mform->setDefault('password', '');
$mform->setType('password', PARAM_RAW);

View File

@ -32,7 +32,7 @@ class group_edit_form extends moodleform {
$mform->addElement('htmleditor', 'description', get_string('groupdescription', 'group'), array('rows'=> '15', 'course' => $courseid, 'cols'=>'45'));
$mform->setType('description', PARAM_RAW);
$mform->addElement('passwordreveal', 'enrolmentkey', get_string('enrolmentkey', 'group'), 'maxlength="254" size="24"', get_string('enrolmentkey'));
$mform->addElement('passwordunmask', 'enrolmentkey', get_string('enrolmentkey', 'group'), 'maxlength="254" size="24"', get_string('enrolmentkey'));
$mform->setHelpButton('enrolmentkey', array('groupenrolmentkey', get_string('enrolmentkey', 'group')), true);
$mform->setType('enrolmentkey', PARAM_RAW);

View File

@ -16,7 +16,7 @@ $string['nonexistentformelements'] = 'Trying to add help buttons to nonexistent
$string['requiredelement'] = 'Required field';
$string['general'] = 'General';
$string['optional'] = 'Optional';
$string['revealpassword'] = 'Reveal';
$string['unmaskpassword'] = 'Unmask';
$string['modstandardels']='Common Module Settings';
$string['miscellaneoussettings']='Miscellaneous Settings';
$string['addfields']='Add $a fields to form';

View File

@ -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);
}

View File

@ -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

View File

@ -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');

View File

@ -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

View File

@ -15,7 +15,7 @@ class login_signup_form extends moodleform {
$mform->setType('username', PARAM_NOTAGS);
$mform->addRule('username', get_string('missingusername'), 'required', null, 'server');
$mform->addElement('passwordreveal', 'password', get_string('password'), 'maxlength="32" size="12"');
$mform->addElement('passwordunmask', 'password', get_string('password'), 'maxlength="32" size="12"');
$mform->setType('password', PARAM_RAW);
$mform->addRule('password', get_string('missingpassword'), 'required', null, 'server');

View File

@ -191,7 +191,7 @@ class mod_quiz_mod_form extends moodleform_mod {
$mform->setAdvanced('popup', $CFG->quiz_fix_popup);
$mform->setDefault('popup', $CFG->quiz_popup);
$mform->addElement('passwordreveal', 'quizpassword', get_string("requirepassword", "quiz"));
$mform->addElement('passwordunmask', 'quizpassword', get_string("requirepassword", "quiz"));
$mform->setType('quizpassword', PARAM_TEXT);
$mform->setHelpButton('quizpassword', array("requirepassword", get_string("requirepassword", "quiz"), "quiz"));
$mform->setAdvanced('quizpassword', $CFG->quiz_fix_password);

View File

@ -553,10 +553,10 @@ form.mform div.error,form.mform fieldset.error {
form.mform .fcheckbox input {
margin-left: 0px;
}
form.mform .fpassword .reveal {
form.mform .fpassword .unmask {
display:inline;
}
form.mform .fpassword .reveal input {
form.mform .fpassword .unmask input {
margin-left:5px;
margin-right:3px;
}
@ -995,12 +995,12 @@ body#admin-modules table.generaltable td.c0
padding: 0.3em 0 1.5em 0;
}
#adminsettings .form-item .reveal input {
#adminsettings .form-item .unmask input {
margin-left:5px;
margin-right:3px;
}
#adminsettings .form-item .reveal label {
#adminsettings .form-item .unmask label {
width: auto;
text-align: left;
}

View File

@ -32,7 +32,7 @@ class user_editadvanced_form extends moodleform {
$mform->setHelpButton('auth', array('authchange', get_string('chooseauthmethod','auth')));
$mform->setAdvanced('auth');
$mform->addElement('passwordreveal', 'newpassword', get_string('newpassword'), 'size="20"');
$mform->addElement('passwordunmask', 'newpassword', get_string('newpassword'), 'size="20"');
$mform->setType('newpassword', PARAM_RAW);
//TODO: add missing help - empty means no change