From f0c4e728ba1d22eae96e67d92106b3535b8612fa Mon Sep 17 00:00:00 2001 From: baelmyhu Date: Fri, 8 Jan 2016 14:52:39 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20hotspot=20creation=20issue=20when=20relpa?= =?UTF-8?q?th=20not=20empty=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://support.chamilo.org/issues/8027 Conflicts: main/inc/lib/javascript/hotspot/js/hotspot.js --- main/exercice/exercise.class.php | 6 +++++- main/exercice/exercise_show.php | 11 +++++++---- main/exercice/export/scorm/scorm_classes.php | 4 +++- main/exercice/hotspot_admin.inc.php | 4 ++-- main/inc/lib/exercise.lib.php | 9 ++++++--- main/inc/lib/javascript/hotspot/js/hotspot.js | 10 +++++----- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index ff264a5b5d..826e46dfad 100755 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -3956,12 +3956,14 @@ class Exercise // We made an extra table for the answers if ($show_result) { + $relPath = api_get_path(REL_PATH); // if ($origin != 'learnpath') { echo ''; echo "

" . get_lang('HotSpot') . "

+
diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php index 18f0217601..44a1653e99 100755 --- a/main/exercice/exercise_show.php +++ b/main/exercice/exercise_show.php @@ -369,8 +369,8 @@ foreach ($questionList as $questionId) { $totalScore += $question_result['score']; if ($show_results) { - echo ''; - + $relPath = api_get_path(REL_PATH); + echo ''; echo " @@ -381,7 +381,8 @@ foreach ($questionList as $questionId) { questionId: $questionId, exerciseId: $id, selector: '#hotspot-solution', - for: 'solution' + for: 'solution', + relPath: '$relPath' }); }); @@ -511,6 +512,7 @@ foreach ($questionList as $questionId) { $resfree = Database::query($queryfree); $questionScore= Database::result($resfree,0,"marks"); $totalScore+=$questionScore; + $relPath = api_get_path(REL_PATH); echo ''; echo " @@ -523,7 +525,8 @@ foreach ($questionList as $questionId) { questionId: $questionId, exerciseId: $id, selector: '#hotspot-solution', - for: 'solution' + for: 'solution', + relPath: '$relPath' }); }); diff --git a/main/exercice/export/scorm/scorm_classes.php b/main/exercice/export/scorm/scorm_classes.php index 9c61b0b608..b1de5ed89f 100755 --- a/main/exercice/export/scorm/scorm_classes.php +++ b/main/exercice/export/scorm/scorm_classes.php @@ -637,6 +637,7 @@ class ScormAnswerHotspot extends Answer $canClick = true; //$tes = isset($_GET['modifyAnswers']) ? '0' : '1'; //echo $tes; + $relPath = api_get_path(REL_PATH); $html .= << @@ -646,7 +647,8 @@ class ScormAnswerHotspot extends Answer new HotspotQuestion({ questionId: {$this->questionJSId}, selector: '#hotspot-{$this->questionJSId}', - for: 'user' + for: 'user', + relPath: '$relPath' }); }); diff --git a/main/exercice/hotspot_admin.inc.php b/main/exercice/hotspot_admin.inc.php index a153e32737..f4b8b9094d 100755 --- a/main/exercice/hotspot_admin.inc.php +++ b/main/exercice/hotspot_admin.inc.php @@ -1038,14 +1038,14 @@ if ($modifyAnswers) { questionId: , selector: '#hotspot-container', for: 'admin', - relpath: '' + relPath: '' }); new HotspotQuestion({ questionId: , selector: '#hotspot-container', for: 'admin', - relpath: '' + relPath: '' }); }); diff --git a/main/inc/lib/exercise.lib.php b/main/inc/lib/exercise.lib.php index 847d5918f2..880d6eddcf 100644 --- a/main/inc/lib/exercise.lib.php +++ b/main/inc/lib/exercise.lib.php @@ -1118,6 +1118,7 @@ HTML; $questionDescription = $objQuestionTmp->selectDescription(); if ($freeze) { + $relPath = api_get_path(REL_PATH); echo " @@ -1191,7 +1193,7 @@ HOTSPOT; } $canClick = isset($_GET['editQuestion']) ? '0' : (isset($_GET['modifyAnswers']) ? '0' : '1'); - + $relPath = api_get_path(REL_PATH); $s .= "
@@ -1201,7 +1203,8 @@ HOTSPOT; questionId: $questionId, exerciseId: $exe_id, selector: '#question_div_' + $questionId + ' .hotspot-image', - for: 'user' + for: 'user', + relPath: '$relPath' }); }); diff --git a/main/inc/lib/javascript/hotspot/js/hotspot.js b/main/inc/lib/javascript/hotspot/js/hotspot.js index 8eecd7c9a3..511fcc94e6 100755 --- a/main/inc/lib/javascript/hotspot/js/hotspot.js +++ b/main/inc/lib/javascript/hotspot/js/hotspot.js @@ -1127,13 +1127,13 @@ window.HotspotQuestion = (function () { switch (config.for) { case 'admin': - xhrQuestion = $.getJSON(config.relpath + 'main/exercice/hotspot_actionscript_admin.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript_admin.as.php', { modifyAnswers: parseInt(config.questionId) }); break; case 'user': - xhrQuestion = $.getJSON(config.relpath + 'main/exercice/hotspot_actionscript.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript.as.php', { modifyAnswers: parseInt(config.questionId), exe_id: parseInt(config.exerciseId) }); @@ -1740,13 +1740,13 @@ window.DelineationQuestion = (function () { switch (config.for) { case 'admin': - xhrQuestion = $.getJSON(config.relpath + 'main/exercice/hotspot_actionscript_admin.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript_admin.as.php', { modifyAnswers: parseInt(config.questionId) }); break; case 'user': - xhrQuestion = $.getJSON(config.relpath + 'main/exercice/hotspot_actionscript.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript.as.php', { modifyAnswers: parseInt(config.questionId) }); break; @@ -1754,7 +1754,7 @@ window.DelineationQuestion = (function () { case 'solution': //no break case 'preview': - xhrQuestion = $.getJSON(config.relpath + 'main/exercice/hotspot_answers.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_answers.as.php', { modifyAnswers: parseInt(config.questionId), exe_id: parseInt(config.exerciseId) });