Your IP : 192.168.165.1


Current Path : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/
Upload File :
Current File : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/form-course-selector.min.js.map

{"version":3,"sources":["../src/form-course-selector.js"],"names":["define","ajax","$","processResults","selector","data","results","i","excludelist","split","courses","length","indexOf","id","push","value","label","displayname","transport","query","success","failure","el","requiredcapabilities","trim","limittoenrolled","includefrontpage","onlywithcompletion","promises","searchargs","criterianame","criteriavalue","page","perpage","calls","methodname","args","options","ids","call","when","apply","done","site","frontpage","pop","matches","fullname","toUpperCase","shortname","splice","fail"],"mappings":"AAyBAA,OAAM,6BAAC,CAAC,WAAD,CAAc,QAAd,CAAD,CAA0B,SAASC,CAAT,CAAeC,CAAf,CAAkB,CAE9C,MAAsD,CAElDC,cAAc,CAAE,wBAASC,CAAT,CAAmBC,CAAnB,CAAyB,IAEjCC,CAAAA,CAAO,CAAG,EAFuB,CAGjCC,CAAC,CAAG,CAH6B,CAIjCC,CAAW,CAAG,CAAON,CAAC,CAACE,CAAD,CAAD,CAAYC,IAAZ,CAAiB,SAAjB,CAAP,KAAoCI,KAApC,CAA0C,GAA1C,CAJmB,CAMrC,IAAKF,CAAC,CAAG,CAAT,CAAYA,CAAC,CAAGF,CAAI,CAACK,OAAL,CAAaC,MAA7B,CAAqCJ,CAAC,EAAtC,CAA0C,CACtC,GAAwD,CAAC,CAArD,GAAAC,CAAW,CAACI,OAAZ,CAA2BP,CAAI,CAACK,OAAL,CAAaH,CAAb,EAAgBM,EAA3C,IAAJ,CAA4D,CACxDP,CAAO,CAACQ,IAAR,CAAa,CAACC,KAAK,CAAEV,CAAI,CAACK,OAAL,CAAaH,CAAb,EAAgBM,EAAxB,CAA4BG,KAAK,CAAEX,CAAI,CAACK,OAAL,CAAaH,CAAb,EAAgBU,WAAnD,CAAb,CACH,CACJ,CACD,MAAOX,CAAAA,CACV,CAdiD,CAgBlDY,SAAS,CAAE,mBAASd,CAAT,CAAmBe,CAAnB,CA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OC,KAAP,CAAavC,CAAC,CAACsC,IAAf,CAAqBZ,CAArB,EAA+Bc,IAA/B,CAAoC,SAASrC,CAAT,CAAesC,CAAf,CAAqB,CACrD,GAAIA,CAAI,EAAmB,CAAf,EAAAA,CAAI,CAAChC,MAAjB,CAA8B,IACtBiC,CAAAA,CAAS,CAAGD,CAAI,CAACE,GAAL,EADU,CAEtBC,CAAO,CAAa,EAAV,GAAA3B,CAAK,EACoD,CAAC,CAAjE,CAAAyB,CAAS,CAACG,QAAV,CAAmBC,WAAnB,GAAiCpC,OAAjC,CAAyCO,CAAK,CAAC6B,WAAN,EAAzC,CADO,EAE0D,CAAC,CAAlE,CAAAJ,CAAS,CAACK,SAAV,CAAoBD,WAApB,GAAkCpC,OAAlC,CAA0CO,CAAK,CAAC6B,WAAN,EAA1C,CAJmB,CAK1B,GAAIF,CAAJ,CAAa,CACTzC,CAAI,CAACK,OAAL,CAAawC,MAAb,CAAoB,CAApB,CAAuB,CAAvB,CAA0BN,CAA1B,CACH,CACJ,CACDxB,CAAO,CAACf,CAAD,CACV,CAXD,EAWG8C,IAXH,CAWQ9B,CAXR,CAYH,CA5EiD,CA8EzD,CAhFK,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 * Course selector adaptor for auto-complete form element.\n *\n * @module     core/form-course-selector\n * @class      form-course-selector\n * @package    core\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(['core/ajax', 'jquery'], function(ajax, $) {\n\n    return /** @alias module:core/form-course-selector */ {\n        // Public variables and functions.\n        processResults: function(selector, data) {\n            // Mangle the results into an array of objects.\n            var results = [];\n            var i = 0;\n            var excludelist = String($(selector).data('exclude')).split(',');\n\n            for (i = 0; i < data.courses.length; i++) {\n                if (excludelist.indexOf(String(data.courses[i].id)) === -1) {\n                    results.push({value: data.courses[i].id, label: data.courses[i].displayname});\n                }\n            }\n            return results;\n        },\n\n        transport: function(selector, query, success, failure) {\n            var el = $(selector);\n\n            // Parse some data-attributes from the form element.\n            var requiredcapabilities = el.data('requiredcapabilities');\n            if (requiredcapabilities.trim() !== \"\") {\n                requiredcapabilities = requiredcapabilities.split(',');\n            } else {\n                requiredcapabilities = [];\n            }\n\n            var limittoenrolled = el.data('limittoenrolled');\n            var includefrontpage = el.data('includefrontpage');\n            var onlywithcompletion = el.data('onlywithcompletion');\n\n            // Build the query.\n            var promises = null;\n\n            if (typeof query === \"undefined\") {\n                query = '';\n            }\n\n            var searchargs = {\n                criterianame: 'search',\n                criteriavalue: query,\n                page: 0,\n                perpage: 100,\n                requiredcapabilities: requiredcapabilities,\n                limittoenrolled: limittoenrolled,\n                onlywithcompletion: onlywithcompletion\n            };\n\n            var calls = [{\n                methodname: 'core_course_search_courses', args: searchargs\n            }];\n            if (includefrontpage) {\n                calls.push({\n                    methodname: 'core_course_get_courses',\n                    args: {\n                        options: {\n                            ids: [includefrontpage]\n                        }\n                    }\n                });\n            }\n\n            // Go go go!\n            promises = ajax.call(calls);\n            $.when.apply($.when, promises).done(function(data, site) {\n                if (site && site.length == 1) {\n                    var frontpage = site.pop();\n                    var matches = query === ''\n                        || frontpage.fullname.toUpperCase().indexOf(query.toUpperCase()) > -1\n                        || frontpage.shortname.toUpperCase().indexOf(query.toUpperCase()) > -1;\n                    if (matches) {\n                        data.courses.splice(0, 0, frontpage);\n                    }\n                }\n                success(data);\n            }).fail(failure);\n        }\n    };\n});\n"],"file":"form-course-selector.min.js"}