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

(-)univention-management-console-module-udm/umc/js/udm.js (-6 / +34 lines)
 Lines 127-132    Link Here 
127
		// internal reference to the detail page for editing an LDAP object
127
		// internal reference to the detail page for editing an LDAP object
128
		_detailPage: null,
128
		_detailPage: null,
129
129
130
		// internal variables for preloading a DetailPage Bug# 38190
131
		_ldapNameDeferred: null,
132
		_defaultObjectType: 'users/user',
133
130
		// internal reference if Page is fully rendered
134
		// internal reference if Page is fully rendered
131
		_pageRenderedDeferred: null,
135
		_pageRenderedDeferred: null,
132
136
 Lines 489-494    Link Here 
489
			this._searchPage.startup();
493
			this._searchPage.startup();
490
			this.addChild(this._searchPage);
494
			this.addChild(this._searchPage);
491
			this._checkMissingApp();
495
			this._checkMissingApp();
496
			this._loadUCRVariables().then(lang.hitch(this, '_preloadDetailPage'));
492
		},
497
		},
493
498
494
		renderGrid: function() {
499
		renderGrid: function() {
 Lines 1503-1512    Link Here 
1503
				this.createDetailPage(options.objectType, undefined, options);
1508
				this.createDetailPage(options.objectType, undefined, options);
1504
			}));
1509
			}));
1505
			this._newObjectDialog.on('Done', lang.hitch(this, function() {
1510
			this._newObjectDialog.on('Done', lang.hitch(this, function() {
1506
				var hideDeferred = this._newObjectDialog.hide();
1511
				this._ldapNameDeferred.resolve();
1512
				// var hideDeferred = this._newObjectDialog.hide();
1507
				// do it this way: if dialog was never shown
1513
				// do it this way: if dialog was never shown
1508
				//   hide returns undefined
1514
				//   hide returns undefined
1509
				when(hideDeferred).then(lang.hitch(this, function() {
1515
				when(this._ldapNameDeferred).then(lang.hitch(this, function() {
1510
					// really remove _newObjectDialog (on('hide') tried before):
1516
					// really remove _newObjectDialog (on('hide') tried before):
1511
					//   dialog may never have been shown
1517
					//   dialog may never have been shown
1512
					//   so no onHide() call. See comment above
1518
					//   so no onHide() call. See comment above
 Lines 1518-1523    Link Here 
1518
				}));
1524
				}));
1519
			}));
1525
			}));
1520
			this._newObjectDialog.on('hide', lang.hitch(this, function() {
1526
			this._newObjectDialog.on('hide', lang.hitch(this, function() {
1527
				this.closeDetailPage();
1521
				this._newObjectDialog.destroyRecursive();
1528
				this._newObjectDialog.destroyRecursive();
1522
				this._newObjectDialog = null;
1529
				this._newObjectDialog = null;
1523
			}));
1530
			}));
 Lines 1544-1552    Link Here 
1544
			);
1551
			);
1545
		},
1552
		},
1546
1553
1547
		createDetailPage: function(objectType, ldapName, newObjOptions, /*Boolean?*/ isClosable, /*String?*/ note) {
1554
		_preloadDetailPage: function(){
1548
			// summary:
1555
			this._ldapNameDeferred = new Deferred();
1549
			//		Creates and views the detail page for editing LDAP objects.
1556
			this._setDetailPage(
1557
					this._defaultObjectType,
1558
					this._ldapNameDeferred,
1559
					/*newObjectOptions*/ null,
1560
					/*isClosable*/ false,
1561
					/*note*/ null
1562
				);
1563
		},
1564
1565
		_setDetailPage: function(objectType, ldapName, newObjOptions, /*Boolean*/ isClosable, /*String*/ note) {
1550
			this._detailPage = new DetailPage({
1566
			this._detailPage = new DetailPage({
1551
				umcpCommand: lang.hitch(this, 'umcpCommand'),
1567
				umcpCommand: lang.hitch(this, 'umcpCommand'),
1552
				addWarning: lang.hitch(this, 'addWarning'),
1568
				addWarning: lang.hitch(this, 'addWarning'),
 Lines 1563-1573    Link Here 
1563
				objectNamePlural: this.objectNamePlural,
1579
				objectNamePlural: this.objectNamePlural,
1564
				objectNameSingular: this.objectNameSingular
1580
				objectNameSingular: this.objectNameSingular
1565
			});
1581
			});
1582
			this.addChild(this._detailPage);
1583
			this.selectChild(this._searchPage);
1584
		},
1566
1585
1586
		createDetailPage: function(objectType, ldapName, newObjOptions, /*Boolean?*/ isClosable, /*String?*/ note) {
1587
			// summary:
1588
			//		Creates and views the detail page for editing LDAP objects.
1589
			if(this._detailPage && this._defaultObjectType == objectType && !this._newObjectDialog){
1590
				this._ldapNameDeferred.resolve(ldapName);
1591
			} else {
1592
				this._setDetailPage(objectType, ldapName, newObjOptions, isClosable, note);
1593
			}
1594
1567
			this._detailPage.on('closeTab', lang.hitch(this, 'closeDetailPage'));
1595
			this._detailPage.on('closeTab', lang.hitch(this, 'closeDetailPage'));
1568
			this._detailPage.on('save', lang.hitch(this, 'onObjectSaved'));
1596
			this._detailPage.on('save', lang.hitch(this, 'onObjectSaved'));
1569
			this._detailPage.on('focusModule', lang.hitch(this, 'focusModule'));
1597
			this._detailPage.on('focusModule', lang.hitch(this, 'focusModule'));
1570
			this.addChild(this._detailPage);
1571
			if (this._newObjectDialog) {
1598
			if (this._newObjectDialog) {
1572
				var getFromDetailPage = {
1599
				var getFromDetailPage = {
1573
					properties: this._detailPage.propertyQuery,
1600
					properties: this._detailPage.propertyQuery,
 Lines 1608-1613    Link Here 
1608
				this._detailPage.destroyRecursive();
1635
				this._detailPage.destroyRecursive();
1609
				this._detailPage = null;
1636
				this._detailPage = null;
1610
			}
1637
			}
1638
			this._preloadDetailPage();
1611
			this.resetTitle();
1639
			this.resetTitle();
1612
		},
1640
		},
1613
1641
(-)univention-management-console-module-udm/umc/js/udm/DetailPage.js (-23 / +28 lines)
 Lines 35-40    Link Here 
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",
 Lines 61-67    Link Here 
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
 Lines 201-207    Link Here 
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
 Lines 210-216    Link Here 
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);
 Lines 271-280    Link Here 
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({
 Lines 385-395    Link Here 
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);
 Lines 768-787    Link Here 
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) {

Return to bug 38190