Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 33... Línea 33...
33
     * Initial state ready method.
33
     * Initial state ready method.
34
     *
34
     *
35
     * @param {number} sectionid the section id
35
     * @param {number} sectionid the section id
36
     * @param {Object} state the initial state
36
     * @param {Object} state the initial state
37
     * @param {Element} fullregion the complete section region to mark as dragged
37
     * @param {Element} fullregion the complete section region to mark as dragged
-
 
38
     * @param {Boolean} isDndAllowed Whether drag and drop is allowed in this section.
38
     */
39
     */
39
    configDragDrop(sectionid, state, fullregion) {
40
    configDragDrop(sectionid, state, fullregion, isDndAllowed = true) {
Línea 40... Línea 41...
40
 
41
 
41
        this.id = sectionid;
42
        this.id = sectionid;
42
        if (this.section === undefined) {
43
        if (this.section === undefined) {
43
            this.section = state.section.get(this.id);
44
            this.section = state.section.get(this.id);
44
        }
45
        }
45
        if (this.course === undefined) {
46
        if (this.course === undefined) {
46
            this.course = state.course;
47
            this.course = state.course;
Línea 47... Línea 48...
47
        }
48
        }
48
 
49
 
49
        // Prevent topic zero from being draggable.
50
        // Prevent topic zero and delegated sections from being draggable.
50
        if (this.section.number > 0) {
51
        if (this.section.number > 0 && this.section.component === null) {
Línea 51... Línea 52...
51
            this.getDraggableData = this._getDraggableData;
52
            this.getDraggableData = this._getDraggableData;
Línea 52... Línea 53...
52
        }
53
        }
53
 
54
 
54
        this.fullregion = fullregion;
55
        this.fullregion = fullregion;
55
 
56
 
56
        // Drag and drop is only available for components compatible course formats.
57
        // Drag and drop is only available for components compatible course formats.
57
        if (this.reactive.isEditing && this.reactive.supportComponents) {
58
        if (this.reactive.isEditing && this.reactive.supportComponents && isDndAllowed) {
58
            // Init the dropzone.
59
            // Init the dropzone.
Línea 120... Línea 121...
120
     */
121
     */
121
    validateDropData(dropdata) {
122
    validateDropData(dropdata) {
122
        // Course module validation.
123
        // Course module validation.
123
        if (dropdata?.type === 'cm') {
124
        if (dropdata?.type === 'cm') {
124
            // Prevent content loops with subsections.
125
            // Prevent content loops with subsections.
125
            if (this.section?.component && dropdata?.delegatesection === true) {
126
            if (this.section?.component && dropdata?.hasdelegatedsection === true) {
126
                return false;
127
                return false;
127
            }
128
            }
128
            // The first section element is already there so we can ignore it.
129
            // The first section element is already there so we can ignore it.
129
            const firstcmid = this.section?.cmlist[0];
130
            const firstcmid = this.section?.cmlist[0];
130
            return dropdata.id !== firstcmid;
131
            return dropdata.id !== firstcmid;