[Hw4mdl-svn] SF.net SVN: hw4mdl: [170] trunk/moodle/mod/liveclassroom
Brought to you by:
jhlinder,
trollinger
|
From: <hu...@us...> - 2007-01-08 13:02:30
|
Revision: 170
http://svn.sourceforge.net/hw4mdl/?rev=170&view=rev
Author: hugues
Date: 2007-01-08 05:02:27 -0800 (Mon, 08 Jan 2007)
Log Message:
-----------
http://u.horizonwimba.com/bugzilla/show_bug.cgi?id=10624
- Enlarged the size of the input field for the launcher link, it was not displaying correctly.
- I also fixed a bug when the guest access was removed.
Modified Paths:
--------------
trunk/moodle/mod/liveclassroom/generateSettings.php
trunk/moodle/mod/liveclassroom/lib.php
Modified: trunk/moodle/mod/liveclassroom/generateSettings.php
===================================================================
--- trunk/moodle/mod/liveclassroom/generateSettings.php 2007-01-08 10:12:11 UTC (rev 169)
+++ trunk/moodle/mod/liveclassroom/generateSettings.php 2007-01-08 13:02:27 UTC (rev 170)
@@ -1176,7 +1176,7 @@
$launcher_link = $CFG->liveclassroom_servername."/launcher.cgi?room=".$roomId;
$parameters=array("type" => "text", "id" => "link",
- "name" => "link", "maxlength" => "50",
+ "name" => "link", "maxlength" => isset($launcher_link)?strlen($launcher_link):"50",
"size" => strlen($launcher_link) , "readonly" => "");
if($action=='update'){
$parameters['value']=$launcher_link;
Modified: trunk/moodle/mod/liveclassroom/lib.php
===================================================================
--- trunk/moodle/mod/liveclassroom/lib.php 2007-01-08 10:12:11 UTC (rev 169)
+++ trunk/moodle/mod/liveclassroom/lib.php 2007-01-08 13:02:27 UTC (rev 170)
@@ -322,6 +322,8 @@
*/
function liveclassroom_update_room ($course_id, $roomname, $instructor_led, $attributes) {
+ $student_id = liveclassroom_api_get_student_user_id ($courseid) ;
+
//set media_type and media_format according to the appropriate values according to the media_type attribute
$attributes = liveclassroom_check_media($attributes);
@@ -329,12 +331,12 @@
//Test if the type of room has been changed
if($_SESSION['led']!=$attributes['led']) { // Type changed
if($list_attributes['led']=='instructor'){
- liveclassroom_api_remove_user_role ($_GET['id'], liveclassroom_api_get_student_user_id ($courseid) , 'Instructor') ;
- liveclassroom_api_add_user_role ($_GET['id'], liveclassroom_api_get_student_user_id ($courseid), 'Student');
+ liveclassroom_api_remove_user_role ($_GET['id'], $student_id, 'Instructor') ;
+ liveclassroom_api_add_user_role ($_GET['id'], $student_id, 'Student');
}
else {
- liveclassroom_api_remove_user_role ($_GET['id'], liveclassroom_api_get_student_user_id ($courseid) , 'Student') ;
- liveclassroom_api_add_user_role ($_GET['id'], liveclassroom_api_get_student_user_id ($courseid), 'Instructor');
+ liveclassroom_api_remove_user_role ($_GET['id'], $student_id , 'Student') ;
+ liveclassroom_api_add_user_role ($_GET['id'], $student_id, 'Instructor');
}
}
unset($attributes['led']);
@@ -350,6 +352,12 @@
return false;
}
}
+ else if ($attributes['guest']==0) {
+ if (! liveclassroom_api_remove_user_role ($_GET['id'], 'Guest' , 'Student')) {
+ return false;
+ }
+ }
+
return true;
}
@@ -368,20 +376,39 @@
$roomid = LIVECLASSROOM_MOODLE_PREFIX.$enc_coursename.'_'.rand();
+ //set media_type and media_format according to the appropriate values according to the media_type attribute
+ $attributes = liveclassroom_check_media($attributes);
+
+
+ if (! liveclassroom_api_create_class ($roomid, $roomname, $instructor_led, $attributes)) {
+ //error ("liveclassroom_create_room: Cannot create room with id:$roomid and name: $roomname");
+ return false;
+ }
+
+ if (! liveclassroom_adjust_roles ($roomid, $enc_coursename, $instructor_led)) {
+ return false;
+ }
+
+ //Guest enabled?
+ if ((isset($attributes['guests'])) && ($attributes['guests']==1)) {
+ if (! liveclassroom_api_add_user_role ($roomid, 'Guest' , 'Student')) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+
+function liveclassroom_adjust_roles ($roomid, $enc_coursename, $instructor_led) {
+
$teacherid = LIVECLASSROOM_MOODLE_PREFIX.$enc_coursename.LIVECLASSROOM_TEACHER_SUFFIX;
$studentid = LIVECLASSROOM_MOODLE_PREFIX.$enc_coursename.LIVECLASSROOM_STUDENT_SUFFIX;
- //set media_type and media_format according to the appropriate values according to the media_type attribute
- $attributes = liveclassroom_check_media($attributes);
-
if($instructor_led==true) { // main lecture hall
- if (! liveclassroom_api_create_class ($roomid, $roomname, true, $attributes)) {
- //error ("liveclassroom_create_room: Cannot create room with id:$roomid and name: $roomname");
- return false;
- }
- if (! liveclassroom_api_add_user_role ($roomid, $teacherid, 'ClassAdmin')) {
-
+ if (! liveclassroom_api_add_user_role ($roomid, $teacherid, 'ClassAdmin')) {
//error('liveclassroom_create_room: Cannot add classadminright to Teachers');
return false;
}
@@ -395,10 +422,6 @@
}
}
else if($instructor_led==false){ // discussion room
- if (! liveclassroom_api_create_class ($roomid, $roomname, false, $attributes)) {
- //error ("liveclassroom_create_room: Cannot create room with id:$roomid and name: $roomname");
- return false;
- }
if (! liveclassroom_api_add_user_role ($roomid, $teacherid, 'ClassAdmin')) {
//error('liveclassroom_create_room: Cannot add classadminright to Teachers');
return false;
@@ -412,18 +435,9 @@
return false;
}
}
- //Guest enabled?
- if ((isset($attributes['guests'])) && ($attributes['guests']==1)) {
- if (! liveclassroom_api_add_user_role ($roomid, 'Guest' , 'Student')) {
- return false;
- }
- }
-
return true;
}
-
-
/**
* Return the id of liveclassroom activities in this course
* @param string the courseid
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|