|
38 |
import univention.admin.syntax |
38 |
import univention.admin.syntax |
39 |
import univention.admin.hook |
39 |
import univention.admin.hook |
40 |
import univention.admin.localization |
40 |
import univention.admin.localization |
|
|
41 |
from univention.admin.layout import Tab |
41 |
|
42 |
|
42 |
translation=univention.admin.localization.translation('univention/admin') |
43 |
translation=univention.admin.localization.translation('univention/admin') |
43 |
_=translation.translate |
44 |
_=translation.translate |
|
173 |
#if module.initialized: # reload custom attributes |
174 |
#if module.initialized: # reload custom attributes |
174 |
removetab = [] |
175 |
removetab = [] |
175 |
for tab in module.layout: |
176 |
for tab in module.layout: |
176 |
if tab.short_description in custom_fields.keys(): |
177 |
if tab.label in custom_fields.keys(): |
177 |
removetab.append(tab) |
178 |
removetab.append(tab) |
178 |
for tab in removetab: |
179 |
for tab in removetab: |
179 |
module.layout.remove(tab) |
180 |
module.layout.remove(tab) |
|
283 |
for item in itemlist: |
284 |
for item in itemlist: |
284 |
if is_property_in_layout(item, field): |
285 |
if is_property_in_layout(item, field): |
285 |
return True |
286 |
return True |
286 |
elif itemlist.property == field.property: |
287 |
elif itemlist == field: |
287 |
return True |
288 |
return True |
288 |
return False |
289 |
return False |
289 |
|
290 |
|
|
477 |
# remove fields on tabs marked for replacement |
478 |
# remove fields on tabs marked for replacement |
478 |
removetab = [] |
479 |
removetab = [] |
479 |
for tab in module.layout: |
480 |
for tab in module.layout: |
480 |
if tab.short_description in overwriteTabList: |
481 |
if tab.label in overwriteTabList: |
481 |
tab.set_fields( [] ) |
482 |
tab["layout"] = [] |
482 |
|
483 |
|
483 |
for tabname in properties4tabs.keys(): |
484 |
for tabname in properties4tabs.keys(): |
484 |
priofields = properties4tabs[tabname] |
485 |
priofields = properties4tabs[tabname] |
|
488 |
currentTab = None |
489 |
currentTab = None |
489 |
# get existing fields if tab has not been overwritten |
490 |
# get existing fields if tab has not been overwritten |
490 |
for tab in module.layout: |
491 |
for tab in module.layout: |
491 |
ud.debug(ud.ADMIN, ud.INFO, 'modules update_extended_attributes: tabname=%s tab.short=%s' % (tabname, tab.short_description) ) |
492 |
ud.debug(ud.ADMIN, ud.INFO, 'modules update_extended_attributes: tabname=%s tab.short=%s' % (tabname, tab.label) ) |
492 |
|
493 |
|
493 |
if tab.short_description == tabname: |
494 |
if tab.label == tabname: |
494 |
currentTab = tab |
495 |
currentTab = tab |
495 |
# found tab in layout |
496 |
# found tab in layout |
496 |
fields = currentTab.get_fields() |
497 |
fields = currentTab["layout"] |
497 |
# get last line |
498 |
# get last line |
498 |
if len(fields) > 0: |
499 |
if len(fields) > 0: |
499 |
if len(fields[-1]) == 1: |
500 |
if len(fields[-1]) == 1: |
|
521 |
ud.debug(ud.ADMIN, ud.INFO, 'modules update_extended_attributes: lastprio=%s lastfield=%s'% (lastprio,lastfield)) |
522 |
ud.debug(ud.ADMIN, ud.INFO, 'modules update_extended_attributes: lastprio=%s lastfield=%s'% (lastprio,lastfield)) |
522 |
for (prio, field, tabAdvanced, overwritePosition, fullWidth) in priofields: |
523 |
for (prio, field, tabAdvanced, overwritePosition, fullWidth) in priofields: |
523 |
ud.debug(ud.ADMIN, ud.INFO, 'modules update_extended_attributes: custom fields found prio %s'% prio) |
524 |
ud.debug(ud.ADMIN, ud.INFO, 'modules update_extended_attributes: custom fields found prio %s'% prio) |
524 |
if currentTab.advanced and not tabAdvanced: |
525 |
if currentTab["advanced"] and not tabAdvanced: |
525 |
currentTab.advanced = False |
526 |
currentTab["advanced"] = False |
526 |
|
527 |
|
527 |
# do not readd property if already present in layout |
528 |
# do not readd property if already present in layout |
528 |
if lastfield and lastfield.property == field.property: |
529 |
if lastfield == field: |
529 |
continue |
530 |
continue |
530 |
if is_property_in_layout(fields, field): |
531 |
if is_property_in_layout(fields, field): |
531 |
continue |
532 |
continue |
|
541 |
oldfield = fields[ fline ][ fpos ] |
542 |
oldfield = fields[ fline ][ fpos ] |
542 |
fields[ fline ][ fpos ] = field |
543 |
fields[ fline ][ fpos ] = field |
543 |
ud.debug(ud.ADMIN, ud.INFO, |
544 |
ud.debug(ud.ADMIN, ud.INFO, |
544 |
'modules update_extended_attributes: replacing field "%s" with "%s" on position "%s" (%s,%s)' % (oldfield.property, field.property, prio, fline, fpos)) |
545 |
'modules update_extended_attributes: replacing field "%s" with "%s" on position "%s" (%s,%s)' % (oldfield, field, prio, fline, fpos)) |
545 |
else: |
546 |
else: |
546 |
fields[ fline ].append( field ) |
547 |
fields[ fline ].append( field ) |
547 |
ud.debug(ud.ADMIN, ud.INFO, |
548 |
ud.debug(ud.ADMIN, ud.INFO, |
548 |
'modules update_extended_attributes: added new field "%s" on position "%s" (%s,%s)' % (field.property, prio, fline, fpos)) |
549 |
'modules update_extended_attributes: added new field "%s" on position "%s" (%s,%s)' % (field, prio, fline, fpos)) |
549 |
else: |
550 |
else: |
550 |
if fullWidth: |
551 |
if fullWidth: |
551 |
fields.append([field]) |
552 |
fields.append([field]) |
|
574 |
if lastfield: |
575 |
if lastfield: |
575 |
fields.append([lastfield]) |
576 |
fields.append([lastfield]) |
576 |
ud.debug(ud.ADMIN, ud.INFO, 'modules update_extended_attributes: one custom field added %s'% fields) |
577 |
ud.debug(ud.ADMIN, ud.INFO, 'modules update_extended_attributes: one custom field added %s'% fields) |
577 |
currentTab.set_fields(fields) |
578 |
currentTab["layout"] = fields |
578 |
ud.debug(ud.ADMIN, ud.INFO, 'modules update_extended_attributes: layout for tab %s finished: %s'% (tabname, fields) ) |
579 |
ud.debug(ud.ADMIN, ud.INFO, 'modules update_extended_attributes: layout for tab %s finished: %s'% (tabname, fields) ) |
579 |
|
580 |
|
580 |
# check for properties with the syntax class LDAP_Search |
581 |
# check for properties with the syntax class LDAP_Search |