Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{"version":3,"file":"tool_type.min.js","sources":["../src/tool_type.js"],"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 * Provides an interface for a tool type in the Moodle server.\n *\n * @module     mod_lti/tool_type\n * @copyright  2015 Ryan Wyllie <ryan@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since      3.1\n */\ndefine(['core/ajax', 'core/notification'], function(ajax, notification) {\n    return {\n        /**\n         * Get a list of tool types from Moodle for the given\n         * search args.\n         *\n         * See also:\n         * mod/lti/classes/external.php get_tool_types_parameters()\n         *\n         * @method query\n         * @public\n         * @param {Object} args Search parameters\n         * @return {Promise} jQuery Deferred object\n         */\n        query: function(args) {\n            var request = {\n                methodname: 'mod_lti_get_tool_types',\n                args: args || {}\n            };\n\n            var promise = ajax.call([request])[0];\n\n            promise.fail(notification.exception);\n\n            return promise;\n        },\n\n        /**\n         * Create a tool type in Moodle.\n         *\n         * The promise will fail if the URL is not a cartridge, so you must handle the fail result.\n         *\n         * See also:\n         * mod/lti/classes/external.php create_tool_type_parameters()\n         *\n         * @method create\n         * @public\n         * @param {Object} args Tool type properties\n         * @return {Promise} jQuery Deferred object\n         */\n        create: function(args) {\n            var request = {\n                methodname: 'mod_lti_create_tool_type',\n                args: args\n            };\n\n            var promise = ajax.call([request])[0];\n\n            return promise;\n        },\n\n        /**\n         * Update a tool type in Moodle.\n         *\n         * See also:\n         * mod/lti/classes/external.php update_tool_type_parameters()\n         *\n         * @method update\n         * @public\n         * @param {Object} args Tool type properties\n         * @return {Promise} jQuery Deferred object\n         */\n        update: function(args) {\n            var request = {\n                methodname: 'mod_lti_update_tool_type',\n                args: args\n            };\n\n            var promise = ajax.call([request])[0];\n\n            promise.fail(notification.exception);\n\n            return promise;\n        },\n\n        /**\n         * Delete a tool type from Moodle.\n         *\n         * @method delete\n         * @public\n         * @param {Integer} id Tool type ID\n         * @return {Promise} jQuery Deferred object\n         */\n        'delete': function(id) {\n            var request = {\n                methodname: 'mod_lti_delete_tool_type',\n                args: {\n                    id: id\n                }\n            };\n\n            var promise = ajax.call([request])[0];\n\n            promise.fail(notification.exception);\n\n            return promise;\n        },\n\n        /**\n         * Get a list of tool types from Moodle for the given\n         * tool proxy id.\n         *\n         * @method query\n         * @public\n         * @param {Integer} id Tool type ID\n         * @return {Promise} jQuery Deferred object\n         */\n        getFromToolProxyId: function(id) {\n            return this.query({toolproxyid: id});\n        },\n\n        /**\n         * Check if the given URL is a cartridge URL.\n         *\n         * The promise will fail if the URL is unreachable, so you must handle the fail result.\n         *\n         * @method isCartridge\n         * @public\n         * @param {String} url\n         * @return {Promise} jQuery Deferred object\n         */\n        isCartridge: function(url) {\n            var request = {\n                methodname: 'mod_lti_is_cartridge',\n                args: {\n                    url: url\n                }\n            };\n\n            var promise = ajax.call([request])[0];\n\n            return promise;\n        },\n\n        /**\n         * Tool type constants.\n         */\n        constants: {\n            state: {\n                configured: 1,\n                pending: 2,\n                rejected: 3\n            },\n        }\n    };\n});\n"],"names":["define","ajax","notification","query","args","request","methodname","promise","call","fail","exception","create","update","id","getFromToolProxyId","this","toolproxyid","isCartridge","url","constants","state","configured","pending","rejected"],"mappings":";;;;;;;;AAuBAA,2BAAO,CAAC,YAAa,sBAAsB,SAASC,KAAMC,oBAC/C,CAaHC,MAAO,SAASC,UACRC,QAAU,CACVC,WAAY,yBACZF,KAAMA,MAAQ,IAGdG,QAAUN,KAAKO,KAAK,CAACH,UAAU,UAEnCE,QAAQE,KAAKP,aAAaQ,WAEnBH,SAgBXI,OAAQ,SAASP,UACTC,QAAU,CACVC,WAAY,2BACZF,KAAMA,aAGIH,KAAKO,KAAK,CAACH,UAAU,IAgBvCO,OAAQ,SAASR,UACTC,QAAU,CACVC,WAAY,2BACZF,KAAMA,MAGNG,QAAUN,KAAKO,KAAK,CAACH,UAAU,UAEnCE,QAAQE,KAAKP,aAAaQ,WAEnBH,gBAWD,SAASM,QACXR,QAAU,CACVC,WAAY,2BACZF,KAAM,CACFS,GAAIA,KAIRN,QAAUN,KAAKO,KAAK,CAACH,UAAU,UAEnCE,QAAQE,KAAKP,aAAaQ,WAEnBH,SAYXO,mBAAoB,SAASD,WAClBE,KAAKZ,MAAM,CAACa,YAAaH,MAapCI,YAAa,SAASC,SACdb,QAAU,CACVC,WAAY,uBACZF,KAAM,CACFc,IAAKA,aAICjB,KAAKO,KAAK,CAACH,UAAU,IAQvCc,UAAW,CACPC,MAAO,CACHC,WAAY,EACZC,QAAS,EACTC,SAAU"}