Univention Bugzilla – Attachment 4618 Details for
Bug 26784
Restrukturierung Online Update / Paketmanagement
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
onValidation wird Form hinzugefügt
onValidationError.patch (text/plain), 2.92 KB, created by
Dirk Wiesenthal
on 2012-08-24 18:28:01 CEST
(
hide
)
Description:
onValidation wird Form hinzugefügt
Filename:
MIME Type:
Creator:
Dirk Wiesenthal
Created:
2012-08-24 18:28:01 CEST
Size:
2.92 KB
patch
obsolete
>Index: umc/widgets/CheckBox.js >=================================================================== >--- umc/widgets/CheckBox.js (Revision 35029) >+++ umc/widgets/CheckBox.js (Arbeitskopie) >@@ -65,6 +65,12 @@ > > _getValueAttr: function() { > return this.get('checked'); >+ }, >+ >+ setValid(isValid, message) { >+ // a checkbox cannot be invalid >+ // (for now, we should consider implementing it!) >+ return false; > } > }); > }); >Index: umc/widgets/_FormWidgetMixin.js >=================================================================== >--- umc/widgets/_FormWidgetMixin.js (Revision 35029) >+++ umc/widgets/_FormWidgetMixin.js (Arbeitskopie) >@@ -116,6 +116,7 @@ > this.set('invalidMessage', message); > this._maskValidSubsetError = false; > } >+ return true; > } > }); > }); >Index: umc/widgets/Form.js >=================================================================== >--- umc/widgets/Form.js (Revision 35029) >+++ umc/widgets/Form.js (Arbeitskopie) >@@ -456,8 +456,14 @@ > } > deferred = deferred.then(lang.hitch(this, function(data) { > // fire event >- this.onSaved(true); >- return data; >+ if (data && parseInt(data.status, 10) == 201) { >+ // 201 is ridiculous... >+ this.onValidationError(data.result); >+ return data; >+ } else { >+ this.onSaved(true); >+ return data; >+ } > }), lang.hitch(this, function() { > // fire event also in error case > this.onSaved(false); >@@ -487,6 +493,24 @@ > return widgets; > }, > >+ onValidationError(/*Object*/ data) { >+ // naive implementation >+ umc.tools.forIn(data, dojo.hitch(this, function(iwidget, error_msg) { >+ var worked = false; >+ try { >+ worked = this.getWidget(iwidget).setValid(false, error_msg); >+ } catch(e) { >+ console.log(iwidget, e); >+ } >+ if (!worked) { >+ umc.dialog.notify(error_msg); >+ } >+ })); >+ onSaved(false, data); >+ >+ this.onSaved(false); >+ }, >+ > onSaved: function(/*Boolean*/ success) { > // event stub > }, >Index: umc/store.js >=================================================================== >--- umc/store.js (Revision 35029) >+++ umc/store.js (Arbeitskopie) >@@ -142,8 +142,14 @@ > else { > return this._genericMultiCmd(type, [param]). > then(function(results) { >- if (results && results instanceof Array) { >- return results[0]; >+ if (results) >+ if (results instanceof Array) { >+ // 200 >+ return results[0]; >+ } else { >+ // validation error in singleCmd (put, add, ...) >+ return {'status' : 201, 'result' : results['0']['object']}; >+ } > } > }); > } >@@ -156,7 +162,7 @@ > } > else { > // send the UMCP command >- return this.umcpCommand(this.storePath + '/' + type, params). >+ return this.umcpCommand(this.storePath + '/' + type, params, false). > then(/*REQUIRE:"dojo/_base/lang"*/ lang.hitch(this, function(data) { > // make sure that we get an non-empty array > //console.log('# _genericMultiCmd - deferred: data=' + String(data));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 26784
: 4618