Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 82... Línea 82...
82
     */
82
     */
83
    getLastCm() {
83
    getLastCm() {
84
        return null;
84
        return null;
85
    }
85
    }
Línea -... Línea 86...
-
 
86
 
-
 
87
    /**
-
 
88
     * Get a fallback element when there is no CM in the section.
-
 
89
     *
-
 
90
     * This is used to show the correct dropzone position.
-
 
91
     *
-
 
92
     * @returns {element|null} the las course module element of the section.
-
 
93
     */
-
 
94
    getLastCmFallback() {
-
 
95
        return null;
-
 
96
    }
86
 
97
 
Línea 87... Línea 98...
87
    // Drag and drop methods.
98
    // Drag and drop methods.
88
 
99
 
89
    /**
100
    /**
Línea 115... Línea 126...
115
        if (dropdata?.type === 'files') {
126
        if (dropdata?.type === 'files') {
116
            return true;
127
            return true;
117
        }
128
        }
118
        // We accept any course module unless it can form a subsection loop.
129
        // We accept any course module unless it can form a subsection loop.
119
        if (dropdata?.type === 'cm') {
130
        if (dropdata?.type === 'cm') {
120
            if (this.section?.component && dropdata?.delegatesection === true) {
131
            if (this.section?.component && dropdata?.hasdelegatedsection === true) {
121
                return false;
132
                return false;
122
            }
133
            }
123
            return true;
134
            return true;
124
        }
135
        }
125
        // We accept any section but yourself and the next one.
-
 
126
        if (dropdata?.type === 'section') {
136
        if (dropdata?.type === 'section') {
-
 
137
            // Sections controlled by a plugin cannot accept sections.
-
 
138
            if (this.section.component !== null) {
-
 
139
                return false;
-
 
140
            }
-
 
141
            // We accept any section but yourself and the next one.
127
            return dropdata?.id != this.id && dropdata?.number != this.section.number + 1;
142
            return dropdata?.id != this.id && dropdata?.number != this.section.number + 1;
128
        }
143
        }
129
        return false;
144
        return false;
130
    }
145
    }
Línea 148... Línea 163...
148
            }).catch((error) => {
163
            }).catch((error) => {
149
                throw error;
164
                throw error;
150
            });
165
            });
151
        }
166
        }
152
        if (dropdata.type == 'cm') {
167
        if (dropdata.type == 'cm') {
-
 
168
            const lastCm = this.getLastCm();
-
 
169
            lastCm?.classList.add(this.classes.DROPDOWN);
-
 
170
            if (!lastCm) {
153
            this.getLastCm()?.classList.add(this.classes.DROPDOWN);
171
                this.getLastCmFallback()?.classList.add(this.classes.DROPDOWN);
-
 
172
            }
154
        }
173
        }
155
        if (dropdata.type == 'section') {
174
        if (dropdata.type == 'section') {
156
            this.element.classList.remove(this.classes.DROPUP);
175
            this.element.classList.remove(this.classes.DROPUP);
157
            this.element.classList.add(this.classes.DROPDOWN);
176
            this.element.classList.add(this.classes.DROPDOWN);
158
        }
177
        }
Línea 161... Línea 180...
161
    /**
180
    /**
162
     * Hide the component dropzone.
181
     * Hide the component dropzone.
163
     */
182
     */
164
    hideDropZone() {
183
    hideDropZone() {
165
        this.getLastCm()?.classList.remove(this.classes.DROPDOWN);
184
        this.getLastCm()?.classList.remove(this.classes.DROPDOWN);
-
 
185
        this.getLastCmFallback()?.classList.remove(this.classes.DROPDOWN);
166
        this.element.classList.remove(this.classes.DROPUP);
186
        this.element.classList.remove(this.classes.DROPUP);
167
        this.element.classList.remove(this.classes.DROPDOWN);
187
        this.element.classList.remove(this.classes.DROPDOWN);
168
        this.removeOverlay();
188
        this.removeOverlay();
169
    }
189
    }