$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';
$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
*