mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-34290 using moodleform cast to int in dropbox repository settings
This commit is contained in:
parent
7bb7bd2e79
commit
7e3f70bed7
@ -32,5 +32,4 @@ $string['secret'] = 'Dropbox secret';
|
||||
$string['instruction'] = 'You can get your API Key and secret from <a href="http://www.dropbox.com/developers/apps">Dropbox developers</a>. When setting up your key please select "Full Dropbox" as the "Access level".';
|
||||
$string['cachelimit'] = 'Cache limit';
|
||||
$string['cachelimit_info'] = 'Enter the maximum size of files (in bytes) to be cached on server for Dropbox aliases/shortcuts. Cached files will be served when the source is no longer available. Empty value or zero mean caching of all files regardless of size.';
|
||||
$string['error_cachelimit'] = 'Must be a positive integer or empty value';
|
||||
$string['dropbox:view'] = 'View a Dropbox folder';
|
||||
|
@ -464,25 +464,11 @@ class repository_dropbox extends repository {
|
||||
$mform->addElement('static', null, '', $str_getkey);
|
||||
|
||||
$mform->addElement('text', 'dropbox_cachelimit', get_string('cachelimit', 'repository_dropbox'), array('size' => '40'));
|
||||
$mform->addRule('dropbox_cachelimit', null, 'numeric', null, 'client');
|
||||
$mform->setType('dropbox_cachelimit', PARAM_INT);
|
||||
$mform->addElement('static', 'dropbox_cachelimit_info', '', get_string('cachelimit_info', 'repository_dropbox'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate Admin Settings Moodle form
|
||||
*
|
||||
* @param moodleform $mform Moodle form (passed by reference)
|
||||
* @param array $data array of ("fieldname"=>value) of submitted data
|
||||
* @param array $errors array of ("fieldname"=>errormessage) of errors
|
||||
* @return array array of errors
|
||||
*/
|
||||
public static function type_form_validation($mform, $data, $errors) {
|
||||
if (!empty($data['dropbox_cachelimit']) && (!is_number($data['dropbox_cachelimit']) ||
|
||||
(int)$data['dropbox_cachelimit']<0)) {
|
||||
$errors['dropbox_cachelimit'] = get_string('error_cachelimit', 'repository_dropbox');
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Option names of dropbox plugin
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user