Integration the glossary tool in extra tools

skala
Isaac Flores 15 years ago
parent 8cbb50c4e4
commit 11657a482b
  1. 8
      main/exercice/exercice_submit.php
  2. 14
      main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js
  3. 64
      main/inc/lib/javascript/glossary.js
  4. 6
      main/install/dokeos_main.sql
  5. 4
      main/install/migrate-db-1.8.6.1-1.8.6.2-pre.sql
  6. 81
      main/newscorm/scorm_api.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[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/glossary.js" type="text/javascript" language="javascript"></script>'; //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')) . '<a href="exercise_admin.php?modifyExercise=yes&exerciseId=' . $objExercise->id . '">' . get_lang('ModifyExercise') . '</a>';
echo '</div>';
}
echo '<div class="glossary-content">';
$exerciseTitle = api_parse_tex($exerciseTitle);
echo "<h3>" . $exerciseTitle . "</h3>";
@ -1111,6 +1114,7 @@ if ($_configuration['live_exercise_tracking'] == true && $exerciseFeedbackType !
if ($origin != 'learnpath') {
//so we are not in learnpath tool
echo '</div>'; //End glossary div
Display :: display_footer();
} else {
echo '</body></html>';

@ -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<data_terms.length;i++) {
specific_terms=data_terms[i].split("__|__|");
var my_specific_terms = new RegExp(specific_terms[1],"gi");
new_html=my_text.replace(my_specific_terms,"<a href=\"javascript:void(0)\" class=\"glossary-ajax\" name=\"link"+specific_terms[0]+"\" onclick=\"\">"+specific_terms[1]+"</a>");
var my_specific_terms = new RegExp('[^A-Za-z0-9/_\]('+specific_terms[1]+')',"gi");
new_html=my_text.replace(my_specific_terms,"<span class=\"glossary-ajax\" style='color:blue' name=\"link"+specific_terms[0]+"\">"+specific_terms[1]+"</span>");
$("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("<img src="+my_protocol+"//"+location.host+work_path+"/main/inc/lib/javascript/indicator.gif />"); },
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);
}
});
});

@ -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<data_terms.length;i++) {
specific_terms=data_terms[i].split("__|__|");
var my_specific_terms = new RegExp('[^A-Za-z0-9/_\]('+specific_terms[1]+')',"gi");
new_html=my_text.replace(my_specific_terms," <span class=\"glossary-ajax\" style='color:blue' name=\"link"+specific_terms[0]+"\">"+specific_terms[1]+"</span>");
$(".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 id="+div_show_id+" ><div id="+div_content_id+">&nbsp;</div></div>");
$("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("<img src="+my_protocol+"//"+location.host+work_path+"/main/inc/lib/javascript/indicator.gif />"); },
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();
});
}
});
});
});

@ -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;

@ -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

@ -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];
<?php
if (api_get_setting('show_glossary_in_extra_tools') == 'true') {
?>
attach_glossary_into_scorm();
<?php
}
?>
});
});
@ -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<data_terms.length;i++) {
specific_terms=data_terms[i].split("__|__|");
var my_specific_terms = new RegExp('[^A-Za-z0-9/_\]('+specific_terms[1]+')',"gi");
new_html=my_text.replace(my_specific_terms," <span style='color:blue' class=\"glossary-ajax\" name=\"link"+specific_terms[0]+"\" >"+specific_terms[1]+"</span>");
$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("<div id="+div_show_id+" ><div id="+div_content_id+">&nbsp;</div></div>");
$("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("<img src="+my_protocol+"//"+location.host+work_path+"/main/inc/lib/javascript/indicator.gif />"); },
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();
});
}
});
}
Loading…
Cancel
Save