View | Details | Raw Unified | Return to bug 33344 | Differences between
and this patch

Collapse All | Expand All

(-)a/management/univention-management-console-module-udm/umc/js/udm/DetailPage.js (-3 / +28 lines)
 Lines 49-54   define([ Link Here 
49
	"umc/widgets/ComboBox",
49
	"umc/widgets/ComboBox",
50
	"umc/widgets/Form",
50
	"umc/widgets/Form",
51
	"umc/widgets/Page",
51
	"umc/widgets/Page",
52
	"umc/widgets/LinkList",
52
	"umc/widgets/StandbyMixin",
53
	"umc/widgets/StandbyMixin",
53
	"umc/widgets/TabController",
54
	"umc/widgets/TabController",
54
	"dijit/layout/StackContainer",
55
	"dijit/layout/StackContainer",
 Lines 62-68   define([ Link Here 
62
	"umc/i18n!umc/modules/udm",
63
	"umc/i18n!umc/modules/udm",
63
	"dijit/registry",
64
	"dijit/registry",
64
	"umc/widgets"
65
	"umc/widgets"
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, _ ) {
66
], function(declare, lang, array, on, Deferred, all, when, construct, domClass, topic, json, TitlePane, render, tools, dialog, ContainerWidget, MultiInput, ComboBox, Form, Page, LinkList, StandbyMixin, TabController, StackContainer, Text, Button, LabelPane, Template, OverwriteLabel, UMCPBundle, cache, _ ) {
66
67
67
	var _StandbyPage = declare([Page, StandbyMixin], {});
68
	var _StandbyPage = declare([Page, StandbyMixin], {});
68
69
 Lines 443-448   define([ Link Here 
443
			}));
444
			}));
444
		},
445
		},
445
446
447
		_renderReferencingObjectsTab: function(loadedDeferred) {
448
			when(this.ldapName, lang.hitch(this, function() {
449
				this._referencingObjectsTab = new Page({
450
					title: _('Referencing objects'),
451
					noFooter: true,
452
					headerText: _('Objects referencing this %s', this.objectNameSingular)
453
				});
454
				loadedDeferred.then(lang.hitch(this, '_createReferencingObjects'));
455
			}));
456
		},
457
458
		_createReferencingObjects: function() {
459
			if (!this.ldapName || !this._receivedObjOrigData.$references$ || !this._receivedObjOrigData.$references$.length) {
460
				return;
461
			}
462
			this._addSubTab(this._referencingObjectsTab, 1);
463
			var referencingObjects = new LinkList({
464
				staticValues: this._receivedObjOrigData.$references$
465
			});
466
			this._referencingObjectsTab.addChild(referencingObjects);
467
		},
468
446
		_renderPolicyTab: function(policies) {
469
		_renderPolicyTab: function(policies) {
447
			this._policyWidgets = {};
470
			this._policyWidgets = {};
448
			if (policies && policies.length) {
471
			if (policies && policies.length) {
 Lines 1022-1028   define([ Link Here 
1022
			}));
1045
			}));
1023
		},
1046
		},
1024
1047
1025
		_addSubTab: function(page) {
1048
		_addSubTab: function(page, index) {
1049
			index = index || this._tabs.getChildren().length;
1026
			var tabController = new TabController({
1050
			var tabController = new TabController({
1027
				region: 'nav',
1051
				region: 'nav',
1028
				containerId: this._tabs.id,
1052
				containerId: this._tabs.id,
 Lines 1037-1043   define([ Link Here 
1037
			page.addChild(page.position_text);
1061
			page.addChild(page.position_text);
1038
			page.own(page.position_text);
1062
			page.own(page.position_text);
1039
1063
1040
			this._tabs.addChild(page);
1064
			this._tabs.addChild(page, index);
1041
			this.own(page);
1065
			this.own(page);
1042
		},
1066
		},
1043
1067
 Lines 1118-1123   define([ Link Here 
1118
			this._autoUpdateTabTitle(widgets);
1142
			this._autoUpdateTabTitle(widgets);
1119
			this._renderSubTabs(widgets, layout, metaInfo).then(lang.hitch(this, function() {
1143
			this._renderSubTabs(widgets, layout, metaInfo).then(lang.hitch(this, function() {
1120
				this._renderPolicyTab(policies);
1144
				this._renderPolicyTab(policies);
1145
				this._renderReferencingObjectsTab(loadedDeferred);
1121
				this._renderForm(widgets);
1146
				this._renderForm(widgets);
1122
				this._renderMultiEditCheckBoxes(widgets);
1147
				this._renderMultiEditCheckBoxes(widgets);
1123
				this._registerOptionWatchHandler();
1148
				this._registerOptionWatchHandler();
(-)a/management/univention-management-console-module-udm/umc/python/udm/__init__.py (+1 lines)
 Lines 481-486   def _thread(request): Link Here 
481
						props['$labelObjectType$'] = module.title
481
						props['$labelObjectType$'] = module.title
482
						props['$flags$'] = obj.oldattr.get('univentionObjectFlag', [])
482
						props['$flags$'] = obj.oldattr.get('univentionObjectFlag', [])
483
						props['$operations$'] = module.operations
483
						props['$operations$'] = module.operations
484
						props['$references$'] = module.get_references(ldap_dn)
484
						result.append(props)
485
						result.append(props)
485
					else:
486
					else:
486
						MODULE.process('The LDAP object for the LDAP DN %s could not be found' % ldap_dn)
487
						MODULE.process('The LDAP object for the LDAP DN %s could not be found' % ldap_dn)
(-)a/management/univention-management-console-module-udm/umc/python/udm/udm_ldap.py (-39 / +7 lines)
 Lines 32-38    Link Here 
32
# <http://www.gnu.org/licenses/>.
32
# <http://www.gnu.org/licenses/>.
33
33
34
import sys
34
import sys
35
import copy
36
import re
35
import re
37
import threading
36
import threading
38
import gc
37
import gc
 Lines 46-52    Link Here 
46
from univention.management.console.log import MODULE
45
from univention.management.console.log import MODULE
47
46
48
import univention.admin as udm
47
import univention.admin as udm
49
import univention.admin.layout as udm_layout
50
import univention.admin.modules as udm_modules
48
import univention.admin.modules as udm_modules
51
import univention.admin.objects as udm_objects
49
import univention.admin.objects as udm_objects
52
import univention.admin.syntax as udm_syntax
50
import univention.admin.syntax as udm_syntax
 Lines 55-60    Link Here 
55
from .syntax import widget, default_value
53
from .syntax import widget, default_value
56
54
57
from ldap import LDAPError, NO_SUCH_OBJECT
55
from ldap import LDAPError, NO_SUCH_OBJECT
56
from ldap.filter import filter_format
58
57
59
try:
58
try:
60
	import univention.admin.license
59
	import univention.admin.license
 Lines 633-647   def is_policy_module(self): Link Here 
633
	def get_layout(self, ldap_dn=None):
632
	def get_layout(self, ldap_dn=None):
634
		"""Layout information"""
633
		"""Layout information"""
635
		layout = getattr(self.module, 'layout', [])
634
		layout = getattr(self.module, 'layout', [])
636
		if ldap_dn is not None:
637
			mod = get_module(None, ldap_dn)
638
			if mod is not None and self.name == mod.name and self.is_policy_module():
639
				layout = copy.copy(layout)
640
				tab = udm_layout.Tab(_('Referencing objects'), _('Objects referencing this policy object'),
641
					layout=['_view_referencing_objects']
642
				)
643
				layout.append(tab)
644
645
		if layout and isinstance(layout[0], udm.tab):
635
		if layout and isinstance(layout[0], udm.tab):
646
			return self._parse_old_layout(layout)
636
			return self._parse_old_layout(layout)
647
637
 Lines 695-728   def _scanLayout(_layout): Link Here 
695
			if iprop['id'] in inLayout:
685
			if iprop['id'] in inLayout:
696
				properties.append(iprop)
686
				properties.append(iprop)
697
687
698
		if ldap_dn:
699
			# hack reference list for policies into items
700
			if self.is_policy_module():
701
				# create syntax object
702
				syntax = udm_syntax.LDAP_Search(
703
					filter='(&(objectClass=univentionPolicyReference)(univentionPolicyReference=%s))' % ldap_dn,
704
					viewonly=True)
705
706
				# create item
707
				item = {
708
					'id': '_view_referencing_objects',
709
					'label': '',
710
					'description': '',
711
					'syntax': syntax.name,
712
					'size': syntax.size,
713
					'required': False,
714
					'editable': False,
715
					'options': [],
716
					'readonly': False,
717
					'searchable': False,
718
					'multivalue': True,
719
					'identifies': False,
720
				}
721
722
				# read UCR configuration
723
				item.update(widget(syntax, item))
724
				properties.append(item)
725
726
		return properties
688
		return properties
727
689
728
	@property
690
	@property
 Lines 874-879   def policies(self): Link Here 
874
836
875
		return policies
837
		return policies
876
838
839
	def get_references(self, dn):
840
		if self.is_policy_module():  # TODO: move into the handlers/policies/*.py
841
			search_filter = filter_format("(&(objectClass=univentionPolicyReference)(univentionPolicyReference=%s))", (dn,))
842
			return read_syntax_choices(udm_syntax.LDAP_Search(filter=search_filter, viewonly=True))
843
		return []
844
877
	def types4superordinate(self, flavor, superordinate):
845
	def types4superordinate(self, flavor, superordinate):
878
		"""List of object types for the given superordinate"""
846
		"""List of object types for the given superordinate"""
879
		types = getattr(self.module, 'wizardtypesforsuper')
847
		types = getattr(self.module, 'wizardtypesforsuper')

Return to bug 33344