Index: univention-management-console-module-udm/umc/js/udm.js =================================================================== --- univention-management-console-module-udm/umc/js/udm.js (Revision 62947) +++ univention-management-console-module-udm/umc/js/udm.js (Arbeitskopie) @@ -127,6 +127,10 @@ // internal reference to the detail page for editing an LDAP object _detailPage: null, + // internal variables for preloading a DetailPage Bug# 38190 + _ldapNameDeferred: null, + _defaultObjectType: 'users/user', + // internal reference if Page is fully rendered _pageRenderedDeferred: null, @@ -489,6 +493,7 @@ this._searchPage.startup(); this.addChild(this._searchPage); this._checkMissingApp(); + this._loadUCRVariables().then(lang.hitch(this, '_preloadDetailPage')); }, renderGrid: function() { @@ -1503,10 +1508,11 @@ this.createDetailPage(options.objectType, undefined, options); })); this._newObjectDialog.on('Done', lang.hitch(this, function() { - var hideDeferred = this._newObjectDialog.hide(); + this._ldapNameDeferred.resolve(); + // var hideDeferred = this._newObjectDialog.hide(); // do it this way: if dialog was never shown // hide returns undefined - when(hideDeferred).then(lang.hitch(this, function() { + when(this._ldapNameDeferred).then(lang.hitch(this, function() { // really remove _newObjectDialog (on('hide') tried before): // dialog may never have been shown // so no onHide() call. See comment above @@ -1518,6 +1524,7 @@ })); })); this._newObjectDialog.on('hide', lang.hitch(this, function() { + this.closeDetailPage(); this._newObjectDialog.destroyRecursive(); this._newObjectDialog = null; })); @@ -1544,9 +1551,18 @@ ); }, - createDetailPage: function(objectType, ldapName, newObjOptions, /*Boolean?*/ isClosable, /*String?*/ note) { - // summary: - // Creates and views the detail page for editing LDAP objects. + _preloadDetailPage: function(){ + this._ldapNameDeferred = new Deferred(); + this._setDetailPage( + this._defaultObjectType, + this._ldapNameDeferred, + /*newObjectOptions*/ null, + /*isClosable*/ false, + /*note*/ null + ); + }, + + _setDetailPage: function(objectType, ldapName, newObjOptions, /*Boolean*/ isClosable, /*String*/ note) { this._detailPage = new DetailPage({ umcpCommand: lang.hitch(this, 'umcpCommand'), addWarning: lang.hitch(this, 'addWarning'), @@ -1563,11 +1579,22 @@ objectNamePlural: this.objectNamePlural, objectNameSingular: this.objectNameSingular }); + this.addChild(this._detailPage); + this.selectChild(this._searchPage); + }, + createDetailPage: function(objectType, ldapName, newObjOptions, /*Boolean?*/ isClosable, /*String?*/ note) { + // summary: + // Creates and views the detail page for editing LDAP objects. + if(this._detailPage && this._defaultObjectType == objectType && !this._newObjectDialog){ + this._ldapNameDeferred.resolve(ldapName); + } else { + this._setDetailPage(objectType, ldapName, newObjOptions, isClosable, note); + } + this._detailPage.on('closeTab', lang.hitch(this, 'closeDetailPage')); this._detailPage.on('save', lang.hitch(this, 'onObjectSaved')); this._detailPage.on('focusModule', lang.hitch(this, 'focusModule')); - this.addChild(this._detailPage); if (this._newObjectDialog) { var getFromDetailPage = { properties: this._detailPage.propertyQuery, @@ -1608,6 +1635,7 @@ this._detailPage.destroyRecursive(); this._detailPage = null; } + this._preloadDetailPage(); this.resetTitle(); }, Index: univention-management-console-module-udm/umc/js/udm/DetailPage.js =================================================================== --- univention-management-console-module-udm/umc/js/udm/DetailPage.js (Revision 62947) +++ univention-management-console-module-udm/umc/js/udm/DetailPage.js (Arbeitskopie) @@ -35,6 +35,7 @@ "dojo/on", "dojo/Deferred", "dojo/promise/all", + "dojo/when", "dojo/dom-construct", "dojo/dom-class", "dojo/topic", @@ -61,7 +62,7 @@ "umc/i18n!umc/modules/udm", "dijit/registry", "umc/widgets" -], 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, _ ) { +], 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, _ ) { var _StandbyPage = declare([Page, StandbyMixin], {}); @@ -201,7 +202,7 @@ // and initiate the rendering process. this.inherited(arguments); - this.headerButtons = this.getButtonDefinitions(); + this.set('headerButtons', this.getButtonDefinitions()); this.standby(true); @@ -210,7 +211,7 @@ // for the detail page, we first need to query property data from the server // for the layout of the selected object type, then we can render the page - var objectDN = this._multiEdit || this.moduleFlavor == 'users/self' ? null : this.ldapName || null; + var objectDN = this._multiEdit || this.moduleFlavor == 'users/self' || this.ldapName instanceof Deferred ? null : this.ldapName || null; // prepare parallel queries var moduleCache = cache.get(this.moduleFlavor); this.propertyQuery = moduleCache.getProperties(this.objectType, objectDN); @@ -271,10 +272,6 @@ }, _loadObject: function(formBuiltDeferred, policyDeferred) { - formBuiltDeferred.then(lang.hitch(this, function() { - this._displayProgressOnSubmitButton(); - })); - if (!this.ldapName || this._multiEdit) { // no DN given or multi edit mode all({ @@ -385,11 +382,12 @@ })); }, - _displayProgressOnSubmitButton: function() { + _displayProgressOnSubmitButton: function(loadedDeferred) { var submitButton = this._headerButtons.submit; var origLabel = submitButton.get('label'); submitButton.set('disabled', true); - this._form.ready().then(lang.hitch(this, function() { + + loadedDeferred.then(lang.hitch(this, function() { // reset label of submit button submitButton.set('label', origLabel); submitButton.set('disabled', false); @@ -768,20 +766,23 @@ var isSyncedObject = function(obj) { return -1 !== obj.$flags$[0].indexOf('synced'); }; - var objects = this.ldapName; - if (!this._multiEdit) { - objects = [objects]; - } - // load all objects to see if they have univentionObjectFlag == synced - all(array.map(objects, lang.hitch(this, function(dn) { - return this.moduleStore.get(dn); - }))).then(lang.hitch(this, function(objs) { - if (array.some(objs, isSyncedObject)) { - properties = this._disableSyncedReadonlyProperties(properties); - this.isSyncedObject = true; + when(this.ldapName, lang.hitch(this, function(ldapName){ + this.ldapName = ldapName; + var objects = this.ldapName; + if (!this._multiEdit) { + objects = [objects]; } - deferred.resolve(properties); - }), function() { deferred.resolve(properties); }); + // load all objects to see if they have univentionObjectFlag == synced + all(array.map(objects, lang.hitch(this, function(dn) { + return this.moduleStore.get(dn); + }))).then(lang.hitch(this, function(objs) { + if (array.some(objs, isSyncedObject)) { + properties = this._disableSyncedReadonlyProperties(properties); + this.isSyncedObject = true; + } + deferred.resolve(properties); + }), function() { deferred.resolve(properties); }); + })); return deferred; }, @@ -1060,9 +1061,13 @@ var formBuiltDeferred = new Deferred(); this._policyDeferred = new Deferred(); - var loadedDeferred = this._loadObject(formBuiltDeferred, this._policyDeferred); + var loadedDeferred = when(this.ldapName, lang.hitch(this, function(ldapName) { + this.ldapName = ldapName; + return this._loadObject(formBuiltDeferred, this._policyDeferred); + })); loadedDeferred.then(lang.hitch(this, 'addActiveDirectoryWarning')); loadedDeferred.then(lang.hitch(this, 'set', 'helpLink', metaInfo.help_link)); + this._displayProgressOnSubmitButton(loadedDeferred); all([loadedDeferred, formBuiltDeferred]).then(lang.hitch(this, '_notifyAboutAutomaticChanges')); if (template && template.length > 0) {