diff --git a/admin/inc/class.admin_categories.inc.php b/admin/inc/class.admin_categories.inc.php index 29e60094dd..39fa28d7d7 100644 --- a/admin/inc/class.admin_categories.inc.php +++ b/admin/inc/class.admin_categories.inc.php @@ -254,6 +254,7 @@ class admin_categories egw_framework::set_onload('$j(document).ready(function() { cat_original_owner = [' . ($content['owner'] ? $content['owner'] : ($content['id'] ? '0' : '')) .']; permission_prompt = \'' . lang('Removing access for groups may cause problems for data in this category. Are you sure? Users in these groups may no longer have access:').'\'; + change_icon(); });'); $readonlys['button[delete]'] = !$content['id'] || !self::$acl_delete || // cant delete not yet saved category diff --git a/admin/js/global_categories.js b/admin/js/global_categories.js index 0fde8a6cf6..827667ba81 100644 --- a/admin/js/global_categories.js +++ b/admin/js/global_categories.js @@ -41,7 +41,6 @@ function check_owner(element_id) { } } - // Somebody will lose permission, give warning. if(diff.length > 0) { var msg = permission_prompt; @@ -52,3 +51,25 @@ function check_owner(element_id) { } return true; } + +/** + * Show icon based on icon-selectbox, hide placeholder (broken image), if no icon selected + */ +function change_icon(_icon) +{ + var img = document.getElementById('exec[icon_url]') || document.getElementById('icon_url'); + + if (typeof _icon == 'undefined') + { + _icon = document.getElementById('exec[data][icon]') || document.getElementById('data[icon]'); + } + if (_icon && _icon.value) + { + img.src = img.src.replace(/\/[^\/]*$/,'\/'+_icon.value); + img.style.display = 'block'; + } + else + { + img.style.display = 'none'; + } +}