mirror of https://github.com/MISP/MISP
fix: [UI] Fix add object menu item
- make the scaffolding system aware of the possibility that "this" might get passed along to javascriptpull/4438/head
parent
ad8eb0ed47
commit
e931b6b80a
|
@ -57,9 +57,14 @@
|
|||
'url' => '/attributes/add/' . $event['Event']['id'],
|
||||
'text' => __('Add Attribute')
|
||||
));
|
||||
echo '<li>';
|
||||
echo '<a href="#" onclick="popoverPopup(this, ' . h($event['Event']['id']) . ', \'objectTemplates\', \'objectMetaChoice\')"> ' . __('Add Object') . '</a>';
|
||||
echo '</li>';
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'addObject',
|
||||
'text' => __('Add Object'),
|
||||
'onClick' => array(
|
||||
'function' => 'popoverPopup',
|
||||
'params' => array('this', h($event['Event']['id']), 'objectTemplates', 'objectMetaChoice')
|
||||
),
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'addAttachment',
|
||||
'url' => '/attributes/add_attachment/' . $event['Event']['id'],
|
||||
|
|
|
@ -23,12 +23,18 @@
|
|||
$class = '';
|
||||
}
|
||||
if (!empty($onClick)) {
|
||||
$params = array();
|
||||
$params = '';
|
||||
foreach ($onClick['params'] as $param) {
|
||||
$params[] = h($param);
|
||||
if (!empty($params)) {
|
||||
$params .= ', ';
|
||||
}
|
||||
if ($param === 'this') {
|
||||
$params .= $param;
|
||||
} else {
|
||||
$params .= "'" . h($param) . "'";
|
||||
}
|
||||
}
|
||||
$params = implode('\', \'', $params);
|
||||
$a .= sprintf(' onClick="%s(\'%s\')"', $onClick['function'], $params);
|
||||
$a .= sprintf(' onClick="%s(%s)"', $onClick['function'], $params);
|
||||
}
|
||||
if (!empty($download)) {
|
||||
$download = 'download="' . h($download) . '"';
|
||||
|
|
Loading…
Reference in New Issue