Fixes double onclick jquery binding

skala
Julio Montoya 14 years ago
parent eae5daa508
commit 003ec87d71
  1. 89
      main/course_progress/index.php
  2. 4
      main/inc/lib/thematic.lib.php

@ -80,45 +80,12 @@ $default_thematic_plan_title = $thematic->get_default_thematic_plan_title();
$htmlHeadXtra[] = api_get_jquery_ui_js(); $htmlHeadXtra[] = api_get_jquery_ui_js();
$htmlHeadXtra[] = '<script language="javascript"> // Only when I see the 3 columns. Avoids double or triple click binding for onclick event
function datetime_by_attendance(selected_value) { if ($action == 'thematic_details') {
$.ajax({ $htmlHeadXtra[] = '<script language="javascript">
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {},
type: "POST",
url: "'.api_get_path(WEB_AJAX_PATH).'thematic.ajax.php?a=get_datetime_by_attendance",
data: "attendance_id="+selected_value+"&thematic_advance_id='.$thematic_id.'",
success: function(datos) {
$("#div_datetime_attendance").html(datos);
}
});
}
$(document).ready(function() {
$(".thematic_advance_actions, .thematic_tools ").hide();
$(".thematic_content").mouseover(function() {
var id = parseInt(this.id.split("_")[3]);
$("#thematic_id_content_"+id ).show();
});
$(".thematic_content").mouseleave(function() {
var id = parseInt(this.id.split("_")[3]);
$("#thematic_id_content_"+id ).hide();
});
$(".thematic_advance_content").mouseover(function() {
var id = parseInt(this.id.split("_")[4]);
$("#thematic_advance_tools_"+id ).show();
});
$(".thematic_advance_content").mouseleave(function() {
var id = parseInt(this.id.split("_")[4]);
$("#thematic_advance_tools_"+id ).hide();
});
$(document).ready(function() {
//Second col //Second col
$(".thematic_plan_opener").live("click", function() { $(".thematic_plan_opener").live("click", function() {
@ -177,10 +144,10 @@ $(document).ready(function() {
// Third col // Third col
$(".thematic_advanced_opener, .thematic_advanced_add_opener").live("click", function() { $(".thematic_advanced_opener, .thematic_advanced_add_opener").click(function() {
var url = this.href; var url = this.href;
var my_class = this.className; var my_class = this.className;
var dialog = $("#dialog"); var dialog = $("#dialog")
if ($("#dialog").length == 0) { if ($("#dialog").length == 0) {
dialog = $(\'<div id="dialog" style="display:hidden"></div> \').appendTo(\'body\'); dialog = $(\'<div id="dialog" style="display:hidden"></div> \').appendTo(\'body\');
} }
@ -225,6 +192,50 @@ $(document).ready(function() {
//prevent the browser to follow the link //prevent the browser to follow the link
return false; return false;
}); });
});
</script>';
}
$htmlHeadXtra[] = '<script language="javascript">
function datetime_by_attendance(selected_value) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {},
type: "POST",
url: "'.api_get_path(WEB_AJAX_PATH).'thematic.ajax.php?a=get_datetime_by_attendance",
data: "attendance_id="+selected_value+"&thematic_advance_id='.$thematic_id.'",
success: function(datos) {
$("#div_datetime_attendance").html(datos);
}
});
}
$(document).ready(function() {
$(".thematic_advance_actions, .thematic_tools ").hide();
$(".thematic_content").mouseover(function() {
var id = parseInt(this.id.split("_")[3]);
$("#thematic_id_content_"+id ).show();
});
$(".thematic_content").mouseleave(function() {
var id = parseInt(this.id.split("_")[3]);
$("#thematic_id_content_"+id ).hide();
});
$(".thematic_advance_content").mouseover(function() {
var id = parseInt(this.id.split("_")[4]);
$("#thematic_advance_tools_"+id ).show();
});
$(".thematic_advance_content").mouseleave(function() {
var id = parseInt(this.id.split("_")[4]);
$("#thematic_advance_tools_"+id ).hide();
});
}); });

@ -4,9 +4,7 @@
/** /**
* This file contains class used like library, provides functions for thematic option inside attendance tool. It's also used like model to thematic_controller (MVC pattern) * This file contains class used like library, provides functions for thematic option inside attendance tool. It's also used like model to thematic_controller (MVC pattern)
* @author Christian Fasanando <christian1827@gmail.com> * @author Christian Fasanando <christian1827@gmail.com>
* @author Julio Montoya <gugli100@gmail.com> SQL fixes, * @author Julio Montoya <gugli100@gmail.com> SQL fixes
* By the way there are 3 tables that are mixed,
* there should be 3 different classes Thematic, ThematicAdvanced and Thematic plan and a controller
* @package chamilo.course_progress * @package chamilo.course_progress
*/ */

Loading…
Cancel
Save