mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-51036 tool_lp: Addressing comments left during peer review
This commit is contained in:
parent
572721ac1d
commit
182f609213
12 changed files with 59 additions and 23 deletions
|
@ -1 +1 @@
|
|||
define(["jquery","core/templates","core/ajax","core/notification","core/str","tool_lp/menubar","tool_lp/base"],function(a,b,c,d,e,f,g){var h=function(){g.prototype.constructor.apply(this,[])};return h.prototype=Object.create(g.prototype),h.prototype._nodeSelector='[data-node="user-competency"]',h.prototype._cancelReviewRequest=function(a){var b={methodname:"tool_lp_user_competency_cancel_review_request",args:{userid:a.userid,competencyid:a.competencyid}};c.call([b])[0].then(function(){this._trigger("review-request-cancelled",a),this._trigger("status-changed",a)}.bind(this),function(){this._trigger("error-occured",a)}.bind(this))},h.prototype.cancelReviewRequest=function(a){this._cancelReviewRequest(a)},h.prototype._cancelReviewRequestHandler=function(b){b.preventDefault();var c=this._findUserCompetencyData(a(b.target));this.cancelReviewRequest(c)},h.prototype._requestReview=function(a){var b={methodname:"tool_lp_user_competency_request_review",args:{userid:a.userid,competencyid:a.competencyid}};c.call([b])[0].then(function(){this._trigger("review-requested",a),this._trigger("status-changed",a)}.bind(this),function(){this._trigger("error-occured",a)}.bind(this))},h.prototype.requestReview=function(a){this._requestReview(a)},h.prototype._requestReviewHandler=function(b){b.preventDefault();var c=this._findUserCompetencyData(a(b.target));this.requestReview(c)},h.prototype._startReview=function(a){var b={methodname:"tool_lp_user_competency_start_review",args:{userid:a.userid,competencyid:a.competencyid}};c.call([b])[0].then(function(){this._trigger("review-started",a),this._trigger("status-changed",a)}.bind(this),function(){this._trigger("error-occured",a)}.bind(this))},h.prototype.startReview=function(a){this._startReview(a)},h.prototype._startReviewHandler=function(b){b.preventDefault();var c=this._findUserCompetencyData(a(b.target));this.startReview(c)},h.prototype._stopReview=function(a){var b={methodname:"tool_lp_user_competency_stop_review",args:{userid:a.userid,competencyid:a.competencyid}};c.call([b])[0].then(function(){this._trigger("review-stopped",a),this._trigger("status-changed",a)}.bind(this),function(){this._trigger("error-occured",a)}.bind(this))},h.prototype.stopReview=function(a){this._stopReview(a)},h.prototype._stopReviewHandler=function(b){b.preventDefault();var c=this._findUserCompetencyData(a(b.target));this.stopReview(c)},h.prototype.enhanceMenubar=function(a){f.enhance(a,{'[data-action="request-review"]':this._requestReviewHandler.bind(this),'[data-action="cancel-review-request"]':this._cancelReviewRequestHandler.bind(this)})},h.prototype._findUserCompetencyData=function(a){var b,c=a.parents(this._nodeSelector);if(1!=c.length)throw new Error("The evidence node was not located.");if(b=c.data(),"undefined"==typeof b||"undefined"==typeof b.userid||"undefined"==typeof b.competencyid)throw new Error("User competency data could not be found.");return b},h.prototype.enhanceMenubar=function(a){f.enhance(a,{'[data-action="request-review"]':this._requestReviewHandler.bind(this),'[data-action="cancel-review-request"]':this._cancelReviewRequestHandler.bind(this),'[data-action="start-review"]':this._startReviewHandler.bind(this),'[data-action="stop-review"]':this._stopReviewHandler.bind(this)})},h.prototype.registerEvents=function(b){var c=a(b);c.find('[data-action="request-review"]').click(this._requestReviewHandler.bind(this)),c.find('[data-action="cancel-review-request"]').click(this._cancelReviewRequestHandler.bind(this)),c.find('[data-action="start-review"]').click(this._startReviewHandler.bind(this)),c.find('[data-action="stop-review"]').click(this._stopReviewHandler.bind(this))},h});
|
||||
define(["jquery","core/templates","core/ajax","core/notification","core/str","tool_lp/menubar","tool_lp/event_base"],function(a,b,c,d,e,f,g){var h=function(){g.prototype.constructor.apply(this,[])};return h.prototype=Object.create(g.prototype),h.prototype._nodeSelector='[data-node="user-competency"]',h.prototype._cancelReviewRequest=function(a){var b={methodname:"tool_lp_user_competency_cancel_review_request",args:{userid:a.userid,competencyid:a.competencyid}};c.call([b])[0].then(function(){this._trigger("review-request-cancelled",a),this._trigger("status-changed",a)}.bind(this),function(){this._trigger("error-occured",a)}.bind(this))},h.prototype.cancelReviewRequest=function(a){this._cancelReviewRequest(a)},h.prototype._cancelReviewRequestHandler=function(b){b.preventDefault();var c=this._findUserCompetencyData(a(b.target));this.cancelReviewRequest(c)},h.prototype._requestReview=function(a){var b={methodname:"tool_lp_user_competency_request_review",args:{userid:a.userid,competencyid:a.competencyid}};c.call([b])[0].then(function(){this._trigger("review-requested",a),this._trigger("status-changed",a)}.bind(this),function(){this._trigger("error-occured",a)}.bind(this))},h.prototype.requestReview=function(a){this._requestReview(a)},h.prototype._requestReviewHandler=function(b){b.preventDefault();var c=this._findUserCompetencyData(a(b.target));this.requestReview(c)},h.prototype._startReview=function(a){var b={methodname:"tool_lp_user_competency_start_review",args:{userid:a.userid,competencyid:a.competencyid}};c.call([b])[0].then(function(){this._trigger("review-started",a),this._trigger("status-changed",a)}.bind(this),function(){this._trigger("error-occured",a)}.bind(this))},h.prototype.startReview=function(a){this._startReview(a)},h.prototype._startReviewHandler=function(b){b.preventDefault();var c=this._findUserCompetencyData(a(b.target));this.startReview(c)},h.prototype._stopReview=function(a){var b={methodname:"tool_lp_user_competency_stop_review",args:{userid:a.userid,competencyid:a.competencyid}};c.call([b])[0].then(function(){this._trigger("review-stopped",a),this._trigger("status-changed",a)}.bind(this),function(){this._trigger("error-occured",a)}.bind(this))},h.prototype.stopReview=function(a){this._stopReview(a)},h.prototype._stopReviewHandler=function(b){b.preventDefault();var c=this._findUserCompetencyData(a(b.target));this.stopReview(c)},h.prototype.enhanceMenubar=function(a){f.enhance(a,{'[data-action="request-review"]':this._requestReviewHandler.bind(this),'[data-action="cancel-review-request"]':this._cancelReviewRequestHandler.bind(this)})},h.prototype._findUserCompetencyData=function(a){var b,c=a.parents(this._nodeSelector);if(1!=c.length)throw new Error("The evidence node was not located.");if(b=c.data(),"undefined"==typeof b||"undefined"==typeof b.userid||"undefined"==typeof b.competencyid)throw new Error("User competency data could not be found.");return b},h.prototype.enhanceMenubar=function(a){f.enhance(a,{'[data-action="request-review"]':this._requestReviewHandler.bind(this),'[data-action="cancel-review-request"]':this._cancelReviewRequestHandler.bind(this),'[data-action="start-review"]':this._startReviewHandler.bind(this),'[data-action="stop-review"]':this._stopReviewHandler.bind(this)})},h.prototype.registerEvents=function(b){var c=a(b);c.find('[data-action="request-review"]').click(this._requestReviewHandler.bind(this)),c.find('[data-action="cancel-review-request"]').click(this._cancelReviewRequestHandler.bind(this)),c.find('[data-action="start-review"]').click(this._startReviewHandler.bind(this)),c.find('[data-action="stop-review"]').click(this._stopReviewHandler.bind(this))},h});
|
|
@ -14,9 +14,9 @@
|
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Base javascript module.
|
||||
* Event base javascript module.
|
||||
*
|
||||
* @module tool_lp/base
|
||||
* @module tool_lp/event_base
|
||||
* @package tool_lp
|
||||
* @copyright 2015 Frédéric Massart - FMCorz.net
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
|
@ -55,5 +55,5 @@ define(['jquery'], function($) {
|
|||
this._eventNode.trigger(type, [data]);
|
||||
};
|
||||
|
||||
return /** @alias module:tool_lp/base */ Base;
|
||||
return /** @alias module:tool_lp/event_base */ Base;
|
||||
});
|
|
@ -27,8 +27,8 @@ define(['jquery',
|
|||
'core/notification',
|
||||
'core/str',
|
||||
'tool_lp/menubar',
|
||||
'tool_lp/base'],
|
||||
function($, Templates, Ajax, Notification, Str, Menubar, Base) {
|
||||
'tool_lp/event_base'],
|
||||
function($, Templates, Ajax, Notification, Str, Menubar, EventBase) {
|
||||
|
||||
/**
|
||||
* UserCompetencyWorkflow class.
|
||||
|
@ -36,9 +36,9 @@ define(['jquery',
|
|||
* @param {String} selector The node containing the buttons to switch mode.
|
||||
*/
|
||||
var UserCompetencyWorkflow = function() {
|
||||
Base.prototype.constructor.apply(this, []);
|
||||
EventBase.prototype.constructor.apply(this, []);
|
||||
};
|
||||
UserCompetencyWorkflow.prototype = Object.create(Base.prototype);
|
||||
UserCompetencyWorkflow.prototype = Object.create(EventBase.prototype);
|
||||
|
||||
/** @type {String} The selector to find the user competency data. */
|
||||
UserCompetencyWorkflow.prototype._nodeSelector = '[data-node="user-competency"]';
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
namespace tool_lp;
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use coding_exception;
|
||||
use stdClass;
|
||||
use lang_string;
|
||||
|
||||
|
|
|
@ -2714,7 +2714,7 @@ class external extends external_api {
|
|||
* @return \external_function_parameters
|
||||
*/
|
||||
public static function user_competency_cancel_review_request_returns() {
|
||||
new external_value(PARAM_BOOL, 'The success');
|
||||
return new external_value(PARAM_BOOL, 'The success');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2754,7 +2754,7 @@ class external extends external_api {
|
|||
* @return \external_function_parameters
|
||||
*/
|
||||
public static function user_competency_request_review_returns() {
|
||||
new external_value(PARAM_BOOL, 'The success');
|
||||
return new external_value(PARAM_BOOL, 'The success');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2793,7 +2793,7 @@ class external extends external_api {
|
|||
* @return \external_function_parameters
|
||||
*/
|
||||
public static function user_competency_start_review_returns() {
|
||||
new external_value(PARAM_BOOL, 'The success');
|
||||
return new external_value(PARAM_BOOL, 'The success');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2832,7 +2832,7 @@ class external extends external_api {
|
|||
* @return \external_function_parameters
|
||||
*/
|
||||
public static function user_competency_stop_review_returns() {
|
||||
new external_value(PARAM_BOOL, 'The success');
|
||||
return new external_value(PARAM_BOOL, 'The success');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
namespace tool_lp\external;
|
||||
require_once($CFG->dirroot . '/comment/lib.php');
|
||||
|
||||
// TODO MDL-52243 Move this to core.
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use comment;
|
||||
|
|
|
@ -153,6 +153,12 @@ $string['lp:planviewown'] = 'View own learning plans';
|
|||
$string['lp:planviewowndraft'] = 'View own draft learning plans';
|
||||
$string['lp:templatemanage'] = 'Manage templates';
|
||||
$string['lp:templateread'] = 'View template';
|
||||
$string['lp:usercompetencycomment'] = 'Comment on a user competency';
|
||||
$string['lp:usercompetencycommentown'] = 'Comment on own user competency';
|
||||
$string['lp:usercompetencyrequestreview'] = 'Request the review of a user competency';
|
||||
$string['lp:usercompetencyrequestreviewown'] = 'Request the review of own user competency';
|
||||
$string['lp:usercompetencyreview'] = 'Review a user competency';
|
||||
$string['lp:usercompetencyview'] = 'View a user competency';
|
||||
$string['lp:userevidencemanage'] = 'Manage evidence of prior learning';
|
||||
$string['lp:userevidencemanageown'] = 'Manage own evidence of prior learning';
|
||||
$string['lp:userevidenceread'] = 'View evidence of prior learning of a user';
|
||||
|
@ -203,6 +209,7 @@ $string['proficient'] = 'Proficient';
|
|||
$string['rate'] = 'Rate';
|
||||
$string['rating'] = 'Rating';
|
||||
$string['relatedcompetencies'] = 'Related competencies';
|
||||
$string['reviewstatus'] = 'Review status';
|
||||
$string['requestreview'] = 'Request review';
|
||||
$string['reopenplan'] = 'Reopen this learning plan';
|
||||
$string['reopenplanconfirm'] = 'Reopen the plan \'{$a}\'? The status of the users competencies that was recorded at the time the plan was previously completed will be deleted, and the plan will become active again.';
|
||||
|
@ -219,7 +226,7 @@ $string['shortname'] = 'Name';
|
|||
$string['startreview'] = 'Start review';
|
||||
$string['state'] = 'State';
|
||||
$string['status'] = 'Status';
|
||||
$string['stopreview'] = 'Stop review';
|
||||
$string['stopreview'] = 'Finish review';
|
||||
$string['stopsyncingcohort'] = 'Stop syncing cohort';
|
||||
$string['suggest'] = 'Suggest';
|
||||
$string['syncplanscohorts'] = 'Sync plans from template cohorts';
|
||||
|
|
|
@ -222,6 +222,7 @@ function tool_lp_comment_add($comment, $params) {
|
|||
}
|
||||
|
||||
// Urls.
|
||||
// TODO MDL-52749 Replace the link to the plan with the user competency page.
|
||||
if (empty($plan)) {
|
||||
$urlname = get_string('userplans', 'tool_lp');
|
||||
$url = new moodle_url('/admin/tool/lp/plans.php', array('userid' => $uc->get_userid()));
|
||||
|
@ -258,8 +259,8 @@ function tool_lp_comment_add($comment, $params) {
|
|||
$message = new \core\message\message();
|
||||
$message->component = 'tool_lp';
|
||||
$message->name = 'user_competency_comment';
|
||||
$message->notification = 0;
|
||||
$message->userfrom = $comment->userid;
|
||||
$message->notification = 1;
|
||||
$message->userfrom = core_user::get_noreply_user();
|
||||
$message->subject = get_string('usercommentedonacompetencysubject', 'tool_lp', $fullname);
|
||||
$message->fullmessage = $fullmessage;
|
||||
$message->fullmessageformat = $format;
|
||||
|
@ -299,8 +300,14 @@ function tool_lp_comment_permissions($params) {
|
|||
* Validates comments.
|
||||
*
|
||||
* @param stdClass $params The parameters.
|
||||
* @return array
|
||||
* @return bool
|
||||
*/
|
||||
function tool_lp_comment_validate($params) {
|
||||
return true;
|
||||
if ($params->commentarea == 'user_competency') {
|
||||
if (!\tool_lp\user_competency::record_exists($params->itemid)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -40,13 +40,25 @@
|
|||
This template does not have an example context because it includes ajax functionality.
|
||||
}}
|
||||
{{#usercompetencysummary}}
|
||||
<div data-region="user-competency-full-info" >
|
||||
<div data-region="user-competency-full-info" data-node="user-competency" data-competencyid="{{usercompetency.competencyid}}" data-userid="{{usercompetency.userid}}" data-region-id="{{uniqid}}">
|
||||
<div data-region="competency-summary">
|
||||
{{#competency}}
|
||||
{{> tool_lp/competency_summary }}
|
||||
{{/competency}}
|
||||
<dl>
|
||||
{{#usercompetency}}
|
||||
<dt>{{#str}}reviewstatus, tool_lp{{/str}}</dt>
|
||||
<dd data-region="user-competency-status">{{statusname}}
|
||||
|
||||
{{#isstatusinreview}}
|
||||
- {{reviewer.fullname}}
|
||||
{{/isstatusinreview}}
|
||||
|
||||
{{#isrequestreviewallowed}}<button data-action="request-review">{{#str}}requestreview, tool_lp{{/str}}</button>{{/isrequestreviewallowed}}
|
||||
{{#iscancelreviewrequestallowed}}<button data-action="cancel-review-request">{{#str}}cancelreviewrequest, tool_lp{{/str}}</button>{{/iscancelreviewrequestallowed}}
|
||||
{{#isstartreviewallowed}}<button data-action="start-review">{{#str}}startreview, tool_lp{{/str}}</button>{{/isstartreviewallowed}}
|
||||
{{#isstopreviewallowed}}<button data-action="stop-review">{{#str}}stopreview, tool_lp{{/str}}</button>{{/isstopreviewallowed}}
|
||||
</dd>
|
||||
<dt>{{#str}}proficient, tool_lp{{/str}}</dt>
|
||||
<dd>
|
||||
<span class="label{{^proficiency}} label-important{{/proficiency}} pull-left">
|
||||
|
@ -71,20 +83,25 @@
|
|||
</form>
|
||||
<br><br>
|
||||
</p>
|
||||
{{/cangradeorsuggest}}
|
||||
</dd>
|
||||
{{#js}}
|
||||
require(['jquery', 'tool_lp/grade_user_competency_inline', 'tool_lp/user_competency_info'], function($, mod, info) {
|
||||
require(['jquery', 'tool_lp/grade_user_competency_inline', 'tool_lp/user_competency_info', 'tool_lp/user_competency_workflow'], function($, mod, info, UserCompWorkflow) {
|
||||
var scaleConfig = JSON.parse('{{{competency.scaleconfiguration}}}');
|
||||
|
||||
var inlineGrader = new mod('grade-competency-form-{{uniqid}}', scaleConfig, '{{competency.competency.id}}', '{{user.id}}', '', '{{course.id}}', '{{#str}}chooserating, tool_lp{{/str}}');
|
||||
var competencyElement = $(document.getElementById('grade-competency-form-{{uniqid}}')).closest('[data-region=user-competency-full-info]');
|
||||
var competencyElement = $('[data-region-id="{{uniqid}}"]');
|
||||
var infoReloader = new info(competencyElement, '{{competency.competency.id}}', '{{user.id}}', '', '{{course.id}}');
|
||||
|
||||
var ucw = new UserCompWorkflow();
|
||||
ucw.registerEvents('[data-region="user-competency-status"]');
|
||||
ucw.on('status-changed', infoReloader.reload.bind(infoReloader));
|
||||
ucw.on('error-occured', infoReloader.reload.bind(infoReloader));
|
||||
|
||||
inlineGrader.on('competencyupdated', infoReloader.reload.bind(infoReloader));
|
||||
});
|
||||
|
||||
{{/js}}
|
||||
{{/cangradeorsuggest}}
|
||||
{{/usercompetency}}
|
||||
{{#usercompetencyplan}}
|
||||
<dd>{{gradename}} - {{#str}}plancompleted, tool_lp{{/str}}</dd>
|
||||
|
@ -101,6 +118,9 @@
|
|||
</dd>
|
||||
{{/usercompetencyplan}}
|
||||
</dl>
|
||||
{{#commentarea}}
|
||||
{{>tool_lp/comment_area}}
|
||||
{{/commentarea}}
|
||||
<dl data-region="evidence-listing">
|
||||
<dt>{{#str}}evidence, tool_lp{{/str}}</dt>
|
||||
<dd>
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
{{/competency}}
|
||||
<dl>
|
||||
{{#usercompetency}}
|
||||
<dt>{{#str}}status, tool_lp{{/str}}</dt>
|
||||
<dt>{{#str}}reviewstatus, tool_lp{{/str}}</dt>
|
||||
<dd data-region="user-competency-status">{{statusname}}
|
||||
|
||||
{{#isstatusinreview}}
|
||||
|
|
|
@ -25,6 +25,6 @@
|
|||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
$plugin->version = 2015111036; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2015111037; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_lp'; // Full name of the plugin (used for diagnostics).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue