Api - automatically find labels for int or floats too

This commit is contained in:
nathangray 2019-03-15 14:14:23 -06:00
parent 48157ac809
commit e7b06de719
2 changed files with 19 additions and 0 deletions

View File

@ -1344,6 +1344,18 @@ abstract class admin_cmd
} }
} }
} }
if (preg_match_all('/<(int|float).*(label|id)="([^"]+)".*(label|id)="([^"]+)"/', $tpl, $matches, PREG_PATTERN_ORDER))
{
foreach($matches[2] as $key => $name)
{
$id = $name === 'id' ? $matches[3][$key] : $matches[5][$key];
$label= $name === 'id' ? $matches[5][$key] : $matches[3][$key];
if (!empty($id) && !empty($label))
{
$labels[$id] = $label;
}
}
}
} }
error_log(__METHOD__."($name) path=$path returning ".json_encode($labels)); error_log(__METHOD__."($name) path=$path returning ".json_encode($labels));
return $labels; return $labels;

View File

@ -58,6 +58,13 @@ class admin_cmd_account_app extends admin_cmd
$apps = admin_cmd::parse_apps($this->apps); $apps = admin_cmd::parse_apps($this->apps);
$old_rights = (array)$GLOBALS['egw']->acl->get_app_list_for_id('run', Egroupware\Api\Acl::READ, $account_id);
$new_rights = $this->allow ?
$old_rights + array($apps) :
array_diff($old_rights, $apps);
$this->set = $new_rights;
$this->old = $old_rights;
if ($check_only) return true; if ($check_only) return true;
//echo "account=$this->account, account_id=$account_id, apps: ".implode(', ',$apps)."\n"; //echo "account=$this->account, account_id=$account_id, apps: ".implode(', ',$apps)."\n";