Merge branch 'wip-mdl-32945' of git://github.com/rajeshtaneja/moodle

This commit is contained in:
Dan Poltawski 2012-07-23 13:35:24 +08:00
commit a5c8e33122
29 changed files with 43 additions and 42 deletions

View File

@ -604,7 +604,7 @@ class define_role_table_advanced extends capability_table_with_risks {
}
// Role name.
$name = optional_param('name', null, PARAM_MULTILANG);
$name = optional_param('name', null, PARAM_TEXT);
if (!is_null($name)) {
$this->role->name = $name;
// Hack: short names of standard roles are equal to archetypes, empty name means localised via lang packs.

View File

@ -249,7 +249,7 @@ class admin_uploaduser_form2 extends moodleform {
}
$mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"');
$mform->setType('city', PARAM_MULTILANG);
$mform->setType('city', PARAM_TEXT);
if (empty($CFG->defaultcity)) {
$mform->setDefault('city', $templateuser->city);
} else {
@ -288,11 +288,11 @@ class admin_uploaduser_form2 extends moodleform {
$mform->setType('idnumber', PARAM_NOTAGS);
$mform->addElement('text', 'institution', get_string('institution'), 'maxlength="40" size="25"');
$mform->setType('institution', PARAM_MULTILANG);
$mform->setType('institution', PARAM_TEXT);
$mform->setDefault('institution', $templateuser->institution);
$mform->addElement('text', 'department', get_string('department'), 'maxlength="30" size="25"');
$mform->setType('department', PARAM_MULTILANG);
$mform->setType('department', PARAM_TEXT);
$mform->setDefault('department', $templateuser->department);
$mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
@ -304,7 +304,7 @@ class admin_uploaduser_form2 extends moodleform {
$mform->setAdvanced('phone2');
$mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"');
$mform->setType('address', PARAM_MULTILANG);
$mform->setType('address', PARAM_TEXT);
$mform->setAdvanced('address');
// Next the profile defaults

View File

@ -36,7 +36,7 @@ class block_blog_tags_edit_form extends block_edit_form {
$mform->addElement('text', 'config_title', get_string('blocktitle', 'blog'));
$mform->setDefault('config_title', get_string('blogtags', 'blog'));
$mform->setType('config_title', PARAM_MULTILANG);
$mform->setType('config_title', PARAM_TEXT);
$numberoftags = array();
for($i = 1; $i <= 50; $i++) {

View File

@ -38,7 +38,7 @@ class block_glossary_random_edit_form extends block_edit_form {
$mform->addElement('text', 'config_title', get_string('title', 'block_glossary_random'));
$mform->setDefault('config_title', get_string('pluginname','block_glossary_random'));
$mform->setType('config_title', PARAM_MULTILANG);
$mform->setType('config_title', PARAM_TEXT);
// Select glossaries to put in dropdown box ...
$glossaries = $DB->get_records_menu('glossary', array('course' => $this->block->course->id), 'name', 'id,name');

View File

@ -35,7 +35,7 @@ class block_html_edit_form extends block_edit_form {
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
$mform->addElement('text', 'config_title', get_string('configtitle', 'block_html'));
$mform->setType('config_title', PARAM_MULTILANG);
$mform->setType('config_title', PARAM_TEXT);
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'noclean'=>true, 'context'=>$this->block->context);
$mform->addElement('editor', 'config_text', get_string('configcontent', 'block_html'), null, $editoroptions);

View File

@ -35,6 +35,6 @@ class block_mentees_edit_form extends block_edit_form {
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
$mform->addElement('text', 'config_title', get_string('configtitleblankhides', 'block_mentees'));
$mform->setType('config_title', PARAM_MULTILANG);
$mform->setType('config_title', PARAM_TEXT);
}
}

View File

@ -34,7 +34,7 @@ class block_tag_flickr_edit_form extends block_edit_form {
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
$mform->addElement('text', 'config_title', get_string('configtitle', 'block_tag_flickr'));
$mform->setType('config_title', PARAM_MULTILANG);
$mform->setType('config_title', PARAM_TEXT);
$mform->addElement('text', 'config_numberofphotos', get_string('numberofphotos', 'block_tag_flickr'), array('size' => 5));
$mform->setType('config_numberofvideos', PARAM_INT);

View File

@ -34,7 +34,7 @@ class block_tag_youtube_edit_form extends block_edit_form {
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
$mform->addElement('text', 'config_title', get_string('configtitle', 'block_tag_youtube'));
$mform->setType('config_title', PARAM_MULTILANG);
$mform->setType('config_title', PARAM_TEXT);
$mform->addElement('text', 'config_numberofvideos', get_string('numberofvideos', 'block_tag_youtube'), array('size' => 5));
$mform->setType('config_numberofvideos', PARAM_INT);

View File

@ -35,7 +35,7 @@ class block_tags_edit_form extends block_edit_form {
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
$mform->addElement('text', 'config_title', get_string('pluginname', 'block_tags'));
$mform->setType('config_title', PARAM_MULTILANG);
$mform->setType('config_title', PARAM_TEXT);
$mform->setDefault('config_title', get_string('pluginname', 'block_tags'));
$numberoftags = array();

View File

@ -43,7 +43,7 @@ class cohort_edit_form extends moodleform {
$mform->addElement('text', 'name', get_string('name', 'cohort'), 'maxlength="254" size="50"');
$mform->addRule('name', get_string('required'), 'required', null, 'client');
$mform->setType('name', PARAM_MULTILANG);
$mform->setType('name', PARAM_TEXT);
$options = $this->get_category_options($cohort->contextid);
$mform->addElement('select', 'contextid', get_string('context', 'role'), $options);

View File

@ -79,7 +79,7 @@ class course_edit_form extends moodleform {
$mform->addElement('text','fullname', get_string('fullnamecourse'),'maxlength="254" size="50"');
$mform->addHelpButton('fullname', 'fullnamecourse');
$mform->addRule('fullname', get_string('missingfullname'), 'required', null, 'client');
$mform->setType('fullname', PARAM_MULTILANG);
$mform->setType('fullname', PARAM_TEXT);
if (!empty($course->id) and !has_capability('moodle/course:changefullname', $coursecontext)) {
$mform->hardFreeze('fullname');
$mform->setConstant('fullname', $course->fullname);
@ -88,7 +88,7 @@ class course_edit_form extends moodleform {
$mform->addElement('text', 'shortname', get_string('shortnamecourse'), 'maxlength="100" size="20"');
$mform->addHelpButton('shortname', 'shortnamecourse');
$mform->addRule('shortname', get_string('missingshortname'), 'required', null, 'client');
$mform->setType('shortname', PARAM_MULTILANG);
$mform->setType('shortname', PARAM_TEXT);
if (!empty($course->id) and !has_capability('moodle/course:changeshortname', $coursecontext)) {
$mform->hardFreeze('shortname');
$mform->setConstant('shortname', $course->shortname);

View File

@ -61,12 +61,12 @@ class course_request_form extends moodleform {
$mform->addElement('text', 'fullname', get_string('fullnamecourse'), 'maxlength="254" size="50"');
$mform->addHelpButton('fullname', 'fullnamecourse');
$mform->addRule('fullname', get_string('missingfullname'), 'required', null, 'client');
$mform->setType('fullname', PARAM_MULTILANG);
$mform->setType('fullname', PARAM_TEXT);
$mform->addElement('text', 'shortname', get_string('shortnamecourse'), 'maxlength="100" size="20"');
$mform->addHelpButton('shortname', 'shortnamecourse');
$mform->addRule('shortname', get_string('missingshortname'), 'required', null, 'client');
$mform->setType('shortname', PARAM_MULTILANG);
$mform->setType('shortname', PARAM_TEXT);
$mform->addElement('editor', 'summary_editor', get_string('summary'), null, course_request::summary_editor_options());
$mform->addHelpButton('summary_editor', 'coursesummary');

View File

@ -263,7 +263,7 @@ class core_enrol_external extends external_api {
'lastname' => new external_value(PARAM_NOTAGS, 'The family name of the user', VALUE_OPTIONAL),
'fullname' => new external_value(PARAM_NOTAGS, 'The fullname of the user'),
'email' => new external_value(PARAM_TEXT, 'An email address - allow email as root@localhost', VALUE_OPTIONAL),
'address' => new external_value(PARAM_MULTILANG, 'Postal address', VALUE_OPTIONAL),
'address' => new external_value(PARAM_TEXT, 'Postal address', VALUE_OPTIONAL),
'phone1' => new external_value(PARAM_NOTAGS, 'Phone 1', VALUE_OPTIONAL),
'phone2' => new external_value(PARAM_NOTAGS, 'Phone 2', VALUE_OPTIONAL),
'icq' => new external_value(PARAM_NOTAGS, 'icq number', VALUE_OPTIONAL),

View File

@ -33,7 +33,7 @@ $userid = optional_param('userid', false, PARAM_INT);
$itemid = optional_param('itemid', false, PARAM_INT);
$type = optional_param('type', false, PARAM_ALPHA);
$action = optional_param('action', false, PARAM_ALPHA);
$newvalue = optional_param('newvalue', false, PARAM_MULTILANG);
$newvalue = optional_param('newvalue', false, PARAM_TEXT);
/// basic access checks
if (!$course = $DB->get_record('course', array('id' => $courseid))) {

View File

@ -102,7 +102,7 @@ class autogroup_form extends moodleform {
$mform->addElement('text', 'namingscheme', get_string('namingscheme', 'group'));
$mform->addHelpButton('namingscheme', 'namingscheme', 'group');
$mform->addRule('namingscheme', get_string('required'), 'required', null, 'client');
$mform->setType('namingscheme', PARAM_MULTILANG);
$mform->setType('namingscheme', PARAM_TEXT);
// there must not be duplicate group names in course
$template = get_string('grouptemplate', 'group');
$gname = groups_parse_name($template, 0);
@ -123,7 +123,7 @@ class autogroup_form extends moodleform {
}
$mform->addElement('text', 'groupingname', get_string('groupingname', 'group'), $options);
$mform->setType('groupingname', PARAM_MULTILANG);
$mform->setType('groupingname', PARAM_TEXT);
$mform->disabledIf('groupingname', 'grouping', 'noteq', '-1');
$mform->addElement('hidden','courseid');

View File

@ -50,7 +50,7 @@ class group_form extends moodleform {
$mform->addElement('text','name', get_string('groupname', 'group'),'maxlength="254" size="50"');
$mform->addRule('name', get_string('required'), 'required', null, 'client');
$mform->setType('name', PARAM_MULTILANG);
$mform->setType('name', PARAM_TEXT);
$mform->addElement('text','idnumber', get_string('idnumbergroup'), 'maxlength="100" size="10"');
$mform->addHelpButton('idnumber', 'idnumbergroup');

View File

@ -52,7 +52,7 @@ class grouping_form extends moodleform {
$mform->addElement('text','name', get_string('groupingname', 'group'),'maxlength="254" size="50"');
$mform->addRule('name', get_string('required'), 'required', null, 'server');
$mform->setType('name', PARAM_MULTILANG);
$mform->setType('name', PARAM_TEXT);
$mform->addElement('text','idnumber', get_string('idnumbergrouping'), 'maxlength="100" size="10"');
$mform->addHelpButton('idnumber', 'idnumbergrouping');

View File

@ -3243,7 +3243,7 @@ class admin_setting_sitesettext extends admin_setting_configtext {
* @return mixed true or message string
*/
public function validate($data) {
$cleaned = clean_param($data, PARAM_MULTILANG);
$cleaned = clean_param($data, PARAM_TEXT);
if ($cleaned === '') {
return get_string('required');
}

View File

@ -277,6 +277,7 @@ define('PARAM_FORMAT', 'alphanumext');
/**
* PARAM_MULTILANG - deprecated alias of PARAM_TEXT.
* @deprecated since 2.0
*/
define('PARAM_MULTILANG', 'text');

View File

@ -60,7 +60,7 @@ class quiz_add_random_form extends moodleform {
get_string('randomquestionusinganewcategory', 'quiz'));
$mform->addElement('text', 'name', get_string('name'), 'maxlength="254" size="50"');
$mform->setType('name', PARAM_MULTILANG);
$mform->setType('name', PARAM_TEXT);
$mform->addElement('questioncategory', 'parent', get_string('parentcategory', 'question'),
array('contexts' => $usablecontexts, 'top' => true));

View File

@ -57,11 +57,11 @@ class question_category_edit_form extends moodleform {
$mform->addElement('text', 'name', get_string('name'),'maxlength="254" size="50"');
$mform->setDefault('name', '');
$mform->addRule('name', get_string('categorynamecantbeblank', 'question'), 'required', null, 'client');
$mform->setType('name', PARAM_MULTILANG);
$mform->setType('name', PARAM_TEXT);
$mform->addElement('textarea', 'info', get_string('categoryinfo', 'question'), array('rows'=> '10', 'cols'=>'45'));
$mform->setDefault('info', '');
$mform->setType('info', PARAM_MULTILANG);
$mform->setType('info', PARAM_TEXT);
$this->add_action_buttons(false, get_string('addcategory', 'question'));

View File

@ -849,7 +849,7 @@ class qformat_default {
* Convert a string, as returned by {@link assemble_category_path()},
* back into an array of category names.
*
* Each category name is cleaned by a call to clean_param(, PARAM_MULTILANG),
* Each category name is cleaned by a call to clean_param(, PARAM_TEXT),
* which matches the cleaning in question/category_form.php.
*
* @param string $path
@ -859,7 +859,7 @@ class qformat_default {
$rawnames = preg_split('~(?<!/)/(?!/)~', $path);
$names = array();
foreach ($rawnames as $rawname) {
$names[] = clean_param(trim(str_replace('//', '/', $rawname)), PARAM_MULTILANG);
$names[] = clean_param(trim(str_replace('//', '/', $rawname)), PARAM_TEXT);
}
return $names;
}

View File

@ -224,7 +224,7 @@ function useredit_shared_definition(&$mform, $editoroptions = null, $filemanager
$mform->addHelpButton('screenreader', 'screenreaderuse');
$mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="21"');
$mform->setType('city', PARAM_MULTILANG);
$mform->setType('city', PARAM_TEXT);
$mform->addRule('city', $strrequired, 'required', null, 'client');
if (!empty($CFG->defaultcity)) {
$mform->setDefault('city', $CFG->defaultcity);
@ -282,7 +282,7 @@ function useredit_shared_definition(&$mform, $editoroptions = null, $filemanager
$mform->addHelpButton('imagefile', 'newpicture');
$mform->addElement('text', 'imagealt', get_string('imagealt'), 'maxlength="100" size="30"');
$mform->setType('imagealt', PARAM_MULTILANG);
$mform->setType('imagealt', PARAM_TEXT);
}
@ -317,10 +317,10 @@ function useredit_shared_definition(&$mform, $editoroptions = null, $filemanager
$mform->setType('idnumber', PARAM_NOTAGS);
$mform->addElement('text', 'institution', get_string('institution'), 'maxlength="40" size="25"');
$mform->setType('institution', PARAM_MULTILANG);
$mform->setType('institution', PARAM_TEXT);
$mform->addElement('text', 'department', get_string('department'), 'maxlength="30" size="25"');
$mform->setType('department', PARAM_MULTILANG);
$mform->setType('department', PARAM_TEXT);
$mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
$mform->setType('phone1', PARAM_NOTAGS);
@ -329,7 +329,7 @@ function useredit_shared_definition(&$mform, $editoroptions = null, $filemanager
$mform->setType('phone2', PARAM_NOTAGS);
$mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"');
$mform->setType('address', PARAM_MULTILANG);
$mform->setType('address', PARAM_TEXT);
}

View File

@ -452,7 +452,7 @@ class core_user_external extends external_api {
'lastname' => new external_value(PARAM_NOTAGS, 'The family name of the user', VALUE_OPTIONAL),
'fullname' => new external_value(PARAM_NOTAGS, 'The fullname of the user'),
'email' => new external_value(PARAM_TEXT, 'An email address - allow email as root@localhost', VALUE_OPTIONAL),
'address' => new external_value(PARAM_MULTILANG, 'Postal address', VALUE_OPTIONAL),
'address' => new external_value(PARAM_TEXT, 'Postal address', VALUE_OPTIONAL),
'phone1' => new external_value(PARAM_NOTAGS, 'Phone 1', VALUE_OPTIONAL),
'phone2' => new external_value(PARAM_NOTAGS, 'Phone 2', VALUE_OPTIONAL),
'icq' => new external_value(PARAM_NOTAGS, 'icq number', VALUE_OPTIONAL),
@ -604,7 +604,7 @@ class core_user_external extends external_api {
'lastname' => new external_value(PARAM_NOTAGS, 'The family name of the user', VALUE_OPTIONAL),
'fullname' => new external_value(PARAM_NOTAGS, 'The fullname of the user'),
'email' => new external_value(PARAM_TEXT, 'An email address - allow email as root@localhost', VALUE_OPTIONAL),
'address' => new external_value(PARAM_MULTILANG, 'Postal address', VALUE_OPTIONAL),
'address' => new external_value(PARAM_TEXT, 'Postal address', VALUE_OPTIONAL),
'phone1' => new external_value(PARAM_NOTAGS, 'Phone 1', VALUE_OPTIONAL),
'phone2' => new external_value(PARAM_NOTAGS, 'Phone 2', VALUE_OPTIONAL),
'icq' => new external_value(PARAM_NOTAGS, 'icq number', VALUE_OPTIONAL),

View File

@ -29,7 +29,7 @@ class profile_define_base {
$form->addElement('text', 'name', get_string('profilename', 'admin'), 'size="50"');
$form->addRule('name', $strrequired, 'required', null, 'client');
$form->setType('name', PARAM_MULTILANG);
$form->setType('name', PARAM_TEXT);
$form->addElement('editor', 'description', get_string('profiledescription', 'admin'), null, null);

View File

@ -5,11 +5,11 @@ class profile_define_menu extends profile_define_base {
function define_form_specific($form) {
/// Param 1 for menu type contains the options
$form->addElement('textarea', 'param1', get_string('profilemenuoptions', 'admin'), array('rows' => 6, 'cols' => 40));
$form->setType('param1', PARAM_MULTILANG);
$form->setType('param1', PARAM_TEXT);
/// Default data
$form->addElement('text', 'defaultdata', get_string('profiledefaultdata', 'admin'), 'size="50"');
$form->setType('defaultdata', PARAM_MULTILANG);
$form->setType('defaultdata', PARAM_TEXT);
}
function define_validate_specific($data, $files) {

View File

@ -5,7 +5,7 @@ class profile_define_text extends profile_define_base {
function define_form_specific($form) {
/// Default data
$form->addElement('text', 'defaultdata', get_string('profiledefaultdata', 'admin'), 'size="50"');
$form->setType('defaultdata', PARAM_MULTILANG);
$form->setType('defaultdata', PARAM_TEXT);
/// Param 1 for text type is the size of the field
$form->addElement('text', 'param1', get_string('profilefieldsize', 'admin'), 'size="6"');

View File

@ -33,7 +33,7 @@ class profile_field_text extends profile_field_base {
/// Create the form field
$mform->addElement($fieldtype, $this->inputname, format_string($this->field->name), 'maxlength="'.$maxlength.'" size="'.$size.'" ');
$mform->setType($this->inputname, PARAM_MULTILANG);
$mform->setType($this->inputname, PARAM_TEXT);
}
}

View File

@ -23,7 +23,7 @@ class category_form extends moodleform {
$mform->setType('action', PARAM_ACTION);
$mform->addElement('text', 'name', get_string('profilecategoryname', 'admin'), 'maxlength="255" size="30"');
$mform->setType('name', PARAM_MULTILANG);
$mform->setType('name', PARAM_TEXT);
$mform->addRule('name', $strrequired, 'required', null, 'client');
$this->add_action_buttons(true);