Add new exercise.js file loaded only in the exercise tool.

pull/3016/head
Julio Montoya 6 years ago
parent 1d879f13e6
commit 96f76b7fe4
  1. 50
      assets/css/scss/_exercise.scss
  2. 10
      assets/js/exercise.js
  3. 1
      main/exercise/exercise.class.php
  4. 5
      main/exercise/exercise_reminder.php
  5. 6
      main/exercise/exercise_report.php
  6. 6
      main/exercise/exercise_result.php
  7. 11
      main/exercise/exercise_submit.php
  8. 5
      main/exercise/overview.php
  9. 5
      main/exercise/question.class.php
  10. 6
      main/exercise/result.php
  11. 5
      main/inc/lib/api.lib.php
  12. 4
      package.json
  13. 2
      webpack.config.js
  14. 11
      yarn.lock

@ -8,4 +8,54 @@
.question_menu li {
display: inline-block;
}
/* Fixes questions list */
.question_options {
min-height: 150px;
}
.question_options label {
margin-bottom: 14px;
display: block;
font-weight: normal;
}
.question_options .radio {
min-height: 18px;
margin-left: 65px;
}
.question_options .checkbox {
margin-left: 65px;
}
.question_options .radio input[type="radio"], .question_options .checkbox input[type="checkbox"] {
float: left;
margin-left: -25px;
}
.question_options input[type="text"] {
padding: 6px 12px;
margin: 2px 2px 2px 0;
vertical-align: middle;
display: inline-block;
height: 34px;
line-height: 1.42857;
border: 1px solid #CCCCCC;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
color: #555555;
font-weight: bold;
background-color: #FCF8D6;
}
.question_options input[type="text"]:focus {
border-color: #66AFE9;
background-color: #ffffff;
outline: 0 none;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);
}

@ -0,0 +1,10 @@
import 'jsplumb';
import 'jquery-ui-touch-punch';
import 'xcolor/jquery.xcolor.js';
import '../../main/inc/lib/javascript/epiclock/javascript/jquery.dateformat.min.js';
import '../../main/inc/lib/javascript/epiclock/javascript/jquery.epiclock.js';
import '../../main/inc/lib/javascript/epiclock/renderers/minute/epiclock.minute.js';

@ -8055,7 +8055,6 @@ class Exercise
])
) {
$hide = (int) $this->getPageConfigurationAttribute('hide_expected_answer');
if ($hide === 1) {
return false;
}

@ -50,14 +50,15 @@ if ($objExercise->expired_time != 0 && !empty($clock_expired_time)) {
if ($time_control) {
// Get time left for expiring time
$time_left = api_strtotime($clock_expired_time, 'UTC') - time();
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/stylesheet/jquery.epiclock.css');
/*$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/stylesheet/jquery.epiclock.css');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.dateformat.min.js');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');
$htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');
$htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');*/
$htmlHeadXtra[] = $objExercise->showTimeControlJS($time_left);
}
$htmlHeadXtra[] = api_get_build_js('exercise.js');
$htmlHeadXtra[] = api_get_css_asset('pretty-checkbox/dist/pretty-checkbox.min.css');
$exe_id = 0;

@ -666,7 +666,7 @@ if ($is_allowedToEdit || $is_tutor) {
return "<span title=\""+tabLoginx[0]+rowObject[2]+tabLoginx[1]+"\">"+cellvalue+"</span>";
}';
}
// Autowidth
$extra_params['autowidth'] = 'true';
$extra_params['height'] = 'auto';
$extra_params['gridComplete'] = "
@ -687,10 +687,10 @@ if (typeof defaultGroupId !== 'undefined') {
defaultGroupId = Cookies.get('default_group_".$exercise_id."');
$('#gs_group_name').val(defaultGroupId);
}
if (typeof defaultGroupId !== 'undefined') {
var posted_data = $(\"#results\").jqGrid('getGridParam', 'postData');
var extraFilter = ',{\"field\":\"group_id\",\"op\":\"eq\",\"data\":\"'+ defaultGroupId +'\"}]}';
var extraFilter = ',{\"field\":\"group_id\",\"op\":\"eq\",\"data\":\"'+ defaultGroupId +'\"}]}';
var filters = posted_data.filters;
var stringObj = new String(filters);
stringObj.replace(']}', extraFilter);

@ -76,12 +76,14 @@ if (api_get_configuration_value('quiz_prevent_copy_paste')) {
}
if (!empty($objExercise->getResultAccess())) {
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css');
/*$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.dateformat.min.js');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');
$htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');
$htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');*/
}
$htmlHeadXtra[] = api_get_build_js('exercise.js');
if (!in_array($origin, ['learnpath', 'embeddable'])) {
// So we are not in learnpath tool
Display::display_header($nameTools, get_lang('Exercise'));

@ -55,15 +55,16 @@ $js = '<script>'.api_get_language_translate_html().'</script>';
$htmlHeadXtra[] = $js;
//$htmlHeadXtra[] = api_get_js('jqueryui-touch-punch/jquery.ui.touch-punch.min.js');
$htmlHeadXtra[] = api_get_js('jquery.jsPlumb.all.js');
//$htmlHeadXtra[] = api_get_js('jquery.jsPlumb.all.js');
//$htmlHeadXtra[] = api_get_js('d3/jquery.xcolor.js');
//This library is necessary for the time control feature
//tmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/stylesheet/jquery.epiclock.css');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.dateformat.min.js');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');
$htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');
//$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css');
//$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.dateformat.min.js');
//$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');
//$htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');
$htmlHeadXtra[] = api_get_build_js('exercise.js');
$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'annotation/js/annotation.js"></script>';

@ -62,14 +62,15 @@ if ($objExercise->expired_time != 0 && !empty($clock_expired_time)) {
$time_control = true;
}
$htmlHeadXtra[] = api_get_build_js('exercise.js');
if ($time_control) {
// Get time left for expiring time
$time_left = api_strtotime($clock_expired_time, 'UTC') - time();
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/stylesheet/jquery.epiclock.css');
/*$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/stylesheet/jquery.epiclock.css');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.dateformat.min.js');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');
$htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');
$htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');*/
$htmlHeadXtra[] = $objExercise->showTimeControlJS($time_left);
}

@ -974,13 +974,13 @@ abstract class Question
$this->saveCategory($categoryId);
if (!empty($exerciseId)) {
api_item_property_update(
/*api_item_property_update(
$this->course,
TOOL_QUIZ,
$id,
'QuizQuestionUpdated',
api_get_user_id()
);
);*/
}
if (api_get_setting('search_enabled') === 'true') {
$this->search_engine_edit($exerciseId);
@ -1855,7 +1855,6 @@ abstract class Question
$type = new $type[1]();
$img = $type->getTypePicture();
$explanation = get_lang($type->getExplanation());
echo '<li>';
echo '<div class="icon-image">';
$icon = '<a href="admin.php?'.api_get_cidreq().'&newQuestion=yes&answerType='.$i.'">'.

@ -59,12 +59,14 @@ $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'annotation/js/annotation.js"></script>';
if (!empty($objExercise->getResultAccess())) {
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css');
/*$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.dateformat.min.js');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');
$htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');
$htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');*/
}
$htmlHeadXtra[] = api_get_build_js('exercise.js');
if ($show_headers) {
$interbreadcrumb[] = [
'url' => 'exercise.php?'.api_get_cidreq(),

@ -7175,6 +7175,11 @@ function api_get_js($file)
return '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$file.'"></script>'."\n";
}
function api_get_build_js($file)
{
return '<script type="text/javascript" src="'.api_get_path(WEB_PUBLIC_PATH).'build/'.$file.'"></script>'."\n";
}
/**
* Returns the <script> HTML tag.
*

@ -36,13 +36,15 @@
"image-map-resizer": "^1.0.10",
"jquery-ui": "^1.12.1",
"jquery-ui-timepicker-addon": "^1.6.3",
"jquery-ui-touch-punch": "^0.2.3",
"jquery.scrollbar": "^0.2.11",
"js-cookie": "^2.2.0",
"jsplumb": "^2.6.9",
"jsplumb": "^2.12",
"linkifyjs": "^2.1.8",
"mathjax": "^2.7",
"mediaelement": "^4.2",
"mediaelement-plugins": "https://github.com/chamilo/mediaelement-plugins",
"xcolor": "https://github.com/infusion/jQuery-xcolor",
"moment": "^2.22",
"multiselect-two-sides": "^2.5.5",
"mxgraph": "^4.0",

@ -12,6 +12,8 @@ Encore
.addEntry('app', './assets/js/app.js')
.addEntry('bootstrap', './assets/js/bootstrap.js')
.addEntry('exercise', './assets/js/exercise.js')
.addEntry('free-jqgrid', './assets/js/free-jqgrid.js')
.addStyleEntry('css/app', './assets/css/app.scss')

@ -4411,6 +4411,11 @@ jquery-ui-timepicker-addon@^1.6.3:
resolved "https://registry.yarnpkg.com/jquery-ui-timepicker-addon/-/jquery-ui-timepicker-addon-1.6.3.tgz#8037c39b0b630282dd0b37dd8ad7fc5e1163377f"
integrity sha1-gDfDmwtjAoLdCzfditf8XhFjN38=
jquery-ui-touch-punch@^0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/jquery-ui-touch-punch/-/jquery-ui-touch-punch-0.2.3.tgz#eed82242733ba243f46b3e87c1841b308191da68"
integrity sha1-7tgiQnM7okP0az6HwYQbMIGR2mg=
jquery-ui@^1.12.1:
version "1.12.1"
resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.12.1.tgz#bcb4045c8dd0539c134bc1488cdd3e768a7a9e51"
@ -4527,7 +4532,7 @@ jsonfile@^4.0.0:
optionalDependencies:
graceful-fs "^4.1.6"
jsplumb@^2.6.9:
jsplumb@^2.12:
version "2.12.3"
resolved "https://registry.yarnpkg.com/jsplumb/-/jsplumb-2.12.3.tgz#acf53eb258e02e6a668e734e7a34a18d64bca466"
integrity sha512-Os14At5sSec8ZDZWVg4CIxipuK50LPAXP3QrS/ZRZjswyxme+rzHbkUURobySJoNXJSkRrGGh1THUa1w2VOuBg==
@ -8172,6 +8177,10 @@ ws@^6.2.1:
dependencies:
async-limiter "~1.0.0"
"xcolor@https://github.com/infusion/jQuery-xcolor":
version "0.0.0"
resolved "https://github.com/infusion/jQuery-xcolor#d3361b651bde8808f92c7225179d72b438af838a"
xtend@^4.0.0, xtend@~4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"

Loading…
Cancel
Save