Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 109... Línea 109...
109
    // Get the height of the div at this point before we shrink it if required
109
    // Get the height of the div at this point before we shrink it if required
110
    var height = this.div.get('offsetHeight');
110
    var height = this.div.get('offsetHeight');
111
    var collapsedimage = 't/collapsed'; // ltr mode
111
    var collapsedimage = 't/collapsed'; // ltr mode
112
    if (right_to_left()) {
112
    if (right_to_left()) {
113
        collapsedimage = 't/collapsed_rtl';
113
        collapsedimage = 't/collapsed_rtl';
114
    } else {
-
 
115
        collapsedimage = 't/collapsed';
-
 
116
    }
114
    }
117
    if (this.div.hasClass('collapsed')) {
115
    if (this.div.hasClass('collapsed')) {
118
        // Add the correct image and record the YUI node created in the process
116
        // Add the correct image and record the YUI node created in the process
119
        this.icon = Y.Node.create('<img src="'+M.util.image_url(collapsedimage, 'moodle')+'" alt="" />');
117
        this.icon = Y.Node.create('<img src="'+M.util.image_url(collapsedimage, 'moodle')+'" alt="" class="icon" />');
120
        // Shrink the div as it is collapsed by default
118
        // Shrink the div as it is collapsed by default
121
        this.div.setStyle('height', caption.get('offsetHeight')+'px');
119
        this.div.setStyle('height', caption.get('offsetHeight')+'px');
122
    } else {
120
    } else {
123
        // Add the correct image and record the YUI node created in the process
121
        // Add the correct image and record the YUI node created in the process
124
        this.icon = Y.Node.create('<img src="'+M.util.image_url('t/expanded', 'moodle')+'" alt="" />');
122
        this.icon = Y.Node.create('<img src="'+M.util.image_url('t/expanded', 'moodle')+'" alt="" class="icon" />');
125
    }
123
    }
126
    a.append(this.icon);
124
    a.append(this.icon);
Línea 127... Línea 125...
127
 
125
 
128
    // Create the animation.
126
    // Create the animation.
Línea 194... Línea 192...
194
 * @type Y.Node
192
 * @type Y.Node
195
 */
193
 */
196
M.util.CollapsibleRegion.prototype.icon = null;
194
M.util.CollapsibleRegion.prototype.icon = null;
Línea 197... Línea 195...
197
 
195
 
198
/**
-
 
199
 * Makes a best effort to connect back to Moodle to update a user preference,
-
 
200
 * however, there is no mechanism for finding out if the update succeeded.
-
 
201
 *
-
 
202
 * Before you can use this function in your JavsScript, you must have called
-
 
203
 * user_preference_allow_ajax_update from moodlelib.php to tell Moodle that
-
 
204
 * the udpate is allowed, and how to safely clean and submitted values.
-
 
205
 *
-
 
206
 * @param {String} name the name of the setting to update.
-
 
207
 * @param {String} value the value to set it to.
-
 
208
 *
196
/**
209
 * @deprecated since Moodle 4.3.
197
 * @deprecated since Moodle 4.3.
210
 */
198
 */
211
M.util.set_user_preference = function(name, value) {
199
M.util.set_user_preference = function() {
212
    Y.log('M.util.set_user_preference is deprecated. Please use the "core_user/repository" module instead.', 'warn');
-
 
213
 
-
 
214
    require(['core_user/repository'], function(UserRepository) {
-
 
215
        UserRepository.setUserPreference(name, value);
-
 
216
    });
200
    throw new Error('M.util.set_user_preference is deprecated. Please use the "core_user/repository" module instead.');
Línea 217... Línea 201...
217
};
201
};
218
 
202
 
219
/**
203
/**
Línea 798... Línea 782...
798
    if (node.one('.lightbox')) {
782
    if (node.one('.lightbox')) {
799
        return node.one('.lightbox');
783
        return node.one('.lightbox');
800
    }
784
    }
Línea 801... Línea 785...
801
 
785
 
-
 
786
    node.setStyle('position', 'relative');
802
    node.setStyle('position', 'relative');
787
 
803
    var waiticon = Y.Node.create('<img />')
-
 
804
    .setAttrs({
788
    var waiticon = Y.Node.create('<img />')
805
        'src' : M.util.image_url(WAITICON.pix, WAITICON.component)
-
 
806
    })
-
 
807
    .setStyles({
-
 
808
        'position' : 'relative',
789
        .setAttribute('src', M.util.image_url(WAITICON.pix, WAITICON.component))
809
        'top' : '50%'
-
 
Línea 810... Línea 790...
810
    });
790
        .addClass('icon');
811
 
791
 
812
    var lightbox = Y.Node.create('<div></div>')
792
    var lightbox = Y.Node.create('<div></div>')
813
    .setStyles({
793
    .setStyles({
814
        'opacity' : '.75',
794
        'opacity' : '.75',
815
        'position' : 'absolute',
795
        'position' : 'absolute',
816
        'width' : '100%',
796
        'width' : '100%',
817
        'height' : '100%',
797
        'height' : '100%',
-
 
798
        'top' : 0,
818
        'top' : 0,
799
        'left' : 0,
819
        'left' : 0,
800
        'paddingTop': '50%',
820
        'backgroundColor' : 'white',
801
        'backgroundColor' : 'white',
821
        'textAlign' : 'center'
802
        'textAlign' : 'center'
822
    })
803
    })
Línea 843... Línea 824...
843
        return node.one('.spinner');
824
        return node.one('.spinner');
844
    }
825
    }
Línea 845... Línea 826...
845
 
826
 
846
    var spinner = Y.Node.create('<img />')
827
    var spinner = Y.Node.create('<img />')
847
        .setAttribute('src', M.util.image_url(WAITICON.pix, WAITICON.component))
828
        .setAttribute('src', M.util.image_url(WAITICON.pix, WAITICON.component))
848
        .addClass('spinner')
-
 
849
        .addClass('iconsmall')
829
        .addClass('spinner icon')
Línea 850... Línea 830...
850
        .hide();
830
        .hide();
851
 
831
 
852
    node.append(spinner);
832
    node.append(spinner);
Línea 1168... Línea 1148...
1168
 */
1148
 */
1169
function stripHTML(str) {
1149
function stripHTML(str) {
1170
    throw new Error('stripHTML can not be used any more. Please use jQuery instead.');
1150
    throw new Error('stripHTML can not be used any more. Please use jQuery instead.');
1171
}
1151
}
Línea -... Línea 1152...
-
 
1152
 
1172
 
1153
// eslint-disable-next-line no-unused-vars
1173
function updateProgressBar(id, percent, msg, estimate) {
1154
function updateProgressBar(id, percent, msg, estimate, error) {
1174
    var event,
1155
    var event,
1175
        el = document.getElementById(id),
1156
        el = document.getElementById(id),
Línea 1176... Línea 1157...
1176
        eventData = {};
1157
        eventData = {};
Línea 1180... Línea 1161...
1180
    }
1161
    }
Línea 1181... Línea 1162...
1181
 
1162
 
1182
    eventData.message = msg;
1163
    eventData.message = msg;
1183
    eventData.percent = percent;
1164
    eventData.percent = percent;
-
 
1165
    eventData.estimate = estimate;
Línea 1184... Línea 1166...
1184
    eventData.estimate = estimate;
1166
    eventData.error = error;
1185
 
1167
 
1186
    try {
1168
    try {
1187
        event = new CustomEvent('update', {
1169
        event = new CustomEvent('update', {