mirror of https://github.com/MISP/MISP
chg: [UI] Side menu optimisations and cleanup
parent
45f602b93b
commit
b082353eb1
|
@ -1,3 +1,7 @@
|
|||
<?php
|
||||
$this->set('menuItem', $menuItem);
|
||||
$divider = $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
?>
|
||||
<div class="actions sideMenu">
|
||||
<ul class="nav nav-list">
|
||||
<?php
|
||||
|
@ -10,7 +14,6 @@
|
|||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'dashboardAdd',
|
||||
'url' => '#',
|
||||
'text' => __('Add Widget'),
|
||||
'onClick' => array(
|
||||
'function' => 'openGenericModalPost',
|
||||
|
@ -19,7 +22,6 @@
|
|||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'dashboardImport',
|
||||
'url' => '#',
|
||||
'text' => __('Import Config JSON'),
|
||||
'onClick' => array(
|
||||
'function' => 'openGenericModal',
|
||||
|
@ -28,7 +30,6 @@
|
|||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'dashboardExport',
|
||||
'url' => '#',
|
||||
'text' => __('Export Config JSON'),
|
||||
'onClick' => array(
|
||||
'function' => 'openGenericModal',
|
||||
|
@ -37,7 +38,6 @@
|
|||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'dashboardSave',
|
||||
'url' => '#',
|
||||
'text' => __('Save Dashboard Config'),
|
||||
'onClick' => array(
|
||||
'function' => 'openGenericModal',
|
||||
|
@ -51,9 +51,9 @@
|
|||
));
|
||||
break;
|
||||
case 'event':
|
||||
$dataEventId = isset($event['Event']['id']) ? h($event['Event']['id']) : 0;
|
||||
echo '<div id="hiddenSideMenuData" class="hidden" data-event-id="' . $dataEventId . '"></div>';
|
||||
if (in_array($menuItem, array('addAttribute', 'addObject', 'addAttachment', 'addIOC', 'addThreatConnect', 'populateFromTemplate', 'merge'))) {
|
||||
$eventId = intval($event['Event']['id']);
|
||||
echo '<div id="hiddenSideMenuData" class="hidden" data-event-id="' . $eventId . '"></div>';
|
||||
if (in_array($menuItem, array('editEvent', 'addAttribute', 'addObject', 'addAttachment', 'addIOC', 'addThreatConnect', 'populateFromTemplate', 'merge'))) {
|
||||
// we can safely assume that mayModify is true if coming from these actions, as they require it in the controller and the user has already passed that check
|
||||
$mayModify = true;
|
||||
if ($isAclPublish) $mayPublish = true;
|
||||
|
@ -68,49 +68,47 @@
|
|||
if ($menuItem === 'enrichmentResults') {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'enrichmentResults',
|
||||
'url' => '#',
|
||||
'text' => __('Enrichment Module Result')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
}
|
||||
if ($menuItem === 'freetextResults') {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'freetextResults',
|
||||
'url' => '#',
|
||||
'text' => __('Freetext Import Result')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
}
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'viewEvent',
|
||||
'url' => '/events/view/' . $event['Event']['id'],
|
||||
'url' => '/events/view/' . $eventId,
|
||||
'text' => __('View Event')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'viewGraph',
|
||||
'url' => '/events/viewGraph/' . $event['Event']['id'],
|
||||
'url' => '/events/viewGraph/' . $eventId,
|
||||
'text' => __('View Correlation Graph')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'eventLog',
|
||||
'url' => '/logs/event_index/' . $event['Event']['id'],
|
||||
'url' => '/logs/event_index/' . $eventId,
|
||||
'text' => __('View Event History')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
if ($isSiteAdmin || (isset($mayModify) && $mayModify)) {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'editEvent',
|
||||
'url' => '/events/edit/' . $event['Event']['id'],
|
||||
'url' => '/events/edit/' . $eventId,
|
||||
'text' => __('Edit Event')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_post_link', array(
|
||||
'url' => '/events/delete/' . h($event['Event']['id']),
|
||||
'url' => '/events/delete/' . $eventId,
|
||||
'text' => __('Delete Event'),
|
||||
'message' => __('Are you sure you want to delete # %s?', h($event['Event']['id']))
|
||||
'message' => __('Are you sure you want to delete event #%s?', $eventId)
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'addAttribute',
|
||||
'url' => '/attributes/add/' . $event['Event']['id'],
|
||||
'url' => '/attributes/add/' . $eventId,
|
||||
'text' => __('Add Attribute')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
|
@ -118,75 +116,75 @@
|
|||
'text' => __('Add Object'),
|
||||
'onClick' => array(
|
||||
'function' => 'popoverPopup',
|
||||
'params' => array('this', h($event['Event']['id']), 'objectTemplates', 'objectMetaChoice')
|
||||
'params' => array('this', $eventId, 'objectTemplates', 'objectMetaChoice')
|
||||
),
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'addAttachment',
|
||||
'url' => '/attributes/add_attachment/' . $event['Event']['id'],
|
||||
'url' => '/attributes/add_attachment/' . $eventId,
|
||||
'text' => __('Add Attachment')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'onClick' => array(
|
||||
'function' => 'getPopup',
|
||||
'params' => array($event['Event']['id'], 'events', 'importChoice')
|
||||
'params' => array($eventId, 'events', 'importChoice')
|
||||
),
|
||||
'text' => __('Populate from...')
|
||||
));
|
||||
if ($menuItem === 'populateFromtemplate') {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'url' => '/templates/populateEventFromTemplate/' . $template_id . '/' . $event['Event']['id'],
|
||||
'url' => '/templates/populateEventFromTemplate/' . $template_id . '/' . $eventId,
|
||||
'text' => __('Populate From Template')
|
||||
));
|
||||
}
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'onClick' => array(
|
||||
'function' => 'genericPopup',
|
||||
'params' => array($baseurl . '/events/enrichEvent/' . $event['Event']['id'], '#confirmation_box')
|
||||
'params' => array($baseurl . '/events/enrichEvent/' . $eventId, '#confirmation_box')
|
||||
),
|
||||
'text' => __('Enrich Event')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'merge',
|
||||
'url' => '/events/merge/' . $event['Event']['id'],
|
||||
'url' => '/events/merge/' . $eventId,
|
||||
'text' => __('Merge attributes from...')
|
||||
));
|
||||
}
|
||||
if (($isSiteAdmin && (!isset($mayModify) || !$mayModify)) || (!isset($mayModify) || !$mayModify)) {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'proposeAttribute',
|
||||
'url' => '/shadow_attributes/add/' . $event['Event']['id'],
|
||||
'url' => '/shadow_attributes/add/' . $eventId,
|
||||
'text' => __('Propose Attribute')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'proposeAttachment',
|
||||
'url' => '/shadow_attributes/add_attachment/' . $event['Event']['id'],
|
||||
'url' => '/shadow_attributes/add_attachment/' . $eventId,
|
||||
'text' => __('Propose Attachment')
|
||||
));
|
||||
}
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
$publishButtons = ' hidden';
|
||||
if (isset($event['Event']['published']) && 0 == $event['Event']['published'] && ($isSiteAdmin || (isset($mayPublish) && $mayPublish))) $publishButtons = "";
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'onClick' => array(
|
||||
'function' => 'publishPopup',
|
||||
'params' => array($event['Event']['id'], 'alert')
|
||||
'params' => array($eventId, 'alert')
|
||||
),
|
||||
'class' => 'publishButtons not-published ' . $publishButtons,
|
||||
'class' => 'publishButtons not-published' . $publishButtons,
|
||||
'text' => __('Publish Event')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'onClick' => array(
|
||||
'function' => 'publishPopup',
|
||||
'params' => array($event['Event']['id'], 'publish')
|
||||
'params' => array($eventId, 'publish')
|
||||
),
|
||||
'class' => 'publishButtons not-published ' . $publishButtons,
|
||||
'class' => 'publishButtons not-published' . $publishButtons,
|
||||
'text' => __('Publish (no email)')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'onClick' => array(
|
||||
'function' => 'publishPopup',
|
||||
'params' => array($event['Event']['id'], 'unpublish')
|
||||
'params' => array($eventId, 'unpublish')
|
||||
),
|
||||
'class' => (isset($event['Event']['published']) && (1 == $event['Event']['published'] && $mayModify)) ? '' : 'hidden',
|
||||
'text' => __('Unpublish')
|
||||
|
@ -195,7 +193,7 @@
|
|||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'onClick' => array(
|
||||
'function' => 'publishPopup',
|
||||
'params' => array($event['Event']['id'], 'sighting')
|
||||
'params' => array($eventId, 'sighting')
|
||||
),
|
||||
'class' => 'publishButtons',
|
||||
'text' => __('Publish Sightings')
|
||||
|
@ -206,13 +204,13 @@
|
|||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'onClick' => array(
|
||||
'function' => 'delegatePopup',
|
||||
'params' => array($event['Event']['id'])
|
||||
'params' => array($eventId)
|
||||
),
|
||||
'text' => __('Delegate Publishing')
|
||||
));
|
||||
}
|
||||
if (isset($delegationRequest) && $delegationRequest && ($isSiteAdmin || ($isAclPublish && ($me['org_id'] == $delegationRequest['EventDelegation']['org_id'] || $me['org_id'] == $delegationRequest['EventDelegation']['requester_org_id'])))) {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
if ($isSiteAdmin || ($isAclPublish && ($me['org_id'] == $delegationRequest['EventDelegation']['org_id']))) {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'onClick' => array(
|
||||
|
@ -229,22 +227,23 @@
|
|||
),
|
||||
'text' => __('Discard Delegation Request')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
}
|
||||
}
|
||||
if (Configure::read('Plugin.ZeroMQ_enable') && $isAclZmq) {
|
||||
if ($isAclZmq && Configure::read('Plugin.ZeroMQ_enable')) {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_post_link', array(
|
||||
'url' => '/events/pushEventToZMQ/' . h($event['Event']['id']),
|
||||
'url' => '/events/pushEventToZMQ/' . $eventId,
|
||||
'text' => __('Publish event to ZMQ'),
|
||||
'message' => __('Are you sure you wish to republish the current event to the ZMQ channel?')
|
||||
));
|
||||
}
|
||||
if (Configure::read('Plugin.Kafka_enable') &&
|
||||
if ($isAclKafka &&
|
||||
Configure::read('Plugin.Kafka_enable') &&
|
||||
Configure::read('Plugin.Kafka_event_notifications_enable') &&
|
||||
Configure::read('Plugin.Kafka_event_notifications_topic') &&
|
||||
$isAclKafka) {
|
||||
Configure::read('Plugin.Kafka_event_notifications_topic')
|
||||
) {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_post_link', array(
|
||||
'url' => '/events/pushEventToKafka/' . h($event['Event']['id']),
|
||||
'url' => '/events/pushEventToKafka/' . $eventId,
|
||||
'text' => __('Publish event to Kafka'),
|
||||
'message' => __('Are you sure you wish to republish the current event to the Kafka topic?')
|
||||
));
|
||||
|
@ -252,18 +251,18 @@
|
|||
if (!empty($event['Orgc']['local'])) {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'contact',
|
||||
'url' => '/events/contact/' . $event['Event']['id'],
|
||||
'url' => '/events/contact/' . $eventId,
|
||||
'text' => __('Contact Reporter')
|
||||
));
|
||||
}
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'onClick' => array(
|
||||
'function' => 'getPopup',
|
||||
'params' => array($event['Event']['id'], 'events', 'exportChoice')
|
||||
'params' => array($eventId, 'events', 'exportChoice')
|
||||
),
|
||||
'text' => __('Download as...')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'url' => '/events/index',
|
||||
'text' => __('List Events')
|
||||
|
@ -330,7 +329,7 @@
|
|||
'text' => __('REST client')
|
||||
));
|
||||
}
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'listAttributes',
|
||||
'url' => '/attributes/index',
|
||||
|
@ -342,7 +341,7 @@
|
|||
'text' => __('Search Attributes')
|
||||
));
|
||||
if ($menuItem == 'searchAttributes2') {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'onClick' => array(
|
||||
'function' => 'getPopup',
|
||||
|
@ -351,7 +350,7 @@
|
|||
'text' => __('Download as...')
|
||||
));
|
||||
}
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'viewProposals',
|
||||
'url' => '/shadow_attributes/index/all:0',
|
||||
|
@ -367,7 +366,7 @@
|
|||
'url' => '/event_delegations/index/context:pending',
|
||||
'text' => __('View delegation requests')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'url' => '/events/export',
|
||||
'text' => __('Export')
|
||||
|
@ -401,7 +400,7 @@
|
|||
));
|
||||
}
|
||||
if ($menuItem === 'edit') {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'url' => '/admin/regexp/edit/' . h($id),
|
||||
'text' => __('Edit Regexp')
|
||||
|
@ -468,7 +467,7 @@
|
|||
));
|
||||
}
|
||||
if ($menuItem == 'edit') {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'url' => '/admin/whitelists/edit' . h($id),
|
||||
'text' => __('Edit Whitelist')
|
||||
|
@ -491,7 +490,7 @@
|
|||
'url' => '/users/change_pw',
|
||||
'text' => __('Change Password')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
} else if((Configure::read('Plugin.CustomAuth_custom_password_reset'))) {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'custom_pw_reset',
|
||||
|
@ -561,7 +560,7 @@
|
|||
'text' => __('Add Sharing Group')
|
||||
));
|
||||
}
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'userGuide',
|
||||
'url' => '/pages/display/doc/general',
|
||||
|
@ -630,7 +629,7 @@
|
|||
));
|
||||
}
|
||||
if ($menuItem === 'edit' && $isSiteAdmin) {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'edit',
|
||||
'url' => '/servers/edit/' . h($id),
|
||||
|
@ -707,7 +706,7 @@
|
|||
'text' => __('Delete User'),
|
||||
'message' => __('Are you sure you want to delete # %s? It is highly recommended to never delete users but to disable them instead.', h($id))
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
}
|
||||
if ($isSiteAdmin && $menuItem === 'editRole') {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
|
@ -721,7 +720,7 @@
|
|||
'text' => __('Delete Role'),
|
||||
'message' => __('Are you sure you want to delete # %s?', h($id))
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
}
|
||||
if ($isSiteAdmin) {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
|
@ -757,7 +756,7 @@
|
|||
'text' => __('Contact Users')
|
||||
));
|
||||
}
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
if ($isSiteAdmin) {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'addOrg',
|
||||
|
@ -794,7 +793,7 @@
|
|||
'url' => '/organisations/index',
|
||||
'text' => __('List Organisations')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'addRole',
|
||||
'url' => '/admin/roles/add',
|
||||
|
@ -807,7 +806,7 @@
|
|||
'text' => __('List Roles')
|
||||
));
|
||||
if ($isSiteAdmin) {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'url' => '/servers/serverSettings',
|
||||
'text' => __('Server Settings & Maintenance')
|
||||
|
@ -820,14 +819,14 @@
|
|||
'url' => '/servers/updateProgress',
|
||||
'text' => __('Update Progress')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
if (Configure::read('MISP.background_jobs')) {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'jobs',
|
||||
'url' => '/jobs/index',
|
||||
'text' => __('Jobs')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'tasks',
|
||||
'url' => '/tasks',
|
||||
|
@ -889,7 +888,7 @@
|
|||
'url' => '/posts/add/thread/' . h($thread_id),
|
||||
'text' => __('Add Post')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
}
|
||||
}
|
||||
if ($menuItem === 'edit') {
|
||||
|
@ -903,7 +902,7 @@
|
|||
'url' => '/threads/view/' . h($id),
|
||||
'text' => __('Edit Post')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
}
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'url' => '/threads/index',
|
||||
|
@ -934,7 +933,6 @@
|
|||
if ($menuItem === 'edit') {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'edit',
|
||||
'url' => '#',
|
||||
'text' => __('Edit Tag')
|
||||
));
|
||||
}
|
||||
|
@ -1026,7 +1024,7 @@
|
|||
'url' => '/decayingModel/import',
|
||||
'text' => __('Import Decaying Model')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'url' => '/decayingModel/add',
|
||||
'text' => __('Add Decaying Model')
|
||||
|
@ -1035,7 +1033,7 @@
|
|||
'url' => '/decayingModel/decayingTool',
|
||||
'text' => __('Decaying Models Tool')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_divider');
|
||||
echo $divider;
|
||||
}
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'url' => '/decayingModel/index',
|
||||
|
@ -1138,7 +1136,6 @@
|
|||
if ($menuItem === 'edit') {
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'edit',
|
||||
'url' => '#',
|
||||
'text' => __('Edit News Item')
|
||||
));
|
||||
}
|
||||
|
@ -1232,8 +1229,3 @@
|
|||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#li<?php echo h($menuItem); ?>').addClass("active");
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,46 +1,42 @@
|
|||
<?php
|
||||
$a = '';
|
||||
if (!empty($element_id)) {
|
||||
$element_id = 'id="li' . $element_id . '"';
|
||||
} else {
|
||||
if (!empty($url)) {
|
||||
$urlparts = explode('/', $url);
|
||||
$element_id = 'id="li' . h(end($urlparts)) . '"';
|
||||
$active = $this->get('menuItem');
|
||||
if (empty($element_id) && !empty($url)) {
|
||||
$urlparts = explode('/', $url);
|
||||
$element_id = end($urlparts);
|
||||
}
|
||||
if ($active === $element_id) {
|
||||
$class .= ' active';
|
||||
}
|
||||
if (!empty($element_id)) {
|
||||
$li = ' id="li' . h($element_id) . '"';
|
||||
} else {
|
||||
$li = '';
|
||||
}
|
||||
if (!empty($class)) {
|
||||
$li .= ' class="' . h(trim($class)) . '"';
|
||||
}
|
||||
if (empty($url)) {
|
||||
$a = 'href="#"';
|
||||
} else if (strpos($url, '://') !== false) {
|
||||
$a = 'href="' . h($url) . '"';
|
||||
} else {
|
||||
$a = 'href="' . $this->get('baseurl') . h($url) . '"';
|
||||
}
|
||||
if (!empty($onClick)) {
|
||||
$params = '';
|
||||
foreach ($onClick['params'] as $param) {
|
||||
if (!empty($params)) {
|
||||
$params .= ', ';
|
||||
}
|
||||
if ($param === 'this') {
|
||||
$params .= $param;
|
||||
} else {
|
||||
$element_id = '';
|
||||
$params .= "'" . h($param) . "'";
|
||||
}
|
||||
}
|
||||
if (empty($url)) {
|
||||
$a = 'href="#"';
|
||||
} else if (strpos($url, '://') !== null) {
|
||||
$a = 'href="' . h($url) . '"';
|
||||
} else {
|
||||
$a = 'href="' . $baseurl . h($url) . '"';
|
||||
}
|
||||
if (!empty($class)) {
|
||||
$class = 'class="' . h($class) . '"';
|
||||
} else {
|
||||
$class = '';
|
||||
}
|
||||
if (!empty($onClick)) {
|
||||
$params = '';
|
||||
foreach ($onClick['params'] as $param) {
|
||||
if (!empty($params)) {
|
||||
$params .= ', ';
|
||||
}
|
||||
if ($param === 'this') {
|
||||
$params .= $param;
|
||||
} else {
|
||||
$params .= "'" . h($param) . "'";
|
||||
}
|
||||
}
|
||||
$a .= sprintf(' onClick="%s(%s)"', $onClick['function'], $params);
|
||||
}
|
||||
if (!empty($download)) {
|
||||
$download = 'download="' . h($download) . '"';
|
||||
} else {
|
||||
$download = '';
|
||||
}
|
||||
|
||||
echo sprintf('<li %s %s><a %s %s>%s</a></li>', $element_id, $class, $a, $download, h($text));
|
||||
?>
|
||||
$a .= sprintf(' onclick="%s(%s)"', $onClick['function'], $params);
|
||||
}
|
||||
if (!empty($download)) {
|
||||
$a .= ' download="' . h($download) . '"';
|
||||
}
|
||||
echo "<li$li><a $a>" . h($text) . '</a></li>';
|
||||
|
|
|
@ -1,32 +1,21 @@
|
|||
<?php
|
||||
$a = '';
|
||||
if (!empty($element_id)) {
|
||||
$element_id = 'id="li' . $element_id . '"';
|
||||
if (!empty($element_id)) {
|
||||
$li = ' id="li' . $element_id . '"';
|
||||
} else {
|
||||
if (!empty($url)) {
|
||||
$urlparts = explode('/', $url);
|
||||
$li = ' id="li' . h(end($urlparts)) . '"';
|
||||
} else {
|
||||
if (!empty($url)) {
|
||||
$urlparts = explode('/', $url);
|
||||
$element_id = 'id="li' . h(end($urlparts)) . '"';
|
||||
} else {
|
||||
$element_id = '';
|
||||
}
|
||||
$li = '';
|
||||
}
|
||||
if (empty($url)) {
|
||||
$a = '';
|
||||
} else if (strpos($url, '://') !== null) {
|
||||
$a = h($url);
|
||||
} else {
|
||||
$a = $baseurl . h($url);
|
||||
}
|
||||
if (!empty($class)) {
|
||||
$class = 'class="' . h($class) . '"';
|
||||
} else {
|
||||
$class = '';
|
||||
}
|
||||
$post_link = $this->Form->postLink(
|
||||
__('%s', $text),
|
||||
$url,
|
||||
null,
|
||||
empty($message) ? null : $message
|
||||
);
|
||||
echo sprintf('<li %s %s>%s</li>', $element_id, $class, $post_link);
|
||||
?>
|
||||
}
|
||||
if (!empty($class)) {
|
||||
$li .= ' class="' . h($class) . '"';
|
||||
}
|
||||
$post_link = $this->Form->postLink(
|
||||
$text,
|
||||
$url,
|
||||
null,
|
||||
empty($message) ? null : $message
|
||||
);
|
||||
echo "<li$li>$post_link</li>";
|
||||
|
|
Loading…
Reference in New Issue