From 3d57af91f64620042bfc33c8ef78a46ae34e3a74 Mon Sep 17 00:00:00 2001 From: Arthur Portugal Date: Wed, 28 Oct 2009 14:27:40 -0500 Subject: [PATCH 1/3] Removed duplicated get_lang DT#5496 --- main/group/group_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/group/group_edit.php b/main/group/group_edit.php index b31793d981..7058488187 100644 --- a/main/group/group_edit.php +++ b/main/group/group_edit.php @@ -335,7 +335,7 @@ Display :: display_header($nameTools, "Group"); setDefaults($defaults); From 0d9dbbd562ea5752657a1d8421f11eb2107f18b0 Mon Sep 17 00:00:00 2001 From: Arthur Portugal Date: Wed, 28 Oct 2009 17:20:30 -0500 Subject: [PATCH 2/3] Reverted change because the first group always was hidden --- main/inc/lib/groupmanager.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/inc/lib/groupmanager.lib.php b/main/inc/lib/groupmanager.lib.php index 6d343cd857..7b60930c50 100644 --- a/main/inc/lib/groupmanager.lib.php +++ b/main/inc/lib/groupmanager.lib.php @@ -183,7 +183,7 @@ class GroupManager { } $groups = array (); - if(is_array($thisGroup = Database::fetch_array($groupList))){ + $thisGroup= array(); while ($thisGroup = Database::fetch_array($groupList)) { if ($thisGroup['category_id'] == VIRTUAL_COURSE_CATEGORY) { @@ -202,7 +202,7 @@ class GroupManager { } } $groups[] = $thisGroup; - } + } return $groups; } @@ -826,7 +826,7 @@ class GroupManager { * Retrieve all the groups where enrollment is still allowed * (reverse) ordered by the number of place available */ - echo $sql = "SELECT g.id gid, g.max_student-count(ug.user_id) nbPlaces, g.max_student + $sql = "SELECT g.id gid, g.max_student-count(ug.user_id) nbPlaces, g.max_student FROM ".$group_table." g LEFT JOIN ".$group_user_table." ug ON `g`.`id` = `ug`.`group_id` From 11657a482bfbbc2fd212149c67af87a73c2be68c Mon Sep 17 00:00:00 2001 From: Isaac Flores Date: Wed, 28 Oct 2009 17:31:45 -0500 Subject: [PATCH 3/3] Integration the glossary tool in extra tools --- main/exercice/exercice_submit.php | 8 +- .../glossary/fck_glossary_automatic.js | 14 ++-- main/inc/lib/javascript/glossary.js | 64 +++++++++++++++ main/install/dokeos_main.sql | 6 +- .../migrate-db-1.8.6.1-1.8.6.2-pre.sql | 4 + main/newscorm/scorm_api.php | 81 +++++++++++++++++++ 6 files changed, 166 insertions(+), 11 deletions(-) create mode 100644 main/inc/lib/javascript/glossary.js diff --git a/main/exercice/exercice_submit.php b/main/exercice/exercice_submit.php index 75d99803e7..e49522015b 100644 --- a/main/exercice/exercice_submit.php +++ b/main/exercice/exercice_submit.php @@ -68,7 +68,10 @@ $language_file = 'exercice'; require_once '../inc/global.inc.php'; $this_section = SECTION_COURSES; - +if (api_get_setting('show_glossary_in_extra_tools') == 'true') { + $htmlHeadXtra[] = ''; //jQuery + $htmlHeadXtra[] = ''; //Glossary + } /* ------------ ACCESS RIGHTS ------------ */ // notice for unauthorized people. api_protect_course_script(true); @@ -901,7 +904,7 @@ if (api_is_course_admin() && $origin != 'learnpath') { echo Display :: return_icon('edit.gif', get_lang('ModifyExercise')) . '' . get_lang('ModifyExercise') . ''; echo ''; } - + echo '
'; $exerciseTitle = api_parse_tex($exerciseTitle); echo "

" . $exerciseTitle . "

"; @@ -1111,6 +1114,7 @@ if ($_configuration['live_exercise_tracking'] == true && $exerciseFeedbackType ! if ($origin != 'learnpath') { //so we are not in learnpath tool + echo '
'; //End glossary div Display :: display_footer(); } else { echo ''; diff --git a/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js b/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js index 92a0f11264..a9de15c94c 100755 --- a/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js +++ b/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js @@ -6,7 +6,7 @@ $(document).ready(function() { work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/')); $.ajax({ contentType: "application/x-www-form-urlencoded", - beforeSend: function(objeto) { + beforeSend: function(content_object) { }, type: "POST", url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php", @@ -15,11 +15,11 @@ $(document).ready(function() { if (datos.length==0) { return false; } - data_terms=datos.split("[|.|_|.|-|.|]"); + data_terms=datas.split("[|.|_|.|-|.|]"); for(i=0;i"+specific_terms[1]+""); + var my_specific_terms = new RegExp('[^A-Za-z0-9/_\]('+specific_terms[1]+')',"gi"); + new_html=my_text.replace(my_specific_terms,""+specific_terms[1]+""); $("body").html(new_html); my_text=$("body").html(); } @@ -36,13 +36,13 @@ $(document).ready(function() { my_glossary_id=data_notebook[1]; $.ajax({ contentType: "application/x-www-form-urlencoded", - beforeSend: function(objeto) { + beforeSend: function(content_object) { $("div#"+div_content_id).html(""); }, type: "POST", url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php", data: "glossary_id="+my_glossary_id, - success: function(datos) { - $("div#"+div_content_id).html(datos); + success: function(datas) { + $("div#"+div_content_id).html(datas); } }); }); diff --git a/main/inc/lib/javascript/glossary.js b/main/inc/lib/javascript/glossary.js new file mode 100644 index 0000000000..41d979ba00 --- /dev/null +++ b/main/inc/lib/javascript/glossary.js @@ -0,0 +1,64 @@ +$(document).ready(function() { + $(window).load(function () { + + var my_text=$(".glossary-content").html(); + my_protocol = location.protocol; + my_pathname=location.pathname; + work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/')); + $.ajax({ + contentType: "application/x-www-form-urlencoded", + beforeSend: function(content_object) { + }, + type: "POST", + url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php", + data: "glossary_data=true", + success: function(datas) { + if (datas.length==0) { + return false; + } + data_terms=datas.split("[|.|_|.|-|.|]"); + + for(i=0;i"+specific_terms[1]+""); + $(".glossary-content").html(new_html); + my_text=$(".glossary-content").html(); + + } + + $(".glossary-content .glossary-ajax").mouseover(function(){ + random_id=Math.round(Math.random()*100); + div_show_id="div_show_id"+random_id; + div_content_id="div_content_id"+random_id; + $(this).append("
 
"); + $("div#"+div_show_id).attr("style","display:inline;float:left;position:absolute;background-color:#F5F6CE;border-bottom: 1px dashed #dddddd;border-right: 1px dashed #dddddd;border-left: 1px dashed #dddddd;border-top: 1px dashed #dddddd;color:#305582;margin-left:5px;margin-right:5px;"); + $("div#"+div_content_id).attr("style","background-color:#F5F6CE;color:#305582;margin-left:8px;margin-right:8px;margin-top:5px;margin-bottom:5px;"); + notebook_id=$(this).attr("name"); + data_notebook=notebook_id.split("link"); + my_glossary_id=data_notebook[1]; + $.ajax({ + contentType: "application/x-www-form-urlencoded", + beforeSend: function(content_object) { + $("div#"+div_content_id).html(""); }, + type: "POST", + url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php", + data: "glossary_id="+my_glossary_id, + success: function(datas) { + $("div#"+div_content_id).html(datas); + } + }); + }); + $(".glossary-content .glossary-ajax").mouseout(function(){ + var current_element, + current_element=$(this); + div_show_id=current_element.find("div").attr("id"); + $("div#"+div_show_id).remove(); + }); + + + } + + }); + }); +}); \ No newline at end of file diff --git a/main/install/dokeos_main.sql b/main/install/dokeos_main.sql index 2b58a7e80a..b7a545f8b8 100644 --- a/main/install/dokeos_main.sql +++ b/main/install/dokeos_main.sql @@ -735,6 +735,7 @@ VALUES ('search_show_unlinked_results',NULL,'radio','Search','true','SearchShowUnlinkedResultsTitle','SearchShowUnlinkedResultsComment',NULL,NULL,1), ('show_courses_descriptions_in_catalog', NULL, 'radio', 'Course', 'true', 'ShowCoursesDescriptionsInCatalogTitle', 'ShowCoursesDescriptionsInCatalogComment', NULL, NULL, 1), ('allow_coach_to_edit_course_session',NULL,'radio','Course','false','AllowCoachsToEditInsideTrainingSessions','AllowCoachsToEditInsideTrainingSessionsComment',NULL,NULL, 0), +('show_glossary_in_extra_tools', NULL, 'radio', 'Course', 'false', 'ShowGlossaryInExtraToolsTitle', 'ShowGlossaryInExtraToolsComment', NULL, NULL,1), ('dokeos_database_version', NULL, 'textfield', NULL,'1.8.6.1.8565','DokeosDatabaseVersion','',NULL,NULL,0); UNLOCK TABLES; /*!40000 ALTER TABLE settings_current ENABLE KEYS */; @@ -918,8 +919,9 @@ VALUES ('show_courses_descriptions_in_catalog', 'true', 'Yes'), ('show_courses_descriptions_in_catalog', 'false', 'No'), ('allow_coach_to_edit_course_session','true','Yes'), -('allow_coach_to_edit_course_session','false','No'); - +('allow_coach_to_edit_course_session','false','No'), +('show_glossary_in_extra_tools', 'true', 'Yes'), +('show_glossary_in_extra_tools', 'false', 'No'); UNLOCK TABLES; diff --git a/main/install/migrate-db-1.8.6.1-1.8.6.2-pre.sql b/main/install/migrate-db-1.8.6.1-1.8.6.2-pre.sql index 2c9e94d9c3..67119ed8fa 100755 --- a/main/install/migrate-db-1.8.6.1-1.8.6.2-pre.sql +++ b/main/install/migrate-db-1.8.6.1-1.8.6.2-pre.sql @@ -23,6 +23,7 @@ CREATE TABLE session_category (id int(11) NOT NULL auto_increment, name varchar( INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_coach_to_edit_course_session', NULL, 'radio', 'Course', 'false', 'AllowCoachsToEditInsideTrainingSessions', 'AllowCoachsToEditInsideTrainingSessionsComment', NULL, NULL, 0); INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable) VALUES ('show_courses_descriptions_in_catalog', NULL, 'radio', 'Course', 'true', 'ShowCoursesDescriptionsInCatalogTitle', 'ShowCoursesDescriptionsInCatalogComment', NULL, NULL, 1, 1); +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable) VALUES ('show_glossary_in_extra_tools', NULL, 'radio', 'Course', 'false', 'ShowGlossaryInExtraToolsTitle', 'ShowGlossaryInExtraToolsComment', NULL, NULL,1,0); INSERT INTO settings_options (variable, value, display_text) VALUES ('show_courses_descriptions_in_catalog', 'true', 'Yes'); INSERT INTO settings_options (variable, value, display_text) VALUES ('show_courses_descriptions_in_catalog', 'false', 'No'); @@ -30,6 +31,9 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('show_cours INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_coach_to_edit_course_session', 'true', 'Yes'); INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_coach_to_edit_course_session', 'false', 'No'); +INSERT INTO settings_options (variable, value, display_text) VALUES ('show_glossary_in_extra_tools', 'true', 'Yes'); +INSERT INTO settings_options (variable, value, display_text) VALUES ('show_glossary_in_extra_tools', 'false', 'No'); + -- xxSTATSxx -- xxUSERxx diff --git a/main/newscorm/scorm_api.php b/main/newscorm/scorm_api.php index f00c02f5f6..25f9f0fc79 100755 --- a/main/newscorm/scorm_api.php +++ b/main/newscorm/scorm_api.php @@ -184,6 +184,13 @@ $(document).ready( function() { //alert("Document title: " + $("iframe#content_id").attr('src')); info_lms_item[0]=info_lms_item[1]; info_lms_item[1]= info_lms_item[1]; + + attach_glossary_into_scorm(); + }); }); @@ -1578,3 +1585,77 @@ addEvent(window,'load',addListeners,false); if(lms_lp_type==1 || lms_item_type=='asset'){ xajax_start_timer(); } + +/** +*Allow attach the glossary terms into html document of scorm +*Added by Isaac flores +*/ +function attach_glossary_into_scorm() { + var f = $('#content_id')[0]; + + var doc = f.contentWindow ? f.contentWindow.document : + f.contentDocument ? f.contentDocument : f.document; + + var $frame_content = $('body',doc); + var my_text=$frame_content.html(); + + my_protocol = location.protocol; + my_pathname=location.pathname; + work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/')); + + $.ajax({ + contentType: "application/x-www-form-urlencoded", + beforeSend: function(objeto) { + }, + type: "POST", + url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php", + data: "glossary_data=true", + success: function(datos) { + if (datos.length==0) { + return false; + } + data_terms=datos.split("[|.|_|.|-|.|]"); + for(i=0;i"+specific_terms[1]+""); + $frame_content.html(new_html); + my_text=$frame_content.html(); + } + //mouse over event + $("iframe").contents().find('body').find('.glossary-ajax').mouseover(function(){ + random_id=Math.round(Math.random()*100); + div_show_id="div_show_id"+random_id; + div_content_id="div_content_id"+random_id; + $(this).append("
 
"); + $("iframe").contents().find('body').find("div#"+div_show_id).attr("style","display:inline;float:left;position:absolute;background-color:#F5F6CE;border-bottom: 1px dashed #dddddd;border-right: 1px dashed #dddddd;border-left: 1px dashed #dddddd;border-top: 1px dashed #dddddd;color:#305582;margin-left:5px;margin-right:5px;"); + $("iframe").contents().find('body').find("div#"+div_content_id).attr("style","background-color:#F5F6CE;color:#305582;margin-left:8px;margin-right:8px;margin-top:5px;margin-bottom:5px;"); + notebook_id=$(this).attr("name"); + data_notebook=notebook_id.split("link"); + my_glossary_id=data_notebook[1]; + $.ajax({ + contentType: "application/x-www-form-urlencoded", + beforeSend: function(objeto) { + $("iframe").contents().find('body').find("div#"+div_content_id).html(""); }, + type: "POST", + url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php", + data: "glossary_id="+my_glossary_id, + success: function(datos) { + $("iframe").contents().find('body').find("div#"+div_content_id).html(datos); + } + }); + }); + // mouse out event + $("iframe").contents().find('body').find('.glossary-ajax').mouseout(function(){ + var current_element, + current_element=$(this); + div_show_id=current_element.find("div").attr("id"); + $("iframe").contents().find('body').find("div#"+div_show_id).remove(); + }); + + + } + + }); + +} \ No newline at end of file