Fix glossary ajax URLs see BT#8187

1.9.x
Julio Montoya 11 years ago
parent bce902b285
commit 148399581c
  1. 46
      main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js
  2. 22
      main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_manual.js

@ -5,33 +5,35 @@
* document/showinframes.php * document/showinframes.php
* newscorm/lp_view.php * newscorm/lp_view.php
* newscorm/scorm_api.php * newscorm/scorm_api.php
* *
*/ */
/*$(document).ready(function() { /*$(document).ready(function() {
$(window).load(function() { $(window).load(function() {
*/ */
my_protocol = location.protocol; my_protocol = location.protocol;
my_pathname=location.pathname; my_pathname=location.pathname;
work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/')); work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));
var glossaryAjaxUrl = my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php";
var mainUrl = my_protocol+"//"+location.host+work_path+"/main/";
$.ajax({ $.ajax({
contentType: "application/x-www-form-urlencoded", contentType: "application/x-www-form-urlencoded",
beforeSend: function(content_object) {}, beforeSend: function(content_object) {},
type: "POST", type: "POST",
url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php", url: glossaryAjaxUrl,
data: "glossary_data=true", data: "glossary_data=true",
success: function(datas) { success: function(datas) {
if (datas.length==0) { if (datas.length==0) {
return false; return false;
} }
// glossary terms // glossary terms
data_terms=datas.split("[|.|_|.|-|.|]"); data_terms=datas.split("[|.|_|.|-|.|]");
var complex_array = new Array(); var complex_array = new Array();
var cp_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("__|__|"); specific_terms=data_terms[i].split("__|__|");
var real_term = specific_terms[1]; // glossary term var real_term = specific_terms[1]; // glossary term
var real_code = specific_terms[0]; // glossary id var real_code = specific_terms[0]; // glossary id
complex_array[real_code] = real_term; complex_array[real_code] = real_term;
cp_complex_array[real_code] = real_term; cp_complex_array[real_code] = real_term;
@ -55,8 +57,8 @@
} }
} }
//alert(n + ' ' + 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();
@ -67,19 +69,19 @@
//mouse on click //mouse on click
$("body").on("click", ".glossary-ajax", function(e) { $("body").on("click", ".glossary-ajax", function(e) {
random_id = Math.round(Math.random()*100); random_id = Math.round(Math.random()*100);
//div_show_id = "div_show_id"+random_id; //div_show_id = "div_show_id"+random_id;
//div_content_id = "div_content_id"+random_id; //div_content_id = "div_content_id"+random_id;
div_show_id = "div_show_id"; div_show_id = "div_show_id";
div_content_id = "div_content_id"; div_content_id = "div_content_id";
$(this).append("<div id="+div_show_id+"><div id="+div_content_id+">&nbsp;</div></div>"); $(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_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;");
var $target = $(this); var $target = $(this);
$("#"+div_show_id).dialog("destroy"); $("#"+div_show_id).dialog("destroy");
$("#"+div_show_id).dialog({ $("#"+div_show_id).dialog({
autoOpen: false, autoOpen: false,
@ -91,25 +93,25 @@
$("div#"+div_content_id).remove(); $("div#"+div_content_id).remove();
} }
}); });
notebook_id = $(this).attr("name"); notebook_id = $(this).attr("name");
data_notebook = notebook_id.split("link"); data_notebook = notebook_id.split("link");
my_glossary_id = data_notebook[1]; my_glossary_id = data_notebook[1];
$.ajax({ $.ajax({
contentType: "application/x-www-form-urlencoded", contentType: "application/x-www-form-urlencoded",
beforeSend: function(content_object) { beforeSend: function(content_object) {
$("div#"+div_content_id).html("<img src='../../../../../../../main/inc/lib/javascript/indicator.gif' />"); $("div#"+div_content_id).html("<img src='"+mainUrl+"inc/lib/javascript/indicator.gif' />");
}, },
type: "POST", type: "POST",
url: "../../../../../../../main/glossary/glossary_ajax_request.php", url: glossaryAjaxUrl,
data: "glossary_id="+my_glossary_id, data: "glossary_id="+my_glossary_id,
success: function(datas) { success: function(datas) {
$("div#"+div_content_id).html(datas); $("div#"+div_content_id).html(datas);
$("#"+div_show_id).dialog("open"); $("#"+div_show_id).dialog("open");
} }
}); });
}); });
//mouse out event //mouse out event
@ -118,18 +120,18 @@
div_show_id=current_element.find("div").attr("id"); div_show_id=current_element.find("div").attr("id");
$("div#"+div_show_id).remove(); $("div#"+div_show_id).remove();
});*/ });*/
//mouse click //mouse click
/*$("body").on("click", ".glossary-ajax", function(){ /*$("body").on("click", ".glossary-ajax", function(){
var current_element = $(this); var current_element = $(this);
div_show_id=current_element.find("div").attr("id"); div_show_id=current_element.find("div").attr("id");
$("div#"+div_show_id).remove(); $("div#"+div_show_id).remove();
});*/ });*/
} }
}); });
/* /*
}); });
});*/ });*/

@ -12,11 +12,13 @@ newscorm/scorm_api.php
// $(window).load(function () { // $(window).load(function () {
my_protocol = location.protocol; my_protocol = location.protocol;
my_pathname=location.pathname; my_pathname=location.pathname;
work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/')); work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));
var glossaryAjaxUrl = my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php";
var mainUrl = my_protocol+"//"+location.host+work_path+"/main/";
//$("body .glossary").mouseover(function(){ //$("body .glossary").mouseover(function(){
$("body").on("click", ".glossary", function() { $("body").on("click", ".glossary", function() {
is_glossary_name = $(this).html(); is_glossary_name = $(this).html();
random_id = Math.round(Math.random()*100); random_id = Math.round(Math.random()*100);
/*div_show_id="div_show_id"+random_id; /*div_show_id="div_show_id"+random_id;
@ -24,10 +26,10 @@ newscorm/scorm_api.php
div_show_id="div_show_id"; div_show_id="div_show_id";
div_content_id="div_content_id"; div_content_id="div_content_id";
$(this).append("<div id="+div_show_id+" ><div id="+div_content_id+">&nbsp;</div></div>"); $(this).append("<div id="+div_show_id+" ><div id="+div_content_id+">&nbsp;</div></div>");
var $target = $(this); var $target = $(this);
$("#"+div_show_id).dialog("destroy"); $("#"+div_show_id).dialog("destroy");
$("#"+div_show_id).dialog({ $("#"+div_show_id).dialog({
@ -42,17 +44,17 @@ newscorm/scorm_api.php
}); });
/* $("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_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;");*/
$.ajax({ $.ajax({
contentType: "application/x-www-form-urlencoded", contentType: "application/x-www-form-urlencoded",
beforeSend: function(result) { beforeSend: function(result) {
$("div#"+div_content_id).html("<img src='../../../../../../../main/inc/lib/javascript/indicator.gif' />"); $("div#"+div_content_id).html("<img src='"+mainUrl+"inc/lib/javascript/indicator.gif' />");
}, },
type: "POST", type: "POST",
url: "../../../../../../../main/glossary/glossary_ajax_request.php", url: glossaryAjaxUrl,
data: "glossary_name="+is_glossary_name, data: "glossary_name="+is_glossary_name,
success: function(data) { success: function(data) {
$("div#"+div_content_id).html(data); $("div#"+div_content_id).html(data);
@ -60,7 +62,7 @@ newscorm/scorm_api.php
} }
}); });
}); });
/* /*
$("body .glossary").mouseout(function(){ $("body .glossary").mouseout(function(){
current_element=$(this); current_element=$(this);
@ -68,6 +70,6 @@ newscorm/scorm_api.php
$("div#"+div_show_id).remove(); $("div#"+div_show_id).remove();
}); });
*/ */
// }); // });
//}); //});

Loading…
Cancel
Save