Index: moodle/mod/lamslesson/lib.php =================================================================== RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/lib.php,v diff -u -r1.3 -r1.4 --- moodle/mod/lamslesson/lib.php 24 Jan 2011 02:37:39 -0000 1.3 +++ moodle/mod/lamslesson/lib.php 24 Jan 2011 14:31:03 -0000 1.4 @@ -100,11 +100,14 @@ function lamslesson_update_instance($lamslesson) { global $DB; + //Get first the original record and check whether the sequence_id has changed of not + $originallamslesson = $DB->get_record('lamslesson', array('id' => $lamslesson->instance)); $lamslesson->timemodified = time(); $lamslesson->id = $lamslesson->instance; - # You may have to add extra stuff in here # - lamslesson_add_lesson($lamslesson); + if ($originallamslesson->sequence_id != $lamslesson->sequence_id) { + lamslesson_add_lesson($lamslesson); + } return $DB->update_record('lamslesson', $lamslesson); } Index: moodle/mod/lamslesson/mod_form.php =================================================================== RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/mod_form.php,v diff -u -r1.5 -r1.6 --- moodle/mod/lamslesson/mod_form.php 24 Jan 2011 02:37:39 -0000 1.5 +++ moodle/mod/lamslesson/mod_form.php 24 Jan 2011 14:31:03 -0000 1.6 @@ -31,17 +31,27 @@ $PAGE->requires->yui2_lib('yahoo-dom-event'); $PAGE->requires->yui2_lib('treeview'); -$PAGE->requires->yui2_lib('event'); -$PAGE->requires->yui2_lib('connection'); + require_once($CFG->dirroot.'/course/moodleform_mod.php'); class mod_lamslesson_mod_form extends moodleform_mod { function definition() { global $COURSE, $USER, $CFG; + $mform =& $this->_form; -//------------------------------------------------------------------------------- + if (!empty($this->_instance)) { + $sequence_id = $this->current->sequence_id; + $currentsequence = get_string('currentsequence','lamslesson'); + $updatewarning = get_string('updatewarning','lamslesson'); + } else { + $sequence_id = 0; + $currentsequence = ''; + $updatewarning = ''; + } + + //------------------------------------------------------------------------------- /// Adding the "general" fieldset, where all the common settings are showed $mform->addElement('header', 'general', get_string('general', 'form')); @@ -120,13 +130,13 @@ //--> -