diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php
index 7dfb68b..2686b42 100644
--- a/mod/assignment/lib.php
+++ b/mod/assignment/lib.php
@@ -388,6 +388,28 @@ class assignment_base {
     }
 
     /**
+     * Any preprocessing needed for the settings form for 
+     * this assignment type
+     *
+     * @param array $default_values - array to fill in with the default values
+     *      in the form 'formelement' => 'value'
+     * @param object $form - the form that is to be displayed
+     * @return none
+     */
+    function form_data_preprocessing(&$default_values, $form) {
+    }
+
+    /**
+     * Any extra validation checks needed for the settings
+     * form for this assignment type
+     *
+     * See lib/formslib.php, 'validation' function for details
+     */
+    function form_validation($data, $files) {
+        return array();
+    }
+
+    /**
      * Create a new assignment activity
      *
      * Given an object containing all the necessary data,
diff --git a/mod/assignment/mod_form.php b/mod/assignment/mod_form.php
index 1b5857a..456d96e 100644
--- a/mod/assignment/mod_form.php
+++ b/mod/assignment/mod_form.php
@@ -6,6 +6,7 @@ if (!defined('MOODLE_INTERNAL')) {
 require_once ($CFG->dirroot.'/course/moodleform_mod.php');
 
 class mod_assignment_mod_form extends moodleform_mod {
+    protected $_assignmentinstance = null;
 
     function definition() {
         global $CFG, $DB;
@@ -28,7 +29,7 @@ class mod_assignment_mod_form extends moodleform_mod {
         $mform->setType('type', PARAM_ALPHA);
         $mform->setDefault('type', $type);
 
-        require($CFG->dirroot.'/mod/assignment/type/'.$type.'/assignment.class.php');
+        require_once($CFG->dirroot.'/mod/assignment/type/'.$type.'/assignment.class.php');
         $assignmentclass = 'assignment_'.$type;
         $assignmentinstance = new $assignmentclass();
 
@@ -75,5 +76,49 @@ class mod_assignment_mod_form extends moodleform_mod {
         $this->add_action_buttons();
     }
 
+    // Needed by plugin assignment types if they include a filemanager element in the settings form
+    function hasinstance() {
+        return ($this->_instance != NULL);
+    }
+
+    // Needed by plugin assignment types if they include a filemanager element in the settings form
+    function getcontext() {
+        return $this->context;
+    }
+
+    protected function get_assignment_instance() {
+        global $CFG, $DB;
+        
+        if ($this->_assignmentinstance) {
+            return $this->_assignmentinstance;
+        }
+        if (!empty($this->_instance)) {
+            if($ass = $DB->get_record('assignment', array('id'=>$this->_instance))) {
+                $type = $ass->assignmenttype;
+            } else {
+                print_error('invalidassignment', 'assignment');
+            }
+        } else {
+            $type = required_param('type', PARAM_ALPHA);
+        }
+        require_once($CFG->dirroot.'/mod/assignment/type/'.$type.'/assignment.class.php');
+        $assignmentclass = 'assignment_'.$type;
+        $this->assignmentinstance = new $assignmentclass();
+        return $this->assignmentinstance;
+    }
+
+
+    function data_preprocessing(&$default_values) {
+        // Allow plugin assignment types to preprocess form data (needed if they include any filemanager elements)
+        $this->get_assignment_instance()->form_data_preprocessing($default_values, $this);
+    }
+
+
+    function validataion($data, $files) {
+        // Allow plugin assignment types to do any extra validation after the form has been submitted
+        $errors = parent::validation($data, $files);
+        $errors = array_merge($errors, $this->get_assignment_instance()->form_validation($data, $files));
+        return $errors;
+    }
 }
 
