Permalink
Browse files

MDL-34290 using moodleform cast to int in dropbox repository settings

  • Loading branch information...
danpoltawski authored and marinaglancy committed Aug 14, 2012
1 parent 0707372 commit 7fa4cd1617d9c367a64f450d4fdbd751e0e73967
Showing with 2 additions and 17 deletions.
  1. +0 −1 repository/dropbox/lang/en/repository_dropbox.php
  2. +2 −16 repository/dropbox/lib.php
@@ -32,5 +32,4 @@
$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';
View
@@ -464,25 +464,11 @@ public static function type_config_form($mform, $classname = '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
*

0 comments on commit 7fa4cd1

Please sign in to comment.