mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
Show icon based on icon-selectbox, hide placeholder (broken image), if no icon selected
This commit is contained in:
parent
dd410d49fb
commit
9954e7b42e
@ -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
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user