Current Path : C:/xampp/htdocs/moodle/admin/tool/lp/amd/build/ |
Current File : C:/xampp/htdocs/moodle/admin/tool/lp/amd/build/templateactions.min.js.map |
{"version":3,"sources":["../src/templateactions.js"],"names":["define","$","templates","ajax","notification","str","Actionselector","pagecontextid","templateid","deleteplans","updatePage","newhtml","newjs","replaceWith","runTemplateJS","reloadList","context","render","done","fail","exception","doDelete","requests","call","methodname","args","id","pagecontext","contextid","doDuplicate","e","preventDefault","attr","confirmDelete","template","templatehasrelateddata","get_strings","key","component","param","shortname","strings","actions","actionselector","display","on","data","action","confirm","deleteHandler","duplicateHandler","init"],"mappings":"AAuBAA,OAAM,2BAAC,CAAC,QAAD,CAAW,gBAAX,CAA6B,WAA7B,CAA0C,mBAA1C,CAA+D,UAA/D,CAA2E,wBAA3E,CAAD,CACC,SAASC,CAAT,CAAYC,CAAZ,CAAuBC,CAAvB,CAA6BC,CAA7B,CAA2CC,CAA3C,CAAgDC,CAAhD,CAAgE,IAI/DC,CAAAA,CAAa,CAAG,CAJ+C,CAO/DC,CAAU,CAAG,CAPkD,CAU/DC,CAAW,GAVoD,CAmB/DC,CAAU,CAAG,SAASC,CAAT,CAAkBC,CAAlB,CAAyB,CACtCX,CAAC,CAAC,mCAAD,CAAD,CAAqCY,WAArC,CAAiDF,CAAjD,EACAT,CAAS,CAACY,aAAV,CAAwBF,CAAxB,CACH,CAtBkE,CA8B/DG,CAAU,CAAG,SAASC,CAAT,CAAkB,CAC/Bd,CAAS,CAACe,MAAV,CAAiB,+BAAjB,CAAkDD,CAAlD,EACKE,IADL,CACUR,CADV,EAEKS,IAFL,CAEUf,CAAY,CAACgB,SAFvB,CAGH,CAlCkE,CAwC/DC,CAAQ,CAAG,UAAW,CAGtB,GAAIC,CAAAA,CAAQ,CAAGnB,CAAI,CAACoB,IAAL,CAAU,CAAC,CACtBC,UAAU,CAAE,iCADU,CAEtBC,IAAI,CAAE,CAACC,EAAE,CAAElB,CAAL,CACEC,WAAW,CAAEA,CADf,CAFg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B,CACzBtC,CAAW,GACd,CACDY,CAAQ,EACX,CALD,CAMH,CAvBD,EAuBGF,IAvBH,CAuBQf,CAAY,CAACgB,SAvBrB,CAwBH,CAzBD,IAyBO,CACHf,CAAG,CAAC+B,WAAJ,CAAgB,CACZ,CAACC,GAAG,CAAE,SAAN,CAAiBC,SAAS,CAAE,QAA5B,CADY,CAEZ,CAACD,GAAG,CAAE,gBAAN,CAAwBC,SAAS,CAAE,SAAnC,CAA8CC,KAAK,CAAEL,CAAQ,CAACM,SAA9D,CAFY,CAGZ,CAACH,GAAG,CAAE,QAAN,CAAgBC,SAAS,CAAE,QAA3B,CAHY,CAIZ,CAACD,GAAG,CAAE,QAAN,CAAgBC,SAAS,CAAE,QAA3B,CAJY,CAAhB,EAKGpB,IALH,CAKQ,SAASuB,CAAT,CAAkB,CACtBrC,CAAY,CAAC4C,OAAb,CACAP,CAAO,CAAC,CAAD,CADP,CAEAA,CAAO,CAAC,CAAD,CAFP,CAGAA,CAAO,CAAC,CAAD,CAHP,CAIAA,CAAO,CAAC,CAAD,CAJP,CAKApB,CALA,CAOH,CAbD,EAaGF,IAbH,CAaQf,CAAY,CAACgB,SAbrB,CAcH,CACJ,CA1CD,EA0CGD,IA1CH,CA0CQf,CAAY,CAACgB,SA1CrB,CA2CH,CA5CD,EA4CGD,IA5CH,CA4CQf,CAAY,CAACgB,SA5CrB,CA8CH,CArJkE,CAuJnE,MAAoD,CAOhD6B,aAAa,CAAEhB,CAPiC,CAchDiB,gBAAgB,CAAErB,CAd8B,CAqBhDsB,IAAI,CAAE,cAASvB,CAAT,CAAoB,CACtBrB,CAAa,CAAGqB,CACnB,CAvB+C,CAyBvD,CAjLK,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 * Handle actions on learning plan templates via ajax.\n *\n * @module tool_lp/templateactions\n * @package tool_lp\n * @copyright 2015 Damyon Wiese <damyon@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str', 'tool_lp/actionselector'],\n function($, templates, ajax, notification, str, Actionselector) {\n // Private variables and functions.\n\n /** @var {Number} pagecontextid The id of the context */\n var pagecontextid = 0;\n\n /** @var {Number} templateid The id of the template */\n var templateid = 0;\n\n /** @var {Boolean} Action to apply to plans when deleting a template */\n var deleteplans = true;\n\n /**\n * Callback to replace the dom element with the rendered template.\n *\n * @method updatePage\n * @param {String} newhtml The new html to insert.\n * @param {String} newjs The new js to run.\n */\n var updatePage = function(newhtml, newjs) {\n $('[data-region=\"managetemplates\"]').replaceWith(newhtml);\n templates.runTemplateJS(newjs);\n };\n\n /**\n * Callback to render the page template again and update the page.\n *\n * @method reloadList\n * @param {Object} context The context for the template.\n */\n var reloadList = function(context) {\n templates.render('tool_lp/manage_templates_page', context)\n .done(updatePage)\n .fail(notification.exception);\n };\n\n /**\n * Delete a template and reload the page.\n * @method doDelete\n */\n var doDelete = function() {\n\n // We are chaining ajax requests here.\n var requests = ajax.call([{\n methodname: 'core_competency_delete_template',\n args: {id: templateid,\n deleteplans: deleteplans}\n }, {\n methodname: 'tool_lp_data_for_templates_manage_page',\n args: {\n pagecontext: {\n contextid: pagecontextid\n }\n }\n }]);\n requests[1].done(reloadList).fail(notification.exception);\n };\n\n /**\n * Duplicate a template and reload the page.\n * @method doDuplicate\n * @param {Event} e\n */\n var doDuplicate = function(e) {\n e.preventDefault();\n\n templateid = $(this).attr('data-templateid');\n\n // We are chaining ajax requests here.\n var requests = ajax.call([{\n methodname: 'core_competency_duplicate_template',\n args: {id: templateid}\n }, {\n methodname: 'tool_lp_data_for_templates_manage_page',\n args: {\n pagecontext: {\n contextid: pagecontextid\n }\n }\n }]);\n requests[1].done(reloadList).fail(notification.exception);\n };\n\n /**\n * Handler for \"Delete learning plan template\" actions.\n * @method confirmDelete\n * @param {Event} e\n */\n var confirmDelete = function(e) {\n e.preventDefault();\n\n var id = $(this).attr('data-templateid');\n templateid = id;\n deleteplans = true;\n\n var requests = ajax.call([{\n methodname: 'core_competency_read_template',\n args: {id: templateid}\n }, {\n methodname: 'core_competency_template_has_related_data',\n args: {id: templateid}\n }]);\n\n requests[0].done(function(template) {\n requests[1].done(function(templatehasrelateddata) {\n if (templatehasrelateddata) {\n str.get_strings([\n {key: 'deletetemplate', component: 'tool_lp', param: template.shortname},\n {key: 'deletetemplatewithplans', component: 'tool_lp'},\n {key: 'deleteplans', component: 'tool_lp'},\n {key: 'unlinkplanstemplate', component: 'tool_lp'},\n {key: 'confirm', component: 'moodle'},\n {key: 'cancel', component: 'moodle'}\n ]).done(function(strings) {\n var actions = [{'text': strings[2], 'value': 'delete'},\n {'text': strings[3], 'value': 'unlink'}];\n var actionselector = new Actionselector(\n strings[0], // Title.\n strings[1], // Message\n actions, // Radio button options.\n strings[4], // Confirm.\n strings[5]); // Cancel.\n actionselector.display();\n actionselector.on('save', function(e, data) {\n if (data.action != 'delete') {\n deleteplans = false;\n }\n doDelete();\n });\n }).fail(notification.exception);\n } else {\n str.get_strings([\n {key: 'confirm', component: 'moodle'},\n {key: 'deletetemplate', component: 'tool_lp', param: template.shortname},\n {key: 'delete', component: 'moodle'},\n {key: 'cancel', component: 'moodle'}\n ]).done(function(strings) {\n notification.confirm(\n strings[0], // Confirm.\n strings[1], // Delete learning plan template X?\n strings[2], // Delete.\n strings[3], // Cancel.\n doDelete\n );\n }).fail(notification.exception);\n }\n }).fail(notification.exception);\n }).fail(notification.exception);\n\n };\n\n return /** @alias module:tool_lp/templateactions */ {\n // Public variables and functions.\n /**\n * Expose the event handler for the delete.\n * @method deleteHandler\n * @param {Event} e\n */\n deleteHandler: confirmDelete,\n\n /**\n * Expose the event handler for the duplicate.\n * @method duplicateHandler\n * @param {Event} e\n */\n duplicateHandler: doDuplicate,\n\n /**\n * Initialise the module.\n * @method init\n * @param {Number} contextid The context id of the page.\n */\n init: function(contextid) {\n pagecontextid = contextid;\n }\n };\n});\n"],"file":"templateactions.min.js"}