diff --git a/main/auth/sso/sso_server_test.php b/main/auth/sso/sso_server_test.php
new file mode 100644
index 0000000000..728058aa38
--- /dev/null
+++ b/main/auth/sso/sso_server_test.php
@@ -0,0 +1,89 @@
+ $account['name'],
+ 'secret' => sha1($account['pass']),
+ 'master_domain' => $my_chamilo_server,
+ 'master_auth_uri' => $master_auth_uri,
+ 'lifetime' => time() + 3600,
+ 'target' => filter_xss($_GET['sso_target']),
+ );
+
+ $cookie = base64_encode(serialize($sso));
+ $url = chamilo_sso_protocol() . $master_auth_uri;
+ $params = 'sso_referer='. urlencode($url) .'&sso_cookie='. urlencode($cookie);
+ $final_url = filter_xss($_GET['sso_referer']) .'?'. $params;
+
+ //If your user exists redirect to chamilo and set the account in a session to check it later
+ $_SESSION['my_server_user_session'] = $account;
+
+ //Redirect to chamilo
+ header('Location: '.$final_url);
+ } else {
+ echo '
Wrong parameters
';
+ }
+}
+
+if (isset($_POST['logout'])) {
+ //echo do something to logout
+}
+
+function filter_xss($val) {
+ //do some cleaning
+ return $val;
+}
+
+function chamilo_sso_protocol() {
+ //get the sso_protocol from chamilo using webservices
+ return 'http://';
+}
+?>
+
+
+
\ No newline at end of file
diff --git a/main/chat/chat_functions.lib.php b/main/chat/chat_functions.lib.php
index 431ec2f7d0..f604075819 100644
--- a/main/chat/chat_functions.lib.php
+++ b/main/chat/chat_functions.lib.php
@@ -13,9 +13,9 @@ function exit_of_chat($user_id) {
$course_id = api_get_course_int_id();
$list_course = array();
$list_course = CourseManager::get_courses_list_by_user_id($user_id);
-
- $group_id = intval($_SESSION['id_group']);
- $session_id = intval($_SESSION['id_session']);
+
+ $session_id = api_get_session_id();
+ $group_id = api_get_group_id();
$extra_condition = '';
if (!empty($group_id)) {
@@ -24,11 +24,12 @@ function exit_of_chat($user_id) {
$extra_condition = api_get_session_condition($session_id);
}
$extra_condition.= " AND course_id = $course_id";
- foreach ($list_course as $courses) {
+ $tbl_chat_connected = Database::get_course_table(CHAT_CONNECTED_TABLE);
+
+ foreach ($list_course as $course) {
$response = user_connected_in_chat($user_id);
- if ($response === true) {
- $tbl_chat_connected = Database::get_course_table(CHAT_CONNECTED_TABLE);
- $sql = 'DELETE FROM '.$tbl_chat_connected.' WHERE user_id='.$user_id.$extra_condition;
+ if ($response === true) {
+ $sql = 'DELETE FROM '.$tbl_chat_connected.' WHERE c_id = '.$course['real_id'].' AND user_id='.$user_id.$extra_condition;
Database::query($sql);
}
}
@@ -43,10 +44,11 @@ function exit_of_chat($user_id) {
function user_connected_in_chat ($user_id) {
$tbl_chat_connected = Database::get_course_table(CHAT_CONNECTED_TABLE);
- $group_id = intval($_SESSION['id_group']);
- $session_id = intval($_SESSION['id_session']);
+ $session_id = api_get_session_id();
+ $group_id = api_get_group_id();
+
$user_id = intval($user_id);
- $course_id = api_get_course_int_id();
+ $course_id = api_get_course_int_id();
$extra_condition = '';
@@ -105,8 +107,9 @@ function users_list_in_chat() {
$tbl_chat_connected = Database::get_course_table(CHAT_CONNECTED_TABLE);
$course_id = api_get_course_int_id();
- $group_id = intval($_SESSION['id_group']);
- $session_id = intval($_SESSION['id_session']);
+ $session_id = api_get_session_id();
+ $group_id = api_get_group_id();
+
$extra_condition = '';
if (!empty($group_id)) {
$extra_condition = " WHERE to_group_id = '$group_id'";
@@ -120,4 +123,4 @@ function users_list_in_chat() {
$list_users_in_chat[] = $row;
}
return $list_users_in_chat;
-}
+}
\ No newline at end of file
diff --git a/main/inc/lib/javascript/skills.js b/main/inc/lib/javascript/skills.js
index 11b0d86c26..c62de3e199 100644
--- a/main/inc/lib/javascript/skills.js
+++ b/main/inc/lib/javascript/skills.js
@@ -34,7 +34,6 @@ var editEndpointOptions = {
connector:"Straight"
};
-
//Student arrows
// If user completed the skill
@@ -70,18 +69,8 @@ function cleanclass(obj) {
function open_parent(parent_id, id) {
console.log("open_parent call : id " + id + " parent_id:" + parent_id);
var numeric_parent_id = parent_id.split('_')[1];
- var numeric_id = id.split('_')[1];
-
+ var numeric_id = id.split('_')[1];
$('#'+id).css('top', '0px');
-
- // @todo move this in a function
- var final_left =0;
- var normal_width = 0;
-
- $('.skill_child').each( function(){
- normal_width = $(this).width();
- return true;
- });
load_parent(numeric_parent_id, numeric_id);
}
@@ -93,9 +82,9 @@ function open_parent(parent_id, id) {
function open_block(id, load_user_data, create_root) {
if (debug) console.log("open_block id : " + id+" load_user_data: " +load_user_data + ', create_root ' + create_root);
- var numeric_id = id.split('_')[1];
+ var numeric_id = id.split('_')[1];
- for (var i = 0; i < skills.length; i++) {
+ for (var i = 0; i < skills.length; i++) {ranc
//Remove everything except parents
if (jQuery.inArray(skills[i].element, parents) == -1) {
//if (debug) console.log('deleting this skill '+ skills[i].element + " id: " + i);
@@ -103,25 +92,7 @@ function open_block(id, load_user_data, create_root) {
jsPlumb.removeAllEndpoints(skills[i].element);
$("#"+skills[i].element).remove();
}
- }
-
- /*/Modifying current block position
- pos = $('#'+id).position();
- left_value = center_x;
-
- if (parents.length == 2) {
- top_value = space_between_blocks_y + offset_y;
- } else {
- top_value = 100;
- }
-
- jsPlumb.animate(id, { left: left_value, top:top_value }, { duration:duration_value });
-
- //Modifying root block position
- pos_parent = $('#'+parents[0]).position();
- jsPlumb.animate(parents[0], { left: center_x, top:offset_y }, { duration:duration_value });
- top_value = 2*space_between_blocks_y +offset_y ; */
-
+ }
load_children(numeric_id, 0, load_user_data, create_root);
}
@@ -129,28 +100,29 @@ function load_children(my_id, top_value, load_user_data, create_root) {
if (debug) console.log("load_children : my_id " + my_id + ", top_value:" + top_value +", load_user_data: "+load_user_data+", create_root: "+create_root);
//Fix the block vertical position
- //$('#block_'+my_id).css('top', '150px');
-
my_top_root = 150;
- my_top_children = 250;
+ my_top_children = 250;
+
+ console.log('Loading root info by ajax '+my_id);
+ var skill = null;
+ $.ajax({
+ async: false,//very important other wise it would not work
+ url: url+'&a=get_skill_info&id='+my_id,
+ success: function(json) {
+ skill = jQuery.parseJSON(json);
+ }
+ });
//Creating the root
if (create_root == 1) {
+ //Loading children for the first time
my_top_root = 0;
my_top_children = 150;
+
if (my_id == 1) {
$('#skill_tree').append('Root
');
- } else {
- console.log('Loading root info by ajax '+my_id);
- $.ajax({
- async: false,//very important other wise it would not work
- url: url+'&a=get_skill_info&id='+my_id,
- success: function(json) {
- var skill = jQuery.parseJSON(json);
- $('#skill_tree').append('' +skill.name+'
');
- console.log('Adding root block: '+my_id);
- }
- });
+ } else {
+ $('#skill_tree').append('' +skill.name+'
');
}
//Adding to the skill list
@@ -182,10 +154,28 @@ function load_children(my_id, top_value, load_user_data, create_root) {
json = result.data;
console.log('getJSON result: ' + result.success);
- //console.log('getJSON json: ' + json);
+ //console.log('getJSON json: ' + json);
+
+ //Fixing the root position in the organigram
+ var final_left =0;
+ var normal_width = 0;
+
+ $('.skill_child').each( function(){
+ normal_width = $(this).width();
+ return true;
+ });
+
+ //normal_width = $('.skill_child :first').width();
+ final_left = $('body').width() / 2 - normal_width/2;
+
+ console.log('normal_width -----> '+normal_width);
+ console.log('body.width -----> '+$('body').width());
+ console.log('final_left -----> '+final_left);
+
+ $('#block_'+my_id).css('left', final_left+'px');
$.each(json,function(i, item) {
- if (debug) console.log('Loading children: #' + item.id + " " +item.name);
+ //if (debug) console.log('Loading children: #' + item.id + " " +item.name);
//item.name = ''+item.name+'';
item.name = ''+item.name+'';
@@ -202,7 +192,13 @@ function load_children(my_id, top_value, load_user_data, create_root) {
//Fix the block vertical position
$('#block_'+item.id).css('top', my_top_children+'px');
- if (debug) console.log('Append block: '+item.id);
+ if (create_root == 0) {
+
+ }
+
+
+
+ //if (debug) console.log('Append block: '+item.id);
endpoint = jsPlumb.makeTarget("block_" + item.id, my_edit_point_options);
@@ -211,32 +207,13 @@ function load_children(my_id, top_value, load_user_data, create_root) {
skills.push({
element: "block_" + item.id, endp:endpoint
});
-
- console.log('added to array skills id: ' + item.id+" - name: "+item.name);
+ //console.log('added to array skills id: ' + item.id+" - name: "+item.name);
});
jsPlumb.draggable(jsPlumb.getSelector(".skill_child"));
//jsPlumb.draggable(jsPlumb.getSelector(".skill_root"));
- console.log('draggable');
-
- //Fixing the root position in the organigram
- var final_left =0;
- var normal_width = 0;
-
- $('.skill_child').each( function(){
- normal_width = $(this).width();
- return true;
- });
-
- //normal_width = $('.skill_child :first').width();
- final_left = $('body').width() / 2 - normal_width/2;
-
- console.log('normal_width -----> '+normal_width);
- console.log('body.width -----> '+$('body').width());
- console.log('final_left -----> '+final_left);
-
- jsPlumb.animate('block_'+my_id, { left: final_left, top:my_top_root }, { duration: 100 });
+ console.log('draggable');
console.log('setting animate for block_'+my_id);
console.log('final parents '+parents);
} //result
diff --git a/main/webservices/test.php b/main/webservices/test.php
index fa190bc2b7..b4b747a157 100644
--- a/main/webservices/test.php
+++ b/main/webservices/test.php
@@ -1,17 +1,23 @@
getError();
if ($err) {
@@ -20,34 +26,38 @@ if ($err) {
// At this point, you know the call that follows will fail
}
$response = array();
-if (!empty($_POST['function'])) {
- $response = $client->call($_POST['function']);
- echo '
#';
- print_r($response);
- echo '#
';
+if (!empty($function)) {
+ $response = $client->call($function);
+ echo '
';
+ print_r($response);
+ echo '#
';
+} else {
+ echo "empty function $function";
}
+
$list = scandir($serversys);
$scripts = array();
foreach ($list as $item) {
- if (substr($item,0,1) == '.') { continue; }
- if (substr($item,-8)=='soap.php') {
- $scripts[] = $item;
- }
+ if (substr($item,0,1) == '.') { continue; }
+ if (substr($item,-8)=='soap.php') {
+ $scripts[] = $item;
+ }
}
?>
+