chg: [genericPicker] Allow using picker for galaxy matrixes

pull/7048/head
mokaddem 2021-02-19 09:53:32 +01:00
parent 600b6085b5
commit ba13f9db04
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 11 additions and 4 deletions

View File

@ -296,6 +296,7 @@ class GalaxiesController extends AppController
} else { // should use matrix instead
$param = array(
'name' => $galaxy['Galaxy']['name'],
'value' => $this->baseurl . "/galaxies/selectCluster/" . $target_id . '/' . $target_type . '/' . $galaxy['Galaxy']['id'] . '/local:' . $local . '/eventid:' . $eventid,
'functionName' => sprintf(
"getMatrixPopup('%s', '%s', '%s/local:%s/eventid:%s')",
$target_type,

View File

@ -44,16 +44,16 @@ class GenericPickerHelper extends AppHelper {
return $option_html;
}
function add_link_params($param, $defaults=array()) {
function add_link_params($param, $defaults=array(), $ignoreFunction=false) {
$param_html = ' ';
if (isset($param['functionName'])) {
if (!$ignoreFunction && isset($param['functionName'])) {
$param_html .= sprintf('onclick="execAndClose(this, %s)" ', h($param['functionName']));
} else { // fallback to default submit function
if ($defaults['functionName'] !== '') {
if (!$ignoreFunction && $defaults['functionName'] !== '') {
$param_html .= 'onclick="submitFunction(this, ' . h($defaults['functionName']) . ')" ';
$param_html .= sprintf('onclick="submitFunction(this, %s)" ', h($defaults['functionName']));
} else {
$param_html .= sprintf('data-endpoint="%s" onclick="fetchRequestedData(this)" ', h($param['value']));
$param_html .= sprintf('data-endpoint="%s" onclick="fetchRequestedData(this); event.stopPropagation(); return false;" ', h($param['value']));;
}
}
@ -86,6 +86,12 @@ class GenericPickerHelper extends AppHelper {
if (isset($param['isMatrix']) && $param['isMatrix']) {
$span = '<span style="position: absolute; font-size: 8px; top: 2px;" class="fa fa-th" title="' . __('Start the galaxy matrix picker') . '"></span>';
$pill_html .= $span;
$span = sprintf(
'<button class="btn btn-mini" style="float: right; display: inline-block; margin-left: 16px; margin-top: -4px; margin-right: -5px;" %s>%s</button>',
$this->add_link_params($param, $defaults, true),
'<span class="fa fa-list" title="' . __('Use the picker instead') . '"></span>'
);
$pill_html .= $span;
}
$pill_html .= '</a>';
$pill_html .= '</li>';