pull/4020/head
Julio 3 years ago
commit 81826c90e2
  1. 28
      assets/css/scss/_exercise.scss
  2. 1
      assets/js/exercise.js
  3. 2
      public/main/admin/access_urls.php
  4. 2
      public/main/admin/specific_fields.php
  5. 3
      public/main/dashboard/block.class.php
  6. 7
      public/main/exercise/exercise.class.php
  7. 8
      public/main/exercise/question.class.php
  8. 3
      public/main/inc/lib/display.lib.php
  9. 10
      public/main/inc/lib/exercise.lib.php
  10. 2
      public/main/inc/lib/groupmanager.lib.php
  11. 2
      public/main/inc/lib/security.lib.php
  12. 2
      public/main/lp/learnpathItem.class.php
  13. 4
      public/main/lp/openoffice_presentation.class.php
  14. 2
      public/main/lp/openoffice_text.class.php
  15. 2
      public/main/lp/openoffice_text_document.class.php
  16. 2
      public/main/session/session_category_add.php
  17. 4
      public/main/session/session_category_edit.php
  18. 2
      public/main/session/session_category_list.php
  19. 6
      public/main/session/session_course_list.php
  20. 10
      public/main/session/session_course_user_list.php
  21. 2
      public/main/survey/survey.php
  22. 60
      public/main/template/default/exercise/submit.js.html.twig
  23. 2
      public/main/user/resume_session.php
  24. 2
      src/CourseBundle/Component/CourseCopy/CourseSelectForm.php

@ -118,19 +118,19 @@
@apply border border-gray-400 rounded-sm p-2 cursor-move bg-gray-100;
}
.question-answer__items {
&--horizontal,
&--vertical {
.question-answer {
&__items {
@apply flex gap-4;
}
&--horizontal {
@apply flex-row flex-wrap;
}
&--vertical {
@apply flex-col;
}
}
}
.droppable-item {
@apply p-2 bg-indigo-200;
@ -154,4 +154,24 @@
}
}
}
&.type-19 {
@apply mb-4;
.drag_question {
@apply relative;
.window {
@apply border rounded-md relative;
&.window_left_question {
@apply text-right p-3 pr-5;
}
&.window_right_question {
@apply p-3 pl-5;
}
}
}
}
}

@ -8,3 +8,4 @@ import '../../public/main/inc/lib/javascript/epiclock/javascript/jquery.epiclock
import '../../public/main/inc/lib/javascript/epiclock/renderers/minute/epiclock.minute.js';
import './annotation'
import '../../public/main/inc/lib/javascript/hotspot/js/hotspot.js';
import '../../public/main/inc/lib/javascript/d3/jquery.xcolor.js';

@ -172,7 +172,7 @@ foreach ($data as $row) {
"access_url_edit.php?url_id=$url_id"
);
if ('1' != $url_id) {
$actions .= '<a href="access_urls.php?action=delete_url&amp;url_id='.$url_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('Please confirm your choice'), ENT_QUOTES, $charset))."'".')) return false;">'.
$actions .= '<a href="access_urls.php?action=delete_url&amp;url_id='.$url_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('Please confirm your choice'), ENT_QUOTES))."'".')) return false;">'.
Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL).'</a>';
}
$urls[] = [$url, $description, $status, $createdAt, $actions];

@ -54,7 +54,7 @@ function edit_filter($id, $url_params, $row)
global $charset;
$return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.
Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
$return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("Please confirm your choice"), ENT_QUOTES, $charset))."'".')) return false;">'.
$return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("Please confirm your choice"), ENT_QUOTES))."'".')) return false;">'.
Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
return $return;

@ -25,8 +25,7 @@ class Block
$closeLink = '<a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\''.addslashes(
api_htmlentities(
get_lang('Please confirm your choice'),
ENT_QUOTES,
$charset
ENT_QUOTES
)
).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'">
<em class="fa fa-times"></em>

@ -9063,7 +9063,7 @@ class Exercise
'',
[
'onclick' => "javascript:if(!confirm('".addslashes(
api_htmlentities(get_lang('Are you sure to copy'), ENT_QUOTES, $charset)
api_htmlentities(get_lang('Are you sure to copy'), ENT_QUOTES)
)." ".addslashes($title)."?"."')) return false;",
'href' => 'exercise.php?'.api_get_cidreq(
).'&action=copy_exercise&sec_token='.$token.'&exerciseId='.$exerciseId,
@ -9085,8 +9085,7 @@ class Exercise
addslashes(
api_htmlentities(
get_lang('Are you sure to delete results'),
ENT_QUOTES,
$charset
ENT_QUOTES
)
)." ".addslashes($title)."?"."')) return false;",
'href' => 'exercise.php?'.api_get_cidreq(
@ -9200,7 +9199,7 @@ class Exercise
'',
[
'onclick' => "javascript:if(!confirm('".addslashes(
api_htmlentities(get_lang('Are you sure to copy'), ENT_QUOTES, $charset)
api_htmlentities(get_lang('Are you sure to copy'), ENT_QUOTES)
)." ".addslashes($title)."?"."')) return false;",
'href' => 'exercise.php?'.api_get_cidreq(
).'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$exerciseId,

@ -1499,8 +1499,12 @@ abstract class Question
$explanation = $type->getExplanation();
echo '<li>';
echo '<div class="icon-image">';
$icon = '<a href="admin.php?'.api_get_cidreq().'&newQuestion=yes&answerType='.$i.'&exerciseId='.$exerciseId.'">'.
Display::return_icon($img, $explanation, null, ICON_SIZE_BIG).'</a>';
$icon = Display::url(
Display::return_icon($img, $explanation, null, ICON_SIZE_BIG),
'admin.php?'.api_get_cidreq().'&'
.http_build_query(['newQuestion' => 'yes', 'answerType' => $i, 'exerciseId' => $exerciseId]),
['title' => $explanation]
);
if (false === $objExercise->force_edit_exercise_in_lp) {
if (true == $objExercise->exercise_was_added_in_lp) {

@ -462,8 +462,7 @@ class Display
if ($filter) {
$message = api_htmlentities(
$message,
ENT_QUOTES,
api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding()
ENT_QUOTES
);
}

@ -1302,20 +1302,18 @@ HTML;
$s .= "
<script>
$(function() {
$(window).on('load', function() {
jsPlumb.connect({
MatchingDraggable.instances['$questionId'].connect({
source: 'window_$windowId',
target: 'window_{$questionId}_{$selectedIndex}_answer',
endpoint: ['Blank', {radius: 15}],
endpoint: ['Dot', {radius: 12}],
anchors: ['RightMiddle', 'LeftMiddle'],
paintStyle: {strokeStyle: '#8A8888', lineWidth: 8},
paintStyle: {stroke: '#8A8888', strokeWidth: 8},
connector: [
MatchingDraggable.connectorType,
{curvines: MatchingDraggable.curviness}
]
});
});
});
</script>
";
}
@ -1375,7 +1373,7 @@ HTML;
$isVertical = 'v' == $objQuestionTmp->extra;
$s .= "</ul></div>";
$counterAnswer = 1;
$s .= '<div class="question-answer__items--'.($isVertical ? 'vertical' : 'horizontal').'">';
$s .= '<div class="question-answer__items question-answer__items--'.($isVertical ? 'vertical' : 'horizontal').'">';
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$windowId = $questionId.'_'.$counterAnswer;

@ -2117,7 +2117,7 @@ class GroupManager
$url = api_get_path(WEB_CODE_PATH).'group/';
$confirmMessage = addslashes(
api_htmlentities(get_lang('Please confirm your choice'), ENT_QUOTES, $charset)
api_htmlentities(get_lang('Please confirm your choice'), ENT_QUOTES)
);
foreach ($groupList as $group) {

@ -459,7 +459,7 @@ class Security
if (!empty($list)) {
foreach ($list as $term) {
$term = str_replace(["\r\n", "\r", "\n", "\t"], '', $term);
$html_entities_value = api_htmlentities($term, ENT_QUOTES, api_get_system_encoding());
$html_entities_value = api_htmlentities($term, ENT_QUOTES);
$bad_terms[] = $term;
if ($term != $html_entities_value) {
$bad_terms[] = $html_entities_value;

@ -3154,7 +3154,7 @@ class learnpathItem
$new_terms_string = implode(',', $new_terms);
// TODO: Validate csv string.
$terms = Database::escape_string(api_htmlentities($new_terms_string, ENT_QUOTES, $charset));
$terms = Database::escape_string(api_htmlentities($new_terms_string, ENT_QUOTES));
$sql = "UPDATE $lp_item
SET terms = '$terms'
WHERE iid=".$this->get_id();

@ -40,7 +40,7 @@ class OpenofficePresentation extends OpenofficeDocument
list($slide_name, $file_name, $slide_body) = explode('||', $file);
// Filename is utf8 encoded, but when we decode, some chars are not translated (like quote &rsquo;).
// so we remove these chars by translating it in htmlentities and the reconvert it in want charset.
$slide_name = api_htmlentities($slide_name, ENT_COMPAT, $this->original_charset);
$slide_name = api_htmlentities($slide_name, ENT_COMPAT);
$slide_name = str_replace('&rsquo;', '\'', $slide_name);
$slide_name = api_convert_encoding($slide_name, api_get_system_encoding(), $this->original_charset);
$slide_name = api_html_entity_decode($slide_name, ENT_COMPAT, api_get_system_encoding());
@ -247,7 +247,7 @@ class OpenofficePresentation extends OpenofficeDocument
foreach ($files as $file) {
// '||' is used as separator between slide name (with accents) and file name (without accents).
list($slide_name, $file_name) = explode('||', $file);
$slide_name = api_htmlentities($slide_name, ENT_COMPAT, $this->original_charset);
$slide_name = api_htmlentities($slide_name, ENT_COMPAT);
$slide_name = str_replace('&rsquo;', '\'', $slide_name);
$slide_name = api_convert_encoding($slide_name, api_get_system_encoding(), $this->original_charset);
$slide_name = api_html_entity_decode($slide_name, ENT_COMPAT, api_get_system_encoding());

@ -57,7 +57,7 @@ class OpenofficeText extends OpenofficeDocument
// The file is utf8 encoded and it seems to make problems with special quotes.
// Then we htmlentities that, we replace these quotes and html_entity_decode that in good charset.
$charset = api_get_system_encoding();
$content = api_htmlentities($content, ENT_COMPAT, $this->original_charset);
$content = api_htmlentities($content, ENT_COMPAT);
$content = str_replace('&rsquo;', '\'', $content);
$content = api_convert_encoding($content, $charset, $this->original_charset);
$content = str_replace($this->original_charset, $charset, $content);

@ -56,7 +56,7 @@ class OpenOfficeTextDocument extends OpenofficeDocument
// The file is utf8 encoded and it seems to make problems with special quotes.
// then we htmlentities that, we replace these quotes and html_entity_decode that in good charset.
$charset = api_get_system_encoding();
$content = api_htmlentities($content, ENT_COMPAT, $this->original_charset);
$content = api_htmlentities($content, ENT_COMPAT);
$content = str_replace('&rsquo;', '\'', $content);
$content = api_convert_encoding($content, $charset, $this->original_charset);
$content = str_replace($this->original_charset, $charset, $content);

@ -73,7 +73,7 @@ if (!empty($return)) {
<label class="col-sm-3 control-label"><?php echo get_lang('Category name'); ?></label>
<div class="col-sm-6">
<input type="text" class="form-control" name="name" placeholder="<?php echo get_lang('Category'); ?>" size="50" maxlength="50" value="<?php if ($formSent) {
echo api_htmlentities($name, ENT_QUOTES, $charset);
echo api_htmlentities($name, ENT_QUOTES);
} ?>">
</div>
<div class="col-md-3"></div>

@ -93,9 +93,9 @@ if (!empty($return)) {
<label class="col-sm-3 control-label"><?php echo get_lang('Name'); ?></label>
<div class="col-sm-6">
<input class="form-control" type="text" name="name" size="50" maxlength="50" value="<?php if ($formSent) {
echo api_htmlentities($name, ENT_QUOTES, $charset);
echo api_htmlentities($name, ENT_QUOTES);
} else {
echo api_htmlentities($infos['name'], ENT_QUOTES, $charset);
echo api_htmlentities($infos['name'], ENT_QUOTES);
} ?>">
</div>
<div class="col-sm-3"></div>

@ -190,7 +190,7 @@ if (isset($_GET['search']) && 'advanced' === $_GET['search']) {
<tr class="<?php echo $i ? 'row_odd' : 'row_even'; ?>">
<td><input type="checkbox" id="idChecked_<?php echo $x; ?>" name="idChecked[]"
value="<?php echo $enreg['id']; ?>"></td>
<td><?php echo api_htmlentities($enreg['name'], ENT_QUOTES, $charset); ?></td>
<td><?php echo api_htmlentities($enreg['name'], ENT_QUOTES); ?></td>
<td><?php echo "<a href=\"session_list.php?id_category=".$enreg['id']."\">".$nb_courses
." Session(s) </a>"; ?></td>
<td><?php echo api_format_date($enreg['date_start'], DATE_FORMAT_SHORT); ?></td>

@ -62,7 +62,7 @@ $sql = "SELECT c.id, c.code, c.title, nbr_users
LIMIT $from,".($limit + 1);
$result = Database::query($sql);
$Courses = Database::store_result($result);
$tool_name = api_htmlentities($session_name, ENT_QUOTES, $charset).' : '.get_lang('Courses in this session');
$tool_name = api_htmlentities($session_name, ENT_QUOTES).' : '.get_lang('Courses in this session');
$interbreadcrumb[] = ['url' => "session_list.php", "name" => get_lang('Session list')];
$interbreadcrumb[] = ['url' => "resume_session.php?id_session=".Security::remove_XSS($_REQUEST['id_session']), "name" => get_lang('Session overview')];
@ -83,13 +83,13 @@ $tableCourses = [];
foreach ($Courses as $key => $enreg) {
$course = [];
$course[] = '<input type="checkbox" name="idChecked[]" value="'.$enreg['id'].'">';
$course[] = api_htmlentities($enreg['title'], ENT_QUOTES, $charset);
$course[] = api_htmlentities($enreg['title'], ENT_QUOTES);
$course[] = '<a href="session_course_user_list.php?id_session='.$id_session.'&course_code='.$enreg['code'].'">'.$enreg['nbr_users'].' '.get_lang('Users').'</a>';
$course[] = '<a href="'.api_get_path(WEB_COURSE_PATH).$enreg['code'].'/?id_session='.$id_session.'">'.
Display::return_icon('course_home.png', get_lang('Course')).'</a>
<a href="session_course_edit.php?id_session='.$id_session.'&page=session_course_list.php&course_code='.$enreg['code'].'">'.
Display::return_icon('edit.png', get_lang('Edit')).'</a>
<a href="'.api_get_self().'?id_session='.$id_session.'&sort='.$sort.'&action=delete&idChecked[]='.$enreg['id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("Please confirm your choice"), ENT_QUOTES, $charset)).'\')) return false;">'.
<a href="'.api_get_self().'?id_session='.$id_session.'&sort='.$sort.'&action=delete&idChecked[]='.$enreg['id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("Please confirm your choice"), ENT_QUOTES)).'\')) return false;">'.
Display::return_icon('delete.png', get_lang('Delete')).'</a>';
$tableCourses[] = $course;
}

@ -194,16 +194,16 @@ echo Display::page_header($tool_name);
<td><input type="checkbox" name="idChecked[]" value="<?php echo $enreg['user_id']; ?>"></td>
<?php if ($is_western_name_order) {
?>
<td><?php echo api_htmlentities($enreg['firstname'], ENT_QUOTES, $charset); ?></td>
<td><?php echo api_htmlentities($enreg['lastname'], ENT_QUOTES, $charset); ?></td>
<td><?php echo api_htmlentities($enreg['firstname'], ENT_QUOTES); ?></td>
<td><?php echo api_htmlentities($enreg['lastname'], ENT_QUOTES); ?></td>
<?php
} else {
?>
<td><?php echo api_htmlentities($enreg['lastname'], ENT_QUOTES, $charset); ?></td>
<td><?php echo api_htmlentities($enreg['firstname'], ENT_QUOTES, $charset); ?></td>
<td><?php echo api_htmlentities($enreg['lastname'], ENT_QUOTES); ?></td>
<td><?php echo api_htmlentities($enreg['firstname'], ENT_QUOTES); ?></td>
<?php
} ?>
<td><?php echo api_htmlentities($enreg['username'], ENT_QUOTES, $charset); ?></td>
<td><?php echo api_htmlentities($enreg['username'], ENT_QUOTES); ?></td>
<td>
<?php if ($enreg['is_subscribed']) {
?>

@ -332,7 +332,7 @@ while ($row = Database::fetch_array($result, 'ASSOC')) {
echo '<a
href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.
api_get_cidreq().'&action=delete&survey_id='.$survey_id.'&question_id='.$questionId.'"
onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurveyQuestion").'?', ENT_QUOTES, $charset)).'\')) return false;">'.
onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurveyQuestion").'?', ENT_QUOTES)).'\')) return false;">'.
Display::return_icon('delete.png', get_lang('Delete')).'</a>';
if (3 != $survey_data['survey_type']) {
if ($question_counter > 1) {

@ -87,7 +87,12 @@ var MatchingDraggable = {
curviness: 0,
connectorType: 'Straight',
initialized: false,
instances: {},
init: function (questionId) {
var instance = jsPlumb.getInstance();
MatchingDraggable.instances[questionId] = instance;
var windowQuestionSelector = '.window' + questionId + '_question',
countConnections = $(windowQuestionSelector).length,
colorArray = [],
@ -101,25 +106,17 @@ var MatchingDraggable = {
colorArrayDestination = $.xcolor.analogous("#51a351", 10);
}
jsPlumb.importDefaults({
DragOptions: {cursor: 'pointer', zIndex: 2000},
PaintStyle: {strokeStyle: '#000'},
EndpointStyle: {strokeStyle: '#316b31'},
Endpoint: 'Rectangle',
Anchors: ['TopCenter', 'TopCenter']
});
var scope = questionId + "_scope";
var exampleDropOptions = {
tolerance: 'touch',
hoverClass: 'dropHover',
activeClass: 'dragActive'
tolerance: 'touch'
};
var destinationEndPoint = {
endpoint: ["Dot", {radius: 15}],
paintStyle: {fillStyle: MatchingDraggable.colorDestination},
paintStyle: {fill: MatchingDraggable.colorDestination},
isSource: false,
connectorStyle: {strokeStyle: MatchingDraggable.colorDestination, lineWidth: 8},
connectorStyle: {stroke: MatchingDraggable.colorDestination, strokeWidth: 8},
connector: [
MatchingDraggable.connectorType,
{curviness: MatchingDraggable.curviness}
@ -127,9 +124,10 @@ var MatchingDraggable = {
maxConnections: 1000,
isTarget: true,
dropOptions: exampleDropOptions,
scope: scope,
beforeDrop: function (params) {
jsPlumb.select({source: params.sourceId}).each(function (connection) {
jsPlumb.detach(connection);
instance.select({source: params.sourceId}).each(function (connection) {
instance.detach(connection);
});
var selectId = params.sourceId + "_select";
@ -146,26 +144,18 @@ var MatchingDraggable = {
}
};
var count = 0;
var sourceDestinationArray = [];
$(windowQuestionSelector).each(function (index) {
var windowId = $(this).attr("id");
var scope = windowId + "scope";
var destinationColor = colorArray[count].getHex();
var sourceEndPoint = {
endpoint: [
"Dot",
{radius: 15}
],
paintStyle: {
fillStyle: destinationColor
fill: MatchingDraggable.colorDestination
},
isSource: true,
connectorStyle: {
strokeStyle: "#8a8888",
lineWidth: 8
stroke: "#8a8888",
strokeWidth: 8
},
connector: [
MatchingDraggable.connectorType,
@ -177,27 +167,24 @@ var MatchingDraggable = {
scope: scope
};
sourceDestinationArray[count + 1] = sourceEndPoint;
count++;
$(windowQuestionSelector).each(function (index) {
var windowId = $(this).attr("id");
sourceEndPoint.paintStyle.fill = colorArray[index].getHex();
jsPlumb.addEndpoint(
instance.addEndpoint(
windowId,
{
anchor: ['RightMiddle', 'RightMiddle', 'RightMiddle', 'RightMiddle']
},
sourceEndPoint
);
var destinationCount = 0;
});
$(windowQuestionSelector).each(function (index) {
var windowDestinationId = $(this).attr("id");
destinationEndPoint.scope = scope;
destinationEndPoint.paintStyle.fillStyle = colorArrayDestination[destinationCount].getHex();
destinationCount++;
destinationEndPoint.paintStyle.fill = colorArrayDestination[index].getHex();
jsPlumb.addEndpoint(
instance.addEndpoint(
windowDestinationId + "_answer",
{
anchors: ['LeftMiddle', 'LeftMiddle', 'LeftMiddle', 'LeftMiddle']
@ -205,7 +192,6 @@ var MatchingDraggable = {
destinationEndPoint
);
});
});
MatchingDraggable.attachBehaviour();
},
@ -218,8 +204,6 @@ var MatchingDraggable = {
jsPlumb.ready(function () {
if ($(".drag_question").length > 0) {
MatchingDraggable.init();
$(document).scroll(function () {
jsPlumb.repaintEverything();
});

@ -250,7 +250,7 @@ if ('true' === $allowTutors) {
if (!empty($user['user_id'])) {
$user_link = '<a
href="'.api_get_path(WEB_CODE_PATH).'admin/user_information.php?user_id='.intval($user['user_id']).'">'.
api_htmlentities(api_get_person_name($user['firstname'], $user['lastname']), ENT_QUOTES, $charset).' ('.$user['username'].')</a>';
api_htmlentities(api_get_person_name($user['firstname'], $user['lastname']), ENT_QUOTES).' ('.$user['username'].')</a>';
}
$link_to_add_user_in_url = '';

@ -292,7 +292,7 @@ class CourseSelectForm
<button
class="save"
type="submit"
onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('Please confirm your choice'), ENT_QUOTES, $charset))."'".')) return false;" >'.
onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('Please confirm your choice'), ENT_QUOTES))."'".')) return false;" >'.
get_lang('Validate').'</button>';
} else {
if ($recycleOption) {

Loading…
Cancel
Save