%PDF- %PDF-
| Direktori : /opt/bitnami/apps/moodle/htdocs/customfield__d9c9c01/amd/build/ |
| Current File : /opt/bitnami/apps/moodle/htdocs/customfield__d9c9c01/amd/build/form.min.js.map |
{"version":3,"sources":["../src/form.js"],"names":["define","$","Str","Notification","Ajax","Templates","SortableList","Pending","confirmDelete","id","type","component","area","itemid","pendingPromise","get_strings","then","s","confirm","pendingDeletePromise","func","call","methodname","args","response","render","html","js","replaceNode","resolve","catch","exception","createNewCategory","promises","categoryid","window","location","href","Promise","all","init","mainlist","attr","on","e","preventDefault","categoryName","element","closest","find","sortCat","moveHandlerSelector","getElementName","el","Deferred","evt","info","positionChanged","data","beforeid","targetNextElement","stopPropagation","sort","getDestinationName","parentElement","afterElement","length","get_string","targetList","children","each","fields","nofields","append","remove","setTimeout","width"],"mappings":"AAuBAA,OAAM,yBAAC,CACH,QADG,CAEH,UAFG,CAGH,mBAHG,CAIH,WAJG,CAKH,gBALG,CAMH,oBANG,CAOH,cAPG,CAQH,uBARG,CAAD,CASH,SAASC,CAAT,CAAYC,CAAZ,CAAiBC,CAAjB,CAA+BC,CAA/B,CAAqCC,CAArC,CAAgDC,CAAhD,CAA8DC,CAA9D,CAAuE,IAWlEC,CAAAA,CAAa,CAAG,SAASC,CAAT,CAAaC,CAAb,CAAmBC,CAAnB,CAA8BC,CAA9B,CAAoCC,CAApC,CAA4C,CAC5D,GAAIC,CAAAA,CAAc,CAAG,GAAIP,CAAAA,CAAJ,CAAY,qCAAZ,CAArB,CACAL,CAAG,CAACa,WAAJ,CAAgB,CACZ,CAAC,IAAO,SAAR,CADY,CAEZ,CAAC,IAAO,gBAAkBL,CAA1B,CAAgCC,SAAS,CAAE,kBAA3C,CAFY,CAGZ,CAAC,IAAO,KAAR,CAHY,CAIZ,CAAC,IAAO,IAAR,CAJY,CAAhB,EAMCK,IAND,CAMM,SAASC,CAAT,CAAY,CACdd,CAAY,CAACe,OAAb,CAAqBD,CAAC,CAAC,CAAD,CAAtB,CAA2BA,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AC,IAAD,CAAD,CAAQgD,IAAR,CAAahD,CAAC,CAAC,WAAD,CAAd,CADf,CAEA,GAAI,CAACsE,CAAM,CAACL,MAAR,EAAkB,CAACM,CAAQ,CAACN,MAAhC,CAAwC,CACpCjE,CAAC,CAAC,IAAD,CAAD,CAAQgD,IAAR,CAAa,OAAb,EAAsBwB,MAAtB,CACI,4CAA0CxD,CAA1C,CAA8C,YADlD,CAGH,CACD,GAAIsD,CAAM,CAACL,MAAP,EAAiBM,CAAQ,CAACN,MAA9B,CAAsC,CAClCM,CAAQ,CAACE,MAAT,EACH,CACJ,CAXD,EAYA,MAAO,KACV,CAdD,EAeC1D,IAfD,CAeMF,CAAc,CAACe,OAfrB,EAgBCC,KAhBD,CAgBO3B,CAAY,CAAC4B,SAhBpB,CAiBH,CAvBD,EAyBA9B,CAAC,CAAC,uCAAD,CAAD,CAA2C0C,EAA3C,CAA8C,wBAA9C,CACI,SAASY,CAAT,CAAcC,CAAd,CAAoB,CAChBmB,UAAU,CAAC,UAAW,CAClB1E,CAAC,CAAC,2BAAD,CAAD,CAA+B2E,KAA/B,CAAqCpB,CAAI,CAACT,OAAL,CAAa6B,KAAb,EAArC,CACH,CAFS,CAEP,GAFO,CAGb,CALL,CAQH,CAhIE,CAkIV,CA1NK,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 * This module depends on the real jquery - and returns the non-global version of it.\n *\n * @module core_customfield/form\n * @package core_customfield\n * @copyright 2018 Toni Barbera\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/str',\n 'core/notification',\n 'core/ajax',\n 'core/templates',\n 'core/sortable_list',\n 'core/pending',\n 'core/inplace_editable',\n], function($, Str, Notification, Ajax, Templates, SortableList, Pending) {\n\n /**\n * Display confirmation dialogue\n *\n * @param {Number} id\n * @param {String} type\n * @param {String} component\n * @param {String} area\n * @param {Number} itemid\n */\n var confirmDelete = function(id, type, component, area, itemid) {\n var pendingPromise = new Pending('core_customfield/form:confirmDelete');\n Str.get_strings([\n {'key': 'confirm'},\n {'key': 'confirmdelete' + type, component: 'core_customfield'},\n {'key': 'yes'},\n {'key': 'no'},\n ])\n .then(function(s) {\n Notification.confirm(s[0], s[1], s[2], s[3], function() {\n var pendingDeletePromise = new Pending('core_customfield/form:confirmDelete');\n var func = (type === 'field') ? 'core_customfield_delete_field' : 'core_customfield_delete_category';\n Ajax.call([\n {methodname: func, args: {id: id}},\n {methodname: 'core_customfield_reload_template', args: {component: component, area: area, itemid: itemid}}\n ])[1]\n .then(function(response) {\n return Templates.render('core_customfield/list', response);\n })\n .then(function(html, js) {\n Templates.replaceNode($('[data-region=\"list-page\"]'), html, js);\n return null;\n })\n .then(pendingDeletePromise.resolve)\n .catch(Notification.exception);\n });\n\n return;\n })\n .then(pendingPromise.resolve)\n .catch(Notification.exception);\n };\n\n /**\n * Creates a new custom fields category with default name and updates the list\n *\n * @param {String} component\n * @param {String} area\n * @param {Number} itemid\n */\n var createNewCategory = function(component, area, itemid) {\n var pendingPromise = new Pending('core_customfield/form:confirmDelete');\n var promises = Ajax.call([\n {methodname: 'core_customfield_create_category', args: {component: component, area: area, itemid: itemid}},\n {methodname: 'core_customfield_reload_template', args: {component: component, area: area, itemid: itemid}}\n ]);\n var categoryid;\n\n promises[0].then(function(response) {\n categoryid = response;\n return null;\n }).catch(Notification.exception);\n\n promises[1].then(function(response) {\n return Templates.render('core_customfield/list', response);\n })\n .then(function(html, js) {\n Templates.replaceNode($('[data-region=\"list-page\"]'), html, js);\n window.location.href = '#category-' + categoryid;\n return null;\n })\n .catch(Notification.exception);\n\n Promise.all(promises)\n .then(pendingPromise.resolve)\n .catch();\n };\n\n return {\n /**\n * Initialise the custom fields manager\n */\n init: function() {\n var mainlist = $('#customfield_catlist');\n var component = mainlist.attr('data-component');\n var area = mainlist.attr('data-area');\n var itemid = mainlist.attr('data-itemid');\n\n $(\"[data-role=deletefield]\").on('click', function(e) {\n confirmDelete($(this).attr('data-id'), 'field', component, area, itemid);\n e.preventDefault();\n });\n\n $(\"[data-role=deletecategory]\").on('click', function(e) {\n confirmDelete($(this).attr('data-id'), 'category', component, area, itemid);\n e.preventDefault();\n });\n\n $('[data-role=addnewcategory]').on('click', function() {\n createNewCategory(component, area, itemid);\n });\n\n var categoryName = function(element) {\n return element\n .closest('[data-category-id]')\n .find('[data-inplaceeditable][data-itemtype=category][data-component=core_customfield]')\n .attr('data-value');\n };\n\n // Sort category.\n var sortCat = new SortableList(\n $('#customfield_catlist .categorieslist'),\n {moveHandlerSelector: '.movecategory [data-drag-type=move]'}\n );\n\n sortCat.getElementName = function(el) {\n return $.Deferred().resolve(categoryName(el));\n };\n\n $('[data-category-id]').on('sortablelist-drop', function(evt, info) {\n if (info.positionChanged) {\n var pendingPromise = new Pending('core_customfield/form:categoryid:on:sortablelist-drop');\n Ajax.call([\n {\n methodname: 'core_customfield_move_category',\n args: {\n id: info.element.data('category-id'),\n beforeid: info.targetNextElement.data('category-id')\n }\n\n },\n ])[0]\n .then(pendingPromise.resolve)\n .catch(Notification.exception);\n }\n evt.stopPropagation(); // Important for nested lists to prevent multiple targets.\n });\n\n // Sort fields.\n var sort = new SortableList(\n $('#customfield_catlist .fieldslist tbody'),\n {moveHandlerSelector: '.movefield [data-drag-type=move]'}\n );\n\n sort.getDestinationName = function(parentElement, afterElement) {\n if (!afterElement.length) {\n return Str.get_string('totopofcategory', 'customfield', categoryName(parentElement));\n } else if (afterElement.attr('data-field-name')) {\n return Str.get_string('afterfield', 'customfield', afterElement.attr('data-field-name'));\n } else {\n return $.Deferred().resolve('');\n }\n };\n\n $('[data-field-name]').on('sortablelist-drop', function(evt, info) {\n evt.stopPropagation(); // Important for nested lists to prevent multiple targets.\n if (info.positionChanged) {\n var pendingPromise = new Pending('core_customfield/form:fieldname:on:sortablelist-drop');\n Ajax.call([\n {\n methodname: 'core_customfield_move_field',\n args: {\n id: info.element.data('field-id'),\n beforeid: info.targetNextElement.data('field-id'),\n categoryid: Number(info.targetList.closest('[data-category-id]').attr('data-category-id'))\n },\n },\n ])[0]\n .then(pendingPromise.resolve)\n .catch(Notification.exception);\n }\n });\n\n $('[data-field-name]').on('sortablelist-drag', function(evt) {\n var pendingPromise = new Pending('core_customfield/form:fieldname:on:sortablelist-drag');\n\n evt.stopPropagation(); // Important for nested lists to prevent multiple targets.\n\n // Refreshing fields tables.\n Str.get_string('therearenofields', 'core_customfield').then(function(s) {\n $('#customfield_catlist .categorieslist').children().each(function() {\n var fields = $(this).find($('.field')),\n nofields = $(this).find($('.nofields'));\n if (!fields.length && !nofields.length) {\n $(this).find('tbody').append(\n '<tr class=\"nofields\"><td colspan=\"5\">' + s + '</td></tr>'\n );\n }\n if (fields.length && nofields.length) {\n nofields.remove();\n }\n });\n return null;\n })\n .then(pendingPromise.resolve)\n .catch(Notification.exception);\n });\n\n $('[data-category-id], [data-field-name]').on('sortablelist-dragstart',\n function(evt, info) {\n setTimeout(function() {\n $('.sortable-list-is-dragged').width(info.element.width());\n }, 501);\n }\n );\n\n }\n };\n});\n"],"file":"form.min.js"}