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

(-)umc/widgets/CheckBox.js (+6 lines)
 Lines 65-70    Link Here 
65
65
66
		_getValueAttr: function() {
66
		_getValueAttr: function() {
67
			return this.get('checked');
67
			return this.get('checked');
68
		},
69
70
		setValid(isValid, message) {
71
			// a checkbox cannot be invalid
72
			// (for now, we should consider implementing it!)
73
			return false;
68
		}
74
		}
69
	});
75
	});
70
});
76
});
(-)umc/widgets/_FormWidgetMixin.js (+1 lines)
 Lines 116-121    Link Here 
116
				this.set('invalidMessage', message);
116
				this.set('invalidMessage', message);
117
				this._maskValidSubsetError = false;
117
				this._maskValidSubsetError = false;
118
			}
118
			}
119
			return true;
119
		}
120
		}
120
	});
121
	});
121
});
122
});
(-)umc/widgets/Form.js (-2 / +26 lines)
 Lines 456-463    Link Here 
456
			}
456
			}
457
			deferred = deferred.then(lang.hitch(this, function(data) {
457
			deferred = deferred.then(lang.hitch(this, function(data) {
458
				// fire event
458
				// fire event
459
				this.onSaved(true);
459
				if (data && parseInt(data.status, 10) == 201) {
460
				return data;
460
					// 201 is ridiculous...
461
					this.onValidationError(data.result);
462
					return data;
463
				} else {
464
					this.onSaved(true);
465
					return data;
466
				}
461
			}), lang.hitch(this, function() {
467
			}), lang.hitch(this, function() {
462
				// fire event also in error case
468
				// fire event also in error case
463
				this.onSaved(false);
469
				this.onSaved(false);
 Lines 487-492    Link Here 
487
			return widgets;
493
			return widgets;
488
		},
494
		},
489
495
496
		onValidationError(/*Object*/ data) {
497
			// naive implementation
498
			umc.tools.forIn(data, dojo.hitch(this, function(iwidget, error_msg) {
499
				var worked = false;
500
				try {
501
					worked = this.getWidget(iwidget).setValid(false, error_msg);
502
				} catch(e) {
503
					console.log(iwidget, e);
504
				}
505
				if (!worked) {
506
					umc.dialog.notify(error_msg);
507
				}
508
			}));
509
			onSaved(false, data);
510
511
			this.onSaved(false);
512
		},
513
490
		onSaved: function(/*Boolean*/ success) {
514
		onSaved: function(/*Boolean*/ success) {
491
			// event stub
515
			// event stub
492
		},
516
		},
(-)umc/store.js (-3 / +9 lines)
 Lines 142-149    Link Here 
142
		else {
142
		else {
143
			return this._genericMultiCmd(type, [param]).
143
			return this._genericMultiCmd(type, [param]).
144
				then(function(results) {
144
				then(function(results) {
145
					if (results && results instanceof Array) {
145
					if (results)
146
						return results[0];
146
						if (results instanceof Array) {
147
							// 200
148
							return results[0];
149
						} else {
150
							// validation error in singleCmd (put, add, ...)
151
							return {'status' : 201, 'result' : results['0']['object']};
152
						}
147
					}
153
					}
148
				});
154
				});
149
		}
155
		}
 Lines 156-162    Link Here 
156
		}
162
		}
157
		else {
163
		else {
158
			// send the UMCP command
164
			// send the UMCP command
159
			return this.umcpCommand(this.storePath + '/' + type, params).
165
			return this.umcpCommand(this.storePath + '/' + type, params, false).
160
				then(/*REQUIRE:"dojo/_base/lang"*/ lang.hitch(this, function(data) {
166
				then(/*REQUIRE:"dojo/_base/lang"*/ lang.hitch(this, function(data) {
161
					// make sure that we get an non-empty array
167
					// make sure that we get an non-empty array
162
					//console.log('# _genericMultiCmd - deferred: data=' + String(data));
168
					//console.log('# _genericMultiCmd - deferred: data=' + String(data));

Return to bug 26784