Index: moodle/mod/lamslesson/lang/en/lamslesson.php =================================================================== diff -u -r80acd159361b65ce02deaae0f5d232f6c3d31f3f -r3ae896d21d5e7b871f6dc84d35089ed2cc262dad --- moodle/mod/lamslesson/lang/en/lamslesson.php (.../lamslesson.php) (revision 80acd159361b65ce02deaae0f5d232f6c3d31f3f) +++ moodle/mod/lamslesson/lang/en/lamslesson.php (.../lamslesson.php) (revision 3ae896d21d5e7b871f6dc84d35089ed2cc262dad) @@ -66,14 +66,16 @@ $string['requestsourceinfo'] = 'What is the name of your Moodle instance?. This value will appear after saving a sequence and will be used to prompt the user to "return to ". So here you can put the name you give your Moodle server. ie: "Virtual Campus"'; $string['validationbutton'] = "Validate settings"; -$string['validationinfo'] = 'Press the button to validate your settings.'; +$string['validationheader'] = 'Settings validation'; +$string['validationinfo'] = 'Before you save your settings, please press the button to validate them with the LAMS server. If the validation is correct, save these settings. If not, please check that the settings you have entered match with the values in the LAMS server'; +$string['validationhelp'] = 'Need help? check out the'; +$string['lamsmoodlehelp'] = 'LAMS-Moodle integration tutorial'; - +$string['validationsuccessful'] = 'Validation successful! You can now save your settings and start using LAMS within Moodle.'; +$string['validationfailed'] = 'Validation failed: please check that the settings you have entered match with the settings in LAMS'; // -$string['notsetup'] = 'Configuration is not complete'; - // Labels for errors when calling LAMS Server $string['restcall503'] = 'Call to LAMS failed: received an HTTP status of 503. This might mean that LAMS is unavailable. Please wait a minute and try again, or contact your system administrator.'; $string['restcall403'] = 'Call to LAMS failed: received an HTTP status of 403 Forbidden. Please check the configurations settings and/or contact your system administrator.'; Index: moodle/mod/lamslesson/lib.php =================================================================== diff -u -rc6f6605de18894e645f9a9cabb994996fdf90924 -r3ae896d21d5e7b871f6dc84d35089ed2cc262dad --- moodle/mod/lamslesson/lib.php (.../lib.php) (revision c6f6605de18894e645f9a9cabb994996fdf90924) +++ moodle/mod/lamslesson/lib.php (.../lib.php) (revision 3ae896d21d5e7b871f6dc84d35089ed2cc262dad) @@ -54,6 +54,7 @@ define('LAMSLESSON_PARAM_MONITOR_METHOD', 'monitor'); define('LAMSLESSON_PARAM_LEARNER_METHOD', 'learner'); define('LAMSLESSON_PARAM_PREVIEW_METHOD', 'preview'); +define('LAMSLESSON_PARAM_VERIFY_METHOD', 'verify'); define('LAMSLESSON_PARAM_SINGLE_PROGRESS_METHOD', 'singleStudentProgress'); define('LAMSLESSON_PARAM_PROGRESS_METHOD', 'studentProgress'); define('LAMSLESSON_PARAM_CUSTOM_CSV', 'customCSV'); @@ -890,5 +891,36 @@ } else { lamslesson_grade_item_update($lamslesson); } + } +/** + * Verify Moodle settings with LAMS + * + * @param url $url + * @param string $id + * @param string $key + */ +function lamslesson_verify($url, $id, $key){ + + $datetime = date("F d,Y g:i a"); + $datetime_encoded = urlencode($datetime); + + $plaintext = $datetime.$id.$key; + // create hash + $hashvalue = sha1(strtolower($plaintext)); + + $request = $url . LAMSLESSON_LESSON_MANAGER . "?method=" . LAMSLESSON_PARAM_VERIFY_METHOD . "&serverId=" . $id . "&datetime=" . $datetime_encoded . "&hashValue=" . $hashvalue; + + $validate = file_get_contents($request); + + if ( $validate == 1 ) { + // validation successful + return get_string('validationsuccessful', 'lamslesson'); + } else { + // validation failed + return get_string('validationfailed', 'lamslesson'); + } + +} + Index: moodle/mod/lamslesson/styles.css =================================================================== diff -u -r80acd159361b65ce02deaae0f5d232f6c3d31f3f -r3ae896d21d5e7b871f6dc84d35089ed2cc262dad --- moodle/mod/lamslesson/styles.css (.../styles.css) (revision 80acd159361b65ce02deaae0f5d232f6c3d31f3f) +++ moodle/mod/lamslesson/styles.css (.../styles.css) (revision 3ae896d21d5e7b871f6dc84d35089ed2cc262dad) @@ -11,6 +11,7 @@ #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;} +#validatebutton a {text-decoration:none;padding-left: 2.25em;background: url([[pix:i/admin]]) 5% 50% no-repeat;} /* Copyright (c) 2006 Yahoo! Inc. All rights reserved. This file is from: Fisheye: Tag c8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc refers to a dead (removed) revision in file `moodle/mod/lamslesson/validate.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc refers to a dead (removed) revision in file `moodle/mod/lamslesson/verify.php'. Fisheye: No comparison available. Pass `N' to diff?