Commit c7001577 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge changes I420c023d,Iac63c94b

* changes:
  Behat fix for install_framework.feature
  Bug 1825282: Show only html in smartevidence add feedback modal
parents 585f17aa fd31924f
......@@ -859,77 +859,74 @@ class Framework {
$collection = $view->get('collection');
$evidence = get_record('framework_evidence', 'annotation', $annotation->get('id'));
$defaultval = $evidence->state;
$selfassess = get_field('framework', 'selfassess', 'id', $evidence->framework);
if (!is_object($collection) || !$collection->get('framework')) {
return false;
}
$annotationhtml = clean_html($text);
$annotationdivhtml = '<div class="modal-header modal-section">' . get_string("assessment", "module.framework") . '</div>';
$assessmenthtml = '<div class="top-line select form-group">
<span class="pseudolabel">' . get_string("assessment", "module.framework") . '</span>
' . self::get_evidence_statuses($collection->get('framework'))[$defaultval] . '
</div>';
$options = self::get_my_assessment_options_for_user($view, $evidence->framework);
if (!$options) {
if (!$options || !array_key_exists($defaultval, $options)
|| ($view->get('owner') == $USER->get('id') && !$selfassess)
|| ($view->get('owner') != $USER->get('id') && $selfassess)
) {
// not allowed to set the assessment so we just show the current state as html
$choices = self::get_evidence_statuses($collection->get('framework'));
$smarty = smarty_core();
$smarty->assign('annotationhtml', $annotationhtml);
$smarty->assign('annotationdivhtml', $annotationdivhtml);
$smarty->assign('assessmenthtml', $assessmenthtml);
$content = $smarty->fetch('module:framework:evidencestatus.tpl');
}
else {
// Show the select box with current state selected
$assessment = array(
'type' => 'html',
'type' => 'select',
'title' => get_string('assessment', 'module.framework'),
'value' => $choices[$defaultval],
'options' => $options,
'defaultvalue' => $defaultval,
'width' => '280px',
'class' => 'top-line',
);
}
else {
if (!array_key_exists($defaultval, $options)) {
// not allowed to set the assessment to current state so show current state as html
$choices = self::get_evidence_statuses($collection->get('framework'));
$assessment = array(
$form = array(
'name' => 'annotationfeedback',
'jsform' => true,
'renderer' => 'div',
'plugintype' => 'module',
'pluginname' => 'framework',
'jssuccesscallback' => 'updateAnnotation',
'elements' => array(
'annotation' => array(
'type' => 'html',
'value' => $annotationhtml,
),
),
);
if ($options) {
$form['elements']['annotationdiv'] = array(
'type' => 'html',
'title' => get_string('assessment', 'module.framework'),
'value' => $choices[$defaultval],
'class' => 'top-line',
'value' => $annotationdivhtml,
);
$form['elements']['assessment'] = $assessment;
}
else {
// Show the select box with current state selected
$assessment = array(
'type' => 'select',
'title' => get_string('assessment', 'module.framework'),
'options' => $options,
'defaultvalue' => $defaultval,
'width' => '280px',
'class' => 'top-line',
$frameworkurl = $collection->collection_nav_framework_option();
if ($options) {
$form['elements']['submitcancel'] = array(
'type' => 'submitcancel',
'class' => 'btn-secondary',
'value' => array(get_string('save'), get_string('cancel')),
'goto' => $frameworkurl->fullurl,
);
}
$content = pieform($form);
}
$form = array(
'name' => 'annotationfeedback',
'jsform' => true,
'renderer' => 'div',
'plugintype' => 'module',
'pluginname' => 'framework',
'jssuccesscallback' => 'updateAnnotation',
'elements' => array(
'annotation' => array(
'type' => 'html',
'value' => clean_html($text),
),
),
);
if ($options || (!$options && $view->get('owner') == $USER->get('id'))) {
$form['elements']['annotationdiv'] = array(
'type' => 'html',
'value' => '<div class="modal-header modal-section">' . get_string("assessment", "module.framework") . '</div>',
);
$form['elements']['assessment'] = $assessment;
}
$frameworkurl = $collection->collection_nav_framework_option();
if ($options) {
$form['elements']['submitcancel'] = array(
'type' => 'submitcancel',
'class' => 'btn-secondary',
'value' => array(get_string('save'), get_string('cancel')),
'goto' => $frameworkurl->fullurl,
);
}
$content = pieform($form);
list($feedbackcount, $annotationfeedback) = ArtefactTypeAnnotationfeedback::get_annotation_feedback_for_matrix($artefact, $view, $annotation->get('id'));
$content .= $annotationfeedback;
......
<div>
<div class="html form-group">
<p>{$annotationhtml|safe}</p>
</div>
<div class="html form-group">
{$annotationdivhtml|safe}
</div>
{$assessmenthtml|safe}
</div>
......@@ -95,7 +95,7 @@ Scenario: Installing framework module and activating for an institution
And I press "Place feedback"
# And change assessment status
And I should not see the field "Assessment"
And I press "Save"
And I close the dialog
And I log out
# Try as another admin
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment