Fix glossary see BT#8187

1.10.x
Julio Montoya 10 years ago
parent bd813eadfb
commit 02af48d402
  1. 9
      app/Resources/public/css/themes/chamilo/default.css
  2. 42
      main/document/showinframes.php
  3. 6
      main/exercice/exercise_submit.php
  4. 2
      main/glossary/glossary.js.php
  5. 4
      main/inc/lib/template.lib.php
  6. 3
      main/newscorm/scorm_api.php
  7. 56
      main/template/default/glossary/glossary_auto.js.tpl
  8. 59
      main/template/default/glossary/glossary_manual.js.tpl

@ -192,13 +192,6 @@ a:focus {
background: #ECF0F1;
border-color: #ECF0F1;
}
.ui-widget-content{
border-color: #ECF0F1;
}
.ui-widget-header{
border: none;
background: transparent;
}
/* End Jquery UI */
footer{
background-color:#2C3E50;
@ -230,4 +223,4 @@ footer a{
}
.navbar-default .navbar-toggle:focus, .navbar-default .navbar-toggle:hover{
background-color: #00677C;
}
}

@ -161,34 +161,20 @@ if ($is_courseAdmin) {
}
$js_glossary_in_documents = '';
if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
$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_jquery_web_path().'"},
{type:"script", id:"_fr4", src:"'.api_get_path(WEB_PATH).'web/assets/jquery-ui/jquery-ui.min.js"},
{type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_PATH).'web/assets/jquery-ui/themes/smoothness/jquery-ui.min.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 = '
$.frameReady(function(){
// $("<div>I am a div courses</div>").prependTo("body");
}, "top.mainFrame",
{
load: [
{ type:"script", id:"_fr1", src:"'.api_get_jquery_web_path().'"},
{ type:"script", id:"_fr4", src:"'.api_get_path(WEB_PATH).'web/assets/jquery-ui/jquery-ui.min.js"},
{ type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_PATH).'web/assets/jquery-ui/themes/smoothness/jquery-ui.min.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"}
]
});';
}
$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_jquery_web_path().'"},
{ type:"script", id:"_fr4", src:"'.api_get_path(WEB_PATH).'web/assets/jquery-ui/jquery-ui.min.js"},
{ type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_PATH).'web/assets/jquery-ui/themes/smoothness/jquery-ui.min.css"},
{ type:"stylesheet", id:"_fr6", src:"'.api_get_path(WEB_PATH).'web/assets/jquery-ui/themes/smoothness/theme.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_CODE_PATH).'glossary/glossary.js.php"}
]
});';
$web_odf_supported_files = DocumentManager::get_web_odf_extension_list();
// PDF should be displayed with viewerJS

@ -46,7 +46,7 @@ if ($origin == 'learnpath') {
$showGlossary = in_array($glossaryExtraTools, array('true', 'lp', 'exercise_and_lp'));
}
if ($showGlossary) {
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'glossary/glossary.js.php"></script>';
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'glossary/glossary.js.php?add_ready=1"></script>';
$htmlHeadXtra[] = api_get_js('jquery.highlight.js');
}
@ -54,8 +54,8 @@ $htmlHeadXtra[] = api_get_js('jquery.jsPlumb.all.js');
$htmlHeadXtra[] = api_get_js('d3/jquery.xcolor.js');
//This library is necessary for the time control feature
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/stylesheet/jquery.epiclock.css');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css');
//tmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/stylesheet/jquery.epiclock.css');
//$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.dateformat.min.js');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');
$htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');

@ -10,5 +10,7 @@ if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
$templateName = 'glossary/glossary_manual.js.tpl';
}
$addReady = isset($_GET['add_ready']) ? true : false;
$tpl->assign('add_ready', $addReady);
$contentTemplate = $tpl->get_template($templateName);
$tpl->display($contentTemplate);

@ -623,11 +623,11 @@ class Template
$isoCode = api_get_language_isocode();
$bowerJsFiles = [
'bootstrap/dist/js/bootstrap.min.js',
'modernizr/modernizr.js',
'jquery/dist/jquery.min.js',
'moment/min/moment-with-locales.min.js',
'bootstrap/dist/js/bootstrap.min.js',
'jquery-ui/jquery-ui.min.js',
'moment/min/moment-with-locales.min.js',
'ckeditor/ckeditor.js',
'bootstrap-daterangepicker/daterangepicker.js',
'jquery-timeago/jquery.timeago.js',

@ -2025,8 +2025,6 @@ function attach_glossary_into_scorm(type) {
}
var complex_array = new Array();
//$("iframe").contents().find("body .glossary-ajax").on("click", ".glossary-ajax", function() {
$("iframe").contents().find("body").on("click", ".glossary-ajax", function() {
div_show_id="div_show_id";
@ -2046,7 +2044,6 @@ function attach_glossary_into_scorm(type) {
var extra_left = 0;
}
//$("#"+div_show_id).dialog("destroy");
show_dialog.dialog({
autoOpen: false,
width: 600,

@ -1,10 +1,16 @@
{% if add_ready %}
$(document).ready(function() {
$(window).load(function () {
{% endif %}
var my_text = $(".glossary-content").html();
var ajaxRequestUrl = "{{ _p.web }}main/glossary/glossary_ajax_request.php";
var imageSource = "{{ _p.web }}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",
@ -12,13 +18,14 @@ $(document).ready(function() {
if (datas.length==0) {
return false;
}
data_terms = datas.split("[|.|_|.|-|.|]");
// 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++) {
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];
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;
}
@ -40,41 +47,54 @@ $(document).ready(function() {
}
}
}
$('#highlight-plugin').removeHighlight().highlight(n,my_index)
$('body').removeHighlight().highlight(n, my_index);
}
}
var complex_array = new Array();
$("#highlight-plugin .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;
$(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_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();
}
});
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='{{ _p.web_main }}/inc/lib/javascript/indicator.gif' />");
$("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");
}
});
});
$("#highlight-plugin .glossary-ajax").mouseout(function(){
var current_element = $(this);
div_show_id=current_element.find("div").attr("id");
$("div#"+div_show_id).remove();
});
}
});
{% if add_ready %}
});
});
{% endif %}

@ -2,38 +2,47 @@ var ajaxRequestUrl = "{{ _p.web }}main/glossary/glossary_ajax_request.php";
var imageSource = "{{ _p.web_main }}" + "inc/lib/javascript/indicator.gif";
var indicatorImage ='<img src="' + imageSource + '" />';
{% if add_ready %}
$(document).ready(function() {
$('html').on('mouseup', function(e) {
if(!$(e.target).closest('.popover').length) {
$('.popover').each(function(){
$(this.previousSibling).popover('hide');
});
}
});
$(".glossary").attr('data-toggle', 'popover');
$(".glossary").popover({
'content': '{{ 'Loading' | get_lang }}',
'html' : true
});
{% endif %}
$("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 thisLink = $(this);
var $target = $(this);
$.ajax({
contentType: "application/x-www-form-urlencoded",
type: "POST",
url: ajaxRequestUrl,
data: "glossary_name="+is_glossary_name,
success: function(data) {
thisLink.attr('data-title', is_glossary_name).data('bs.popover');
var popover = thisLink.attr('data-content',data).data('bs.popover');
popover.setContent();
popover.$tip.addClass(popover.options.placement);
//$("#"+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");
}
});
});
{% if add_ready %}
});
{% endif %}

Loading…
Cancel
Save