[Hw4mdl-svn] SF.net SVN: hw4mdl: [145] trunk/moodle/mod/liveclassroom
Brought to you by:
jhlinder,
trollinger
|
From: <hu...@us...> - 2006-12-29 09:31:07
|
Revision: 145
http://svn.sourceforge.net/hw4mdl/?rev=145&view=rev
Author: hugues
Date: 2006-12-29 01:31:00 -0800 (Fri, 29 Dec 2006)
Log Message:
-----------
http://u.horizonwimba.com/bugzilla/show_bug.cgi?id=10560
- Updated the version of the integration: it comes from a constant defined in lib.php
- The version of the LC server comes from the server now
- Updated the way we return String messages, they will come from the anguage file in the future
- Some other re-indentation
Modified Paths:
--------------
trunk/moodle/mod/liveclassroom/api.php
trunk/moodle/mod/liveclassroom/config.html
trunk/moodle/mod/liveclassroom/generateListRooms.php
trunk/moodle/mod/liveclassroom/lib.php
trunk/moodle/mod/liveclassroom/manageRoomAction.php
trunk/moodle/mod/liveclassroom/welcome.php
Modified: trunk/moodle/mod/liveclassroom/api.php
===================================================================
--- trunk/moodle/mod/liveclassroom/api.php 2006-12-28 15:54:55 UTC (rev 144)
+++ trunk/moodle/mod/liveclassroom/api.php 2006-12-29 09:31:00 UTC (rev 145)
@@ -41,7 +41,6 @@
* @package liveclassroom
*/
-//require_once('System.php');
require_once('lib.php');
$LIVECLASSROOM_MOODLE_PREFIX = liveclassroom_api_get_prefix();
@@ -61,12 +60,11 @@
define("LIVECLASSROOM_API_FUNCTION_LIST_ROLE","function=listRole");
define("LIVECLASSROOM_API_FUNCTION_CREATE_GROUP","function=createGroup");
define("LIVECLASSROOM_API_FUNCTION_MODIFY_GROUP","function=modifyGroup");
+define("LIVECLASSROOM_API_FUNCTION_STATUS","function=statusServer");
define("LIVECLASSROOM_API_RECORD_SEPERATOR","=END RECORD");
-
-
/*
* Get the prefix to use for creating rooms and users.
*
Modified: trunk/moodle/mod/liveclassroom/config.html
===================================================================
--- trunk/moodle/mod/liveclassroom/config.html 2006-12-28 15:54:55 UTC (rev 144)
+++ trunk/moodle/mod/liveclassroom/config.html 2006-12-29 09:31:00 UTC (rev 145)
@@ -44,13 +44,13 @@
<tr valign="top">
<td align="right"><?php print_string('lcversion', 'liveclassroom')?> :</td>
<td>
- <?php print_string("lcversionnumber", "liveclassroom") ?>
+ <?php echo liveclassroom_get_version(); ?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('integrationversion', 'liveclassroom')?> :</td>
<td>
- <?php print_string("integrationversionnumber", "liveclassroom") ?>
+ <?php echo LIVECLASSROOM_MODULE_VERSION ?>
</td>
</tr>
<tr>
Modified: trunk/moodle/mod/liveclassroom/generateListRooms.php
===================================================================
--- trunk/moodle/mod/liveclassroom/generateListRooms.php 2006-12-28 15:54:55 UTC (rev 144)
+++ trunk/moodle/mod/liveclassroom/generateListRooms.php 2006-12-29 09:31:00 UTC (rev 145)
@@ -32,7 +32,7 @@
/// This page is to generate the list of rooms and archives
- require_once("../../config.php");
+ require_once("../../config.php");
require_once("lib.php");
require_once("api.php");
@@ -145,6 +145,9 @@
$xmlstring = $xmldoc->dump_mem(true); // Xml datas into a string
$finalstring = str_replace("\n", '', $xmlstring);
+
+ add_to_log("", "liveclassroom", "test id", "test", $xmlstring);
+
echo $xmlstring;
?>
\ No newline at end of file
Modified: trunk/moodle/mod/liveclassroom/lib.php
===================================================================
--- trunk/moodle/mod/liveclassroom/lib.php 2006-12-28 15:54:55 UTC (rev 144)
+++ trunk/moodle/mod/liveclassroom/lib.php 2006-12-29 09:31:00 UTC (rev 145)
@@ -33,10 +33,16 @@
require_once($CFG->libdir.'/datalib.php');
require_once("api.php");
require_once($CFG->dirroot.'/course/lib.php');
+
+
+define (LIVECLASSROOM_MODULE_VERSION, "0.9");
+
//Suffixes used when creting the profiles account on the LC server
-$LIVECLASSROOM_TEACHER_SUFFIX = "_T"; //Teachers will use the user $CFG->liveclassroom_settinguniqueid + $course->id + $LIVECLASSROOM_TEACHER_SUFFIX
-$LIVECLASSROOM_STUDENT_SUFFIX = "_S"; //Students will use the user $CFG->liveclassroom_settinguniqueid + $course->id + $LIVECLASSROOM_STUDENT_SUFFIX
+define (LIVECLASSROOM_TEACHER_SUFFIX, "_T"); //Teachers will use the user $CFG->liveclassroom_settinguniqueid + $course->id + $LIVECLASSROOM_TEACHER_SUFFIX
+define (LIVECLASSROOM_STUDENT_SUFFIX, "_S"); //Students will use the user $CFG->liveclassroom_settinguniqueid + $course->id + $LIVECLASSROOM_STUDENT_SUFFIX
+
+
$LIVECLASSROOM_LOGS = "logs.php"; //file use to the logs
/**
* Validate the data in passed in the configuration page
@@ -75,22 +81,21 @@
/// will create a new instance and return the id number
/// of the new instance.
- $liveclassroom->timemodified = time();
+ $liveclassroom->timemodified = time();
- # May have to add extra stuff in here #
- $roomname = liveclassroom_api_get_room_name($liveclassroom->type);
+ # May have to add extra stuff in here #
+ $roomname = liveclassroom_api_get_room_name($liveclassroom->type);
- if($result = insert_record("liveclassroom", $liveclassroom)) {
- add_to_log($liveclassroom->course, "liveclassroom", "Add activity", liveclassroom_send_logs("addInstance","liveclassroomId=".$result."&roomname=$roomname"), "Activity \"".$liveclassroom->name."\" added");
-
- }
- else
- {
- add_to_log($liveclassroom->course, "liveclassroom", "Add activity", liveclassroom_send_logs("errorAddInstance","liveclassroomId=".$result."&roomname=$roomname"), "Activity \"".$liveclassroom->name."\" has not been added");
-
- $result=false;
- }
- return $result;
+ if($result = insert_record("liveclassroom", $liveclassroom)) {
+ add_to_log($liveclassroom->course, "liveclassroom", "Add activity",
+ liveclassroom_send_logs("addInstance","liveclassroomId=".$result."&roomname=$roomname"), "Activity \"".$liveclassroom->name."\" added");
+ }
+ else {
+ add_to_log($liveclassroom->course, "liveclassroom", "Add activity",
+ liveclassroom_send_logs("errorAddInstance","liveclassroomId=".$result."&roomname=$roomname"), "Activity \"".$liveclassroom->name."\" has not been added");
+ $result=false;
+ }
+ return $result;
}
@@ -273,6 +278,7 @@
}
+
/**
* Create the different kind of room on this course
* call the function create_room for each type of room available for the course given
@@ -1037,52 +1043,51 @@
*/
function liveclassroom_get_message($type) {
- switch ($type)
- {
- case "roomCreated":
- $return = "Your room has been successfully created.";
- break;
- case "roomUpdated":
- $return = "Your room has been successfully updated.";
- break;
- case "roomDeleted":
- $return = "Your room has been successfully deleted.";
- break;
- case "notfind":
- $return = "Invalid Live Classroom parameters. Please contact your administrator for more information.";
- break;
- case "room":
- $return = "Invalid Live Classroom parameters. Please contact your administrator for more information. ";
- break;
- case "connection":
- $return = "Moodle cannot connect to the Live Classroom server. Please reload the page or contact your administrator for more information. ";
- break;
- case "bd":
- $return = "Moodle cannot connect to the Live Classroom database. Please reload the page or contact your administrator for more information. ";
- break;
- case "session":
- //createMessage("exception","the session has timed out due to inactivity. Please reload the page to reconnect. ");
- break;
- case "signature":
- $return = "Invalid connection to Live Classroom. Please contact your administrator for more information. ";
- break;
- case "board":
- $return = "Invalid Voice Board parameters. Please contact your administrator for more information. ";
- break;
- case "connection_vt":
- $return = "Moodle cannot connect to the Voice Board server. Please reload the page or contact your administrator for more information. ";
- break;
- case "bdvt":
- $return = "Moodle cannot connect to the Voice Board database. Please reload the page or contact your administrator for more information. ";
- break;
- case "sessionvt":
- $return = "The Voice Board session has timed out due to inactivity. Please reload the page to reconnect. ";
- break;
- case "signaturevt":
- $return = "Invalid connection to Voice Board. Please contact your administrator for more information. ";
- break;
- }
- return $return;
+ switch ($type) {
+ case "roomCreated":
+ return "Your room has been successfully created.";
+
+ case "roomUpdated":
+ return "Your room has been successfully updated.";
+
+ case "roomDeleted":
+ return "Your room has been successfully deleted.";
+
+ case "notfind":
+ return "Invalid Live Classroom parameters. Please contact your administrator for more information.";
+
+ case "room":
+ return "Invalid Live Classroom parameters. Please contact your administrator for more information. ";
+
+ case "connection":
+ return "Moodle cannot connect to the Live Classroom server. Please reload the page or contact your administrator for more information. ";
+
+ case "bd":
+ return "Moodle cannot connect to the Live Classroom database. Please reload the page or contact your administrator for more information. ";
+
+ case "session":
+ //createMessage("exception","the session has timed out due to inactivity. Please reload the page to reconnect. ");
+
+ case "signature":
+ return "Invalid connection to Live Classroom. Please contact your administrator for more information. ";
+
+ case "board":
+ return "Invalid Voice Board parameters. Please contact your administrator for more information. ";
+
+ case "connection_vt":
+ return "Moodle cannot connect to the Voice Board server. Please reload the page or contact your administrator for more information. ";
+
+ case "bdvt":
+ return "Moodle cannot connect to the Voice Board database. Please reload the page or contact your administrator for more information. ";
+
+ case "sessionvt":
+ return "The Voice Board session has timed out due to inactivity. Please reload the page to reconnect. ";
+
+ case "signaturevt":
+ return "Invalid connection to Voice Board. Please contact your administrator for more information. ";
+
+ }
+ return "Default Message";
}
/*
@@ -1103,4 +1108,40 @@
return $link;
}
+
+
+/**
+ * Returns the version of the server.
+ *
+ */
+function liveclassroom_get_version () {
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_STATUS, "");
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+
+ $currentline = strtok($data,"\n");
+ while (!empty($currentline) && !preg_match("/horizon_version=/", $currentline, $matches)) {
+ $currentline = strtok("\n");
+ }
+
+ if (empty($currentline)) {
+ return "noversion";
+ }
+
+ $version= substr($currentline, 16);
+
+ //DEBUG
+ if (empty($version)) {
+ return "emptyversion";
+ }
+
+ return $version;
+}
+
+
?>
Modified: trunk/moodle/mod/liveclassroom/manageRoomAction.php
===================================================================
--- trunk/moodle/mod/liveclassroom/manageRoomAction.php 2006-12-28 15:54:55 UTC (rev 144)
+++ trunk/moodle/mod/liveclassroom/manageRoomAction.php 2006-12-29 09:31:00 UTC (rev 145)
@@ -41,14 +41,14 @@
error("Guests are not allowed to create rooms", $_SERVER["HTTP_REFERER"]);
}
- if (isstudent($courseid)) {
+ if (isstudent($courseid)) {
error("Students are not allowed to create rooms", $_SERVER["HTTP_REFERER"]);
}
if (!liveclassroom_init_session($_GET)) {
- error("ExpiredSessionException");
- }
+ error("ExpiredSessionException");
+ }
- $url = liveclassroom_get_url_params($courseid);
+ $url = liveclassroom_get_url_params($courseid);
session_start(); // to get the previous type of the room
Modified: trunk/moodle/mod/liveclassroom/welcome.php
===================================================================
--- trunk/moodle/mod/liveclassroom/welcome.php 2006-12-28 15:54:55 UTC (rev 144)
+++ trunk/moodle/mod/liveclassroom/welcome.php 2006-12-29 09:31:00 UTC (rev 145)
@@ -77,111 +77,87 @@
?>
<html>
-<head>
-<title>Live ClassRooms</title>
-<link rel="STYLESHEET" href="css/StyleSheet.css" type="text/css" />
-<script type="text/javascript" src='<?PHP p($CFG->liveclassroom_servername)?>/js/launch.js'></script>
-
-
- <script language="javascript" src="js/Ajax.js"></script>
+ <head>
+ <title>Live ClassRooms</title>
+ <link rel="STYLESHEET" href="css/StyleSheet.css" type="text/css" />
+ <script type="text/javascript" src='<?PHP p($CFG->liveclassroom_servername)?>/js/launch.js'></script>
+ <script language="javascript" src="js/Ajax.js"></script>
<script language="javascript" src="js/xmldom.js"></script>
<script language="javascript" src="js/verifForm.js"></script>
- <script language="javascript" src="js/constants.js"></script>
+ <script language="javascript" src="js/constants.js"></script>
<script language="javascript" src="js/pngfix.js"></script>
<script language="javascript" src="js/manageXml.js"></script>
- <script language="javascript" src="js/hwCommons.js"></script>
+ <script language="javascript" src="js/hwCommons.js"></script>
-<script type="text/javascript">
-
-
-
-
+ <script type="text/javascript">
function doOpenAddActivity(url,param){
+ if(currentId!="") {
- if(currentId!="") {
-
- if( (typeSelect=="MainLecture") || (typeSelect == "Discussion") ) {
-
- var complete_url=url+'?roomId='+currentId+'&id=<?php p($id) ?>§ion=0&sesskey=<?php echo sesskey(); ?>&'+param;
- window.open(complete_url,"_top");
-
+ if( (typeSelect=="MainLecture") || (typeSelect == "Discussion") ) {
+ var complete_url=url+'?roomId='+currentId+'&id=<?php p($id) ?>§ion=0&sesskey=<?php echo sesskey(); ?>&'+param;
+ window.open(complete_url,"_top");
}
- }
-
+ }
}
-function doOpenReport()
-{
- if(currentId!="")
- {
- var complete_url='reports.php'+'?roomId='+currentId+'&hza='+session['authToken'];
- var w = window.open(complete_url,'lc_popup','scrollbars=yes,resizable=yes,width=800,height=500');
- w.focus();
- }
+function doOpenReport() {
+ if(currentId!="") {
+ var complete_url='reports.php'+'?roomId='+currentId+'&hza='+session['authToken'];
+ var w = window.open(complete_url,'lc_popup','scrollbars=yes,resizable=yes,width=800,height=500');
+ w.focus();
+ }
}
-function doDelete()
-{
- if(currentId!="")
- {
- var complete_url='manageRoomAction.php'+'?time='+session["timeOfLoad"]+'&enc_course_id='+session["courseId"]+'&enc_email='+session["email"]+'&enc_firstname='+session["firstName"]+'&enc_lastname='+session["lastName"]+'&enc_role='+session["role"]+'&signature='+session["signature"]+'&id ='+currentId+'&action=deleteRoom&hza='+session['authToken'] ;
- location.href = complete_url
- //var w = window.open(complete_url, '_top');
- // w.focus();
-
- }
+function doDelete(){
+ if(currentId!=""){
+ var complete_url='manageRoomAction.php'+'?time='+session["timeOfLoad"]+'&enc_course_id='+session["courseId"]+'&enc_email='+session["email"]+'&enc_firstname='+session["firstName"]+'&enc_lastname='+session["lastName"]+'&enc_role='+session["role"]+'&signature='+session["signature"]+'&id ='+currentId+'&action=deleteRoom&hza='+session['authToken'] ;
+ location.href = complete_url
+ //var w = window.open(complete_url, '_top');
+ // w.focus();
+ }
}
function displaySpace(){
- var display="";
- display+= "<td width='130'></td>";
- return display;
+ var display="";
+ display+= "<td width='130'></td>";
+ return display;
}
function ChoicePage(){
-
- <?php
- if(isset($_GET['addnew']))
+ <?php
+ if(isset($_GET['addnew']))
{
?>
- showPopup()
+ showPopup()
+ currentProduct = "LiveClassroom";
+ typeSelect="MainLecture";
-
- currentProduct = "LiveClassroom";
- typeSelect="MainLecture";
-
- var parameters="";
- parameters="product=liveclassroom&";
- parameters+="action=new&";
- parameters+=getURLParameters();
- currentId = "";
- /* Pr\xE9paration d'une requ\xEAte asynchrone de type GET : */
- xmlhttp.open("GET", 'generateSettings.php?'+parameters+'',true);
- /* Effectue la requ\xEAte : */
- xmlhttp.onreadystatechange=eval(Management);
+ var parameters="";
+ parameters="product=liveclassroom&";
+ parameters+="action=new&";
+ parameters+=getURLParameters();
+ currentId = "";
+ /* Preparing an asynchronous GET request: */
+ xmlhttp.open("GET", 'generateSettings.php?'+parameters+'',true);
+ /* run the request : */
+ xmlhttp.onreadystatechange=eval(Management);
- xmlhttp.send(null);
-
+ xmlhttp.send(null);
<?php
- }
- else
- {
+ }
+ else {
?>
-
- DisplayFirstPage("generateListRooms.php");
+ DisplayFirstPage("generateListRooms.php");
<?php
- }
- ?>
-
+ }
+ ?>
}
-
-
</script>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|