Your IP : 192.168.165.1


Current Path : C:/xampp/htdocs/moodle/admin/tool/lp/amd/build/
Upload File :
Current File : C:/xampp/htdocs/moodle/admin/tool/lp/amd/build/competencyactions.min.js.map

{"version":3,"sources":["../src/competencyactions.js"],"names":["define","$","url","templates","notification","str","ajax","dragdrop","Ariatree","Dialogue","menubar","Picker","Outcomes","RuleConfig","Pending","treeModel","moveSource","moveTarget","pageContextId","pickerInstance","ruleConfigInstance","relatedTarget","taxonomiesConstants","rulesModules","selectedCompetencyId","addHandler","parent","data","params","competencyframeworkid","getCompetencyFrameworkId","pagecontextid","parentid","id","relocate","queryparams","param","window","location","relativeUrl","hasRule","get_strings","key","component","shortname","done","strings","confirm","fail","exception","doMove","frameworkid","requests","call","methodname","args","competencyid","search","val","reloadPage","confirmMove","targetComp","getCompetency","sourceComp","confirmMessage","showConfirm","path","indexOf","initMovePopup","popup","body","getContent","treeRoot","find","tree","on","evt","target","selected","show","close","addCompetencyChildren","competencies","i","length","haschildren","children","moveHandler","e","preventDefault","competency","searchtext","when","apply","framework","competenciestree","onecompetency","render","editHandler","context","newhtml","newjs","replaceWith","runTemplateJS","updateSearchHandler","moveUpHandler","moveDownHandler","seeCoursesHandler","courses","html","get_string","linkedcourses","relateCompetenciesHandler","pendingPromise","compIds","competencyIds","calls","each","index","value","push","relatedcompetencyid","promises","then","js","updatedRelatedCompetencies","resolve","catch","setDisallowedCompetencyIDs","display","ruleConfigHandler","setTargetCompetencyId","ruleConfigSaveHandler","config","update","idnumber","description","descriptionformat","ruletype","ruleoutcome","ruleconfig","promise","result","renderCompetencySummary","doDelete","success","alert","deleteCompetencyHandler","dragStart","originalEvent","dataTransfer","setData","allowDrop","dropEffect","dragEnter","addClass","dragLeave","removeClass","dropOver","getData","deleteRelatedHandler","relatedid","substr","removeRelated","triggerCompetencyViewedEvent","getTaxonomyAtLevel","level","constant","Deferred","showdeleterelatedaction","showrelatedcompetencies","showrule","pluginbaseurl","NONE","getString","name","modInfo","type","strs","rule","outcome","replaceNodeContents","strAddTaxonomy","strSelectedTaxonomy","selectionChanged","node","btn","actionMenu","selectedTitle","sublevel","closeAll","clone","remove","end","text","hide","getCompetencyLevel","parseTaxonomies","taxonomiesstr","all","split","unshift","init","model","pagectxid","taxonomies","rulesMods","enhance","bind","top"],"mappings":"AAuBAA,OAAM,6BAAC,CAAC,QAAD,CACC,UADD,CAEC,gBAFD,CAGC,mBAHD,CAIC,UAJD,CAKC,WALD,CAMC,0BAND,CAOC,cAPD,CAQC,kBARD,CASC,iBATD,CAUC,0BAVD,CAWC,6BAXD,CAYC,8BAZD,CAaC,cAbD,CAAD,CAeC,SACKC,CADL,CACQC,CADR,CACaC,CADb,CACwBC,CADxB,CACsCC,CADtC,CAC2CC,CAD3C,CACiDC,CADjD,CAC2DC,CAD3D,CACqEC,CADrE,CAC+EC,CAD/E,CACwFC,CADxF,CACgGC,CADhG,CAC0GC,CAD1G,CACsHC,CADtH,CAEG,IAIFC,CAAAA,CAAS,CAAG,IAJV,CAMFC,CAAU,CAAG,IANX,CAQFC,CAAU,CAAG,IARX,CAUFC,CAVE,CAYFC,CAZE,CAcFC,CAdE,CAgBFC,CAhBE,CAkBFC,CAlBE,CAoBFC,CApBE,CAsBFC,CAAoB,CAAG,IAtBrB,CA4BFC,CAAU,CAAG,UAAW,IACpBC,CAAAA,CAAM,CAAGzB,CAAC,CAAC,qCAAD,CAAD,CAAuC0B,IAAvC,CAA4C,YAA5C,CADW,CAGpBC,CAAM,CAAG,CACTC,qBAAqB,CAAEd,CAAS,CAACe,wBAAV,EADd,CAETC,aAAa,CAAEb,CAFN,CAHW,CAQxB,GAAe,IAAX,GAAAQ,CAAJ,CAAqB,CAEjBE,CAAM,CAACI,QAAP,CAAkBN,CAAM,CAACO,EAC5B,CAED,GAAIC,CAAAA,CAAQ,CAAG,UAAW,CACtB,GAAIC,CAAAA,CAAW,CAAGlC,CAAC,CAACmC,KAAF,CAAQR,CAAR,CAAlB,CACAS,MAAM,CAACC,QAAP,CAAkBpC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AN,CAAS,kBAAT,CAA6B6G,CAA7B,EAGApK,CAAkB,CAAG,GAAIP,CAAAA,CAAJ,CAAeE,CAAf,CAA0BQ,CAA1B,CAArB,CACAH,CAAkB,CAACuD,EAAnB,CAAsB,MAAtB,CAA8ByD,CAAqB,CAAC4E,IAAtB,CAA2B,IAA3B,CAA9B,CACH,CA7CE,CA+CV,CA50BK,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 * Handle selection changes and actions on the competency tree.\n *\n * @module     tool_lp/competencyactions\n * @package    tool_lp\n * @copyright  2015 Damyon Wiese <damyon@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery',\n        'core/url',\n        'core/templates',\n        'core/notification',\n        'core/str',\n        'core/ajax',\n        'tool_lp/dragdrop-reorder',\n        'tool_lp/tree',\n        'tool_lp/dialogue',\n        'tool_lp/menubar',\n        'tool_lp/competencypicker',\n        'tool_lp/competency_outcomes',\n        'tool_lp/competencyruleconfig',\n        'core/pending',\n        ],\n       function(\n            $, url, templates, notification, str, ajax, dragdrop, Ariatree, Dialogue, menubar, Picker, Outcomes, RuleConfig, Pending\n        ) {\n\n    // Private variables and functions.\n    /** @var {Object} treeModel - This is an object representing the nodes in the tree. */\n    var treeModel = null;\n    /** @var {Node} moveSource - The start of a drag operation */\n    var moveSource = null;\n    /** @var {Node} moveTarget - The end of a drag operation */\n    var moveTarget = null;\n    /** @var {Number} pageContextId The page context ID. */\n    var pageContextId;\n    /** @type {Object} Picker instance. */\n    var pickerInstance;\n    /** @type {Object} Rule config instance. */\n    var ruleConfigInstance;\n    /** @type {Object} The competency we're picking a relation to. */\n    var relatedTarget;\n    /** @type {Object} Taxonomy constants indexed per level. */\n    var taxonomiesConstants;\n    /** @type {Array} The rules modules. Values are object containing type, namd and amd. */\n    var rulesModules;\n    /** @type {Number} the selected competency ID. */\n    var selectedCompetencyId = null;\n\n    /**\n     * Respond to choosing the \"Add\" menu item for the selected node in the tree.\n     * @method addHandler\n     */\n    var addHandler = function() {\n        var parent = $('[data-region=\"competencyactions\"]').data('competency');\n\n        var params = {\n            competencyframeworkid: treeModel.getCompetencyFrameworkId(),\n            pagecontextid: pageContextId\n        };\n\n        if (parent !== null) {\n            // We are adding at a sub node.\n            params.parentid = parent.id;\n        }\n\n        var relocate = function() {\n            var queryparams = $.param(params);\n            window.location = url.relativeUrl('/admin/tool/lp/editcompetency.php?' + queryparams);\n        };\n\n        if (parent !== null && treeModel.hasRule(parent.id)) {\n            str.get_strings([\n                {key: 'confirm', component: 'moodle'},\n                {key: 'addingcompetencywillresetparentrule', component: 'tool_lp', param: parent.shortname},\n                {key: 'yes', component: 'core'},\n                {key: 'no', component: 'core'}\n            ]).done(function(strings) {\n                notification.confirm(\n                    strings[0],\n                    strings[1],\n                    strings[2],\n                    strings[3],\n                    relocate\n                );\n            }).fail(notification.exception);\n        } else {\n            relocate();\n        }\n    };\n\n    /**\n     * A source and destination has been chosen - so time to complete a move.\n     * @method doMove\n     */\n    var doMove = function() {\n        var frameworkid = $('[data-region=\"filtercompetencies\"]').data('frameworkid');\n        var requests = ajax.call([{\n            methodname: 'core_competency_set_parent_competency',\n            args: {competencyid: moveSource, parentid: moveTarget}\n        }, {\n            methodname: 'tool_lp_data_for_competencies_manage_page',\n            args: {competencyframeworkid: frameworkid,\n                    search: $('[data-region=\"filtercompetencies\"] input').val()}\n        }]);\n        requests[1].done(reloadPage).fail(notification.exception);\n    };\n\n    /**\n     * Confirms a competency move.\n     *\n     * @method confirmMove\n     */\n    var confirmMove = function() {\n        moveTarget = typeof moveTarget === \"undefined\" ? 0 : moveTarget;\n        if (moveTarget == moveSource) {\n            // No move to do.\n            return;\n        }\n\n        var targetComp = treeModel.getCompetency(moveTarget) || {},\n            sourceComp = treeModel.getCompetency(moveSource) || {},\n            confirmMessage = 'movecompetencywillresetrules',\n            showConfirm = false;\n\n        // We shouldn't be moving the competency to the same parent.\n        if (sourceComp.parentid == moveTarget) {\n            return;\n        }\n\n        // If we are moving to a child of self.\n        if (targetComp.path && targetComp.path.indexOf('/' + sourceComp.id + '/') >= 0) {\n            confirmMessage = 'movecompetencytochildofselfwillresetrules';\n\n            // Show a confirmation if self has rules, as they'll disappear.\n            showConfirm = showConfirm || treeModel.hasRule(sourceComp.id);\n        }\n\n        // Show a confirmation if the current parent, or the destination have rules.\n        showConfirm = showConfirm || (treeModel.hasRule(targetComp.id) || treeModel.hasRule(sourceComp.parentid));\n\n        // Show confirm, and/or do the things.\n        if (showConfirm) {\n            str.get_strings([\n                {key: 'confirm', component: 'moodle'},\n                {key: confirmMessage, component: 'tool_lp'},\n                {key: 'yes', component: 'moodle'},\n                {key: 'no', component: 'moodle'}\n            ]).done(function(strings) {\n                notification.confirm(\n                    strings[0], // Confirm.\n                    strings[1], // Delete competency X?\n                    strings[2], // Delete.\n                    strings[3], // Cancel.\n                    doMove\n                );\n            }).fail(notification.exception);\n\n        } else {\n            doMove();\n        }\n    };\n\n    /**\n     * A move competency popup was opened - initialise the aria tree in it.\n     * @method initMovePopup\n     * @param {dialogue} popup The tool_lp/dialogue that was created.\n     */\n    var initMovePopup = function(popup) {\n        var body = $(popup.getContent());\n        var treeRoot = body.find('[data-enhance=movetree]');\n        var tree = new Ariatree(treeRoot, false);\n        tree.on('selectionchanged', function(evt, params) {\n            var target = params.selected;\n            moveTarget = $(target).data('id');\n        });\n        treeRoot.show();\n\n        body.on('click', '[data-action=\"move\"]', function() {\n          popup.close();\n          confirmMove();\n        });\n        body.on('click', '[data-action=\"cancel\"]', function() {\n          popup.close();\n        });\n    };\n\n    /**\n     * Turn a flat list of competencies into a tree structure (recursive).\n     * @method addCompetencyChildren\n     * @param {Object} parent The current parent node in the tree\n     * @param {Object[]} competencies The flat list of competencies\n     */\n    var addCompetencyChildren = function(parent, competencies) {\n        var i;\n\n        for (i = 0; i < competencies.length; i++) {\n            if (competencies[i].parentid == parent.id) {\n                parent.haschildren = true;\n                competencies[i].children = [];\n                competencies[i].haschildren = false;\n                parent.children[parent.children.length] = competencies[i];\n                addCompetencyChildren(competencies[i], competencies);\n            }\n        }\n    };\n\n    /**\n     * A node was chosen and \"Move\" was selected from the menu. Open a popup to select the target.\n     * @param {Event} e\n     * @method moveHandler\n     */\n    var moveHandler = function(e) {\n        e.preventDefault();\n        var competency = $('[data-region=\"competencyactions\"]').data('competency');\n\n        // Remember what we are moving.\n        moveSource = competency.id;\n\n        // Load data for the template.\n        var requests = ajax.call([\n            {\n                methodname: 'core_competency_search_competencies',\n                args: {\n                    competencyframeworkid: competency.competencyframeworkid,\n                    searchtext: ''\n                }\n            }, {\n                methodname: 'core_competency_read_competency_framework',\n                args: {\n                    id: competency.competencyframeworkid\n                }\n            }\n        ]);\n\n        // When all data has arrived, continue.\n        $.when.apply(null, requests).done(function(competencies, framework) {\n\n            // Expand the list of competencies into a tree.\n            var i;\n            var competenciestree = [];\n            for (i = 0; i < competencies.length; i++) {\n                var onecompetency = competencies[i];\n                if (onecompetency.parentid == \"0\") {\n                    onecompetency.children = [];\n                    onecompetency.haschildren = 0;\n                    competenciestree[competenciestree.length] = onecompetency;\n                    addCompetencyChildren(onecompetency, competencies);\n                }\n            }\n\n            str.get_strings([\n                {key: 'movecompetency', component: 'tool_lp', param: competency.shortname},\n                {key: 'move', component: 'tool_lp'},\n                {key: 'cancel', component: 'moodle'}\n            ]).done(function(strings) {\n\n                var context = {\n                    framework: framework,\n                    competencies: competenciestree\n                };\n\n                templates.render('tool_lp/competencies_move_tree', context)\n                   .done(function(tree) {\n                       new Dialogue(\n                           strings[0], // Move competency x.\n                           tree, // The move tree.\n                           initMovePopup\n                       );\n\n                   }).fail(notification.exception);\n\n           }).fail(notification.exception);\n\n        }).fail(notification.exception);\n\n    };\n\n    /**\n     * Edit the selected competency.\n     * @method editHandler\n     */\n    var editHandler = function() {\n        var competency = $('[data-region=\"competencyactions\"]').data('competency');\n\n        var params = {\n            competencyframeworkid: treeModel.getCompetencyFrameworkId(),\n            id: competency.id,\n            parentid: competency.parentid,\n            pagecontextid: pageContextId\n        };\n\n        var queryparams = $.param(params);\n        window.location = url.relativeUrl('/admin/tool/lp/editcompetency.php?' + queryparams);\n    };\n\n    /**\n     * Re-render the page with the latest data.\n     * @param {Object} context\n     * @method reloadPage\n     */\n    var reloadPage = function(context) {\n        templates.render('tool_lp/manage_competencies_page', context)\n            .done(function(newhtml, newjs) {\n                $('[data-region=\"managecompetencies\"]').replaceWith(newhtml);\n                templates.runTemplateJS(newjs);\n            })\n           .fail(notification.exception);\n    };\n\n    /**\n     * Perform a search and render the page with the new search results.\n     * @param {Event} e\n     * @method updateSearchHandler\n     */\n    var updateSearchHandler = function(e) {\n        e.preventDefault();\n\n        var frameworkid = $('[data-region=\"filtercompetencies\"]').data('frameworkid');\n\n        var requests = ajax.call([{\n            methodname: 'tool_lp_data_for_competencies_manage_page',\n            args: {competencyframeworkid: frameworkid,\n                    search: $('[data-region=\"filtercompetencies\"] input').val()}\n        }]);\n        requests[0].done(reloadPage).fail(notification.exception);\n    };\n\n    /**\n     * Move a competency \"up\". This only affects the sort order within the same branch of the tree.\n     * @method moveUpHandler\n     */\n    var moveUpHandler = function() {\n        // We are chaining ajax requests here.\n        var competency = $('[data-region=\"competencyactions\"]').data('competency');\n        var requests = ajax.call([{\n            methodname: 'core_competency_move_up_competency',\n            args: {id: competency.id}\n        }, {\n            methodname: 'tool_lp_data_for_competencies_manage_page',\n            args: {competencyframeworkid: competency.competencyframeworkid,\n                    search: $('[data-region=\"filtercompetencies\"] input').val()}\n        }]);\n        requests[1].done(reloadPage).fail(notification.exception);\n    };\n\n    /**\n     * Move a competency \"down\". This only affects the sort order within the same branch of the tree.\n     * @method moveDownHandler\n     */\n    var moveDownHandler = function() {\n        // We are chaining ajax requests here.\n        var competency = $('[data-region=\"competencyactions\"]').data('competency');\n        var requests = ajax.call([{\n            methodname: 'core_competency_move_down_competency',\n            args: {id: competency.id}\n        }, {\n            methodname: 'tool_lp_data_for_competencies_manage_page',\n            args: {competencyframeworkid: competency.competencyframeworkid,\n                    search: $('[data-region=\"filtercompetencies\"] input').val()}\n        }]);\n        requests[1].done(reloadPage).fail(notification.exception);\n    };\n\n    /**\n     * Open a dialogue to show all the courses using the selected competency.\n     * @method seeCoursesHandler\n     */\n    var seeCoursesHandler = function() {\n        var competency = $('[data-region=\"competencyactions\"]').data('competency');\n\n        var requests = ajax.call([{\n            methodname: 'tool_lp_list_courses_using_competency',\n            args: {id: competency.id}\n        }]);\n\n        requests[0].done(function(courses) {\n            var context = {\n                courses: courses\n            };\n            templates.render('tool_lp/linked_courses_summary', context).done(function(html) {\n                str.get_string('linkedcourses', 'tool_lp').done(function(linkedcourses) {\n                    new Dialogue(\n                        linkedcourses, // Title.\n                        html, // The linked courses.\n                        initMovePopup\n                    );\n                }).fail(notification.exception);\n            }).fail(notification.exception);\n        }).fail(notification.exception);\n    };\n\n    /**\n     * Open a competencies popup to relate competencies.\n     *\n     * @method relateCompetenciesHandler\n     */\n    var relateCompetenciesHandler = function() {\n        relatedTarget = $('[data-region=\"competencyactions\"]').data('competency');\n\n        if (!pickerInstance) {\n            pickerInstance = new Picker(pageContextId, relatedTarget.competencyframeworkid);\n            pickerInstance.on('save', function(e, data) {\n                var pendingPromise = new Pending();\n                var compIds = data.competencyIds;\n\n                var calls = [];\n                $.each(compIds, function(index, value) {\n                    calls.push({\n                        methodname: 'core_competency_add_related_competency',\n                        args: {competencyid: value, relatedcompetencyid: relatedTarget.id}\n                    });\n                });\n\n                calls.push({\n                    methodname: 'tool_lp_data_for_related_competencies_section',\n                    args: {competencyid: relatedTarget.id}\n                });\n\n                var promises = ajax.call(calls);\n\n                promises[calls.length - 1].then(function(context) {\n                    return templates.render('tool_lp/related_competencies', context);\n                }).then(function(html, js) {\n                    $('[data-region=\"relatedcompetencies\"]').replaceWith(html);\n                    templates.runTemplateJS(js);\n                    updatedRelatedCompetencies();\n                    return;\n                })\n                .then(pendingPromise.resolve)\n                .catch(notification.exception);\n            });\n        }\n\n        pickerInstance.setDisallowedCompetencyIDs([relatedTarget.id]);\n        pickerInstance.display();\n    };\n\n    var ruleConfigHandler = function(e) {\n        e.preventDefault();\n        relatedTarget = $('[data-region=\"competencyactions\"]').data('competency');\n        ruleConfigInstance.setTargetCompetencyId(relatedTarget.id);\n        ruleConfigInstance.display();\n    };\n\n    var ruleConfigSaveHandler = function(e, config) {\n        var update = {\n            id: relatedTarget.id,\n            shortname: relatedTarget.shortname,\n            idnumber: relatedTarget.idnumber,\n            description: relatedTarget.description,\n            descriptionformat: relatedTarget.descriptionformat,\n            ruletype: config.ruletype,\n            ruleoutcome: config.ruleoutcome,\n            ruleconfig: config.ruleconfig\n        };\n        var promise = ajax.call([{\n            methodname: 'core_competency_update_competency',\n            args: {competency: update}\n        }]);\n        promise[0].then(function(result) {\n            if (result) {\n                relatedTarget.ruletype = config.ruletype;\n                relatedTarget.ruleoutcome = config.ruleoutcome;\n                relatedTarget.ruleconfig = config.ruleconfig;\n                renderCompetencySummary(relatedTarget);\n            }\n            return;\n        }).catch(notification.exception);\n    };\n\n    /**\n     * Delete a competency.\n     * @method doDelete\n     */\n    var doDelete = function() {\n        // We are chaining ajax requests here.\n        var competency = $('[data-region=\"competencyactions\"]').data('competency');\n        var requests = ajax.call([{\n            methodname: 'core_competency_delete_competency',\n            args: {id: competency.id}\n        }, {\n            methodname: 'tool_lp_data_for_competencies_manage_page',\n            args: {competencyframeworkid: competency.competencyframeworkid,\n                    search: $('[data-region=\"filtercompetencies\"] input').val()}\n        }]);\n        requests[0].done(function(success) {\n            if (success === false) {\n                str.get_strings([\n                {key: 'competencycannotbedeleted', component: 'tool_lp', param: competency.shortname},\n                {key: 'cancel', component: 'moodle'}\n                ]).done(function(strings) {\n                    notification.alert(\n                        null,\n                        strings[0]\n                    );\n                }).fail(notification.exception);\n            }\n        }).fail(notification.exception);\n        requests[1].done(reloadPage).fail(notification.exception);\n    };\n\n    /**\n     * Show a confirm dialogue before deleting a competency.\n     * @method deleteCompetencyHandler\n     */\n    var deleteCompetencyHandler = function() {\n        var competency = $('[data-region=\"competencyactions\"]').data('competency'),\n            confirmMessage = 'deletecompetency';\n\n        if (treeModel.hasRule(competency.parentid)) {\n            confirmMessage = 'deletecompetencyparenthasrule';\n        }\n\n        str.get_strings([\n            {key: 'confirm', component: 'moodle'},\n            {key: confirmMessage, component: 'tool_lp', param: competency.shortname},\n            {key: 'delete', component: 'moodle'},\n            {key: 'cancel', component: 'moodle'}\n        ]).done(function(strings) {\n            notification.confirm(\n                strings[0], // Confirm.\n                strings[1], // Delete competency X?\n                strings[2], // Delete.\n                strings[3], // Cancel.\n                doDelete\n            );\n        }).fail(notification.exception);\n    };\n\n    /**\n     * HTML5 implementation of drag/drop (there is an accesible alternative in the menus).\n     * @method dragStart\n     * @param {Event} e\n     */\n    var dragStart = function(e) {\n        e.originalEvent.dataTransfer.setData('text', $(e.target).parent().data('id'));\n    };\n\n    /**\n     * HTML5 implementation of drag/drop (there is an accesible alternative in the menus).\n     * @method allowDrop\n     * @param {Event} e\n     */\n    var allowDrop = function(e) {\n        e.originalEvent.dataTransfer.dropEffect = 'move';\n        e.preventDefault();\n    };\n\n    /**\n     * HTML5 implementation of drag/drop (there is an accesible alternative in the menus).\n     * @method dragEnter\n     * @param {Event} e\n     */\n    var dragEnter = function(e) {\n        e.preventDefault();\n        $(this).addClass('currentdragtarget');\n    };\n\n    /**\n     * HTML5 implementation of drag/drop (there is an accesible alternative in the menus).\n     * @method dragLeave\n     * @param {Event} e\n     */\n    var dragLeave = function(e) {\n        e.preventDefault();\n        $(this).removeClass('currentdragtarget');\n    };\n\n    /**\n     * HTML5 implementation of drag/drop (there is an accesible alternative in the menus).\n     * @method dropOver\n     * @param {Event} e\n     */\n    var dropOver = function(e) {\n        e.preventDefault();\n        moveSource = e.originalEvent.dataTransfer.getData('text');\n        moveTarget = $(e.target).parent().data('id');\n        $(this).removeClass('currentdragtarget');\n\n        confirmMove();\n    };\n\n    /**\n     * Deletes a related competency without confirmation.\n     *\n     * @param {Event} e The event that triggered the action.\n     * @method deleteRelatedHandler\n     */\n    var deleteRelatedHandler = function(e) {\n        e.preventDefault();\n\n        var relatedid = this.id.substr(11);\n        var competency = $('[data-region=\"competencyactions\"]').data('competency');\n        var removeRelated = ajax.call([\n            {methodname: 'core_competency_remove_related_competency',\n              args: {relatedcompetencyid: relatedid, competencyid: competency.id}},\n            {methodname: 'tool_lp_data_for_related_competencies_section',\n              args: {competencyid: competency.id}}\n        ]);\n\n        removeRelated[1].done(function(context) {\n            templates.render('tool_lp/related_competencies', context).done(function(html) {\n                $('[data-region=\"relatedcompetencies\"]').replaceWith(html);\n                updatedRelatedCompetencies();\n            }).fail(notification.exception);\n        }).fail(notification.exception);\n    };\n\n    /**\n     * Updates the competencies list (with relations) and add listeners.\n     *\n     * @method updatedRelatedCompetencies\n     */\n    var updatedRelatedCompetencies = function() {\n\n        // Listeners to newly loaded related competencies.\n        $('[data-action=\"deleterelation\"]').on('click', deleteRelatedHandler);\n\n    };\n\n    /**\n     * Log the competency viewed event.\n     *\n     * @param  {Object} competency The competency.\n     * @method triggerCompetencyViewedEvent\n     */\n    var triggerCompetencyViewedEvent = function(competency) {\n        if (competency.id !== selectedCompetencyId) {\n            // Set the selected competency id.\n            selectedCompetencyId = competency.id;\n            ajax.call([{\n                    methodname: 'core_competency_competency_viewed',\n                    args: {id: competency.id}\n            }]);\n        }\n    };\n\n    /**\n     * Return the taxonomy constant for a level.\n     *\n     * @param  {Number} level The level.\n     * @return {String}\n     * @function getTaxonomyAtLevel\n     */\n    var getTaxonomyAtLevel = function(level) {\n        var constant = taxonomiesConstants[level];\n        if (!constant) {\n            constant = 'competency';\n        }\n        return constant;\n    };\n\n    /**\n     * Render the competency summary.\n     *\n     * @param  {Object} competency The competency.\n     */\n    var renderCompetencySummary = function(competency) {\n        var promise = $.Deferred().resolve().promise(),\n            context = {};\n\n        context.competency = competency;\n        context.showdeleterelatedaction = true;\n        context.showrelatedcompetencies = true;\n        context.showrule = false;\n        context.pluginbaseurl = url.relativeUrl('/admin/tool/lp');\n\n        if (competency.ruleoutcome != Outcomes.NONE) {\n            // Get the outcome and rule name.\n            promise = Outcomes.getString(competency.ruleoutcome).then(function(str) {\n                var name;\n                $.each(rulesModules, function(index, modInfo) {\n                    if (modInfo.type == competency.ruletype) {\n                        name = modInfo.name;\n                    }\n                });\n                return [str, name];\n            });\n        }\n\n        promise.then(function(strs) {\n            if (typeof strs !== 'undefined') {\n                context.showrule = true;\n                context.rule = {\n                    outcome: strs[0],\n                    type: strs[1]\n                };\n            }\n            return context;\n        }).then(function(context) {\n            return templates.render('tool_lp/competency_summary', context);\n        }).then(function(html) {\n            $('[data-region=\"competencyinfo\"]').html(html);\n            $('[data-action=\"deleterelation\"]').on('click', deleteRelatedHandler);\n            return templates.render('tool_lp/loading', {});\n        }).then(function(html, js) {\n            templates.replaceNodeContents('[data-region=\"relatedcompetencies\"]', html, js);\n            return ajax.call([{\n                methodname: 'tool_lp_data_for_related_competencies_section',\n                args: {competencyid: competency.id}\n            }])[0];\n        }).then(function(context) {\n            return templates.render('tool_lp/related_competencies', context);\n        }).then(function(html, js) {\n            $('[data-region=\"relatedcompetencies\"]').replaceWith(html);\n            templates.runTemplateJS(js);\n            updatedRelatedCompetencies();\n            return;\n        }).catch(notification.exception);\n    };\n\n    /**\n     * Return the string \"Add <taxonomy>\".\n     *\n     * @param  {Number} level The level.\n     * @return {String}\n     * @function strAddTaxonomy\n     */\n    var strAddTaxonomy = function(level) {\n        return str.get_string('taxonomy_add_' + getTaxonomyAtLevel(level), 'tool_lp');\n    };\n\n    /**\n     * Return the string \"Selected <taxonomy>\".\n     *\n     * @param  {Number} level The level.\n     * @return {String}\n     * @function strSelectedTaxonomy\n     */\n    var strSelectedTaxonomy = function(level) {\n        return str.get_string('taxonomy_selected_' + getTaxonomyAtLevel(level), 'tool_lp');\n    };\n\n    /**\n     * Handler when a node in the aria tree is selected.\n     * @method selectionChanged\n     * @param {Event} evt The event that triggered the selection change.\n     * @param {Object} params The parameters for the event. Contains a list of selected nodes.\n     * @return {Boolean}\n     */\n    var selectionChanged = function(evt, params) {\n        var node = params.selected,\n            id = $(node).data('id'),\n            btn = $('[data-region=\"competencyactions\"] [data-action=\"add\"]'),\n            actionMenu = $('[data-region=\"competencyactionsmenu\"]'),\n            selectedTitle = $('[data-region=\"selected-competency\"]'),\n            level = 0,\n            sublevel = 1;\n\n        menubar.closeAll();\n\n        if (typeof id === \"undefined\") {\n            // Assume this is the root of the tree.\n            // Here we are only getting the text from the top of the tree, to do it we clone the tree,\n            // remove all children and then call text on the result.\n            $('[data-region=\"competencyinfo\"]').html(node.clone().children().remove().end().text());\n            $('[data-region=\"competencyactions\"]').data('competency', null);\n            actionMenu.hide();\n\n        } else {\n            var competency = treeModel.getCompetency(id);\n\n            level = treeModel.getCompetencyLevel(id);\n            sublevel = level + 1;\n\n            actionMenu.show();\n            $('[data-region=\"competencyactions\"]').data('competency', competency);\n            renderCompetencySummary(competency);\n            // Log Competency viewed event.\n            triggerCompetencyViewedEvent(competency);\n        }\n        strSelectedTaxonomy(level).then(function(str) {\n            selectedTitle.text(str);\n            return;\n        }).catch(notification.exception);\n\n        strAddTaxonomy(sublevel).then(function(str) {\n            btn.show()\n                .find('[data-region=\"term\"]')\n                .text(str);\n            return;\n        }).catch(notification.exception);\n\n        // We handled this event so consume it.\n        evt.preventDefault();\n        return false;\n    };\n\n    /**\n     * Return the string \"Selected <taxonomy>\".\n     *\n     * @function parseTaxonomies\n     * @param  {String} taxonomiesstr Comma separated list of taxonomies.\n     * @return {Array} of level => taxonomystr\n     */\n    var parseTaxonomies = function(taxonomiesstr) {\n        var all = taxonomiesstr.split(',');\n        all.unshift(\"\");\n        delete all[0];\n\n        // Note we don't need to fill holes, because other functions check for empty anyway.\n        return all;\n    };\n\n    return {\n        /**\n         * Initialise this page (attach event handlers etc).\n         *\n         * @method init\n         * @param {Object} model The tree model provides some useful functions for loading and searching competencies.\n         * @param {Number} pagectxid The page context ID.\n         * @param {Object} taxonomies Constants indexed by level.\n         * @param {Object} rulesMods The modules of the rules.\n         */\n        init: function(model, pagectxid, taxonomies, rulesMods) {\n            treeModel = model;\n            pageContextId = pagectxid;\n            taxonomiesConstants = parseTaxonomies(taxonomies);\n            rulesModules = rulesMods;\n\n            $('[data-region=\"competencyactions\"] [data-action=\"add\"]').on('click', addHandler);\n\n            menubar.enhance('.competencyactionsmenu', {\n                '[data-action=\"edit\"]': editHandler,\n                '[data-action=\"delete\"]': deleteCompetencyHandler,\n                '[data-action=\"move\"]': moveHandler,\n                '[data-action=\"moveup\"]': moveUpHandler,\n                '[data-action=\"movedown\"]': moveDownHandler,\n                '[data-action=\"linkedcourses\"]': seeCoursesHandler,\n                '[data-action=\"relatedcompetencies\"]': relateCompetenciesHandler.bind(this),\n                '[data-action=\"competencyrules\"]': ruleConfigHandler.bind(this)\n            });\n            $('[data-region=\"competencyactionsmenu\"]').hide();\n            $('[data-region=\"competencyactions\"] [data-action=\"add\"]').hide();\n\n            $('[data-region=\"filtercompetencies\"]').on('submit', updateSearchHandler);\n            // Simple html5 drag drop because we already added an accessible alternative.\n            var top = $('[data-region=\"managecompetencies\"] [data-enhance=\"tree\"]');\n            top.on('dragstart', 'li>span', dragStart)\n                .on('dragover', 'li>span', allowDrop)\n                .on('dragenter', 'li>span', dragEnter)\n                .on('dragleave', 'li>span', dragLeave)\n                .on('drop', 'li>span', dropOver);\n\n            model.on('selectionchanged', selectionChanged);\n\n            // Prepare the configuration tool.\n            ruleConfigInstance = new RuleConfig(treeModel, rulesModules);\n            ruleConfigInstance.on('save', ruleConfigSaveHandler.bind(this));\n        }\n    };\n});\n"],"file":"competencyactions.min.js"}