Current Path : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/ |
Current File : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/permissionmanager.min.js.map |
{"version":3,"sources":["../src/permissionmanager.js"],"names":["define","$","config","notification","templates","Y","SELECTORS","ADDROLE","REMOVEROLE","UNPROHIBIT","rolesloadedevent","Event","contextid","contextname","adminurl","overideableroles","panel","loadOverideableRoles","params","getroles","sesskey","post","done","data","trigger","err","exception","fail","jqXHR","status","error","changePermissions","row","roleid","action","M","cfg","capability","templatedata","rolename","imageurl","util","image_url","spanclass","linkclass","icon","iconalt","get_string","find","first","closest","remove","render","content","insertBefore","allowedLink","hide","handleAddRole","e","preventDefault","link","currentTarget","one","use","confirmationDetails","cap","context","message","core","dialogue","draggable","modal","closeButton","width","set","i","existingrolelinks","roles","disabled","disable","filter","length","roledetails","push","show","on","handleRemoveRole","questionDetails","role","confirm","initialize","args","body"],"mappings":"AAyBAA,OAAM,0BAAC,CAAC,QAAD,CAAW,aAAX,CAA0B,mBAA1B,CAA+C,gBAA/C,CAAiE,UAAjE,CAAD,CACF,SAASC,CAAT,CAAYC,CAAZ,CAAoBC,CAApB,CAAkCC,CAAlC,CAA6CC,CAA7C,CAAgD,IAM5CC,CAAAA,CAAS,CAAG,CACZC,OAAO,CAAE,6BADG,CAEZC,UAAU,CAAE,iCAFA,CAGZC,UAAU,CAAE,kBAHA,CANgC,CAW5CC,CAAgB,CAAGT,CAAC,CAACU,KAAF,CAAQ,aAAR,CAXyB,CAY5CC,CAZ4C,CAa5CC,CAb4C,CAc5CC,CAd4C,CAe5CC,CAf4C,CAgB5CC,CAAK,CAAG,IAhBoC,CAwB5CC,CAAoB,CAAG,+BAAW,CAClC,GAAIC,CAAAA,CAAM,CAAG,CACTN,SAAS,CAAEA,CADF,CAETO,QAAQ,CAAE,CAFD,CAGTC,OAAO,CAAElB,CAAM,CAACkB,OAHP,CAAb,CAOAnB,CAAC,CAACoB,IAAF,CAAOP,CAAQ,CAAG,gBAAlB,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C,CAAuDqD,CAAvD,CADJ,CAEIpD,CAAC,CAACM,IAAF,CAAOM,UAAP,CAAkB,oBAAlB,CAAwC,WAAxC,CAFJ,CAGIZ,CAAC,CAACM,IAAF,CAAOM,UAAP,CAAkB,mBAAlB,CAAuC,WAAvC,CAHJ,CAII,UAAW,CACRhB,CAAiB,CAACC,CAAD,CAAMC,CAAN,CAAcC,CAAd,CACnB,CANL,CAQF,CAlBF,EAmBAjB,CAAoB,EACvB,CA9N+C,CAgOhD,MAAmD,CAM/CyE,UAAU,CAAE,oBAASC,CAAT,CAAe,CACvB/E,CAAS,CAAG+E,CAAI,CAAC/E,SAAjB,CACAC,CAAW,CAAG8E,CAAI,CAAC9E,WAAnB,CACAC,CAAQ,CAAG6E,CAAI,CAAC7E,QAAhB,CACA,GAAI8E,CAAAA,CAAI,CAAG3F,CAAC,CAAC,MAAD,CAAZ,CACA2F,CAAI,CAACP,EAAL,CAAQ,OAAR,CAAiB/E,CAAS,CAACC,OAA3B,CAAoCkD,CAApC,EACAmC,CAAI,CAACP,EAAL,CAAQ,OAAR,CAAiB/E,CAAS,CAACE,UAA3B,CAAuC8E,CAAvC,CACH,CAb8C,CAetD,CAhPK,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 * @package core\n * @class permissionmanager\n * @copyright 2015 Martin Mastny <mastnym@vscht.cz>\n * @since 3.0\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n /**\n * @module admin/permissionmanager\n */\ndefine(['jquery', 'core/config', 'core/notification', 'core/templates', 'core/yui'],\n function($, config, notification, templates, Y) {\n\n /**\n * Used CSS selectors\n * @access private\n */\n var SELECTORS = {\n ADDROLE: 'a.allowlink, a.prohibitlink',\n REMOVEROLE: 'a.preventlink, a.unprohibitlink',\n UNPROHIBIT: 'a.unprohibitlink'\n };\n var rolesloadedevent = $.Event('rolesloaded');\n var contextid;\n var contextname;\n var adminurl;\n var overideableroles;\n var panel = null;\n\n /**\n * Load all possible roles, which could be assigned from server\n *\n * @access private\n * @method loadOverideableRoles\n */\n var loadOverideableRoles = function() {\n var params = {\n contextid: contextid,\n getroles: 1,\n sesskey: config.sesskey\n };\n\n // Need to tell jQuery to expect JSON as the content type may not be correct (MDL-55041).\n $.post(adminurl + 'roles/ajax.php', params, null, 'json')\n .done(function(data) {\n try {\n overideableroles = data;\n loadOverideableRoles = function() {\n $('body').trigger(rolesloadedevent);\n };\n loadOverideableRoles();\n } catch (err) {\n notification.exception(err);\n }\n })\n .fail(function(jqXHR, status, error) {\n notification.exception(error);\n });\n };\n\n /**\n * Perform the UI changes after server change\n *\n * @access private\n * @method changePermissions\n * @param {JQuery} row\n * @param {int} roleid\n * @param {string} action\n */\n var changePermissions = function(row, roleid, action) {\n var params = {\n contextid: contextid,\n roleid: roleid,\n sesskey: M.cfg.sesskey,\n action: action,\n capability: row.data('name')\n };\n $.post(adminurl + 'roles/ajax.php', params, null, 'json')\n .done(function(data) {\n var action = data;\n try {\n var templatedata = {rolename: overideableroles[roleid],\n roleid: roleid,\n adminurl: adminurl,\n imageurl: M.util.image_url('t/delete', 'moodle')\n };\n switch (action) {\n case 'allow':\n templatedata.spanclass = 'allowed';\n templatedata.linkclass = 'preventlink';\n templatedata.action = 'prevent';\n templatedata.icon = 't/delete';\n templatedata.iconalt = M.util.get_string('deletexrole', 'core_role', overideableroles[roleid]);\n break;\n case 'prohibit':\n templatedata.spanclass = 'forbidden';\n templatedata.linkclass = 'unprohibitlink';\n templatedata.action = 'unprohibit';\n templatedata.icon = 't/delete';\n templatedata.iconalt = M.util.get_string('deletexrole', 'core_role', overideableroles[roleid]);\n break;\n case 'prevent':\n row.find('a[data-role-id=\"' + roleid + '\"]').first().closest('.allowed').remove();\n return;\n case 'unprohibit':\n row.find('a[data-role-id=\"' + roleid + '\"]').first().closest('.forbidden').remove();\n return;\n default:\n return;\n }\n templates.render('core/permissionmanager_role', templatedata)\n .done(function(content) {\n if (action == 'allow') {\n $(content).insertBefore(row.find('.allowmore:first'));\n } else if (action == 'prohibit') {\n $(content).insertBefore(row.find('.prohibitmore:first'));\n // Remove allowed link\n var allowedLink = row.find('.allowedroles').first().find('a[data-role-id=\"' + roleid + '\"]');\n if (allowedLink) {\n allowedLink.first().closest('.allowed').remove();\n }\n }\n panel.hide();\n })\n .fail(notification.exception);\n } catch (err) {\n notification.exception(err);\n }\n })\n .fail(function(jqXHR, status, error) {\n notification.exception(error);\n });\n };\n\n /**\n * Prompts user for selecting a role which is permitted\n *\n * @access private\n * @method handleAddRole\n * @param {event} e\n */\n var handleAddRole = function(e) {\n e.preventDefault();\n\n var link = $(e.currentTarget);\n\n // TODO: MDL-57778 Convert to core/modal.\n $('body').one('rolesloaded', function() {\n Y.use('moodle-core-notification-dialogue', function() {\n var action = link.data('action');\n var row = link.closest('tr.rolecap');\n var confirmationDetails = {\n cap: row.data('humanname'),\n context: contextname\n };\n var message = M.util.get_string('role' + action + 'info', 'core_role', confirmationDetails);\n if (panel === null) {\n panel = new M.core.dialogue({\n draggable: true,\n modal: true,\n closeButton: true,\n width: '450px'\n });\n }\n panel.set('headerContent', M.util.get_string('role' + action + 'header', 'core_role'));\n\n var i, existingrolelinks;\n\n var roles = [];\n switch (action) {\n case 'allow':\n existingrolelinks = row.find(SELECTORS.REMOVEROLE);\n break;\n case 'prohibit':\n existingrolelinks = row.find(SELECTORS.UNPROHIBIT);\n break;\n }\n for (i in overideableroles) {\n var disabled = '';\n var disable = existingrolelinks.filter(\"[data-role-id='\" + i + \"']\").length;\n if (disable) {\n disabled = 'disabled';\n }\n var roledetails = {roleid: i, rolename: overideableroles[i], disabled: disabled};\n roles.push(roledetails);\n }\n\n templates.render('core/permissionmanager_panelcontent', {message: message, roles: roles})\n .done(function(content) {\n panel.set('bodyContent', content);\n panel.show();\n $('div.role_buttons').on('click', 'input', function(e) {\n var roleid = $(e.currentTarget).data('role-id');\n changePermissions(row, roleid, action);\n });\n })\n .fail(notification.exception);\n\n });\n });\n loadOverideableRoles();\n };\n\n /**\n * Prompts user when removing permission\n *\n * @access private\n * @method handleRemoveRole\n * @param {event} e\n */\n var handleRemoveRole = function(e) {\n e.preventDefault();\n var link = $(e.currentTarget);\n $('body').one('rolesloaded', function() {\n var action = link.data('action');\n var roleid = link.data('role-id');\n var row = link.closest('tr.rolecap');\n var questionDetails = {\n role: overideableroles[roleid],\n cap: row.data('humanname'),\n context: contextname\n };\n\n notification.confirm(M.util.get_string('confirmunassigntitle', 'core_role'),\n M.util.get_string('confirmrole' + action, 'core_role', questionDetails),\n M.util.get_string('confirmunassignyes', 'core_role'),\n M.util.get_string('confirmunassignno', 'core_role'),\n function() {\n changePermissions(row, roleid, action);\n }\n );\n });\n loadOverideableRoles();\n };\n\n return /** @alias module:core/permissionmanager */ {\n /**\n * Initialize permissionmanager\n * @access public\n * @param {Object} args\n */\n initialize: function(args) {\n contextid = args.contextid;\n contextname = args.contextname;\n adminurl = args.adminurl;\n var body = $('body');\n body.on('click', SELECTORS.ADDROLE, handleAddRole);\n body.on('click', SELECTORS.REMOVEROLE, handleRemoveRole);\n }\n };\n});\n"],"file":"permissionmanager.min.js"}