View | Details | Raw Unified | Return to bug 38276
Collapse All | Expand All

(-)a/ucs-4.0-1/management/univention-management-console-frontend/umc/widgets/MultiUploader.js (-1 / +3 lines)
 Lines 154-159   define([ Link Here 
154
		_setValueAttr: function(newVal) {
154
		_setValueAttr: function(newVal) {
155
			this._files.selection.clear();
155
			this._files.selection.clear();
156
			this._files.set('staticValues', newVal);
156
			this._files.set('staticValues', newVal);
157
			this._set('value', newVal);
157
		},
158
		},
158
159
159
		_getValueAttr: function() {
160
		_getValueAttr: function() {
 Lines 161-173   define([ Link Here 
161
		},
162
		},
162
163
163
		_setButtonLabelAttr: function(newVal) {
164
		_setButtonLabelAttr: function(newVal) {
164
			this.buttonLabel = newVal;
165
			this._uploader.set('buttonLabel', newVal);
165
			this._uploader.set('buttonLabel', newVal);
166
			this._set('buttonLabel', newVal);
166
		},
167
		},
167
168
168
		_setDisabledAttr: function(newVal) {
169
		_setDisabledAttr: function(newVal) {
169
			this._files.set('disabled', newVal);
170
			this._files.set('disabled', newVal);
170
			this._uploader.set('disabled', newVal);
171
			this._uploader.set('disabled', newVal);
172
			this._set('disabled', newVal);
171
		},
173
		},
172
174
173
		_getDisabledAttr: function() {
175
		_getDisabledAttr: function() {
(-)a/ucs-4.0-1/management/univention-management-console-frontend/umc/widgets/Uploader.js (-8 / +33 lines)
 Lines 81-87   define([ Link Here 
81
81
82
		// value: String
82
		// value: String
83
		//		The content of the base64 encoded file data.
83
		//		The content of the base64 encoded file data.
84
		value: "",
84
		value: null,
85
85
86
		// maxSize: Number
86
		// maxSize: Number
87
		//		A size limit for the uploaded file.
87
		//		A size limit for the uploaded file.
 Lines 116-121   define([ Link Here 
116
		postMixInProperties: function() {
116
		postMixInProperties: function() {
117
			this.inherited(arguments);
117
			this.inherited(arguments);
118
118
119
			if (this.multiFile) {
120
				this.value = [];
121
			} else {
122
				this.value = '';
123
			}
124
119
			// save the original label
125
			// save the original label
120
			this._origButtonLabel = this.buttonLabel;
126
			this._origButtonLabel = this.buttonLabel;
121
		},
127
		},
 Lines 193-199   define([ Link Here 
193
							lang.mixin(params, {
199
							lang.mixin(params, {
194
								iframe: (this._uploader.uploadType === 'iframe') ? true : false
200
								iframe: (this._uploader.uploadType === 'iframe') ? true : false
195
							});
201
							});
196
							
202
197
							this._uploader.upload(params);
203
							this._uploader.upload(params);
198
							this._updateLabel();
204
							this._updateLabel();
199
							this.onUploadStarted(_data);
205
							this.onUploadStarted(_data);
 Lines 239-248   define([ Link Here 
239
			this.set('value', this.value);
245
			this.set('value', this.value);
240
		},
246
		},
241
247
242
		_setDataAttr: function(newVal) {
248
		_setDataAttr: function(data) {
243
			this.data = newVal;
249
			this._set('data', data);
244
			this._settingData = true;
250
			this._settingData = true;
245
			this.set( 'value', newVal && 'content' in newVal ? newVal.content : '' );
251
			var value = '';
252
			if (!this.multiFile && data && 'content' in data) {
253
				// single file upload with data containing content
254
				value = data.content;
255
			} else if (this.multiFile && data instanceof Array) {
256
				// multi file upload -> handle array accordingly
257
				value = array.map(data, function(idata) {
258
					return idata && 'content' in idata ? idata.content : '';
259
				});
260
			} else if (this.multiFile) {
261
				// multi file fallback if data is not an array
262
				value = [];
263
			}
264
			this.set('value', value);
246
			this._settingData = false;
265
			this._settingData = false;
247
		},
266
		},
248
267
 Lines 250-263   define([ Link Here 
250
			if (!this._settingData) {
269
			if (!this._settingData) {
251
				this.data = null;
270
				this.data = null;
252
			}
271
			}
253
			this.value = newVal;
254
272
255
			if ( this.showClearButton ) {
273
			if (this.showClearButton) {
256
				// decide whether to show/hide remove button
274
				// decide whether to show/hide remove button
257
				domClass.toggle(this._clearButton.domNode, 'dijitHidden', !(typeof this.value == "string" && this.value !== ""));
275
				var isVisible = false;
276
				if (!this.multiFile) {
277
					isVisible = typeof newVal == "string" && newVal !== "";
278
				} else {
279
					isVisible = newVal instanceof Array && newVal.length;
280
				}
281
				domClass.toggle(this._clearButton.domNode, 'dijitHidden', !isVisible);
258
			}
282
			}
259
283
260
			// send events
284
			// send events
285
			this._set('value', newVal);
261
			this.onChange(newVal);
286
			this.onChange(newVal);
262
			this.updateView(this.value, this.data);
287
			this.updateView(this.value, this.data);
263
		},
288
		},

Return to bug 38276