Current Path : C:/xampp/htdocs/moodle/mod/assign/amd/build/ |
Current File : C:/xampp/htdocs/moodle/mod/assign/amd/build/grading_navigation_user_info.min.js.map |
{"version":3,"sources":["../src/grading_navigation_user_info.js"],"names":["define","$","notification","ajax","templates","UserInfo","selector","_regionSelector","_region","_userCache","document","on","_refreshUserInfo","bind","prototype","_lastUserId","_getAssignmentId","attr","event","userid","promise","Deferred","render","done","html","js","fadeOut","replaceNodeContents","fadeIn","fail","exception","resolve","assignmentId","requests","call","methodname","args","assignid","embeduser","participant","hasOwnProperty","reject","context","identityfields","data","split","identity","courseid","user","each","i","k","hasidentity","push","join","profileimageurl"],"mappings":"AAyBAA,OAAM,2CAAC,CAAC,QAAD,CAAW,mBAAX,CAAgC,WAAhC,CAA6C,gBAA7C,CAAD,CAAiE,SAASC,CAAT,CAAYC,CAAZ,CAA0BC,CAA1B,CAAgCC,CAAhC,CAA2C,CAQ9G,GAAIC,CAAAA,CAAQ,CAAG,SAASC,CAAT,CAAmB,CAC9B,KAAKC,eAAL,CAAuBD,CAAvB,CACA,KAAKE,OAAL,CAAeP,CAAC,CAACK,CAAD,CAAhB,CACA,KAAKG,UAAL,CAAkB,EAAlB,CAEAR,CAAC,CAACS,QAAD,CAAD,CAAYC,EAAZ,CAAe,cAAf,CAA+B,KAAKC,gBAAL,CAAsBC,IAAtB,CAA2B,IAA3B,CAA/B,CACH,CAND,CASAR,CAAQ,CAACS,SAAT,CAAmBP,eAAnB,CAAqC,IAArC,CAGAF,CAAQ,CAACS,SAAT,CAAmBL,UAAnB,CAAgC,IAAhC,CAGAJ,CAAQ,CAACS,SAAT,CAAmBN,OAAnB,CAA6B,IAA7B,CAGAH,CAAQ,CAACS,SAAT,CAAmBC,WAAnB,CAAiC,CAAjC,CASAV,CAAQ,CAACS,SAAT,CAAmBE,gBAAnB,CAAsC,UAAW,CAC7C,MAAO,MAAKR,OAAL,CAAaS,IAAb,CAAkB,mBAAlB,CACV,CAFD,CAYAZ,CAAQ,CAACS,SA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B,OAAnC,CAA4CgB,CAA5C,CAAkDC,CAAlD,EACA,KAAKjB,OAAL,CAAaoB,MAAb,CAAoB,MAApB,CACH,CAH4B,CAG3Bf,IAH2B,CAGtB,IAHsB,CAA7B,CAIH,CANmE,CAMlEA,IANkE,CAM7D,IAN6D,CAApE,EAMcgB,IANd,CAMmB3B,CAAY,CAAC4B,SANhC,CAOH,CATkB,CAUlBjB,IAVkB,CAUb,IAVa,CA/BnB,CA0CH,CAvF+C,CAuF9CA,IAvF8C,CAuFzC,IAvFyC,CAAhD,EAuFcgB,IAvFd,CAuFmB3B,CAAY,CAAC4B,SAvFhC,CAwFH,CArGD,CAuGA,MAAOzB,CAAAA,CACV,CAvJK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Javascript controller for the \"User summary\" panel at the top of the page.\n *\n * @module mod_assign/grading_navigation_user_info\n * @package mod_assign\n * @class UserInfo\n * @copyright 2016 Damyon Wiese <damyon@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 3.1\n */\ndefine(['jquery', 'core/notification', 'core/ajax', 'core/templates'], function($, notification, ajax, templates) {\n\n /**\n * UserInfo class.\n *\n * @class UserInfo\n * @param {String} selector The selector for the page region containing the user navigation.\n */\n var UserInfo = function(selector) {\n this._regionSelector = selector;\n this._region = $(selector);\n this._userCache = {};\n\n $(document).on('user-changed', this._refreshUserInfo.bind(this));\n };\n\n /** @type {String} Selector for the page region containing the user navigation. */\n UserInfo.prototype._regionSelector = null;\n\n /** @type {Array} Cache of user info contexts. */\n UserInfo.prototype._userCache = null;\n\n /** @type {JQuery} JQuery node for the page region containing the user navigation. */\n UserInfo.prototype._region = null;\n\n /** @type {Integer} Remember the last user id to prevent unnecessary reloads. */\n UserInfo.prototype._lastUserId = 0;\n\n /**\n * Get the assignment id\n *\n * @private\n * @method _getAssignmentId\n * @return {Integer} assignment id\n */\n UserInfo.prototype._getAssignmentId = function() {\n return this._region.attr('data-assignmentid');\n };\n\n /**\n * Get the user context - re-render the template in the page.\n *\n * @private\n * @method _refreshUserInfo\n * @param {Event} event\n * @param {Number} userid\n */\n UserInfo.prototype._refreshUserInfo = function(event, userid) {\n var promise = $.Deferred();\n\n // Put the current user ID in the DOM so yui can access it.\n this._region.attr('data-userid', userid);\n\n // Skip reloading if it is the same user.\n if (this._lastUserId == userid) {\n return;\n }\n this._lastUserId = userid;\n\n // First insert the loading template.\n templates.render('mod_assign/loading', {}).done(function(html, js) {\n // Update the page.\n this._region.fadeOut(\"fast\", function() {\n templates.replaceNodeContents(this._region, html, js);\n this._region.fadeIn(\"fast\");\n }.bind(this));\n\n if (userid < 0) {\n // Render the template.\n templates.render('mod_assign/grading_navigation_no_users', {}).done(function(html, js) {\n if (userid == this._lastUserId) {\n // Update the page.\n this._region.fadeOut(\"fast\", function() {\n templates.replaceNodeContents(this._region, html, js);\n this._region.fadeIn(\"fast\");\n }.bind(this));\n }\n }.bind(this)).fail(notification.exception);\n return;\n }\n\n if (typeof this._userCache[userid] !== \"undefined\") {\n promise.resolve(this._userCache[userid]);\n } else {\n // Load context from ajax.\n var assignmentId = this._getAssignmentId();\n var requests = ajax.call([{\n methodname: 'mod_assign_get_participant',\n args: {\n userid: userid,\n assignid: assignmentId,\n embeduser: true\n }\n }]);\n\n requests[0].done(function(participant) {\n if (!participant.hasOwnProperty('id')) {\n promise.reject('No users');\n } else {\n this._userCache[userid] = participant;\n promise.resolve(this._userCache[userid]);\n }\n }.bind(this)).fail(notification.exception);\n }\n\n promise.done(function(context) {\n var identityfields = $('[data-showuseridentity]').data('showuseridentity').split(','),\n identity = [];\n // Render the template.\n context.courseid = $('[data-region=\"grading-navigation-panel\"]').attr('data-courseid');\n\n if (context.user) {\n // Build a string for the visible identity fields listed in showuseridentity config setting.\n $.each(identityfields, function(i, k) {\n if (typeof context.user[k] !== 'undefined' && context.user[k] !== '') {\n context.hasidentity = true;\n identity.push(context.user[k]);\n }\n });\n context.identity = identity.join(', ');\n\n // Add profile image url to context.\n if (context.user.profileimageurl) {\n context.profileimageurl = context.user.profileimageurl;\n }\n }\n\n templates.render('mod_assign/grading_navigation_user_summary', context).done(function(html, js) {\n // Update the page.\n if (userid == this._lastUserId) {\n this._region.fadeOut(\"fast\", function() {\n templates.replaceNodeContents(this._region, html, js);\n this._region.fadeIn(\"fast\");\n }.bind(this));\n }\n }.bind(this)).fail(notification.exception);\n }.bind(this)).fail(function() {\n // Render the template.\n templates.render('mod_assign/grading_navigation_no_users', {}).done(function(html, js) {\n // Update the page.\n this._region.fadeOut(\"fast\", function() {\n templates.replaceNodeContents(this._region, html, js);\n this._region.fadeIn(\"fast\");\n }.bind(this));\n }.bind(this)).fail(notification.exception);\n }\n .bind(this));\n }.bind(this)).fail(notification.exception);\n };\n\n return UserInfo;\n});\n"],"file":"grading_navigation_user_info.min.js"}