Ckeditor - fix glossary plugin manual/automatic see BT#8968

1.10.x
Julio Montoya 10 years ago
parent e1be094ad0
commit d0f400f425
  1. 54
      main/document/showinframes.php
  2. 198
      main/inc/lib/javascript/ckeditor/plugins/glossary/fck_glossary_automatic.js
  3. 110
      main/inc/lib/javascript/ckeditor/plugins/glossary/fck_glossary_manual.js
  4. 30
      main/inc/lib/javascript/glossary.js
  5. 7
      main/newscorm/scorm_api.php

@ -164,36 +164,32 @@ if ($is_courseAdmin) {
$js_glossary_in_documents = '';
if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
$js_glossary_in_documents = ' // $(document).ready(function() {
$.frameReady(function() {
// $("<div>I am a div courses</div>").prependTo("body");
}, "top.mainFrame",
{ load: [
{type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
{type:"script", id:"_fr4", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
{type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
{type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
{type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/ckeditor/plugins/glossary/fck_glossary_manual.js"}
]
}
);
//});';
$js_glossary_in_documents = '
$.frameReady(function() {
// $("<div>I am a div courses</div>").prependTo("body");
}, "top.mainFrame",
{ load: [
{type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
{type:"script", id:"_fr4", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
{type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
{type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
{type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/ckeditor/plugins/glossary/fck_glossary_manual.js"}
]
});';
} elseif (api_get_setting('show_glossary_in_documents') == 'isautomatic') {
$js_glossary_in_documents = '// $(document).ready(function() {
$.frameReady(function(){
// $("<div>I am a div courses</div>").prependTo("body");
}, "top.mainFrame",
{ load: [
{type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
{type:"script", id:"_fr4", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
{type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
{type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
{type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/plugins/glossary/fck_glossary_automatic.js"}
]
}
);
// });';
$js_glossary_in_documents = '
$.frameReady(function(){
// $("<div>I am a div courses</div>").prependTo("body");
}, "top.mainFrame",
{
load: [
{ type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
{ type:"script", id:"_fr4", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
{ type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
{ type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
{ type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/ckeditor/plugins/glossary/fck_glossary_automatic.js"}
]
});';
}
$web_odf_supported_files = DocumentManager::get_web_odf_extension_list();

@ -1,135 +1,103 @@
/**
* Makes posible to load glossary items from the Glossary Tool
* Makes possible to load glossary items from the Glossary Tool
* This library will be loaded in:
*
* document/showinframes.php
* newscorm/lp_view.php
* newscorm/scorm_api.php
*
*
*/
/*$(document).ready(function() {
$(window).load(function() {
*/
my_protocol = location.protocol;
my_pathname=location.pathname;
work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));
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;
}
// glossary terms
data_terms=datas.split("[|.|_|.|-|.|]");
var complex_array = new Array();
var cp_complex_array = new Array();
for(i=0;i<data_terms.length;i++) {
specific_terms=data_terms[i].split("__|__|");
var real_term = specific_terms[1]; // glossary term
var real_code = specific_terms[0]; // glossary id
complex_array[real_code] = real_term;
cp_complex_array[real_code] = real_term;
}
var ajaxRequestUrl = my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php";
var imageSource = my_protocol+"//"+location.host+work_path+"/main/inc/lib/javascript/indicator.gif";
var indicatorImage ='<img src="' + imageSource + '" />';
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(content_object) {},
type: "POST",
url: ajaxRequestUrl,
data: "glossary_data=true",
success: function(datas) {
if (datas.length==0) {
return false;
}
// glossary terms
data_terms=datas.split("[|.|_|.|-|.|]");
var complex_array = new Array();
var cp_complex_array = new Array();
for(i=0;i<data_terms.length;i++) {
specific_terms=data_terms[i].split("__|__|");
var real_term = specific_terms[1]; // glossary term
var real_code = specific_terms[0]; // glossary id
complex_array[real_code] = real_term;
cp_complex_array[real_code] = real_term;
}
complex_array.reverse();
complex_array.reverse();
for (var my_index in complex_array) {
n = complex_array[my_index];
if (n == null) {
n = '';
} else {
for (var cp_my_index in cp_complex_array) {
cp_data = cp_complex_array[cp_my_index];
if (cp_data == null) {
cp_data = '';
} else {
if (cp_data == n) {
my_index = cp_my_index;
}
for (var my_index in complex_array) {
n = complex_array[my_index];
if (n == null) {
n = '';
} else {
for (var cp_my_index in cp_complex_array) {
cp_data = cp_complex_array[cp_my_index];
if (cp_data == null) {
cp_data = '';
} else {
if (cp_data == n) {
my_index = cp_my_index;
}
}
//alert(n + ' ' + my_index);
$('body').removeHighlight().highlight(n,my_index)
}
}
$('body').removeHighlight().highlight(n, my_index)
}
}
var complex_array = new Array();
var complex_array = new Array();
//mouse on click
$("body").on("click", ".glossary-ajax", function(e) {
random_id = Math.round(Math.random()*100);
div_show_id = "div_show_id";
div_content_id = "div_content_id";
//mouse over event
//$("body .glossary-ajax").mouseover(function(){
//
//mouse on click
$("body").on("click", ".glossary-ajax", function(e) {
random_id = Math.round(Math.random()*100);
//div_show_id = "div_show_id"+random_id;
//div_content_id = "div_content_id"+random_id;
div_show_id = "div_show_id";
div_content_id = "div_content_id";
$(this).append("<div id="+div_show_id+"><div id="+div_content_id+">&nbsp;</div></div>");
//$("div#"+div_show_id).attr("style","z-index:99;display:inline;float:left;position:absolute;background-color:#F2F2F2;border-bottom: 1px solid #2E2E2E;border-right: 1px solid #2E2E2E;border-left: 1px solid #2E2E2E;border-top: 1px solid #2E2E2E;color:#305582;margin-left:5px;margin-right:5px;");
//$("div#"+div_content_id).attr("style","z-index:99;background-color:#F2F2F2;color:#0B3861;margin-left:8px;margin-right:8px;margin-top:5px;margin-bottom:5px;");
var $target = $(this);
$("#"+div_show_id).dialog("destroy");
$("#"+div_show_id).dialog({
autoOpen: false,
width: 600,
height: 200,
position: { my: 'left top', at: 'right top', of: $target },
close: function(){
$("div#"+div_show_id).remove();
$("div#"+div_content_id).remove();
}
});
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='../../../../../../../main/inc/lib/javascript/indicator.gif' />");
},
type: "POST",
url: "../../../../../../../main/glossary/glossary_ajax_request.php",
data: "glossary_id="+my_glossary_id,
success: function(datas) {
$("div#"+div_content_id).html(datas);
$("#"+div_show_id).dialog("open");
}
});
$(this).append("<div id="+div_show_id+"><div id="+div_content_id+">&nbsp;</div></div>");
var $target = $(this);
$("#"+div_show_id).dialog("destroy");
$("#"+div_show_id).dialog({
autoOpen: false,
width: 600,
height: 200,
position: { my: 'left top', at: 'right top', of: $target },
close: function(){
$("div#"+div_show_id).remove();
$("div#"+div_content_id).remove();
}
});
//mouse out event
/*$("body .glossary-ajax").mouseout(function(){
var current_element = $(this);
div_show_id=current_element.find("div").attr("id");
$("div#"+div_show_id).remove();
});*/
//mouse click
/*$("body").on("click", ".glossary-ajax", function(){
var current_element = $(this);
div_show_id=current_element.find("div").attr("id");
$("div#"+div_show_id).remove();
});*/
}
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(indicatorImage);
},
type: "POST",
url: ajaxRequestUrl,
data: "glossary_id="+my_glossary_id,
success: function(datas) {
$("div#"+div_content_id).html(datas);
$("#"+div_show_id).dialog("open");
}
});
});
});*/
}
});

@ -1,73 +1,53 @@
/**
Makes posible to load glossary items from the Glossary Tool
Makes possible to load glossary items from the Glossary Tool
This library will be loaded in:
document/showinframes.php
newscorm/lp_view.php
newscorm/scorm_api.php
*/
//$(document).ready(function() {
// $(window).load(function () {
my_protocol = location.protocol;
my_pathname=location.pathname;
work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));
//$("body .glossary").mouseover(function(){
$("body").on("click", ".glossary", function() {
is_glossary_name = $(this).html();
random_id = Math.round(Math.random()*100);
/*div_show_id="div_show_id"+random_id;
div_content_id="div_content_id"+random_id;*/
div_show_id="div_show_id";
div_content_id="div_content_id";
$(this).append("<div id="+div_show_id+" ><div id="+div_content_id+">&nbsp;</div></div>");
var $target = $(this);
$("#"+div_show_id).dialog("destroy");
$("#"+div_show_id).dialog({
autoOpen: false,
width: 600,
height: 200,
position: { my: 'left top', at: 'right top', of: $target },
close: function(){
$("div#"+div_show_id).remove();
$("div#"+div_content_id).remove();
}
});
/* $("div#"+div_show_id).attr("style","z-index:99;display:inline;float:left;position:absolute;background-color:#F2F2F2;border-bottom: 1px solid #2E2E2E;border-right: 1px solid #2E2E2E;border-left: 1px solid #2E2E2E;border-top: 1px solid #2E2E2E;color:#305582;margin-left:5px;margin-right:5px;");
$("div#"+div_content_id).attr("style","z-index:99;background-color:#F2F2F2;color:#0B3861;margin-left:8px;margin-right:8px;margin-top:5px;margin-bottom:5px;");*/
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(result) {
$("div#"+div_content_id).html("<img src='../../../../../../../main/inc/lib/javascript/indicator.gif' />");
},
type: "POST",
url: "../../../../../../../main/glossary/glossary_ajax_request.php",
data: "glossary_name="+is_glossary_name,
success: function(data) {
$("div#"+div_content_id).html(data);
$("#"+div_show_id).dialog("open");
}
});
});
/*
$("body .glossary").mouseout(function(){
current_element=$(this);
div_show_id=current_element.find("div").attr("id");
$("div#"+div_show_id).remove();
});
*/
// });
//});
my_protocol = location.protocol;
my_pathname = location.pathname;
work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));
var ajaxRequestUrl = my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php";
var imageSource = my_protocol+"//"+location.host+work_path+"/main/inc/lib/javascript/indicator.gif";
var indicatorImage ='<img src="' + imageSource + '" />';
$("body").on("click", ".glossary", function() {
is_glossary_name = $(this).html();
random_id = Math.round(Math.random()*100);
div_show_id = "div_show_id";
div_content_id = "div_content_id";
$(this).append("<div id="+div_show_id+" ><div id="+div_content_id+">&nbsp;</div></div>");
var $target = $(this);
$("#"+div_show_id).dialog("destroy");
$("#"+div_show_id).dialog({
autoOpen: false,
width: 600,
height: 200,
position: { my: 'left top', at: 'right top', of: $target },
close: function(){
$("div#"+div_show_id).remove();
$("div#"+div_content_id).remove();
}
});
var indicator =
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(result) {
$("div#"+div_content_id).html(indicatorImage);
},
type: "POST",
url: ajaxRequestUrl,
data: "glossary_name="+is_glossary_name,
success: function(data) {
$("div#"+div_content_id).html(data);
$("#"+div_show_id).dialog("open");
}
});
});

@ -1,33 +1,35 @@
$(document).ready(function() {
$(window).load(function () {
var my_text=$(".glossary-content").html();
$(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/'));
var ajaxRequestUrl = my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php";
$.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",
url: ajaxRequestUrl,
data: "glossary_data=true",
success: function(datas) {
if (datas.length==0) {
return false;
}
data_terms=datas.split("[|.|_|.|-|.|]");
data_terms = datas.split("[|.|_|.|-|.|]");
var complex_array = new Array();
var cp_complex_array = new Array();
for(i=0;i<data_terms.length;i++) {
for (i=0;i<data_terms.length;i++) {
specific_terms=data_terms[i].split("__|__|");
var real_term = specific_terms[1];
var real_code = specific_terms[0];
complex_array[real_code] = real_term;
cp_complex_array[real_code] = real_term;
}
complex_array.reverse();
for (var my_index in complex_array) {
n = complex_array[my_index];
if (n == null) {
@ -43,10 +45,10 @@ $(document).ready(function() {
}
}
}
$('#highlight-plugin').removeHighlight().highlight(n,my_index)
}
$('#highlight-plugin').removeHighlight().highlight(n,my_index)
}
}
var complex_array = new Array();
$("#highlight-plugin .glossary-ajax").mouseover(function(){
random_id = Math.round(Math.random()*100);
@ -54,7 +56,7 @@ $(document).ready(function() {
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","z-index:99;display:inline;float:left;position:absolute;background-color:#F2F2F2;border-bottom: 1px solid #2E2E2E;border-right: 1px solid #2E2E2E;border-left: 1px solid #2E2E2E;border-top: 1px solid #2E2E2E;color:#305582;margin-left:5px;margin-right:5px;");
$("div#"+div_content_id).attr("style","z-index:99;background-color:#F2F2F2;color:#0B3861;margin-left:8px;margin-right:8px;margin-top:5px;margin-bottom:5px;");
$("div#"+div_content_id).attr("style","z-index:99;background-color:#F2F2F2;color:#0B3861;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];
@ -64,20 +66,20 @@ $(document).ready(function() {
$("div#"+div_content_id).html("<img src='../../../../main/inc/lib/javascript/indicator.gif' />");
},
type: "POST",
url: "../../../../main/glossary/glossary_ajax_request.php",
url: ajaxRequestUrl,
data: "glossary_id="+my_glossary_id,
success: function(datas) {
$("div#"+div_content_id).html(datas);
}
});
});
$("#highlight-plugin .glossary-ajax").mouseout(function(){
var current_element = $(this);
div_show_id=current_element.find("div").attr("id");
$("div#"+div_show_id).remove();
});
//helpers
}
});
});
});
});

@ -1972,6 +1972,7 @@ function attach_glossary_into_scorm(type) {
my_protocol = location.protocol;
my_pathname=location.pathname;
work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));
var ajaxRequestUrl = '<?php echo api_get_path(WEB_CODE_PATH).'glossary/glossary_ajax_request.php'; ?>';
if (type == 'automatic') {
$.ajax({
@ -1979,7 +1980,7 @@ function attach_glossary_into_scorm(type) {
beforeSend: function(object) {
},
type: "POST",
url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php",
url: ajaxRequestUrl,
data: "glossary_data=true",
success: function(datas) {
if (datas.length==0) {
@ -2059,7 +2060,7 @@ function attach_glossary_into_scorm(type) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
type: "POST",
url: "<?php echo api_get_path(WEB_PATH); ?>main/glossary/glossary_ajax_request.php",
url: ajaxRequestUrl,
data: "glossary_id="+my_glossary_id,
success: function(data) {
show_description.html(data);
@ -2106,7 +2107,7 @@ function attach_glossary_into_scorm(type) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
type: "POST",
url: "<?php echo api_get_path(WEB_PATH); ?>main/glossary/glossary_ajax_request.php",
url: ajaxRequestUrl,
data: "glossary_name="+is_glossary_name,
success: function(data) {
show_description.html(data);

Loading…
Cancel
Save