diff --git a/main/course_progress/index.php b/main/course_progress/index.php index ff3ad54e41..fc7f22f42c 100755 --- a/main/course_progress/index.php +++ b/main/course_progress/index.php @@ -82,120 +82,81 @@ $htmlHeadXtra[] = api_get_jquery_ui_js(); // 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() { +$htmlHeadXtra[] = '<script language="javascript"> + +$(document).ready(function() { //Second col - $(".thematic_plan_opener").live("click", function() { - var url = this.href; - var dialog = $("#dialog"); - - if ($("#dialog").length == 0) { - dialog = $(\'<div id="dialog" style="display:hidden"></div> \').appendTo(\'body\'); - } + $("#add_plan").live("click", function() { + + var serialize_form_content = $("#thematic_plan_add").serialize(); + + //Getting FCK content + var oEditor = FCKeditorAPI.GetInstance("description[1]"); + content_1= oEditor.GetXHTML(true) ; + var oEditor = FCKeditorAPI.GetInstance("description[2]"); + content_2= oEditor.GetXHTML(true) ; + var oEditor = FCKeditorAPI.GetInstance("description[3]"); + content_3= oEditor.GetXHTML(true) ; + var oEditor = FCKeditorAPI.GetInstance("description[4]"); + content_4= oEditor.GetXHTML(true) ; + var oEditor = FCKeditorAPI.GetInstance("description[5]"); + content_5= oEditor.GetXHTML(true) ; + var oEditor = FCKeditorAPI.GetInstance("description[6]"); + content_6= oEditor.GetXHTML(true) ; + + $.ajax({ + type: "POST", + url: "'.api_get_path(WEB_AJAX_PATH).'thematic.ajax.php?a=save_thematic_plan", + data: "desc[1]="+content_1+"&"+"desc[2]="+content_2+"&"+"desc[3]="+content_3+"&"+"desc[4]="+content_4+"&"+"desc[5]="+content_5+"&"+"desc[6]="+content_6+"&"+serialize_form_content, + success: function(data) { + var thematic_id = $("input[name=\"thematic_id\"]").val(); + $("#thematic_plan_"+thematic_id).html(data); + $("#thematic_plan_add").html("<div class=\"confirmation-message\">'.addslashes(get_lang('Saved')).'</div>"); + + } + }); + //prevent the browser to follow the link + return false; + }); - // load remote content - dialog.load( - url, - {}, - function(responseText, textStatus, XMLHttpRequest) { - dialog.dialog({ - width: 720, - height: 550, - modal: true, - buttons: { - '.addslashes(get_lang('Save')).' : function() { - var serialize_form_content = $("#thematic_plan_add").serialize(); - - //Getting FCK content - var oEditor = FCKeditorAPI.GetInstance("description[1]"); - content_1= oEditor.GetXHTML(true) ; - var oEditor = FCKeditorAPI.GetInstance("description[2]"); - content_2= oEditor.GetXHTML(true) ; - var oEditor = FCKeditorAPI.GetInstance("description[3]"); - content_3= oEditor.GetXHTML(true) ; - var oEditor = FCKeditorAPI.GetInstance("description[4]"); - content_4= oEditor.GetXHTML(true) ; - var oEditor = FCKeditorAPI.GetInstance("description[5]"); - content_5= oEditor.GetXHTML(true) ; - var oEditor = FCKeditorAPI.GetInstance("description[6]"); - content_6= oEditor.GetXHTML(true) ; - - $.ajax({ - type: "POST", - url: "'.api_get_path(WEB_AJAX_PATH).'thematic.ajax.php?a=save_thematic_plan", - data: "desc[1]="+content_1+"&"+"desc[2]="+content_2+"&"+"desc[3]="+content_3+"&"+"desc[4]="+content_4+"&"+"desc[5]="+content_5+"&"+"desc[6]="+content_6+"&"+serialize_form_content, - success: function(data) { - var thematic_id = $("input[name=\"thematic_id\"]").val(); - $("#thematic_plan_"+thematic_id).html(data); - } - }); - dialog.dialog("close"); - } - } - }); - } - ); - //prevent the browser to follow the link - return false; - }); + // Third col - $(".thematic_advanced_opener, .thematic_advanced_add_opener").click(function() { - var url = this.href; - var my_class = this.className; - var dialog = $("#dialog") - if ($("#dialog").length == 0) { - dialog = $(\'<div id="dialog" style="display:hidden"></div> \').appendTo(\'body\'); - } - - // load remote content - dialog.load( - url, - {}, - function(responseText, textStatus, XMLHttpRequest) { - - dialog.dialog({ - width: 720, - height: 550, - modal: true, - buttons: { - '.addslashes(get_lang('Save')).' : function() { - var serialize_form_content = $("#thematic_advance").serialize(); - - //Getting FCK content - var oEditor = FCKeditorAPI.GetInstance("content"); - content = oEditor.GetXHTML(true) ; - $.ajax({ - type: "POST", - url: "'.api_get_path(WEB_AJAX_PATH).'thematic.ajax.php?a=save_thematic_advance", - data: "real_content=" + content + "&" +serialize_form_content, - success: function(data) { - var thematic_advance_id = $("input[name=\"thematic_advance_id\"]").val(); - $("#thematic_advance_"+thematic_advance_id).html(data); - - //Only refresh if the parent is to add - if (my_class == "thematic_advanced_add_opener") { - location.reload(true); - } - } - }); - dialog.dialog("close"); - } - } - }); + $("#update_button, #add_button").click(function() { + var url = this.href; + var my_id = this.id; + var serialize_form_content = $("#thematic_advance").serialize(); + + //Getting FCK content + var oEditor = FCKeditorAPI.GetInstance("content"); + content = oEditor.GetXHTML(true) ; + $.ajax({ + type: "POST", + url: "'.api_get_path(WEB_AJAX_PATH).'thematic.ajax.php?a=save_thematic_advance", + data: "real_content=" + content + "&" +serialize_form_content, + success: function(data) { + var thematic_advance_id = $("input[name=\"thematic_advance_id\"]").val(); + $("#thematic_advance_"+thematic_advance_id).html(data); + + $("#thematic_advance").html("<div class=\"confirmation-message\">'.addslashes(get_lang('Saved')).'</div>"); + + //Only refresh if the parent is to add + if (my_id == "add_button") { + location.reload(true); + } } - ); - //prevent the browser to follow the link - return false; - }); + }); + //prevent the browser to follow the link + return false; + }); + - }); - </script>'; -} +}); +</script>'; + $htmlHeadXtra[] = '<script language="javascript"> diff --git a/main/course_progress/thematic.php b/main/course_progress/thematic.php index 3cac21e686..01d7876b16 100755 --- a/main/course_progress/thematic.php +++ b/main/course_progress/thematic.php @@ -127,7 +127,7 @@ if ($action == 'thematic_list') { //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { if (api_is_allowed_to_edit(null, true)) { - echo '<div style="text-align:right"><a class="thematic_plan_opener" href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_plan_list&thematic_id='.$thematic['id'].'">'. + echo '<div style="text-align:right"><a class="thickbox" href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_plan_list&thematic_id='.$thematic['id'].'&width=700&height=500">'. Display::return_icon('edit.png', get_lang('EditThematicPlan'), array('style'=>'vertical-align:middle'),32).'</a></div><br />'; } @@ -145,7 +145,7 @@ if ($action == 'thematic_list') { //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { if (api_is_allowed_to_edit(null, true)) { //echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_advance_list&thematic_id='.$thematic['id'].'">'.Display::return_icon('edit.png',get_lang('EditThematicAdvance'),array('style'=>'vertical-align:middle'),22).'</a></div><br />'; - echo '<div style="text-align:right"><a class="thematic_advanced_add_opener" href="index.php?'.api_get_cidreq().'&action=thematic_advance_add&thematic_id='.$thematic['id'].'">'.Display::return_icon('add.png',get_lang('NewThematicAdvance'),'','32').'</a></div>'; + echo '<div style="text-align:right"><a class="thickbox" href="index.php?'.api_get_cidreq().'&action=thematic_advance_add&thematic_id='.$thematic['id'].'">'.Display::return_icon('add.png',get_lang('NewThematicAdvance'),'','32').'</a></div>'; } //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { @@ -160,7 +160,7 @@ if ($action == 'thematic_list') { $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="thickbox" 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 diff --git a/main/course_progress/thematic_advance.php b/main/course_progress/thematic_advance.php index d44bfd000e..ccc2be741f 100755 --- a/main/course_progress/thematic_advance.php +++ b/main/course_progress/thematic_advance.php @@ -76,7 +76,13 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') { //$form->addElement('textarea', 'content', get_lang('Content')); $form->addElement('html','<div class="clear" style="margin-top:50px;"></div>'); - //$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"'); + + if ($action == 'thematic_advance_add') { + $form->addElement('style_submit_button', null, get_lang('Save'), 'id="add_button" class="save"'); + } else { + $form->addElement('style_submit_button', null, get_lang('Save'), 'id="update_button" class="save"'); + } + //$form->addElement('html', '<a href="#" id="save_button" onclick="save();">Save</a>'); $default['start_date_type'] = 1; $default['custom_start_date'] = date('d-F-Y H:i',api_strtotime(api_get_local_time())); diff --git a/main/course_progress/thematic_plan.php b/main/course_progress/thematic_plan.php index bb38f153d9..3ac6cc889c 100755 --- a/main/course_progress/thematic_plan.php +++ b/main/course_progress/thematic_plan.php @@ -68,7 +68,7 @@ if ($action == 'thematic_plan_list') { } $form->setDefaults($default); } - //$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"'); + $form->addElement('style_submit_button', null, get_lang('Save'), 'id="add_plan" class="save"'); $form->display(); } else if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') { @@ -96,7 +96,7 @@ if ($action == 'thematic_plan_list') { } $form->add_textfield('title', get_lang('Title'), true, array('size'=>'50')); - $form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '80%', 'Height' => '150')); + $form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarStartExpanded'=>'false', 'ToolbarSet' => 'TrainingDescription', 'Width' => '80%', 'Height' => '150')); $form->addElement('html','<div class="clear" style="margin-top:50px;"></div>'); $form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');