Proyectos de Subversion Moodle

Rev

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

{"version":3,"file":"drag_drop_data_store.min.js","sources":["../src/drag_drop_data_store.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 * A javascript module to store calendar drag and drop data.\n *\n * This module is unfortunately required because of the limitations\n * of the HTML5 drag and drop API and it's ability to provide data\n * between the different stages of the drag/drop lifecycle.\n *\n * @module     core_calendar/drag_drop_data_store\n * @copyright  2017 Ryan Wyllie <ryan@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([], function() {\n    /* @var {int|null} eventId The id of the event being dragged */\n    var eventId = null;\n    /* @var {int|null} durationDays How many days the event spans */\n    var durationDays = null;\n    /* @var {int|null} minTimestart The earliest valid timestart */\n    var minTimestart = null;\n    /* @var {int|null} maxTimestart The latest valid tiemstart */\n    var maxTimestart = null;\n    /* @var {string|null} minError Error message for min timestamp violation */\n    var minError = null;\n    /* @var {string|null} maxError Error message for max timestamp violation */\n    var maxError = null;\n\n    /**\n     * Store the id of the event being dragged.\n     *\n     * @param {int} id The event id\n     */\n    var setEventId = function(id) {\n        eventId = id;\n    };\n\n    /**\n     * Get the stored event id.\n     *\n     * @return {int|null}\n     */\n    var getEventId = function() {\n        return eventId;\n    };\n\n    /**\n     * Check if the store has an event id.\n     *\n     * @return {bool}\n     */\n    var hasEventId = function() {\n        return eventId !== null;\n    };\n\n    /**\n     * Store the duration (in days) of the event being dragged.\n     *\n     * @param {int} days Number of days the event spans\n     */\n    var setDurationDays = function(days) {\n        durationDays = days;\n    };\n\n    /**\n     * Get the stored number of days.\n     *\n     * @return {int|null}\n     */\n    var getDurationDays = function() {\n        return durationDays;\n    };\n\n    /**\n     * Store the minimum timestart valid for an event being dragged.\n     *\n     * @param {int} timestamp The unix timstamp\n     */\n    var setMinTimestart = function(timestamp) {\n        minTimestart = timestamp;\n    };\n\n    /**\n     * Get the minimum valid timestart.\n     *\n     * @return {int|null}\n     */\n    var getMinTimestart = function() {\n        return minTimestart;\n    };\n\n    /**\n     * Check if a minimum timestamp is set.\n     *\n     * @return {bool}\n     */\n    var hasMinTimestart = function() {\n        return minTimestart !== null;\n    };\n\n    /**\n     * Store the maximum timestart valid for an event being dragged.\n     *\n     * @param {int} timestamp The unix timstamp\n     */\n    var setMaxTimestart = function(timestamp) {\n        maxTimestart = timestamp;\n    };\n\n    /**\n     * Get the maximum valid timestart.\n     *\n     * @return {int|null}\n     */\n    var getMaxTimestart = function() {\n        return maxTimestart;\n    };\n\n    /**\n     * Check if a maximum timestamp is set.\n     *\n     * @return {bool}\n     */\n    var hasMaxTimestart = function() {\n        return maxTimestart !== null;\n    };\n\n    /**\n     * Store the error string to display if trying to drag an event\n     * earlier than the minimum allowed date.\n     *\n     * @param {string} message The error message\n     */\n    var setMinError = function(message) {\n        minError = message;\n    };\n\n    /**\n     * Get the error message for a minimum time start violation.\n     *\n     * @return {string|null}\n     */\n    var getMinError = function() {\n        return minError;\n    };\n\n    /**\n     * Store the error string to display if trying to drag an event\n     * later than the maximum allowed date.\n     *\n     * @param {string} message The error message\n     */\n    var setMaxError = function(message) {\n        maxError = message;\n    };\n\n    /**\n     * Get the error message for a maximum time start violation.\n     *\n     * @return {string|null}\n     */\n    var getMaxError = function() {\n        return maxError;\n    };\n\n    /**\n     * Reset all of the stored values.\n     */\n    var clearAll = function() {\n        setEventId(null);\n        setDurationDays(null);\n        setMinTimestart(null);\n        setMaxTimestart(null);\n        setMinError(null);\n        setMaxError(null);\n    };\n\n    return {\n        setEventId: setEventId,\n        getEventId: getEventId,\n        hasEventId: hasEventId,\n        setDurationDays: setDurationDays,\n        getDurationDays: getDurationDays,\n        setMinTimestart: setMinTimestart,\n        getMinTimestart: getMinTimestart,\n        hasMinTimestart: hasMinTimestart,\n        setMaxTimestart: setMaxTimestart,\n        getMaxTimestart: getMaxTimestart,\n        hasMaxTimestart: hasMaxTimestart,\n        setMinError: setMinError,\n        getMinError: getMinError,\n        setMaxError: setMaxError,\n        getMaxError: getMaxError,\n        clearAll: clearAll\n    };\n});\n"],"names":["define","eventId","durationDays","minTimestart","maxTimestart","minError","maxError","setEventId","id","setDurationDays","days","setMinTimestart","timestamp","setMaxTimestart","setMinError","message","setMaxError","getEventId","hasEventId","getDurationDays","getMinTimestart","hasMinTimestart","getMaxTimestart","hasMaxTimestart","getMinError","getMaxError","clearAll"],"mappings":";;;;;;;;;;;AA0BAA,4CAAO,IAAI,eAEHC,QAAU,KAEVC,aAAe,KAEfC,aAAe,KAEfC,aAAe,KAEfC,SAAW,KAEXC,SAAW,KAOXC,WAAa,SAASC,IACtBP,QAAUO,IA0BVC,gBAAkB,SAASC,MAC3BR,aAAeQ,MAiBfC,gBAAkB,SAASC,WAC3BT,aAAeS,WA0BfC,gBAAkB,SAASD,WAC3BR,aAAeQ,WA2BfE,YAAc,SAASC,SACvBV,SAAWU,SAkBXC,YAAc,SAASD,SACvBT,SAAWS,eAwBR,CACHR,WAAYA,WACZU,WAzIa,kBACNhB,SAyIPiB,WAjIa,kBACM,OAAZjB,SAiIPQ,gBAAiBA,gBACjBU,gBAjHkB,kBACXjB,cAiHPS,gBAAiBA,gBACjBS,gBAjGkB,kBACXjB,cAiGPkB,gBAzFkB,kBACM,OAAjBlB,cAyFPU,gBAAiBA,gBACjBS,gBAzEkB,kBACXlB,cAyEPmB,gBAjEkB,kBACM,OAAjBnB,cAiEPU,YAAaA,YACbU,YAhDc,kBACPnB,UAgDPW,YAAaA,YACbS,YA/Bc,kBACPnB,UA+BPoB,SAzBW,WACXnB,WAAW,MACXE,gBAAgB,MAChBE,gBAAgB,MAChBE,gBAAgB,MAChBC,YAAY,MACZE,YAAY"}