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 @@
//-->
-
-
- $openauthorlabel
-
+
XXX;
@@ -141,6 +151,8 @@
// display user's lams workspace
$lds = lamslesson_get_sequences_rest($USER->username, $COURSE->id, $COURSE->fullname, $COURSE->timecreated, $USER->country, $USER->lang) ;
+
+
// html "chuck" for YUI tree
$html = <<
@@ -165,6 +177,7 @@
+
XXX;
@@ -190,14 +210,13 @@
$mform->addElement('header', 'selectsequence', get_string('selectsequence', 'lamslesson'));
$mform->addElement('static', 'sequencemessage', '', $html);
-
+
//-------------------------------------------------------------------------------
// add standard elements, common to all modules
$this->standard_coursemodule_elements();
//-------------------------------------------------------------------------------
// add standard buttons, common to all modules
$this->add_action_buttons();
-
}
function validation($data) {
Index: moodle/mod/lamslesson/styles.css
===================================================================
RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/styles.css,v
diff -u -r1.5 -r1.6
--- moodle/mod/lamslesson/styles.css 24 Jan 2011 02:37:39 -0000 1.5
+++ moodle/mod/lamslesson/styles.css 24 Jan 2011 14:31:03 -0000 1.6
@@ -3,6 +3,7 @@
.path-mod-lamslesson .centerlink {text-align:center;padding-top: 15px; padding-bottom:5px;}
.path-mod-lamslesson .progress-header {text-align:center;font-weight: bold;padding-top: 5px; padding-bottom:5px;}
.path-mod-lamslesson .super {position:relative;bottom:0.5em;color:red;font-size:0.8em;}
+.path-mod-lamslesson .note {border:solid 1px #DEDEDE;background:#FFFFCC url([[pix:t/stop]]) 8px 16px no-repeat;color:#222222;padding:10px;text-align:center;}
/* Button styles */
#authorbutton a {text-decoration:none;padding-left: 2.25em;background: url([[pix:i/admin]]) 5% 50% no-repeat;}
Index: moodle/mod/lamslesson/lang/en/lamslesson.php
===================================================================
RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/lang/en/lamslesson.php,v
diff -u -r1.4 -r1.5
--- moodle/mod/lamslesson/lang/en/lamslesson.php 24 Jan 2011 02:43:30 -0000 1.4
+++ moodle/mod/lamslesson/lang/en/lamslesson.php 24 Jan 2011 14:31:03 -0000 1.5
@@ -77,6 +77,8 @@
$string['restcallfail'] = 'Call to LAMS failed: received no response or connection was refused. Please check that you have the correct LAMS server URL and that it is online.';
$string['sequencenotselected'] = 'You must select a sequence to proceed.';
$string['previewthislesson'] = 'Preview this lesson';
+$string['updatewarning'] = 'Warning: selecting another sequence than the current one will create a new lesson for the students. This might result in some slightly confused students';
+$string['currentsequence'] = 'Current sequence:';
// view.php