Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 14... Línea 14...
14
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
14
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 15... Línea 15...
15
 
15
 
16
/**
16
/**
17
 * Various actions on modules and sections in the editing mode - hiding, duplicating, deleting, etc.
17
 * Various actions on modules and sections in the editing mode - hiding, duplicating, deleting, etc.
-
 
18
 *
-
 
19
 * TODO remove this module as part of MDL-83627.
18
 *
20
 *
19
 * @module     core_course/actions
21
 * @module     core_course/actions
20
 * @copyright  2016 Marina Glancy
22
 * @copyright  2016 Marina Glancy
21
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
 * @since      3.3
24
 * @since      3.3
Línea 35... Línea 37...
35
        'core/modal_events',
37
        'core/modal_events',
36
        'core/key_codes',
38
        'core/key_codes',
37
        'core/log',
39
        'core/log',
38
        'core_courseformat/courseeditor',
40
        'core_courseformat/courseeditor',
39
        'core/event_dispatcher',
41
        'core/event_dispatcher',
-
 
42
        'core/local/inplace_editable/events',
40
        'core_course/events'
43
        'core_course/events'
41
    ],
44
    ],
42
    function(
45
    function(
43
        $,
46
        $,
44
        ajax,
47
        ajax,
Línea 52... Línea 55...
52
        ModalEvents,
55
        ModalEvents,
53
        KeyCodes,
56
        KeyCodes,
54
        log,
57
        log,
55
        editor,
58
        editor,
56
        EventDispatcher,
59
        EventDispatcher,
-
 
60
        InplaceEditableEvents,
57
        CourseEvents
61
        CourseEvents
58
    ) {
62
    ) {
-
 
63
        log.debug('The course/actions module is deprecated. Please, add support_components to your course format.');
Línea 59... Línea 64...
59
 
64
 
60
        // Eventually, core_courseformat/local/content/actions will handle all actions for
65
        // Eventually, core_courseformat/local/content/actions will handle all actions for
61
        // component compatible formats and the default actions.js won't be necessary anymore.
66
        // component compatible formats and the default actions.js won't be necessary anymore.
62
        // Meanwhile, we filter the migrated actions.
67
        // Meanwhile, we filter the migrated actions.
63
        const componentActions = [
68
        const componentActions = [
64
            'moveSection', 'moveCm', 'addSection', 'deleteSection', 'cmDelete', 'cmDuplicate', 'sectionHide', 'sectionShow',
69
            'moveSection', 'moveCm', 'addSection', 'deleteSection', 'cmDelete', 'cmDuplicate', 'sectionHide', 'sectionShow',
65
            'cmHide', 'cmShow', 'cmStealth', 'sectionHighlight', 'sectionUnhighlight', 'cmMoveRight', 'cmMoveLeft',
70
            'cmHide', 'cmShow', 'cmStealth', 'sectionHighlight', 'sectionUnhighlight', 'cmMoveRight', 'cmMoveLeft',
66
            'cmNoGroups', 'cmVisibleGroups', 'cmSeparateGroups',
71
            'cmNoGroups', 'cmVisibleGroups', 'cmSeparateGroups', 'addModule', 'newModule',
Línea 67... Línea 72...
67
        ];
72
        ];
68
 
73
 
Línea 993... Línea 998...
993
                    }
998
                    }
994
                });
999
                });
Línea 995... Línea 1000...
995
 
1000
 
996
                // The section and activity names are edited using inplace editable.
1001
                // The section and activity names are edited using inplace editable.
-
 
1002
                // The "update" jQuery event must be captured in order to update the course state.
997
                // The "update" jQuery event must be captured in order to update the course state.
1003
                $('body').on(InplaceEditableEvents.eventTypes.elementUpdated,
998
                $('body').on('updated', `${SELECTOR.SECTIONITEM} [data-inplaceeditable]`, function(e) {
1004
                        `${SELECTOR.SECTIONITEM} [data-inplaceeditable]`, function(e) {
999
                    if (e.ajaxreturn && e.ajaxreturn.itemid) {
1005
                    if (e.detail.ajaxreturn.itemid) {
1000
                        const state = courseeditor.state;
1006
                        const state = courseeditor.state;
1001
                        const section = state.section.get(e.ajaxreturn.itemid);
1007
                        const section = state.section.get(e.detail.ajaxreturn.itemid);
1002
                        if (section !== undefined) {
1008
                        if (section !== undefined) {
1003
                            courseeditor.dispatch('sectionState', [e.ajaxreturn.itemid]);
1009
                            courseeditor.dispatch('sectionState', [e.detail.ajaxreturn.itemid]);
1004
                        }
1010
                        }
1005
                    }
1011
                    }
-
 
1012
                });
-
 
1013
 
1006
                });
1014
                $('body').on(InplaceEditableEvents.eventTypes.elementUpdated,
1007
                $('body').on('updated', `${SELECTOR.ACTIVITYLI} [data-inplaceeditable]`, function(e) {
1015
                        `${SELECTOR.ACTIVITYLI} [data-itemtype="activityname"][data-inplaceeditable]`, function(e) {
1008
                    if (e.ajaxreturn && e.ajaxreturn.itemid) {
1016
                    if (e.detail.ajaxreturn.itemid) {
1009
                        courseeditor.dispatch('cmState', [e.ajaxreturn.itemid]);
1017
                        courseeditor.dispatch('cmState', [e.detail.ajaxreturn.itemid]);
1010
                    }
1018
                    }
Línea 1011... Línea 1019...
1011
                });
1019
                });
1012
 
1020