Skip to content

Commit

Permalink
Merge pull request #676 from oat-sa/hotfix/TAO-3471-backport
Browse files Browse the repository at this point in the history
Hotfix/tao 3471 backport
  • Loading branch information
Dieter Raber authored Dec 13, 2016
2 parents be35bc7 + ba84105 commit fac862d
Show file tree
Hide file tree
Showing 16 changed files with 866 additions and 811 deletions.
14 changes: 14 additions & 0 deletions config/default/testRunner.conf.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,20 @@
*/
'test-taker-review-region' => 'left',

/**
* Show legend on review panel
*
* @type string
*/
'test-taker-review-show-legend' => true,

/**
* Show review panel open on launch
*
* @type string
*/
'test-taker-review-default-open' => true,

/**
* Forces a unique title for all test items.
* @type string
Expand Down
2 changes: 1 addition & 1 deletion manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
'label' => 'QTI test model',
'description' => 'TAO QTI test implementation',
'license' => 'GPL-2.0',
'version' => '5.38.4',
'version' => '5.38.5',
'author' => 'Open Assessment Technologies',
'requires' => array(
'taoTests' => '>=3.7.0',
Expand Down
2 changes: 2 additions & 0 deletions models/classes/runner/config/QtiRunnerConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public function getConfig()
'enabled' => !empty($rawConfig['test-taker-review']),
'scope' => isset($rawConfig['test-taker-review-scope']) ? $rawConfig['test-taker-review-scope'] : null,
'forceTitle' => !empty($rawConfig['test-taker-review-force-title']),
'showLegend' => !empty($rawConfig['test-taker-review-show-legend']),
'defaultOpen' => !empty($rawConfig['test-taker-review-default-open']),
'itemTitle' => isset($rawConfig['test-taker-review-item-title']) ? $rawConfig['test-taker-review-item-title'] : null,
'preventsUnseen' => !empty($rawConfig['test-taker-review-prevents-unseen']),
'canCollapse' => !empty($rawConfig['test-taker-review-can-collapse']),
Expand Down
14 changes: 14 additions & 0 deletions scripts/update/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -844,5 +844,19 @@ public function update($initialVersion) {
}

$this->skip('5.38.2', '5.38.4');


if ($this->isVersion('5.38.4')) {

$qtiTest = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
$config = $qtiTest->getConfig('testRunner');
$config = array_merge($config, array(
'test-taker-review-show-legend' => true,
'test-taker-review-default-open' => true,
));
$qtiTest->setConfig('testRunner', $config);

$this->setVersion('5.38.5');
}
}
}
2 changes: 1 addition & 1 deletion views/css/new-test-runner.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/css/new-test-runner.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/css/test-runner.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/css/test-runner.css.map

Large diffs are not rendered by default.

81 changes: 40 additions & 41 deletions views/js/controllers.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/controllers.min.js.map

Large diffs are not rendered by default.

1,454 changes: 726 additions & 728 deletions views/js/loader/qtiTestRunner.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/qtiTestRunner.min.js.map

Large diffs are not rendered by default.

25 changes: 21 additions & 4 deletions views/js/runner/plugins/navigation/review/navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ define([
infoFlagged: '.qti-navigator-flagged .qti-navigator-counter',
infoPanel: '.qti-navigator-info',
infoPanelLabels: '.qti-navigator-info > .qti-navigator-label',
tabInfoAll: '[data-mode="all"] .qti-navigator-counter',
tabInfoUnanswered: '[data-mode="unanswered"] .qti-navigator-counter',
tabInfoFlagged: '[data-mode="flagged"] .qti-navigator-counter',
parts: '.qti-navigator-part',
partLabels: '.qti-navigator-part > .qti-navigator-label',
sections: '.qti-navigator-section',
Expand Down Expand Up @@ -286,6 +289,8 @@ define([
this.writeCount(this.controls.$infoUnanswered, totalQuestions - progression.answered, totalQuestions);
this.writeCount(this.controls.$infoViewed, progression.viewed, this.getProgressionTotal(progression, 'total'));
this.writeCount(this.controls.$infoFlagged, progression.flagged, totalQuestions);
this.writeCount(this.controls.$infoAll, totalQuestions, null);


// rebuild the tree
if (!context.isLinear) {
Expand Down Expand Up @@ -366,11 +371,16 @@ define([
* Updates a counter
* @param {jQuery} $place
* @param {Number} count
* @param {Number} total
* @param {Number|Null} total
* @private
*/
writeCount: function writeCount($place, count, total) {
$place.text(count + '/' + total);
if($place.parent().hasClass('qti-navigator-tab')){
$place.text(count);
}
else {
$place.text(count + '/' + total);
}
},

/**
Expand Down Expand Up @@ -564,10 +574,16 @@ define([
// links the component to the underlying DOM elements
this.controls = {
// access to info panel displaying counters

$infoAnswered: $component.find(_selectors.infoAnswered),
$infoViewed: $component.find(_selectors.infoViewed),
$infoUnanswered: $component.find(_selectors.infoUnanswered),
$infoFlagged: $component.find(_selectors.infoFlagged),
$infoAll: $component.find(_selectors.tabInfoAll),
$infoUnanswered: this.config.showLegend ?
$component.find(_selectors.infoUnanswered) :
$component.find(_selectors.tabInfoUnanswered),
$infoFlagged: this.config.showLegend ?
$component.find(_selectors.infoFlagged) :
$component.find(_selectors.tabInfoFlagged),

// access to filter switches
$filterBar: $filterBar,
Expand Down Expand Up @@ -681,6 +697,7 @@ define([
self.filter(mode);
}
});

});

// set default filter
Expand Down
18 changes: 14 additions & 4 deletions views/js/runner/plugins/navigation/review/navigator.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<span class="qti-navigator-collapse icon icon-left" title="{{__ 'Collapse the review panel'}}"></span>
<span class="qti-navigator-expand icon icon-right" title="{{__ 'Expand the review panel'}}"></span>
</div>

{{#if showLegend}}
<div class="qti-navigator-info collapsible">
<span class="qti-navigator-label">
<span class="qti-navigator-text">{{__ 'Test status'}}</span>
Expand Down Expand Up @@ -41,17 +41,27 @@
</li>
</ul>
</div>
{{/if}}


<div class="qti-navigator-filters">
<ul class="plain clearfix">
<li class="qti-navigator-filter active" data-mode="all">
<span title="{{__ 'Reset filters'}}">{{__ 'All'}}</span>
<span title="{{__ 'Reset filters'}}" class="qti-navigator-tab">{{__ 'All'}}
{{#unless showLegend}}(<span class="qti-navigator-counter">0</span>){{/unless}}
</span>
</li>

<li class="qti-navigator-filter" data-mode="unanswered">
<span class="icon-unanswered" title="{{__ 'Only display the unanswered items'}}"></span>
<span class="{{#if showLegend}}icon-unanswered {{/if}}qti-navigator-tab" title="{{__ 'Only display the unanswered items'}}">
{{#unless showLegend}}{{__ 'Unanswered'}} (<span class="qti-navigator-counter">0</span>){{/unless}}
</span>
</li>

<li class="qti-navigator-filter" data-mode="flagged">
<span class="icon-flagged" title="{{__ 'Only display the items marked for review'}}"></span>
<span class="{{#if showLegend}}icon-flagged {{/if}}qti-navigator-tab" title="{{__ 'Only display the items marked for review'}}">
{{#unless showLegend}}{{__ 'Flagged'}} (<span class="qti-navigator-counter">0</span>){{/unless}}
</span>
</li>
</ul>
</div>
Expand Down
45 changes: 23 additions & 22 deletions views/js/runner/plugins/navigation/review/review.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ define([
* Tells if the component is enabled
* @returns {Boolean}
*/
function isEnabled() {
function isPluginAllowed() {
var context = testRunner.getTestContext();
return navigatorConfig.enabled && context && context.options && context.options.reviewScreen;
}
Expand Down Expand Up @@ -200,18 +200,17 @@ define([

/**
* Shows/hides the review panel
*
* @param [{Boolean} forcedState], true will show the panel
*/
function togglePanel() {
if (self.getState('enabled') !== false) {
if (self.navigator.is('hidden')) {
self.explicitlyHidden = false;
self.navigator.show();
} else {
self.explicitlyHidden = true;
self.navigator.hide();
}

updateButton(self.$toggleButton, getToggleButtonData(self.navigator));
function togglePanel(forcedState) {
var isHidden = _.isUndefined(forcedState) ? self.navigator.is('hidden') : forcedState;
if (isHidden) {
self.explicitlyHidden = false;
self.navigator.show();
} else {
self.explicitlyHidden = true;
self.navigator.hide();
}
}

Expand Down Expand Up @@ -265,17 +264,19 @@ define([
}
}

if (!isPluginAllowed()) {
this.hide();
}

//disabled by default
this.disable();

if (!isEnabled()) {
this.hide();
}
togglePanel(testConfig.review.defaultOpen);

//change plugin state
testRunner
.on('render', function () {
if (isEnabled()) {
if (isPluginAllowed()) {
self.show();
updateButton(self.$toggleButton, getToggleButtonData(self.navigator));
} else {
Expand All @@ -286,7 +287,7 @@ define([
var context = testRunner.getTestContext();
var map = testRunner.getTestMap();

if (isEnabled()) {
if (isPluginAllowed()) {
updateButton(self.$flagItemButton, getFlagItemButtonData(context));
self.navigator
.update(map, context)
Expand All @@ -300,22 +301,22 @@ define([
}
})
.on('enabletools', function () {
if (isEnabled()) {
if (isPluginAllowed()) {
self.enable();
}
})
.on('disabletools', function () {
if (isEnabled()) {
if (isPluginAllowed()) {
self.disable();
}
})
.on('tool-flagitem', function () {
if (isEnabled() && canFlag(testRunner)) {
if (isPluginAllowed() && canFlag(testRunner)) {
flagCurrentItem();
}
})
.on('tool-reviewpanel', function () {
if (isEnabled()) {
if (isPluginAllowed() && self.getState('enabled')) {
togglePanel();
}
});
Expand Down Expand Up @@ -393,4 +394,4 @@ define([
this.navigator.hide();
}
});
});
});
10 changes: 5 additions & 5 deletions views/scss/inc/_navigator.scss
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ $borderColor: $textHighlight;

li {
display: block;

span {
.qti-navigator-tab {
@include simple-border();
border-left: none;
line-height: $lineHeight;
width: 5rem;
min-width: 5rem;
cursor: pointer;
white-space: nowrap;
}
}
}
Expand Down Expand Up @@ -375,7 +375,7 @@ $borderColor: $textHighlight;
}
}
.qti-navigator-filter {
span {
.qti-navigator-tab {
background-color: $uiGeneralContentBg;

&:hover {
Expand All @@ -384,7 +384,7 @@ $borderColor: $textHighlight;
}
}
&.active {
span {
.qti-navigator-tab {
background-color: $uiClickableActiveBg;
color: $textHighlight;
}
Expand Down

0 comments on commit fac862d

Please sign in to comment.