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

(-)a/univention-management-console-module-appcenter-selfservice/umc/js/appcenter-selfservice/ThumbnailBox.js (-6 / +13 lines)
Lines 139-147 define([ Link Here
139
				'class': 'thumbnailBoxImageInput',
139
				'class': 'thumbnailBoxImageInput',
140
				buttonLabel: this._uploadImageButtonLabel,
140
				buttonLabel: this._uploadImageButtonLabel,
141
				showClearButton: false,
141
				showClearButton: false,
142
				maxSize: 1 * 1024 * 1024,
142
				updateView: lang.hitch(this, '_updateUploadedImagePreview')
143
				updateView: lang.hitch(this, '_updateUploadedImagePreview')
143
			});
144
			});
144
			this._imageUploader.startup();
145
			this._imageUploader.startup();
146
			this._imageUploader.watch('value', lang.hitch(this, '_updateValue'));
145
147
146
			this._youtubeVideoTextBox = new TextBox({
148
			this._youtubeVideoTextBox = new TextBox({
147
				'class': 'thumbnailBoxYoutubeInput',
149
				'class': 'thumbnailBoxYoutubeInput',
Lines 152-157 define([ Link Here
152
			this._youtubeVideoTextBox.on('keypress', lang.hitch(this, 'checkForEnterPress'));
154
			this._youtubeVideoTextBox.on('keypress', lang.hitch(this, 'checkForEnterPress'));
153
		},
155
		},
154
156
157
		_updateValue: function() {
158
			function _cut(val) { if (typeof val == 'string') {return val.substr(0, 20) + '...';} return val; }
159
			console.log('### ThumbnailBox:_updateValue() - old value:', _cut(this.value), ' new value:', _cut(this.get('value')));
160
			this._set('value', this.get('value'));
161
		},
162
155
		_setValueAttr: function(value) {
163
		_setValueAttr: function(value) {
156
			if (!value) {
164
			if (!value) {
157
				// remove content of youtube textbox and show initial label
165
				// remove content of youtube textbox and show initial label
Lines 170-177 define([ Link Here
170
			} else {
178
			} else {
171
				this._updateUploadedImagePreview(value);
179
				this._updateUploadedImagePreview(value);
172
			}
180
			}
173
181
			this._updateValue();
174
			this._set('value', this.get('value'));
175
		},
182
		},
176
183
177
		_getValueAttr: function() {
184
		_getValueAttr: function() {
Lines 234-240 define([ Link Here
234
241
235
		_updateUploadedImagePreview: function(/*image as base64 encoded string*/ value) {
242
		_updateUploadedImagePreview: function(/*image as base64 encoded string*/ value) {
236
			// clear youtube thumbnail preview
243
			// clear youtube thumbnail preview
237
			this._setYoutubeVideThumbnailPreview();
244
			this._setYoutubeVideoThumbnailPreview();
238
			domClass.add(this._youtubeVideoThumbnailPreview.domNode, 'inactive');
245
			domClass.add(this._youtubeVideoThumbnailPreview.domNode, 'inactive');
239
246
240
			this._setUploadedImagePreview(value);
247
			this._setUploadedImagePreview(value);
Lines 253-272 define([ Link Here
253
			this._setUploadedImagePreview();
260
			this._setUploadedImagePreview();
254
			domClass.add(this._uploadedImgPreview.domNode, 'inactive');
261
			domClass.add(this._uploadedImgPreview.domNode, 'inactive');
255
262
256
			this._setYoutubeVideThumbnailPreview(value);
263
			this._setYoutubeVideoThumbnailPreview(value);
257
			domClass.remove(this._youtubeVideoThumbnailPreview.domNode, 'inactive');
264
			domClass.remove(this._youtubeVideoThumbnailPreview.domNode, 'inactive');
258
			this.activePreview = this._youtubeVideoThumbnailPreview;
265
			this.activePreview = this._youtubeVideoThumbnailPreview;
259
266
260
			this.onThumbnailSet();
267
			this.onThumbnailSet();
261
		},
268
		},
262
269
263
		_setYoutubeVideThumbnailPreview: function(value) {
270
		_setYoutubeVideoThumbnailPreview: function(value) {
264
			this._youtubeVideoThumbnailPreview.set('value', value);
271
			this._youtubeVideoThumbnailPreview.set('value', value);
265
		},
272
		},
266
273
267
		_clearPreviews: function() {
274
		_clearPreviews: function() {
268
			this._setUploadedImagePreview();
275
			this._setUploadedImagePreview();
269
			this._setYoutubeVideThumbnailPreview();
276
			this._setYoutubeVideoThumbnailPreview();
270
		},
277
		},
271
278
272
		// fires when a thumbnail is successfully set
279
		// fires when a thumbnail is successfully set
(-)a/univention-management-console-module-appcenter-selfservice/umc/js/appcenter-selfservice/ThumbnailDndList.js (-1 / +18 lines)
Lines 43-54 define([ Link Here
43
		_thumbnailBox: null,
43
		_thumbnailBox: null,
44
		initialBoxValue: null,
44
		initialBoxValue: null,
45
45
46
		_updateValue: function(attr, oldVal, newVal) {
47
			console.log('### ThumbnailDndTile:_updateValue() - old value:', this.value, ' new value:', this.get('value'), ' arguments:', arguments);
48
			this._set('value', newVal);
49
		},
50
46
		buildRendering: function() {
51
		buildRendering: function() {
47
			this.inherited(arguments);
52
			this.inherited(arguments);
48
53
49
			this._thumbnailBox = new ThumbnailBox({
54
			this._thumbnailBox = new ThumbnailBox({
50
				value: this.initialBoxValue
55
				value: this.initialBoxValue
51
			});
56
			});
57
			this._thumbnailBox.watch('value', lang.hitch(this, '_updateValue'));
52
58
53
			var styleContainer = put('div.styleContainer');
59
			var styleContainer = put('div.styleContainer');
54
			var leftNav = put('div.leftNav.dojoDndHandle');
60
			var leftNav = put('div.leftNav.dojoDndHandle');
Lines 120-130 define([ Link Here
120
		//     This reference is used so that there is always only one empty ThumbnailDndTile
126
		//     This reference is used so that there is always only one empty ThumbnailDndTile
121
		_emptyTileNode: null,
127
		_emptyTileNode: null,
122
128
129
		labelPosition: 'top',
130
123
		buildRendering: function() {
131
		buildRendering: function() {
124
			this.inherited(arguments);
132
			this.inherited(arguments);
125
			this._createDndSource();
133
			this._createDndSource();
126
		},
134
		},
127
135
136
		_updateValue: function() {
137
			console.log('### ThumbnailDndList:_updateValue() - old value:', this.value, ' new value:', this.get('value'), ' arguments:', arguments);
138
			this._set('value', this.get('value'));
139
		},
140
128
		_createDndSource: function() {
141
		_createDndSource: function() {
129
			this.dndSource = new Source(this.domNode, {
142
			this.dndSource = new Source(this.domNode, {
130
				type: ['thumbnailDndList'],
143
				type: ['thumbnailDndList'],
Lines 150-161 define([ Link Here
150
						'class': 'thumbnailDndTile',
163
						'class': 'thumbnailDndTile',
151
						disabled: this.get('disabled')
164
						disabled: this.get('disabled')
152
					});
165
					});
166
					tile.watch('value', lang.hitch(this, '_updateValue'));
153
					tile.on('deleteRequest', lang.hitch(this, '_destroyTile', tile));
167
					tile.on('deleteRequest', lang.hitch(this, '_destroyTile', tile));
154
					tile.on('moveUp', lang.hitch(this, '_moveTile', tile, true));
168
					tile.on('moveUp', lang.hitch(this, '_moveTile', tile, true));
155
					tile.on('moveDown', lang.hitch(this, '_moveTile', tile, false));
169
					tile.on('moveDown', lang.hitch(this, '_moveTile', tile, false));
156
					tile.on('addBefore', lang.hitch(this, '_addEmptyTile', tile, true));
170
					tile.on('addBefore', lang.hitch(this, '_addEmptyTile', tile, true));
157
					tile.on('addAfter', lang.hitch(this, '_addEmptyTile', tile, false));
171
					tile.on('addAfter', lang.hitch(this, '_addEmptyTile', tile, false));
158
		
172
159
					return {
173
					return {
160
						node: tile.domNode,
174
						node: tile.domNode,
161
						data: tile,
175
						data: tile,
Lines 175-180 define([ Link Here
175
			if (this.dndSource.getAllNodes().length === 0) {
189
			if (this.dndSource.getAllNodes().length === 0) {
176
				this._addEmptyTile();
190
				this._addEmptyTile();
177
			}
191
			}
192
			this._updateValue();
178
		},
193
		},
179
194
180
		_moveTile: function(tile, before) {
195
		_moveTile: function(tile, before) {
Lines 184-189 define([ Link Here
184
				return;
199
				return;
185
			}
200
			}
186
			put(referenceNode, putCombinator, tile.domNode);
201
			put(referenceNode, putCombinator, tile.domNode);
202
			this._updateValue();
187
		},
203
		},
188
204
189
		_addEmptyTile: function(tile, before) {
205
		_addEmptyTile: function(tile, before) {
Lines 224-229 define([ Link Here
224
			if (this.dndSource.getAllNodes().length === 0) {
240
			if (this.dndSource.getAllNodes().length === 0) {
225
				this._addEmptyTile();
241
				this._addEmptyTile();
226
			}
242
			}
243
			this._set('value', value);
227
		},
244
		},
228
245
229
		_getValueAttr: function() {
246
		_getValueAttr: function() {

Return to bug 43011