Your IP : 192.168.165.1


Current Path : C:/xampp/htdocs/moodle/mod/assign/amd/build/
Upload File :
Current File : C:/xampp/htdocs/moodle/mod/assign/amd/build/grading_panel.min.js.map

{"version":3,"sources":["../src/grading_panel.js"],"names":["define","$","Y","notification","templates","fragment","ajax","str","checker","GradingEvents","Event","GradingPanel","selector","_regionSelector","_region","_userCache","registerEventListeners","prototype","_lastUserId","_lastAttemptNumber","nextUserId","nextUser","_niceReplaceNodeContents","node","html","js","promise","Deferred","fadeOut","replaceNodeContents","fadeIn","resolve","_saveFormState","checked","prop","val","_submitForm","event","form","find","show","trigger","notifyFormSubmitAjax","data","serialize","assignmentid","attr","call","methodname","args","userid","jsonformdata","JSON","stringify","done","_handleFormSubmissionResponse","bind","fail","exception","formdata","response","length","document","get_strings","key","component","strs","alert","use","M","core_formchangechecker","reset_form_dirty_state","hide","_resetForm","e","_refreshGradingPanel","_chooseAttempt","link","target","submissionsId","submissionsform","getElementById","formcopy","clone","formhtml","wrap","confirm","attemptnumber","_addPopoutButtons","region","render","parents","closest","addClass","parent","append","on","_togglePopout","preventDefault","container","hasClass","removeClass","submissiondata","contextid","window","util","js_pending","params","loadFragment","saveFormState","js_complete","_getNextUser","_handleSaveAndShowNext","getPanelElement","collapsePanel","expandPanel","docElement","COLLAPSE_GRADE_PANEL","COLLAPSE_REVIEW_PANEL","EXPAND_GRADE_PANEL"],"mappings":"AAyBAA,OAAM,4BAAC,CAAC,QAAD,CAAW,UAAX,CAAuB,mBAAvB,CAA4C,gBAA5C,CAA8D,eAA9D,CACC,WADD,CACc,UADd,CAC0B,wCAD1B,CAEC,2BAFD,CAE8B,YAF9B,CAAD,CAGC,SAASC,CAAT,CAAYC,CAAZ,CAAeC,CAAf,CAA6BC,CAA7B,CAAwCC,CAAxC,CAAkDC,CAAlD,CAAwDC,CAAxD,CAA6DC,CAA7D,CAAsEC,CAAtE,CAAqFC,CAArF,CAA4F,CAQ/F,GAAIC,CAAAA,CAAY,CAAG,SAASC,CAAT,CA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ApC,EACA4D,CAAU,CAACpB,EAAX,CAAc,OAAd,CAAuB,KAAKvB,UAAL,CAAgBjB,IAAhB,CAAqB,IAArB,CAAvB,EAEA4D,CAAU,CAACpB,EAAX,CAAc,iBAAd,CAAiC,KAAKhE,cAAL,CAAoBwB,IAApB,CAAyB,IAAzB,CAAjC,EAEA4D,CAAU,CAACpB,EAAX,CAAcvF,CAAa,CAAC4G,oBAA5B,CAAkD,UAAW,CACzD,KAAKH,aAAL,EACH,CAFiD,CAEhD1D,IAFgD,CAE3C,IAF2C,CAAlD,EAKA4D,CAAU,CAACpB,EAAX,CAAcvF,CAAa,CAAC6G,qBAA5B,CAAmD,UAAW,CAC1D,KAAKH,WAAL,EACH,CAFkD,CAEjD3D,IAFiD,CAE5C,IAF4C,CAAnD,EAIA4D,CAAU,CAACpB,EAAX,CAAcvF,CAAa,CAAC8G,kBAA5B,CAAgD,UAAW,CACvD,KAAKJ,WAAL,EACH,CAF+C,CAE9C3D,IAF8C,CAEzC,IAFyC,CAAhD,CAGH,CA5BD,CA8BA,MAAO7C,CAAAA,CACV,CA9XK,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 * Javascript controller for the \"Grading\" panel at the right of the page.\n *\n * @module     mod_assign/grading_panel\n * @package    mod_assign\n * @class      GradingPanel\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(['jquery', 'core/yui', 'core/notification', 'core/templates', 'core/fragment',\n        'core/ajax', 'core/str', 'mod_assign/grading_form_change_checker',\n        'mod_assign/grading_events', 'core/event'],\n       function($, Y, notification, templates, fragment, ajax, str, checker, GradingEvents, Event) {\n\n    /**\n     * GradingPanel class.\n     *\n     * @class GradingPanel\n     * @param {String} selector The selector for the page region containing the user navigation.\n     */\n    var GradingPanel = function(selector) {\n        this._regionSelector = selector;\n        this._region = $(selector);\n        this._userCache = [];\n\n        this.registerEventListeners();\n    };\n\n    /** @type {String} Selector for the page region containing the user navigation. */\n    GradingPanel.prototype._regionSelector = null;\n\n    /** @type {Integer} Remember the last user id to prevent unnessecary reloads. */\n    GradingPanel.prototype._lastUserId = 0;\n\n    /** @type {Integer} Remember the last attempt number to prevent unnessecary reloads. */\n    GradingPanel.prototype._lastAttemptNumber = -1;\n\n    /** @type {JQuery} JQuery node for the page region containing the user navigation. */\n    GradingPanel.prototype._region = null;\n\n     /** @type {Integer} The id of the next user in the grading list */\n    GradingPanel.prototype.nextUserId = null;\n\n     /** @type {Boolean} Next user exists in the grading list */\n    GradingPanel.prototype.nextUser = false;\n\n    /**\n     * Fade the dom node out, update it, and fade it back.\n     *\n     * @private\n     * @method _niceReplaceNodeContents\n     * @param {JQuery} node\n     * @param {String} html\n     * @param {String} js\n     * @return {Deferred} promise resolved when the animations are complete.\n     */\n    GradingPanel.prototype._niceReplaceNodeContents = function(node, html, js) {\n        var promise = $.Deferred();\n\n        node.fadeOut(\"fast\", function() {\n            templates.replaceNodeContents(node, html, js);\n            node.fadeIn(\"fast\", function() {\n                promise.resolve();\n            });\n        });\n\n        return promise.promise();\n    };\n\n    /**\n     * Make sure all form fields have the latest saved state.\n     * @private\n     * @method _saveFormState\n     */\n    GradingPanel.prototype._saveFormState = function() {\n        // Copy data from notify students checkbox which was moved out of the form.\n        var checked = $('[data-region=\"grading-actions-form\"] [name=\"sendstudentnotifications\"]').prop(\"checked\");\n        $('.gradeform [name=\"sendstudentnotifications\"]').val(checked);\n    };\n\n    /**\n     * Make form submit via ajax.\n     *\n     * @private\n     * @param {Object} event\n     * @param {Integer} nextUserId\n     * @param {Boolean} nextUser optional. Load next user in the grading list.\n     * @method _submitForm\n     */\n    GradingPanel.prototype._submitForm = function(event, nextUserId, nextUser) {\n        // The form was submitted - send it via ajax instead.\n        var form = $(this._region.find('form.gradeform'));\n\n        $('[data-region=\"overlay\"]').show();\n\n        // We call this, so other modules can update the form with the latest state.\n        form.trigger('save-form-state');\n\n        // Tell all form fields we are about to submit the form.\n        Event.notifyFormSubmitAjax(form[0]);\n\n        // Now we get all the current values from the form.\n        var data = form.serialize();\n        var assignmentid = this._region.attr('data-assignmentid');\n\n        // Now we can continue...\n        ajax.call([{\n            methodname: 'mod_assign_submit_grading_form',\n            args: {assignmentid: assignmentid, userid: this._lastUserId, jsonformdata: JSON.stringify(data)},\n            done: this._handleFormSubmissionResponse.bind(this, data, nextUserId, nextUser),\n            fail: notification.exception\n        }]);\n    };\n\n    /**\n     * Handle form submission response.\n     *\n     * @private\n     * @method _handleFormSubmissionResponse\n     * @param {Array} formdata - submitted values\n     * @param {Integer} nextUserId - optional. The id of the user to load after the form is saved.\n     * @param {Array} response List of errors.\n     * @param {Boolean} nextUser - optional. If true, switch to next user in the grading list.\n     */\n    GradingPanel.prototype._handleFormSubmissionResponse = function(formdata, nextUserId, nextUser, response) {\n        if (typeof nextUserId === \"undefined\") {\n            nextUserId = this._lastUserId;\n        }\n        if (response.length) {\n            // There was an error saving the grade. Re-render the form using the submitted data so we can show\n            // validation errors.\n            $(document).trigger('reset', [this._lastUserId, formdata]);\n        } else {\n            str.get_strings([\n                {key: 'changessaved', component: 'core'},\n                {key: 'gradechangessaveddetail', component: 'mod_assign'},\n            ]).done(function(strs) {\n                notification.alert(strs[0], strs[1]);\n            }).fail(notification.exception);\n            Y.use('moodle-core-formchangechecker', function() {\n                M.core_formchangechecker.reset_form_dirty_state();\n            });\n            if (nextUserId == this._lastUserId) {\n                $(document).trigger('reset', nextUserId);\n            } else if (nextUser) {\n                $(document).trigger('done-saving-show-next', true);\n            } else {\n                $(document).trigger('user-changed', nextUserId);\n            }\n        }\n        $('[data-region=\"overlay\"]').hide();\n    };\n\n    /**\n     * Refresh form with default values.\n     *\n     * @private\n     * @method _resetForm\n     * @param {Event} e\n     * @param {Integer} userid\n     * @param {Array} formdata\n     */\n    GradingPanel.prototype._resetForm = function(e, userid, formdata) {\n        // The form was cancelled - refresh with default values.\n        var event = $.Event(\"custom\");\n        if (typeof userid == \"undefined\") {\n            userid = this._lastUserId;\n        }\n        this._lastUserId = 0;\n        this._refreshGradingPanel(event, userid, formdata);\n    };\n\n    /**\n     * Open a picker to choose an older attempt.\n     *\n     * @private\n     * @param {Object} e\n     * @method _chooseAttempt\n     */\n    GradingPanel.prototype._chooseAttempt = function(e) {\n        // Show a dialog.\n\n        // The form is in the element pointed to by data-submissions.\n        var link = $(e.target);\n        var submissionsId = link.data('submissions');\n        var submissionsform = $(document.getElementById(submissionsId));\n        var formcopy = submissionsform.clone();\n        var formhtml = formcopy.wrap($('<form/>')).html();\n\n        str.get_strings([\n            {key: 'viewadifferentattempt', component: 'mod_assign'},\n            {key: 'view', component: 'core'},\n            {key: 'cancel', component: 'core'},\n        ]).done(function(strs) {\n            notification.confirm(strs[0], formhtml, strs[1], strs[2], function() {\n                var attemptnumber = $(\"input:radio[name='select-attemptnumber']:checked\").val();\n\n                this._refreshGradingPanel(null, this._lastUserId, '', attemptnumber);\n            }.bind(this));\n        }.bind(this)).fail(notification.exception);\n    };\n\n    /**\n     * Add popout buttons\n     *\n     * @private\n     * @method _addPopoutButtons\n     * @param {JQuery} selector The region selector to add popout buttons to.\n     */\n    GradingPanel.prototype._addPopoutButtons = function(selector) {\n        var region = $(selector);\n\n        templates.render('mod_assign/popout_button', {}).done(function(html) {\n            var parents = region.find('[data-fieldtype=\"filemanager\"],[data-fieldtype=\"editor\"],[data-fieldtype=\"grading\"]')\n                    .closest('.fitem');\n            parents.addClass('has-popout').find('label').parent().append(html);\n\n            region.on('click', '[data-region=\"popout-button\"]', this._togglePopout.bind(this));\n        }.bind(this)).fail(notification.exception);\n    };\n\n    /**\n     * Make a div \"popout\" or \"popback\".\n     *\n     * @private\n     * @method _togglePopout\n     * @param {Event} event\n     */\n    GradingPanel.prototype._togglePopout = function(event) {\n        event.preventDefault();\n        var container = $(event.target).closest('.fitem');\n        if (container.hasClass('popout')) {\n            $('.popout').removeClass('popout');\n        } else {\n            $('.popout').removeClass('popout');\n            container.addClass('popout');\n            container.addClass('moodle-has-zindex');\n        }\n    };\n\n    /**\n     * Get the user context - re-render the template in the page.\n     *\n     * @private\n     * @method _refreshGradingPanel\n     * @param {Event} event\n     * @param {Number} userid\n     * @param {String} submissiondata serialised submission data.\n     * @param {Integer} attemptnumber\n     */\n    GradingPanel.prototype._refreshGradingPanel = function(event, userid, submissiondata, attemptnumber) {\n        var contextid = this._region.attr('data-contextid');\n        if (typeof submissiondata === 'undefined') {\n            submissiondata = '';\n        }\n        if (typeof attemptnumber === 'undefined') {\n            attemptnumber = -1;\n        }\n        // Skip reloading if it is the same user.\n        if (this._lastUserId == userid && this._lastAttemptNumber == attemptnumber && submissiondata === '') {\n            return;\n        }\n        this._lastUserId = userid;\n        this._lastAttemptNumber = attemptnumber;\n        $(document).trigger('start-loading-user');\n        // Tell behat to back off too.\n        window.M.util.js_pending('mod-assign-loading-user');\n        // First insert the loading template.\n        templates.render('mod_assign/loading', {}).done(function(html, js) {\n            // Update the page.\n            this._niceReplaceNodeContents(this._region, html, js).done(function() {\n                if (userid > 0) {\n                    this._region.show();\n                    // Reload the grading form \"fragment\" for this user.\n                    var params = {userid: userid, attemptnumber: attemptnumber, jsonformdata: JSON.stringify(submissiondata)};\n                    fragment.loadFragment('mod_assign', 'gradingpanel', contextid, params).done(function(html, js) {\n                        this._niceReplaceNodeContents(this._region, html, js)\n                        .done(function() {\n                            checker.saveFormState('[data-region=\"grade-panel\"] .gradeform');\n                            $(document).on('editor-content-restored', function() {\n                                // If the editor has some content that has been restored\n                                // then save the form state again for comparison.\n                                checker.saveFormState('[data-region=\"grade-panel\"] .gradeform');\n                            });\n                            $('[data-region=\"attempt-chooser\"]').on('click', this._chooseAttempt.bind(this));\n                            this._addPopoutButtons('[data-region=\"grade-panel\"] .gradeform');\n                            $(document).trigger('finish-loading-user');\n                            // Tell behat we are friends again.\n                            window.M.util.js_complete('mod-assign-loading-user');\n                        }.bind(this))\n                        .fail(notification.exception);\n                    }.bind(this)).fail(notification.exception);\n                    $('[data-region=\"review-panel\"]').show();\n                } else {\n                    this._region.hide();\n                    $('[data-region=\"review-panel\"]').hide();\n                    $(document).trigger('finish-loading-user');\n                    // Tell behat we are friends again.\n                    window.M.util.js_complete('mod-assign-loading-user');\n                }\n            }.bind(this));\n        }.bind(this)).fail(notification.exception);\n    };\n\n    /**\n     * Get next user data and store it in global variables\n     *\n     * @private\n     * @method _getNextUser\n     * @param {Event} event\n     * @param {Object} data Next user's data\n     */\n    GradingPanel.prototype._getNextUser = function(event, data) {\n        this.nextUserId = data.nextUserId;\n        this.nextUser = data.nextUser;\n    };\n\n    /**\n     * Handle the save-and-show-next event\n     *\n     * @private\n     * @method _handleSaveAndShowNext\n     */\n    GradingPanel.prototype._handleSaveAndShowNext = function() {\n        this._submitForm(null, this.nextUserId, this.nextUser);\n    };\n\n    /**\n     * Get the grade panel element.\n     *\n     * @method getPanelElement\n     * @return {jQuery}\n     */\n    GradingPanel.prototype.getPanelElement = function() {\n        return $('[data-region=\"grade-panel\"]');\n    };\n\n    /**\n     * Hide the grade panel.\n     *\n     * @method collapsePanel\n     */\n    GradingPanel.prototype.collapsePanel = function() {\n        this.getPanelElement().addClass('collapsed');\n    };\n\n    /**\n     * Show the grade panel.\n     *\n     * @method expandPanel\n     */\n    GradingPanel.prototype.expandPanel = function() {\n        this.getPanelElement().removeClass('collapsed');\n    };\n\n    /**\n     * Register event listeners for the grade panel.\n     *\n     * @method registerEventListeners\n     */\n    GradingPanel.prototype.registerEventListeners = function() {\n        var docElement = $(document);\n        var region = $(this._region);\n        // Add an event listener to prevent form submission when pressing enter key.\n        region.on('submit', 'form', function(e) {\n            e.preventDefault();\n        });\n\n        docElement.on('next-user', this._getNextUser.bind(this));\n        docElement.on('user-changed', this._refreshGradingPanel.bind(this));\n        docElement.on('save-changes', this._submitForm.bind(this));\n        docElement.on('save-and-show-next', this._handleSaveAndShowNext.bind(this));\n        docElement.on('reset', this._resetForm.bind(this));\n\n        docElement.on('save-form-state', this._saveFormState.bind(this));\n\n        docElement.on(GradingEvents.COLLAPSE_GRADE_PANEL, function() {\n            this.collapsePanel();\n        }.bind(this));\n\n        // We should expand if the review panel is collapsed.\n        docElement.on(GradingEvents.COLLAPSE_REVIEW_PANEL, function() {\n            this.expandPanel();\n        }.bind(this));\n\n        docElement.on(GradingEvents.EXPAND_GRADE_PANEL, function() {\n            this.expandPanel();\n        }.bind(this));\n    };\n\n    return GradingPanel;\n});\n"],"file":"grading_panel.min.js"}