Index: moodle/mod/lamslesson/lang/en/lamslesson.php
===================================================================
diff -u -rdd28ba5f76c6f048cf8995119ce74c7a93837078 -r8bc3f6c4fd5b7348954b1026d365ca583a244e8d
--- moodle/mod/lamslesson/lang/en/lamslesson.php (.../lamslesson.php) (revision dd28ba5f76c6f048cf8995119ce74c7a93837078)
+++ moodle/mod/lamslesson/lang/en/lamslesson.php (.../lamslesson.php) (revision 8bc3f6c4fd5b7348954b1026d365ca583a244e8d)
@@ -77,7 +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['disablepopupblocker'] = 'It seems that you have a pop-up blocker that is preventing the preview window to be displayed. Please disable the pop-up blocker to preview'
// view.php
$string['nolessons'] = 'There are no LAMS lessons yet in this instance.';
Index: moodle/mod/lamslesson/lib.php
===================================================================
diff -u -rdd28ba5f76c6f048cf8995119ce74c7a93837078 -r8bc3f6c4fd5b7348954b1026d365ca583a244e8d
--- moodle/mod/lamslesson/lib.php (.../lib.php) (revision dd28ba5f76c6f048cf8995119ce74c7a93837078)
+++ moodle/mod/lamslesson/lib.php (.../lib.php) (revision 8bc3f6c4fd5b7348954b1026d365ca583a244e8d)
@@ -53,11 +53,13 @@
define('LAMSLESSON_PARAM_AUTHOR_METHOD', 'author');
define('LAMSLESSON_PARAM_MONITOR_METHOD', 'monitor');
define('LAMSLESSON_PARAM_LEARNER_METHOD', 'learner');
+define('LAMSLESSON_PARAM_PREVIEW_METHOD', 'preview');
define('LAMSLESSON_PARAM_SINGLE_PROGRESS_METHOD', 'singleStudentProgress');
define('LAMSLESSON_PARAM_PROGRESS_METHOD', 'studentProgress');
define('LAMSLESSON_PARAM_CUSTOM_CSV', 'customCSV');
define('LAMSLESSON_LD_SERVICE', '/services/xml/LearningDesignRepository');
define('LAMSLESSON_LESSON_MANAGER', '/services/xml/LessonManager');
+define('LAMSLESSON_POPUP_OPTIONS', 'location=0,toolbar=0,menubar=0,statusbar=0,width=996,height=700,resizable');
/**
* If you for some reason need to use global variables instead of constants, do not forget to make them
@@ -374,7 +376,7 @@
// start the lesson
$form->lesson_id = lamslesson_get_lesson(
$USER->username, $form->sequence_id, $form->course,
- $form->name, $form->intro,
+ $form->name, $form->intro, 'start',
$locale['country'], $locale['lang'], $form->customCSV
);
@@ -479,8 +481,8 @@
* @param string $lang The Language's ISO code
* @return int lesson id
*/
-function lamslesson_get_lesson($username,$ldid,$courseid,$title,$desc,$country,$lang,$customcsv='') {
- //echo "enter lamslesson_get_lesson
";
+function lamslesson_get_lesson($username,$ldid,$courseid,$title,$desc,$method,$country,$lang,$customcsv='') {
+
global $CFG, $USER;
if (!isset($CFG->lamslesson_serverid, $CFG->lamslesson_serverkey) || $CFG->lamslesson_serverid == "") {
print_error(get_string('notsetup', 'lamslesson'));
@@ -498,7 +500,7 @@
$title = urlencode($title);
$desc = urlencode($desc);
- $request = "$CFG->lamslesson_serverurl" . LAMSLESSON_LESSON_MANAGER . "?method=start&serverId=" . $CFG->lamslesson_serverid . "&datetime=" . $datetime_encoded . "&hashValue=" . $hashvalue . "&username=" . $username . "&ldId=" . $ldid . "&courseId=" . $courseid . "&title=" . $title . "&desc=" . $desc . "&country=" . $country . "&lang=" . $lang;
+ $request = "$CFG->lamslesson_serverurl" . LAMSLESSON_LESSON_MANAGER . "?method=" . $method . "&serverId=" . $CFG->lamslesson_serverid . "&datetime=" . $datetime_encoded . "&hashValue=" . $hashvalue . "&username=" . $username . "&ldId=" . $ldid . "&courseId=" . $courseid . "&title=" . $title . "&desc=" . $desc . "&country=" . $country . "&lang=" . $lang;
// GET call to LAMS
$xml = file_get_contents($request);
@@ -543,7 +545,7 @@
* URL redirects LAMS to learner or monitor interface depending on method.
*/
function lamslesson_get_url($username, $lang, $country, $lessonid, $courseid, $coursename, $coursecreatedate, $method, $customcsv='') {
- global $CFG, $LAMS2CONSTANTS;
+ global $CFG;
// append month/year to course name
$coursename = $coursename.' '.date('n/Y', $coursecreatedate);
Index: moodle/mod/lamslesson/mod_form.php
===================================================================
diff -u -r67850a04a35c8bfbd0b5ae62dbd4126cd2d6fc7d -r8bc3f6c4fd5b7348954b1026d365ca583a244e8d
--- moodle/mod/lamslesson/mod_form.php (.../mod_form.php) (revision 67850a04a35c8bfbd0b5ae62dbd4126cd2d6fc7d)
+++ moodle/mod/lamslesson/mod_form.php (.../mod_form.php) (revision 8bc3f6c4fd5b7348954b1026d365ca583a244e8d)
@@ -31,7 +31,8 @@
$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 {
@@ -67,43 +68,67 @@
$locale = lamslesson_get_locale($COURSE->id);
$canmanage = has_capability('mod/lamslesson:manage', $context);
- //-- Open URL button
+ //-- Open Author & Preview URL buttons
// Check whether this person has the right permissions to see the open button.
if ($canmanage) {
$customcsv = "$USER->username,$COURSE->id,$CFG->lamslesson_serverid";
$authorurl = lamslesson_get_url($USER->username, $locale['lang'], $locale['country'], 0, $COURSE->id, $COURSE->fullname, $COURSE->timecreated, LAMSLESSON_PARAM_AUTHOR_METHOD, $customcsv);
+
+ $previewurl = $CFG->wwwroot.'/mod/lamslesson/preview.php?';
+ $popupoptions = LAMSLESSON_POPUP_OPTIONS;
$openauthorlabel = get_string('openauthor', 'lamslesson');
+ $openpreviewlabel = get_string('previewthislesson', 'lamslesson');
// html "chunk" for open Author button
- $authorbutton = <<
-
+ var authorWin = null;
+ var previewWin = null;
+ var options = '$popupoptions';
+
+ function openAuthor(url,name,fullscreen) {
+ url = url + "&requestSrc=" + escape("$CFG->lamslesson_requestsource");
+ url = url + "¬ifyCloseURL=" + escape(window.location.href);
+ if(authorWin && !authorWin.closed){
+ authorWin.focus();
+ }else{
+ authorWin = window.open(url,name,options);
+ if (fullscreen) {
+ authorWin.moveTo(0,0);
+ authorWin.resizeTo(screen.availWidth,screen.availHeight);
+ }
+ authorWin.focus();
+ }
+ return false;
+ }
+ function openPreview(url,name,fullscreen) {
+
+ url = url + "&ldId=" + document.getElementsByName("sequence_id")[0].value;
+ url = url + "&course=" + $COURSE->id;
+ previewWin = window.open(url,name,options);
+ if (fullscreen) {
+ previewWin.moveTo(0,0);
+ previewWin.resizeTo(screen.availWidth,screen.availHeight);
+ }
+ previewWin.focus();
+ return false;
+ }
+
+ //-->
+
+
XXX;
}
@@ -130,6 +155,9 @@
if (document.getElementsByName("name")[0].value == '') {
document.getElementsByName("name")[0].value = name;
}
+ document.getElementById('previewbutton').style.visibility='visible';
+ } else {
+ document.getElementById('previewbutton').style.visibility='hidden';
}
}
@@ -157,7 +185,7 @@
XXX;
// Now we put the two html chunks together
-$html = $authorbutton . $html;
+$html = $authorpreviewbutton . $html;
$mform->addElement('header', 'selectsequence', get_string('selectsequence', 'lamslesson'));
Fisheye: Tag c8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc refers to a dead (removed) revision in file `moodle/mod/lamslesson/preview.php'.
Fisheye: No comparison available. Pass `N' to diff?
Index: moodle/mod/lamslesson/styles.css
===================================================================
diff -u -r67850a04a35c8bfbd0b5ae62dbd4126cd2d6fc7d -r8bc3f6c4fd5b7348954b1026d365ca583a244e8d
--- moodle/mod/lamslesson/styles.css (.../styles.css) (revision 67850a04a35c8bfbd0b5ae62dbd4126cd2d6fc7d)
+++ moodle/mod/lamslesson/styles.css (.../styles.css) (revision 8bc3f6c4fd5b7348954b1026d365ca583a244e8d)
@@ -5,9 +5,10 @@
.path-mod-lamslesson .super {position:relative;bottom:0.5em;color:red;font-size:0.8em;}
/* Button styles */
-#authorbutton a {padding-left: 2.25em;background: url([[pix:i/admin]]) 5% 50% no-repeat;}
-#learnerbutton a {padding-left: 2.25em;background: url([[pix:t/go]]) 8% 50% no-repeat;}
-#monitorbutton a {padding-left: 2.25em;background: url([[pix:a/search]]) 5% 50% no-repeat;}
+#authorbutton a {text-decoration:none;padding-left: 2.25em;background: url([[pix:i/admin]]) 5% 50% no-repeat;}
+#learnerbutton a {text-decoration:none;padding-left: 2.25em;background: url([[pix:t/go]]) 8% 50% no-repeat;}
+#monitorbutton a {text-decoration:none;padding-left: 2.25em;background: url([[pix:a/search]]) 5% 50% no-repeat;}
+#previewbutton a {text-decoration:none;padding-left: 2.25em;background: url([[pix:a/search]]) 5% 50% no-repeat;}
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved.
This file is from: