Fixes double onclick jquery binding

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

@ -78,47 +78,14 @@ if (!empty($thematic_id)) {
$default_thematic_plan_title = $thematic->get_default_thematic_plan_title();
$htmlHeadXtra[] = api_get_jquery_ui_js();
$htmlHeadXtra[] = '<script language="javascript">
$htmlHeadXtra[] = api_get_jquery_ui_js();
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();
});
// Only when I see the 3 columns. Avoids double or triple click binding for onclick event
if ($action == 'thematic_details') {
$htmlHeadXtra[] = '<script language="javascript">
$(document).ready(function() {
//Second col
$(".thematic_plan_opener").live("click", function() {
@ -177,13 +144,13 @@ $(document).ready(function() {
// Third col
$(".thematic_advanced_opener, .thematic_advanced_add_opener").live("click", function() {
var url = this.href;
$(".thematic_advanced_opener, .thematic_advanced_add_opener").click(function() {
var url = this.href;
var my_class = this.className;
var dialog = $("#dialog");
var dialog = $("#dialog")
if ($("#dialog").length == 0) {
dialog = $(\'<div id="dialog" style="display:hidden"></div> \').appendTo(\'body\');
}
}
// load remote content
dialog.load(
@ -194,9 +161,9 @@ $(document).ready(function() {
dialog.dialog({
width: 720,
height: 550,
modal: true,
modal: true,
buttons: {
'.addslashes(get_lang('Save')).' : function() {
'.addslashes(get_lang('Save')).' : function() {
var serialize_form_content = $("#thematic_advance").serialize();
//Getting FCK content
@ -215,7 +182,7 @@ $(document).ready(function() {
location.reload(true);
}
}
});
});
dialog.dialog("close");
}
}
@ -224,7 +191,51 @@ $(document).ready(function() {
);
//prevent the browser to follow the link
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();
});
});

@ -155,12 +155,12 @@ if ($action == 'thematic_list') {
$thematic_advance['start_date'] = api_get_local_time($thematic_advance['start_date']);
$thematic_advance['start_date'] = api_format_date($thematic_advance['start_date'], DATE_TIME_FORMAT_LONG);
echo '<tr>';
echo '<tr>';
echo '<td width="90%" class="thematic_advance_content" id="thematic_advance_content_id_'.$thematic_advance['id'].'">';
$edit_link = '';
if (api_is_allowed_to_edit(null, true)) {
$edit_link = '<a class="thematic_advanced_opener" href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic['id'].'&thematic_advance_id='.$thematic_advance['id'].'" >'.Display::return_icon('edit.png',get_lang('EditThematicAdvance'),array(),22).'</a>';
$edit_link = '<a class="thematic_advanced_opener" href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic['id'].'&thematic_advance_id='.$thematic_advance['id'].'" >'.Display::return_icon('edit.png',get_lang('EditThematicAdvance'),array(),22).'</a>';
$edit_link .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic['id'].'&thematic_advance_id='.$thematic_advance['id'].'">'.Display::return_icon('delete.png',get_lang('Delete'),'',22).'</a></center>';
//Links

@ -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)
* @author Christian Fasanando <christian1827@gmail.com>
* @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
* @author Julio Montoya <gugli100@gmail.com> SQL fixes
* @package chamilo.course_progress
*/

Loading…
Cancel
Save