Commit edb77733 authored by Lisa Seeto's avatar Lisa Seeto Committed by Robert Lyon

Bug 1857929: Add sign-off and verification details

- created signoff info modal
- created json call for signoff stats and updated completion.json.php
- added css styling to the help icon, change date function calls
- changed msg to include when verification has been disabled & adjust js
- styling changes to modal

Change-Id: I4324cded62b6fe40316f413f2b9da6199554d6e0
Signed-off-by: default avatarLisa Seeto <lisaseeto@catalyst.net.nz>
parent 7d438d97
......@@ -30,8 +30,14 @@ $string['signoffpageconfirm'] = 'Confirm this action?';
$string['verifypagetitle'] = 'Verify page';
$string['verifypagedesc'] = 'Select "Yes" to verify that the portfolio owner has met all requirements for this page. Select "No" to return to the page without verifying it.';
$string['signoffdetails'] = 'Sign-off details';
$string['updatesignoff'] = 'Update page sign-off';
$string['updateverify'] = 'Update page verification';
$string['viewsignoffdetails'] = 'View sign-off details information';
$string['readyforverification'] = 'This page is ready for verification.';
$string['signedoffbyondate'] = '%s signed off this page on %s.';
$string['verifiedbyondate'] = '%s verified this page on %s.';
$string['removedverifynotificationsubject'] = 'Verification for %s removed';
$string['removedverifynotification'] = 'The owner of the page %s has removed their sign-off. Therefore, your verification has also been removed. Please go to the page to see if it is ready to be marked as verified again.';
......
......@@ -21,6 +21,7 @@ $blockid = param_integer('block', null);
$viewid = param_integer('view', null);
$signoff = param_integer('signoff', null);
$verify = param_integer('verify', null);
$signoffstatus = param_integer('signoffstatus', null);
if (empty($viewid) && !empty($blockid)) {
// try to find view from blockid
......@@ -44,6 +45,28 @@ $signable = ArtefactTypePeerassessment::is_signable($view);
$verifiable = ArtefactTypePeerassessment::is_verifiable($view);
$data = new stdClass();
if ($signoffstatus) {
$record = get_record_sql("SELECT * from {view_signoff_verify} where view = ?", array($viewid));
if ($view->get("owner") && $record->signofftime) {
$signedoffby = (int)$view->get('owner');
$signedoffbymsg = get_string('signedoffbyondate', 'blocktype.peerassessment/signoff', display_name($signedoffby, null, true), format_date(strtotime($record->signofftime), 'strftimedate'));
$msg = $signedoffbymsg;
if (($verifiedby = $record->verifier) && $showverify) {
$verifiedbymsg = get_string('verifiedbyondate', 'blocktype.peerassessment/signoff', display_name($verifiedby, null, true), format_date(strtotime($record->verifiedtime), 'strftimedate'));
$msg = '<p>' . $signedoffbymsg . '</p>' . '<p>' . $verifiedbymsg . '</p>';
}
else if ($showverify && !ArtefactTypePeerassessment::is_verified($view)) {
$msg = get_string('readyforverification', 'blocktype.peerassessment/signoff');
}
json_reply(false, array('data' => $msg));
}
else {
//throw an error
json_reply('local', get_string('wrongsignoffviewrequest', 'blocktype.peerassessment/signoff'));
}
}
if ($showsignoff && $signable && $signoff !== null) {
$currentstate = ArtefactTypePeerassessment::is_signed_off($view);
$newstate = 1 - (int)$currentstate;
......
......@@ -29,6 +29,13 @@
{/if}
</div>
{/if}
<div class="help">
<a href="#" id="signoff-info-icon" class="hidden" title="{str tag=viewsignoffdetails section=blocktype.peerassessment/signoff}">
<span class="icon icon-info-circle"></span>
<span class="sr-only">{str tag=viewsignoffdetails section=blocktype.peerassessment/signoff}</span>
</a>
</div>
</div>
{* signoff modal form *}
......@@ -72,6 +79,25 @@
</div>
</div>
</div>
{* signoff info modal *}
<div tabindex="0" class="modal fade" id="signoff-info-modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{str tag=Close}">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">
<span class="icon icon-lg icon-check-circle left" role="presentation" aria-hidden="true"></span>
{str tag=signoffdetails section=blocktype.peerassessment/signoff}
</h4>
</div>
<div class="modal-body">
<p id="signoff-info"></p>
</div>
</div>
</div>
</div>
<script type="application/javascript">
$(function() {
......@@ -80,6 +106,10 @@ $(function() {
$("#verify-confirm-form").modal('hide');
});
var signedoff = '{$signoff}';
var showverify = '{$showverify}';
if (signedoff) {
$('#signoff-info-icon').removeClass('hidden');
}
$('#signoff').on('click', function(event) {
event.preventDefault();
event.stopPropagation();
......@@ -102,13 +132,15 @@ $(function() {
if (data.data) {
if (data.data.signoff_newstate) {
$('#signoff span.icon').addClass('icon-check-circle completed').removeClass('icon-circle incomplete');
$('#signoff-info-icon').removeClass('hidden');
signedoff = '1';
}
else {
$('#signoff span.icon').addClass('icon-circle incomplete').removeClass('icon-check-circle completed');
signedoff = '';
$('#signoff-info-icon').addClass('hidden');
}
if (data.data.verify_change) {
if (data.data.verify_change && showverify) {
$('#signoff').parent().next().find('span.icon').addClass('icon-circle dot disabled').removeClass('icon-check-circle completed');
}
}
......@@ -136,5 +168,17 @@ $(function() {
$("#verify-confirm-form").modal('hide');
});
});
$('#signoff-info-icon').on('click', function(event) {
sendjsonrequest('{$WWWROOT}artefact/peerassessment/completion.json.php', { 'view': '{$view}', 'signoffstatus': 1 }, 'POST', function (data) {
if (data.data) {
if (data.data) {
$('#signoff-info').html(data.data);
}
$('#signoff-info-modal').modal('show');
}
});
});
});
</script>
......@@ -26,6 +26,19 @@ span.help {
}
}
// Used for the sign-off block in verifyform.tpl
div.help {
.icon {
color: $help-icon-color;
opacity: 0.8;
}
&:hover {
.icon {
opacity:1;
}
}
}
.contextualHelp {
position: absolute;
z-index: $zindex-popover;
......
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