|
35 |
"dojo/on", |
35 |
"dojo/on", |
36 |
"dojo/Deferred", |
36 |
"dojo/Deferred", |
37 |
"dojo/promise/all", |
37 |
"dojo/promise/all", |
|
|
38 |
"dojo/when", |
38 |
"dojo/dom-construct", |
39 |
"dojo/dom-construct", |
39 |
"dojo/dom-class", |
40 |
"dojo/dom-class", |
40 |
"dojo/topic", |
41 |
"dojo/topic", |
|
61 |
"umc/i18n!umc/modules/udm", |
62 |
"umc/i18n!umc/modules/udm", |
62 |
"dijit/registry", |
63 |
"dijit/registry", |
63 |
"umc/widgets" |
64 |
"umc/widgets" |
64 |
], function(declare, lang, array, on, Deferred, all, construct, domClass, topic, json, TitlePane, render, tools, dialog, ContainerWidget, MultiInput, ComboBox, Form, Page, StandbyMixin, TabController, StackContainer, Text, Button, LabelPane, Template, OverwriteLabel, UMCPBundle, cache, _ ) { |
65 |
], function(declare, lang, array, on, Deferred, all, when, construct, domClass, topic, json, TitlePane, render, tools, dialog, ContainerWidget, MultiInput, ComboBox, Form, Page, StandbyMixin, TabController, StackContainer, Text, Button, LabelPane, Template, OverwriteLabel, UMCPBundle, cache, _ ) { |
65 |
|
66 |
|
66 |
var _StandbyPage = declare([Page, StandbyMixin], {}); |
67 |
var _StandbyPage = declare([Page, StandbyMixin], {}); |
67 |
|
68 |
|
|
201 |
// and initiate the rendering process. |
202 |
// and initiate the rendering process. |
202 |
this.inherited(arguments); |
203 |
this.inherited(arguments); |
203 |
|
204 |
|
204 |
this.headerButtons = this.getButtonDefinitions(); |
205 |
this.set('headerButtons', this.getButtonDefinitions()); |
205 |
|
206 |
|
206 |
this.standby(true); |
207 |
this.standby(true); |
207 |
|
208 |
|
|
210 |
|
211 |
|
211 |
// for the detail page, we first need to query property data from the server |
212 |
// for the detail page, we first need to query property data from the server |
212 |
// for the layout of the selected object type, then we can render the page |
213 |
// for the layout of the selected object type, then we can render the page |
213 |
var objectDN = this._multiEdit || this.moduleFlavor == 'users/self' ? null : this.ldapName || null; |
214 |
var objectDN = this._multiEdit || this.moduleFlavor == 'users/self' || this.ldapName instanceof Deferred ? null : this.ldapName || null; |
214 |
// prepare parallel queries |
215 |
// prepare parallel queries |
215 |
var moduleCache = cache.get(this.moduleFlavor); |
216 |
var moduleCache = cache.get(this.moduleFlavor); |
216 |
this.propertyQuery = moduleCache.getProperties(this.objectType, objectDN); |
217 |
this.propertyQuery = moduleCache.getProperties(this.objectType, objectDN); |
|
271 |
}, |
272 |
}, |
272 |
|
273 |
|
273 |
_loadObject: function(formBuiltDeferred, policyDeferred) { |
274 |
_loadObject: function(formBuiltDeferred, policyDeferred) { |
274 |
formBuiltDeferred.then(lang.hitch(this, function() { |
|
|
275 |
this._displayProgressOnSubmitButton(); |
276 |
})); |
277 |
|
278 |
if (!this.ldapName || this._multiEdit) { |
275 |
if (!this.ldapName || this._multiEdit) { |
279 |
// no DN given or multi edit mode |
276 |
// no DN given or multi edit mode |
280 |
all({ |
277 |
all({ |
|
385 |
})); |
382 |
})); |
386 |
}, |
383 |
}, |
387 |
|
384 |
|
388 |
_displayProgressOnSubmitButton: function() { |
385 |
_displayProgressOnSubmitButton: function(loadedDeferred) { |
389 |
var submitButton = this._headerButtons.submit; |
386 |
var submitButton = this._headerButtons.submit; |
390 |
var origLabel = submitButton.get('label'); |
387 |
var origLabel = submitButton.get('label'); |
391 |
submitButton.set('disabled', true); |
388 |
submitButton.set('disabled', true); |
392 |
this._form.ready().then(lang.hitch(this, function() { |
389 |
|
|
|
390 |
loadedDeferred.then(lang.hitch(this, function() { |
393 |
// reset label of submit button |
391 |
// reset label of submit button |
394 |
submitButton.set('label', origLabel); |
392 |
submitButton.set('label', origLabel); |
395 |
submitButton.set('disabled', false); |
393 |
submitButton.set('disabled', false); |
|
768 |
|
766 |
|
769 |
var isSyncedObject = function(obj) { return -1 !== obj.$flags$[0].indexOf('synced'); }; |
767 |
var isSyncedObject = function(obj) { return -1 !== obj.$flags$[0].indexOf('synced'); }; |
770 |
|
768 |
|
771 |
var objects = this.ldapName; |
769 |
when(this.ldapName, lang.hitch(this, function(ldapName){ |
772 |
if (!this._multiEdit) { |
770 |
this.ldapName = ldapName; |
773 |
objects = [objects]; |
771 |
var objects = this.ldapName; |
774 |
} |
772 |
if (!this._multiEdit) { |
775 |
// load all objects to see if they have univentionObjectFlag == synced |
773 |
objects = [objects]; |
776 |
all(array.map(objects, lang.hitch(this, function(dn) { |
|
|
777 |
return this.moduleStore.get(dn); |
778 |
}))).then(lang.hitch(this, function(objs) { |
779 |
if (array.some(objs, isSyncedObject)) { |
780 |
properties = this._disableSyncedReadonlyProperties(properties); |
781 |
this.isSyncedObject = true; |
782 |
} |
774 |
} |
783 |
deferred.resolve(properties); |
775 |
// load all objects to see if they have univentionObjectFlag == synced |
784 |
}), function() { deferred.resolve(properties); }); |
776 |
all(array.map(objects, lang.hitch(this, function(dn) { |
|
|
777 |
return this.moduleStore.get(dn); |
778 |
}))).then(lang.hitch(this, function(objs) { |
779 |
if (array.some(objs, isSyncedObject)) { |
780 |
properties = this._disableSyncedReadonlyProperties(properties); |
781 |
this.isSyncedObject = true; |
782 |
} |
783 |
deferred.resolve(properties); |
784 |
}), function() { deferred.resolve(properties); }); |
785 |
})); |
785 |
return deferred; |
786 |
return deferred; |
786 |
}, |
787 |
}, |
787 |
|
788 |
|
Lines 1060-1068
|
Link Here
|
---|
|
1060 |
|
1061 |
|
1061 |
var formBuiltDeferred = new Deferred(); |
1062 |
var formBuiltDeferred = new Deferred(); |
1062 |
this._policyDeferred = new Deferred(); |
1063 |
this._policyDeferred = new Deferred(); |
1063 |
var loadedDeferred = this._loadObject(formBuiltDeferred, this._policyDeferred); |
1064 |
var loadedDeferred = when(this.ldapName, lang.hitch(this, function(ldapName) { |
|
|
1065 |
this.ldapName = ldapName; |
1066 |
return this._loadObject(formBuiltDeferred, this._policyDeferred); |
1067 |
})); |
1064 |
loadedDeferred.then(lang.hitch(this, 'addActiveDirectoryWarning')); |
1068 |
loadedDeferred.then(lang.hitch(this, 'addActiveDirectoryWarning')); |
1065 |
loadedDeferred.then(lang.hitch(this, 'set', 'helpLink', metaInfo.help_link)); |
1069 |
loadedDeferred.then(lang.hitch(this, 'set', 'helpLink', metaInfo.help_link)); |
|
|
1070 |
this._displayProgressOnSubmitButton(loadedDeferred); |
1066 |
all([loadedDeferred, formBuiltDeferred]).then(lang.hitch(this, '_notifyAboutAutomaticChanges')); |
1071 |
all([loadedDeferred, formBuiltDeferred]).then(lang.hitch(this, '_notifyAboutAutomaticChanges')); |
1067 |
|
1072 |
|
1068 |
if (template && template.length > 0) { |
1073 |
if (template && template.length > 0) { |