Merge branch 'preprodparkur' of github.com:chamilo/chamilo-lms into preprodparkur

pull/4101/head
Julio Montoya 6 years ago
commit f5cdf49b99
  1. 8
      app/Resources/public/css/base.css
  2. 15
      main/exercise/exercise_result.php
  3. 57
      main/exercise/exercise_submit.php
  4. 1
      main/inc/lib/template.lib.php
  5. 2
      main/template/default/layout/page.tpl
  6. 2
      main/template/default/layout/show_header.tpl

@ -36,6 +36,14 @@ body {
margin-bottom: 10px; margin-bottom: 10px;
} }
body.page_origin_embeddable {
padding-top: 10px;
}
body.page_origin_embeddable #cm-content > .container {
margin-bottom: 0px;
padding-bottom: 0px;
}
.footer > .container { .footer > .container {
padding-right: 15px; padding-right: 15px;
padding-left: 15px; padding-left: 15px;

@ -89,11 +89,6 @@ if (!in_array($origin, ['learnpath', 'embeddable'])) {
// So we are not in learnpath tool // So we are not in learnpath tool
Display::display_header($nameTools, get_lang('Exercise')); Display::display_header($nameTools, get_lang('Exercise'));
} else { } else {
$htmlHeadXtra[] = "
<style>
body { background: none;}
</style>
";
Display::display_reduced_header(); Display::display_reduced_header();
} }
@ -229,7 +224,7 @@ if (!in_array($origin, ['learnpath', 'embeddable'])) {
} }
Session::write('attempt_remaining', $remainingMessage); Session::write('attempt_remaining', $remainingMessage);
showEmbeddableFinishButton(); //showEmbeddableFinishButton();
Display::display_reduced_footer(); Display::display_reduced_footer();
} else { } else {
$lp_mode = Session::read('lp_mode'); $lp_mode = Session::read('lp_mode');
@ -251,7 +246,7 @@ function showEmbeddableFinishButton()
{ {
echo '<script> echo '<script>
$(function () { $(function () {
$(\'.btn-close-quiz\').on(\'click\', function () { $(\'.btn-close-quiz\').on(\'click\', function () {
window.parent.$(\'video:not(.skip), audio:not(.skip)\').get(0).play(); window.parent.$(\'video:not(.skip), audio:not(.skip)\').get(0).play();
}); });
}); });
@ -260,12 +255,12 @@ function showEmbeddableFinishButton()
echo Display::tag( echo Display::tag(
'p', 'p',
Display::toolbarButton( Display::toolbarButton(
get_lang('EndTest'), get_lang('GoBackToVideo'),
'#', '#',
'times', 'undo',
'warning', 'warning',
['role' => 'button', 'class' => 'btn-close-quiz'] ['role' => 'button', 'class' => 'btn-close-quiz']
), ),
['class' => 'text-right'] ['class' => 'text-center']
); );
} }

@ -863,7 +863,6 @@ if (!in_array($origin, ['learnpath', 'embeddable'])) { //so we are not in learnp
Display::display_header(null, 'Exercises'); Display::display_header(null, 'Exercises');
} else { } else {
$htmlHeadXtra[] = "<style> body { background: none;} </style> ";
Display::display_reduced_header(); Display::display_reduced_header();
echo '<div style="height:10px">&nbsp;</div>'; echo '<div style="height:10px">&nbsp;</div>';
} }
@ -1039,8 +1038,8 @@ if (!empty($error)) {
echo Display::return_message($error, 'error', false); echo Display::return_message($error, 'error', false);
} else { } else {
if (!empty($exercise_sound)) { if (!empty($exercise_sound)) {
echo "<a echo "<a
href=\"../document/download.php?doc_url=%2Faudio%2F".Security::remove_XSS($exercise_sound)."\" href=\"../document/download.php?doc_url=%2Faudio%2F".Security::remove_XSS($exercise_sound)."\"
target=\"_blank\">"; target=\"_blank\">";
echo "<img src=\"../img/sound.gif\" border=\"0\" align=\"absmiddle\" alt=", get_lang('Sound')."\" /></a>"; echo "<img src=\"../img/sound.gif\" border=\"0\" align=\"absmiddle\" alt=", get_lang('Sound')."\" /></a>";
} }
@ -1094,27 +1093,27 @@ if (!empty($error)) {
elm.attachEvent(\'on\' + evType, fn); elm.attachEvent(\'on\' + evType, fn);
} else{ } else{
elm[\'on\'+evType] = fn; elm[\'on\'+evType] = fn;
} }
return; return;
} }
var calledUpdateDuration = false; var calledUpdateDuration = false;
function updateDuration() { function updateDuration() {
if (calledUpdateDuration === false) { if (calledUpdateDuration === false) {
var saveDurationUrl = "'.$saveDurationUrl.'"; var saveDurationUrl = "'.$saveDurationUrl.'";
// Logout of course just in case // Logout of course just in case
$.ajax({ $.ajax({
async: false, async: false,
url: saveDurationUrl, url: saveDurationUrl,
success: function (data) { success: function (data) {
calledUpdateDuration = true; calledUpdateDuration = true;
return; return;
}, },
}); });
return; return;
} }
} }
$(function() { $(function() {
//This pre-load the save.png icon //This pre-load the save.png icon
var saveImage = new Image(); var saveImage = new Image();
@ -1125,6 +1124,16 @@ if (!empty($error)) {
return event.keyCode != 13; return event.keyCode != 13;
}); });
$(".checkCalculatedQuestionOnEnter").keypress(function(event) {
if (event.keyCode === 13) {
event.preventDefault();
var id = $(this).attr("id");
var parts = id.split("_");
var buttonId = "button_" + parts[1];
document.getElementById(buttonId).click();
}
});
$(".main_question").mouseover(function() { $(".main_question").mouseover(function() {
//$(this).find(".exercise_save_now_button").show(); //$(this).find(".exercise_save_now_button").show();
//$(this).addClass("question_highlight"); //$(this).addClass("question_highlight");
@ -1137,7 +1146,7 @@ if (!empty($error)) {
$(".no_remind_highlight").hide(); $(".no_remind_highlight").hide();
// if the users validates the form using return key, // if the users validates the form using return key,
// prevent form action and simulates click on validation button // prevent form action and simulates click on validation button
/*$("#exercise_form").submit(function(){ /*$("#exercise_form").submit(function(){
$(".question-validate-btn").first().trigger("click"); $(".question-validate-btn").first().trigger("click");
@ -1145,10 +1154,10 @@ if (!empty($error)) {
});*/ });*/
$("form#exercise_form").prepend($("#exercise-description")); $("form#exercise_form").prepend($("#exercise-description"));
$(\'button[name="previous_question_and_save"]\').on("touchstart click", function (e) { $(\'button[name="previous_question_and_save"]\').on("touchstart click", function (e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
var var
$this = $(this), $this = $(this),
previousId = parseInt($this.data(\'prev\')) || 0, previousId = parseInt($this.data(\'prev\')) || 0,
@ -1169,7 +1178,7 @@ if (!empty($error)) {
$(\'button[name="save_now"]\').on(\'touchstart click\', function (e) { $(\'button[name="save_now"]\').on(\'touchstart click\', function (e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
var var
$this = $(this), $this = $(this),
questionId = parseInt($this.data(\'question\')) || 0, questionId = parseInt($this.data(\'question\')) || 0,
@ -1181,13 +1190,13 @@ if (!empty($error)) {
$(\'button[name="validate_all"]\').on(\'touchstart click\', function (e) { $(\'button[name="validate_all"]\').on(\'touchstart click\', function (e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
validate_all(); validate_all();
}); });
// Save attempt duration // Save attempt duration
addExerciseEvent(window, \'unload\', updateDuration , false); addExerciseEvent(window, \'unload\', updateDuration , false);
addExerciseEvent(window, \'beforeunload\', updateDuration , false); addExerciseEvent(window, \'beforeunload\', updateDuration , false);
}); });
function previous_question(question_num) { function previous_question(question_num) {
@ -1217,8 +1226,8 @@ if (!empty($error)) {
//$("#save_for_now_"+question_id).html(\''.Display::return_icon('save.png', get_lang('Saved'), [], ICON_SIZE_SMALL).'\'); //$("#save_for_now_"+question_id).html(\''.Display::return_icon('save.png', get_lang('Saved'), [], ICON_SIZE_SMALL).'\');
window.location = url; window.location = url;
} }
function redirectExerciseToResult() function redirectExerciseToResult()
{ {
window.location = "'.$script_php.'?'.$params.'"; window.location = "'.$script_php.'?'.$params.'";
} }
@ -1245,7 +1254,7 @@ if (!empty($error)) {
my_choice = $.param(my_choice); my_choice = $.param(my_choice);
} }
} }
if ($(\'input[name="remind_list[\'+question_id+\']"]\').is(\':checked\')) { if ($(\'input[name="remind_list[\'+question_id+\']"]\').is(\':checked\')) {
$("#question_div_"+question_id).addClass("remind_highlight"); $("#question_div_"+question_id).addClass("remind_highlight");
} else { } else {
@ -1255,7 +1264,7 @@ if (!empty($error)) {
// Only for the first time // Only for the first time
var dataparam = "'.$params.'&type=simple&question_id="+question_id; var dataparam = "'.$params.'&type=simple&question_id="+question_id;
dataparam += "&"+my_choice+"&"+hotspot+"&"+remind_list+"&"+my_choiceDc; dataparam += "&"+my_choice+"&"+hotspot+"&"+remind_list+"&"+my_choiceDc;
$("#save_for_now_"+question_id).html(\''. $("#save_for_now_"+question_id).html(\''.
Display::returnFontAwesomeIcon('spinner', null, true, 'fa-spin').'\'); Display::returnFontAwesomeIcon('spinner', null, true, 'fa-spin').'\');
$.ajax({ $.ajax({
@ -1266,7 +1275,7 @@ if (!empty($error)) {
success: function(return_value) { success: function(return_value) {
if (return_value == "ok") { if (return_value == "ok") {
$("#save_for_now_"+question_id).html(\''. $("#save_for_now_"+question_id).html(\''.
Display::return_icon('save.png', get_lang('Saved'), [], ICON_SIZE_SMALL).'\'); Display::return_icon('save.png', get_lang('Saved'), [], ICON_SIZE_SMALL).'\');
} else if (return_value == "error") { } else if (return_value == "error") {
$("#save_for_now_"+question_id).html(\''. $("#save_for_now_"+question_id).html(\''.
Display::return_icon('error.png', get_lang('Error'), [], ICON_SIZE_SMALL).'\'); Display::return_icon('error.png', get_lang('Error'), [], ICON_SIZE_SMALL).'\');
@ -1308,7 +1317,7 @@ if (!empty($error)) {
// 3. Hotspots. // 3. Hotspots.
var hotspot = $(\'*[name*="hotspot"]\').serialize(); var hotspot = $(\'*[name*="hotspot"]\').serialize();
// Question list. // Question list.
var question_list = ['.implode(',', $questionList).']; var question_list = ['.implode(',', $questionList).'];
var free_answers = {}; var free_answers = {};
@ -1361,7 +1370,7 @@ if (!empty($error)) {
<input type="hidden" name="origin" value="'.$origin.'" /> <input type="hidden" name="origin" value="'.$origin.'" />
<input type="hidden" name="reminder" value="'.$reminder.'" /> <input type="hidden" name="reminder" value="'.$reminder.'" />
<input type="hidden" name="learnpath_id" value="'.$learnpath_id.'" /> <input type="hidden" name="learnpath_id" value="'.$learnpath_id.'" />
<input type="hidden" name="learnpath_item_id" value="'.$learnpath_item_id.'" /> <input type="hidden" name="learnpath_item_id" value="'.$learnpath_item_id.'" />
<input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id.'" />'; <input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id.'" />';
// Show list of questions // Show list of questions

@ -984,6 +984,7 @@ class Template
*/ */
public function display($template, $clearFlashMessages = true) public function display($template, $clearFlashMessages = true)
{ {
$this->assign('page_origin', api_get_origin());
$this->assign('flash_messages', Display::getFlashToString()); $this->assign('flash_messages', Display::getFlashToString());
if ($clearFlashMessages) { if ($clearFlashMessages) {

@ -9,7 +9,7 @@
{% include 'layout/head.tpl'|get_template %} {% include 'layout/head.tpl'|get_template %}
{% endblock %} {% endblock %}
</head> </head>
<body> <body class="{{ 'page_origin' ? ('page_origin_' ~ page_origin) : '' }}">
<!-- START MAIN --> <!-- START MAIN -->
<main id="main" dir="{{ text_direction }}" class="{{ section_name }} {{ login_class }}"> <main id="main" dir="{{ text_direction }}" class="{{ section_name }} {{ login_class }}">
<noscript>{{ "NoJavascript"|get_lang }}</noscript> <noscript>{{ "NoJavascript"|get_lang }}</noscript>

@ -9,7 +9,7 @@
{% include 'layout/head.tpl'|get_template %} {% include 'layout/head.tpl'|get_template %}
{% endblock %} {% endblock %}
</head> </head>
<body> <body class="{{ 'page_origin' ? ('page_origin_' ~ page_origin) : '' }}">
<!-- START MAIN --> <!-- START MAIN -->
<main id="main" dir="{{ text_direction }}" class="{{ section_name }} {{ login_class }}"> <main id="main" dir="{{ text_direction }}" class="{{ section_name }} {{ login_class }}">

Loading…
Cancel
Save