mirror of https://github.com/MISP/MISP
commit
b73e978c09
|
@ -30,13 +30,11 @@ class CerebratesController extends AppController
|
|||
|
||||
public function add()
|
||||
{
|
||||
$this->set('menuData', array('menuList' => 'sync', 'menuItem' => 'add_cerebrate'));
|
||||
$params = [];
|
||||
$this->CRUD->add($params);
|
||||
if ($this->IndexFilter->isRest()) {
|
||||
if ($this->restResponsePayload) {
|
||||
return $this->restResponsePayload;
|
||||
}
|
||||
$this->set('permFlags', $this->Role->permFlags);
|
||||
|
||||
$this->loadModel('Organisation');
|
||||
$orgs = $this->Organisation->find('list', [
|
||||
|
@ -48,6 +46,7 @@ class CerebratesController extends AppController
|
|||
'org_id' => $orgs
|
||||
];
|
||||
$this->set(compact('dropdownData'));
|
||||
$this->set('menuData', array('menuList' => 'sync', 'menuItem' => 'add_cerebrate'));
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
|
@ -59,7 +58,6 @@ class CerebratesController extends AppController
|
|||
if ($this->IndexFilter->isRest()) {
|
||||
return $this->restResponsePayload;
|
||||
}
|
||||
$this->set('permFlags', $this->Role->permFlags);
|
||||
|
||||
$this->loadModel('Organisation');
|
||||
$orgs = $this->Organisation->find('list', [
|
||||
|
|
|
@ -459,7 +459,6 @@ class ACLComponent extends Component
|
|||
'admin_add' => array(),
|
||||
'admin_delete' => array(),
|
||||
'admin_edit' => array(),
|
||||
'admin_index' => array('perm_admin'),
|
||||
'admin_set_default' => array(),
|
||||
'index' => array('*'),
|
||||
'view' => array('*'),
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
class CRUDComponent extends Component
|
||||
{
|
||||
/** @var AppController */
|
||||
public $Controller = null;
|
||||
|
||||
public function initialize(Controller $controller, $settings=array()) {
|
||||
|
@ -114,7 +115,15 @@ class CRUDComponent extends Component
|
|||
$this->Controller->render($params['displayOnSuccess']);
|
||||
return;
|
||||
}
|
||||
$this->Controller->redirect(['action' => 'index']);
|
||||
|
||||
$redirect = isset($params['redirect']) ? $params['redirect'] : ['action' => 'index'];
|
||||
// For AJAX requests doesn't make sense to redirect, redirect must be done on javascript side in `submitGenericFormInPlace`
|
||||
if ($this->Controller->request->is('ajax')) {
|
||||
$redirect = Router::url($redirect);
|
||||
$this->Controller->restResponsePayload = $this->Controller->RestResponse->viewData(['redirect' => $redirect], 'json');
|
||||
} else {
|
||||
$this->Controller->redirect($redirect);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$message = __('%s could not be added.', $modelName);
|
||||
|
@ -166,9 +175,10 @@ class CRUDComponent extends Component
|
|||
$message = __('%s updated.', $modelName);
|
||||
if ($this->Controller->IndexFilter->isRest()) {
|
||||
$this->Controller->restResponsePayload = $this->Controller->RestResponse->viewData($data, 'json');
|
||||
return;
|
||||
} else {
|
||||
$this->Controller->Flash->success($message);
|
||||
$this->Controller->redirect(['action' => 'index']);
|
||||
$this->Controller->redirect(isset($params['redirect']) ? $params['redirect'] : ['action' => 'index']);
|
||||
}
|
||||
} else {
|
||||
if ($this->Controller->IndexFilter->isRest()) {
|
||||
|
@ -229,7 +239,18 @@ class CRUDComponent extends Component
|
|||
if (empty($data)) {
|
||||
throw new NotFoundException(__('Invalid %s.', $modelName));
|
||||
}
|
||||
if ($this->Controller->request->is('post') || $this->Controller->request->is('delete')) {
|
||||
$validationError = null;
|
||||
if (isset($params['validate'])) {
|
||||
try {
|
||||
$params['validate']($data);
|
||||
} catch (Exception $e) {
|
||||
$validationError = $e->getMessage();
|
||||
if ($this->Controller->IndexFilter->isRest()) {
|
||||
$this->Controller->restResponsePayload = $this->Controller->RestResponse->saveFailResponse($modelName, 'delete', $id, $validationError);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($validationError === null && $this->Controller->request->is('post') || $this->Controller->request->is('delete')) {
|
||||
if (!empty($params['modelFunction'])) {
|
||||
$result = $this->Controller->$modelName->{$params['modelFunction']}($id);
|
||||
} else {
|
||||
|
@ -239,12 +260,14 @@ class CRUDComponent extends Component
|
|||
$message = __('%s deleted.', $modelName);
|
||||
if ($this->Controller->IndexFilter->isRest()) {
|
||||
$this->Controller->restResponsePayload = $this->Controller->RestResponse->saveSuccessResponse($modelName, 'delete', $id, 'json', $message);
|
||||
return;
|
||||
} else {
|
||||
$this->Controller->Flash->success($message);
|
||||
$this->Controller->redirect($this->Controller->referer());
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->Controller->set('validationError', $validationError);
|
||||
$this->Controller->set('id', $data[$modelName]['id']);
|
||||
$this->Controller->set('data', $data);
|
||||
$this->Controller->layout = 'ajax';
|
||||
|
|
|
@ -21,7 +21,7 @@ class ObjectTemplatesController extends AppController
|
|||
|
||||
public function objectMetaChoice($event_id)
|
||||
{
|
||||
$metas = $this->ObjectTemplate->find('list', array(
|
||||
$metas = $this->ObjectTemplate->find('all', array(
|
||||
'recursive' => -1,
|
||||
'conditions' => array('ObjectTemplate.active' => 1),
|
||||
'fields' => array('meta-category'),
|
||||
|
@ -35,6 +35,7 @@ class ObjectTemplatesController extends AppController
|
|||
'value' => $this->baseurl . "/ObjectTemplates/objectChoice/$eventId/0"
|
||||
]];
|
||||
foreach ($metas as $meta) {
|
||||
$meta = $meta['ObjectTemplate']['meta-category'];
|
||||
$items[] = array(
|
||||
'name' => $meta,
|
||||
'value' => $this->baseurl . "/ObjectTemplates/objectChoice/$eventId/" . h($meta)
|
||||
|
|
|
@ -9,8 +9,6 @@ App::uses('AppController', 'Controller');
|
|||
*/
|
||||
class RolesController extends AppController
|
||||
{
|
||||
public $options = array('0' => 'Read Only', '1' => 'Manage My Own Events', '2' => 'Manage Organization Events', '3' => 'Manage & Publish Organization Events'); // FIXME move this to Role Model
|
||||
|
||||
public $components = array(
|
||||
'Security',
|
||||
'Session',
|
||||
|
@ -28,36 +26,32 @@ class RolesController extends AppController
|
|||
|
||||
public function view($id=false)
|
||||
{
|
||||
$this->set('menuData', ['menuList' => 'globalActions', 'menuItem' => 'roles']);
|
||||
$this->CRUD->view($id);
|
||||
if ($this->IndexFilter->isRest()) {
|
||||
return $this->restResponsePayload;
|
||||
}
|
||||
$this->set('permissionLevelName', $this->Role->premissionLevelName);
|
||||
$this->set('permFlags', $this->Role->permFlags);
|
||||
$this->set('menuData', ['menuList' => 'globalActions', 'menuItem' => 'roles']);
|
||||
}
|
||||
|
||||
public function admin_add()
|
||||
{
|
||||
$this->set('menuData', array('menuList' => 'admin', 'menuItem' => 'addRole'));
|
||||
$params = [];
|
||||
$selectConditions = [];
|
||||
$params = ['redirect' => ['action' => 'index', 'admin' => false]];
|
||||
$this->CRUD->add($params);
|
||||
if ($this->IndexFilter->isRest()) {
|
||||
if ($this->restResponsePayload) {
|
||||
return $this->restResponsePayload;
|
||||
}
|
||||
$this->set('permFlags', $this->Role->permFlags);
|
||||
$dropdownData = [
|
||||
'options' => $this->options
|
||||
'options' => $this->Role->premissionLevelName,
|
||||
];
|
||||
$this->set(compact('dropdownData'));
|
||||
$this->set('menuData', array('menuList' => 'admin', 'menuItem' => 'addRole'));
|
||||
}
|
||||
|
||||
public function admin_edit($id = null)
|
||||
{
|
||||
if (!$this->_isSiteAdmin()) {
|
||||
$this->redirect(array('controller' => 'roles', 'action' => 'index', 'admin' => false));
|
||||
}
|
||||
$this->Role->id = $id;
|
||||
if (!$this->Role->exists() && !$this->request->is('get')) {
|
||||
throw new NotFoundException(__('Invalid Role'));
|
||||
|
@ -76,7 +70,7 @@ class RolesController extends AppController
|
|||
return $this->RestResponse->viewData($role, $this->response->type());
|
||||
} else {
|
||||
$this->Flash->success(__('The Role has been saved'));
|
||||
$this->redirect(array('action' => 'index'));
|
||||
$this->redirect(array('action' => 'index', 'admin' => false));
|
||||
}
|
||||
} else {
|
||||
if ($this->_isRest()) {
|
||||
|
@ -94,12 +88,30 @@ class RolesController extends AppController
|
|||
$this->request->data['Role']['id'] = $id;
|
||||
$this->request->data = $this->Role->read(null, $id);
|
||||
}
|
||||
$this->set('options', $this->options);
|
||||
$this->set('options', $this->Role->premissionLevelName);
|
||||
$this->set('permFlags', $this->Role->permFlags);
|
||||
$this->set('id', $id);
|
||||
}
|
||||
|
||||
public function admin_index($id = false)
|
||||
public function admin_delete($id = null)
|
||||
{
|
||||
$this->CRUD->delete($id, [
|
||||
'validate' => function (array $role) {
|
||||
$usersWithRole = $this->User->find('count', [
|
||||
'conditions' => ['role_id' => $role['Role']['id']],
|
||||
'recursive' => -1,
|
||||
]);
|
||||
if ($usersWithRole) {
|
||||
throw new Exception(__("It is not possible to delete role that is assigned to users."));
|
||||
}
|
||||
}
|
||||
]);
|
||||
if ($this->IndexFilter->isRest()) {
|
||||
return $this->restResponsePayload;
|
||||
}
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$params = [
|
||||
'filters' => ['name'],
|
||||
|
@ -108,43 +120,21 @@ class RolesController extends AppController
|
|||
$this->loadModel('AdminSetting');
|
||||
$default_setting = $this->AdminSetting->getSetting('default_role');
|
||||
foreach ($elements as &$role) {
|
||||
$role['Role']['default'] = ($role['Role']['id'] == $default_setting) ? true : false;
|
||||
$role['Role']['default'] = $role['Role']['id'] == $default_setting;
|
||||
}
|
||||
return $elements;
|
||||
}
|
||||
];
|
||||
//$this->paginate['fields'] = ['id', 'name'];
|
||||
$this->CRUD->index($params);
|
||||
if ($this->IndexFilter->isRest()) {
|
||||
return $this->restResponsePayload;
|
||||
}
|
||||
$this->set('options', $this->Role->premissionLevelName);
|
||||
$this->set('permFlags', $this->Role->permFlags);
|
||||
$this->set('menuData', array('menuList' => 'globalActions', 'menuItem' => 'roles'));
|
||||
}
|
||||
|
||||
public function admin_delete($id = null)
|
||||
{
|
||||
$this->CRUD->delete($id);
|
||||
if ($this->IndexFilter->isRest()) {
|
||||
return $this->restResponsePayload;
|
||||
}
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->recursive = 0;
|
||||
if ($this->_isRest()) {
|
||||
$roles = $this->Role->find('all', array(
|
||||
'recursive' => -1
|
||||
));
|
||||
return $this->RestResponse->viewData($roles, $this->response->type());
|
||||
} else {
|
||||
$this->set('list', $this->paginate());
|
||||
$this->set('permFlags', $this->Role->permFlags);
|
||||
$this->loadModel('AdminSetting');
|
||||
$this->set('default_role_id', $this->AdminSetting->getSetting('default_role'));
|
||||
$this->set('options', $this->options);
|
||||
}
|
||||
$this->set('menuData', $this->_isAdmin() ?
|
||||
['menuList' => 'admin', 'menuItem' => 'indexRole'] :
|
||||
['menuList' => 'globalActions', 'menuItem' => 'roles']
|
||||
);
|
||||
}
|
||||
|
||||
public function admin_set_default($role_id = false)
|
||||
|
|
|
@ -6,6 +6,7 @@ App::uses('AppModel', 'Model');
|
|||
*/
|
||||
class Role extends AppModel
|
||||
{
|
||||
public $recursive = -1;
|
||||
public $validate = array(
|
||||
'valueNotEmpty' => array(
|
||||
'rule' => array('valueNotEmpty'),
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
);
|
||||
} else {
|
||||
echo sprintf(
|
||||
'<div class="%s">%s<fieldset><legend>%s</legend>%s<div class="clear" style="padding-bottom:10px;">%s</div>%s</fieldset>%s%s%s</div>',
|
||||
'<div class="%s">%s<fieldset><legend>%s</legend>%s<div class="clear">%s</div>%s</fieldset>%s%s%s</div>',
|
||||
empty($data['skip_side_menu']) ? 'form' : 'menuless-form',
|
||||
$formCreate,
|
||||
empty($data['title']) ? h(Inflector::humanize($this->request->params['action'])) . ' ' . $modelForForm : h($data['title']),
|
||||
|
@ -144,7 +144,7 @@
|
|||
?>
|
||||
<script type="text/javascript">
|
||||
var fieldsArray = <?php echo json_encode($fieldsArrayForPersistence); ?>;
|
||||
$(document).ready(function() {
|
||||
$(function() {
|
||||
popoverStartup();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -43,9 +43,19 @@
|
|||
}
|
||||
$rules_raw = implode('<br />', $rules_raw);
|
||||
}
|
||||
|
||||
$classes = ['fa'];
|
||||
$classes[] = !empty(Hash::extract($row, $field['data_path'])[0]) ? 'fa-check' : 'fa-times';
|
||||
|
||||
if (!empty($field['colors'])) {
|
||||
$classes[] = !empty(Hash::extract($row, $field['data_path'])[0]) ? 'green' : 'grey';
|
||||
} else {
|
||||
$classes[] = 'black';
|
||||
}
|
||||
|
||||
echo sprintf(
|
||||
'<i class="black fa fa-%s" role="img" aria-label="%s"></i>%s',
|
||||
(!empty(Hash::extract($row, $field['data_path'])[0])) ? 'check' : 'times',
|
||||
'<i class="%s" role="img" aria-label="%s"></i>%s',
|
||||
implode(' ', $classes),
|
||||
(!empty(Hash::extract($row, $field['data_path'])[0])) ? __('Yes') : __('No'),
|
||||
empty($rules_raw) ? '' :
|
||||
sprintf(
|
||||
|
@ -55,4 +65,4 @@
|
|||
__('Rules')
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
|
|
|
@ -19,11 +19,20 @@
|
|||
} else {
|
||||
$header_data = h($header['name']);
|
||||
}
|
||||
|
||||
}
|
||||
$classes = [];
|
||||
if (!empty($header['sort'])) {
|
||||
$classes[] = 'pagination_link';
|
||||
}
|
||||
if (!empty($header['rotate_header'])) {
|
||||
$classes[] = 'rotate';
|
||||
$header_data = "<div><span>$header_data</span></div>";
|
||||
}
|
||||
|
||||
$headersHtml .= sprintf(
|
||||
'<th%s>%s</th>',
|
||||
!empty($header['sort']) ? ' class="pagination_link"' : '',
|
||||
'<th%s%s>%s</th>',
|
||||
!empty($classes) ? ' class="' . implode(' ', $classes) .'"' : '',
|
||||
!empty($header['header_title']) ? ' title="' . h($header['header_title']) . '"' : '',
|
||||
$header_data
|
||||
);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,14 @@
|
|||
echo $this->element('/genericElements/IndexTable/pagination', array('paginationOptions' => $paginationData));
|
||||
echo $this->element('/genericElements/IndexTable/pagination_links');
|
||||
}
|
||||
$hasSearch = false;
|
||||
if (!empty($data['top_bar'])) {
|
||||
foreach ($data['top_bar']['children'] as $child) {
|
||||
if (isset($child['type']) && $child['type'] === 'search') {
|
||||
$hasSearch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
echo $this->element('/genericElements/ListTopBar/scaffold', array('data' => $data['top_bar']));
|
||||
}
|
||||
$rows = '';
|
||||
|
@ -93,24 +100,25 @@
|
|||
}
|
||||
$url = $baseurl . '/' . $this->params['controller'] . '/' . $this->params['action'];
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
var passedArgsArray = <?= isset($passedArgs) ? $passedArgs : '[]'; ?>;
|
||||
var passedArgsArray = <?= isset($passedArgs) ? $passedArgs : '{}'; ?>;
|
||||
<?php
|
||||
if (isset($containerId)) {
|
||||
echo 'var target = "#' . $containerId . '_content";';
|
||||
}
|
||||
?>
|
||||
var url = "<?= $url ?>";
|
||||
<?php if ($hasSearch): ?>
|
||||
$(function() {
|
||||
$('#quickFilterButton').click(function() {
|
||||
if (typeof(target) !== 'undefined') {
|
||||
runIndexQuickFilter(passedArgsArray, url, target);
|
||||
runIndexQuickFilterFixed(passedArgsArray, url, target);
|
||||
} else {
|
||||
runIndexQuickFilter(passedArgsArray, url);
|
||||
runIndexQuickFilterFixed(passedArgsArray, url);
|
||||
}
|
||||
});
|
||||
});
|
||||
<?php endif; ?>
|
||||
var ajax = <?= $ajax ? 'true' : 'false' ?>;
|
||||
if (ajax && typeof(target) !== 'undefined') {
|
||||
$(target + ' .pagination_link a').on('click', function() {
|
||||
|
|
|
@ -933,7 +933,7 @@ $divider = $this->element('/genericElements/SideMenu/side_menu_divider');
|
|||
}
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'indexRole',
|
||||
'url' => $baseurl . '/admin/roles/index',
|
||||
'url' => $baseurl . '/roles/index',
|
||||
'text' => __('List Roles')
|
||||
));
|
||||
if ($isSiteAdmin) {
|
||||
|
|
|
@ -231,7 +231,7 @@ function submitFunction(clicked, callback) {
|
|||
<select id="<?php echo $select_id; ?>" autofocus style="height: 100px; margin-bottom: 0px;" <?php echo h($this->GenericPicker->add_select_params($defaults)); ?>>
|
||||
<option></option>
|
||||
<?php
|
||||
foreach ($items as $k => $param) {
|
||||
foreach ($items as $param) {
|
||||
if (isset($param['isPill']) && $param['isPill']) {
|
||||
$flag_addPills = true;
|
||||
continue;
|
||||
|
@ -256,7 +256,7 @@ function submitFunction(clicked, callback) {
|
|||
<?php if ($flag_addPills): // add forced pills ?>
|
||||
<ul class="nav nav-pills">
|
||||
<?php
|
||||
foreach ($items as $k => $param) {
|
||||
foreach ($items as $param) {
|
||||
if (isset($param['isPill']) && $param['isPill']) {
|
||||
echo $this->GenericPicker->add_pill($param, $defaults);
|
||||
if (isset($param['additionalData'])) {
|
||||
|
@ -280,7 +280,7 @@ function submitFunction(clicked, callback) {
|
|||
<ul class="nav nav-pills">
|
||||
<select id="<?php echo $select_id; ?>" autofocus style="display: none;" <?php echo h($this->GenericPicker->add_select_params($defaults)); ?>></select>
|
||||
<?php
|
||||
foreach ($items as $k => $param) {
|
||||
foreach ($items as $param) {
|
||||
echo $this->GenericPicker->add_pill($param, $defaults);
|
||||
if (isset($param['additionalData'])) {
|
||||
$additionalData = $param['additionalData'];
|
||||
|
|
|
@ -370,7 +370,7 @@
|
|||
),
|
||||
array(
|
||||
'text' => __('List Roles'),
|
||||
'url' => $baseurl . '/admin/roles/index'
|
||||
'url' => $baseurl . '/roles/index'
|
||||
),
|
||||
array(
|
||||
'text' => __('Add Roles'),
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
</li>
|
||||
</ul>
|
||||
<?php elseif($canEdit && !empty($editRedirect)): ?>
|
||||
<a id="saveMarkdownButton" type="button" class="btn btn-primary" href="<?= h($editRedirect) ?>" target="_blank">
|
||||
<a type="button" class="btn btn-primary" href="<?= h($editRedirect) ?>#splitscreen" target="_blank">
|
||||
<i class="<?= $this->FontAwesome->getClass('edit') ?>"></i>
|
||||
<?= __('Edit report') ?>
|
||||
</a>
|
||||
|
@ -221,4 +221,4 @@
|
|||
if (!empty($additionalMarkdownElements)) {
|
||||
echo $this->element($additionalMarkdownElements['path'], $additionalMarkdownElements['variables']);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -32,12 +32,16 @@
|
|||
'type' => 'search',
|
||||
'button' => __('Filter'),
|
||||
'placeholder' => __('Enter value to search'),
|
||||
'data' => '',
|
||||
'searchKey' => 'value'
|
||||
'searchKey' => 'value',
|
||||
'cancel' => array(
|
||||
'fa-icon' => 'times',
|
||||
'title' => __('Remove filters'),
|
||||
'onClick' => 'cancelSearch',
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'title' => sprintf(__('Event Reports %s'), !empty($event_id) ? sprintf(__('for Event %s'), h($event_id)) : ''),
|
||||
'title' => sprintf(__('Event Reports %s'), !empty($event_id) ?__('for Event %s', h($event_id)) : ''),
|
||||
'primary_id_path' => 'EventReport.id',
|
||||
'fields' => array(
|
||||
array(
|
||||
|
@ -134,21 +138,3 @@
|
|||
echo '</div>';
|
||||
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'eventReports', 'menuItem' => 'index'));
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
var passedArgsArray = <?php echo $passedArgs; ?>;
|
||||
if (passedArgsArray['context'] === undefined) {
|
||||
passedArgsArray['context'] = '';
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$('#quickFilterButton').click(function() {
|
||||
runIndexQuickFilter('/context:' + passedArgsArray['context']);
|
||||
});
|
||||
$('#quickFilterField').on('keypress', function (e) {
|
||||
if(e.which === 13) {
|
||||
runIndexQuickFilter('/context:' + passedArgsArray['context']);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
$table_data = array();
|
||||
$table_data[] = array('key' => __('ID'), 'value' => $report['EventReport']['id']);
|
||||
$table_data[] = array('key' => __('UUID'), 'html' => '<span class="quickSelect">' . h($report['EventReport']['uuid']) . '</span>');
|
||||
$table_data[] = array('key' => __('UUID'), 'value' => $report['EventReport']['uuid'], 'value_class' => 'quickSelect');
|
||||
$table_data[] = array(
|
||||
'key' => __('Event'),
|
||||
'html' => sprintf(
|
||||
|
@ -20,7 +20,13 @@
|
|||
);
|
||||
|
||||
$table_data[] = array('key' => __('Last update'), 'value' => date('Y-m-d H:i:s', $report['EventReport']['timestamp']));
|
||||
$table_data[] = array('key' => __('Deleted'), 'boolean' => $report['EventReport']['deleted'], 'value_class' => $report['EventReport']['deleted'] ? 'red' : 'green');
|
||||
if ($report['EventReport']['deleted']) {
|
||||
$table_data[] = array(
|
||||
'key' => __('Deleted'),
|
||||
'boolean' => $report['EventReport']['deleted'],
|
||||
'value_class' => 'red',
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
<div class='<?= !isset($ajax) || !$ajax ? 'view' : '' ?>'>
|
||||
|
@ -30,7 +36,6 @@
|
|||
<?php echo $this->element('genericElements/viewMetaTable', array('table_data' => $table_data)); ?>
|
||||
</div>
|
||||
<div class="clear">
|
||||
<h4><?= __('Event Report content') ?></h4>
|
||||
<div class="markdownEditor-full-container">
|
||||
<?php
|
||||
echo $this->element('markdownEditor/markdownEditor', [
|
||||
|
|
|
@ -74,17 +74,15 @@
|
|||
}
|
||||
}
|
||||
if (!empty($contributors)) {
|
||||
$contributorsContent = '';
|
||||
$contributorsContent = [];
|
||||
foreach ($contributors as $organisationId => $name) {
|
||||
$contributorsContent .= sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
$baseurl . "/logs/event_index/" . $event['Event']['id'] . '/' . h($name),
|
||||
$this->OrgImg->getOrgImg(array('name' => $name, 'id' => $organisationId, 'size' => 24), true, true)
|
||||
);
|
||||
$org = ['Organisation' => ['id' => $organisationId, 'name' => $name]];
|
||||
$link = $baseurl . "/logs/event_index/" . $event['Event']['id'] . '/' . h($name);
|
||||
$contributorsContent[] = $this->OrgImg->getNameWithImg($org, $link);
|
||||
}
|
||||
$table_data[] = array(
|
||||
'key' => __('Contributors'),
|
||||
'html' => $contributorsContent
|
||||
'html' => implode("<br>", $contributorsContent),
|
||||
);
|
||||
}
|
||||
if (isset($event['User']['email'])) {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$(function () {
|
||||
<?php
|
||||
$uri = $baseurl . "/galaxy_clusters/index/" . $galaxy['Galaxy']['id'];
|
||||
if (isset($passedArgsArray) && isset($passedArgsArray['context']) && $passedArgsArray['context'] == 'fork_tree') {
|
||||
|
@ -46,7 +46,7 @@ $(document).ready(function () {
|
|||
?>
|
||||
$.get("<?php echo h($uri);?>", function(data) {
|
||||
$("#clusters_div").html(data);
|
||||
});
|
||||
}).fail(xhrFailCallback);
|
||||
|
||||
var $kco = $('#killChainOrder');
|
||||
if ($kco && $kco.length > 0) {
|
||||
|
|
|
@ -6,7 +6,7 @@ class OrgImgHelper extends AppHelper
|
|||
{
|
||||
const IMG_PATH = APP . WEBROOT_DIR . DS . 'img' . DS . 'orgs' . DS;
|
||||
|
||||
public function getNameWithImg(array $organisation)
|
||||
public function getNameWithImg(array $organisation, $link = null)
|
||||
{
|
||||
if (!isset($organisation['Organisation'])) {
|
||||
return '';
|
||||
|
@ -14,7 +14,9 @@ class OrgImgHelper extends AppHelper
|
|||
|
||||
$orgImgName = $this->findOrgImage($organisation['Organisation']);
|
||||
$baseurl = $this->_View->viewVars['baseurl'];
|
||||
$link = $baseurl . '/organisations/view/' . (empty($organisation['Organisation']['id']) ? h($organisation['Organisation']['name']) : h($organisation['Organisation']['id']));
|
||||
if (!$link) {
|
||||
$link = $baseurl . '/organisations/view/' . (empty($organisation['Organisation']['id']) ? h($organisation['Organisation']['name']) : h($organisation['Organisation']['id']));
|
||||
}
|
||||
if ($orgImgName) {
|
||||
$orgImgUrl = $baseurl . '/img/orgs/' . $orgImgName;
|
||||
return sprintf('<a href="%s" style="background-image: url(\'%s\')" class="orgImg">%s</a>', $link, $orgImgUrl, h($organisation['Organisation']['name']));
|
||||
|
|
|
@ -1,115 +0,0 @@
|
|||
<?php
|
||||
$fields = [
|
||||
[
|
||||
'name' => __('ID'),
|
||||
'sort' => 'Role.id',
|
||||
'data_path' => 'Role.id'
|
||||
],
|
||||
[
|
||||
'name' => __('Default'),
|
||||
'data_path' => 'Role.default',
|
||||
'element' => 'toggle',
|
||||
'url' => '/admin/roles/set_default',
|
||||
'url_params_data_paths' => ['Role.id'],
|
||||
'checkbox_class' => 'defaultRoleCheckbox',
|
||||
'beforeHook' => "$('.defaultRoleCheckbox').prop('checked', false); $(this).prop('checked', true);"
|
||||
],
|
||||
[
|
||||
'name' => __('Name'),
|
||||
'sort' => 'Role.name',
|
||||
'data_path' => 'Role.name'
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($permFlags as $k => $permFlag) {
|
||||
$fields[] = [
|
||||
'name' => Inflector::Humanize(substr($k, 5)),
|
||||
'sort' => 'Role.' . $k,
|
||||
'data_path' => 'Role.' . $k,
|
||||
'element' => 'boolean'
|
||||
];
|
||||
}
|
||||
|
||||
$fields[] = [
|
||||
'name' => __('Memory Limit'),
|
||||
'sort' => 'Role.memory_limit',
|
||||
'data_path' => 'Role.memory_limit',
|
||||
'decorator' => function($value) use ($default_memory_limit) {
|
||||
return empty($value) ? $default_memory_limit : h($value);
|
||||
}
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => __('Max execution time'),
|
||||
'sort' => 'Role.max_execution_time',
|
||||
'data_path' => 'Role.max_execution_time',
|
||||
'decorator' => function($value) use ($default_max_execution_time) {
|
||||
return (empty($value) ? $default_max_execution_time : h($value)) . ' s';
|
||||
}
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => __('Searches / 15 mins'),
|
||||
'sort' => 'Role.rate_limit_count',
|
||||
'data_path' => 'Role.rate_limit_count',
|
||||
'decorator' => function($value)
|
||||
{
|
||||
return (empty($value) ? __('Unlimited') : h($value));
|
||||
}
|
||||
];
|
||||
|
||||
echo $this->element('genericElements/IndexTable/scaffold', [
|
||||
'scaffold_data' => [
|
||||
'data' => [
|
||||
'data' => $data,
|
||||
'top_bar' => [
|
||||
'pull' => 'right',
|
||||
'children' => [
|
||||
[
|
||||
'type' => 'simple',
|
||||
'children' => [
|
||||
'data' => [
|
||||
'type' => 'simple',
|
||||
'text' => __('Add role'),
|
||||
'class' => 'btn btn-primary',
|
||||
'onClick' => 'openGenericModal',
|
||||
'onClickParams' => [
|
||||
sprintf(
|
||||
'%s/admin/roles/add',
|
||||
$baseurl
|
||||
)
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => 'search',
|
||||
'button' => __('Filter'),
|
||||
'placeholder' => __('Enter value to search'),
|
||||
'searchKey' => 'quickFilter'
|
||||
]
|
||||
]
|
||||
],
|
||||
'fields' => $fields,
|
||||
'title' => empty($ajax) ? __('Roles') : false,
|
||||
'description' => empty($ajax) ? __('Instance specific permission roles.') : false,
|
||||
'actions' => [
|
||||
[
|
||||
'url' => $baseurl . '/admin/roles/edit',
|
||||
'url_params_data_paths' => array(
|
||||
'Role.id'
|
||||
),
|
||||
'icon' => 'edit'
|
||||
],
|
||||
[
|
||||
'onclick' => sprintf(
|
||||
'openGenericModal(\'%s/admin/roles/delete/[onclick_params_data_path]\');',
|
||||
$baseurl
|
||||
),
|
||||
'onclick_params_data_path' => 'Role.id',
|
||||
'icon' => 'trash'
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
|
@ -1,76 +1,145 @@
|
|||
<div class="roles index">
|
||||
<h2><?php echo __('Roles');?></h2>
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<?php
|
||||
$this->Paginator->options(array(
|
||||
'update' => '.span12',
|
||||
'evalScripts' => true,
|
||||
'before' => '$(".progress").show()',
|
||||
'complete' => '$(".progress").hide()',
|
||||
));
|
||||
|
||||
echo $this->Paginator->prev('« ' . __('previous'), array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'prev disabled', 'escape' => false, 'disabledTag' => 'span'));
|
||||
echo $this->Paginator->numbers(array('modulus' => 20, 'separator' => '', 'tag' => 'li', 'currentClass' => 'active', 'currentTag' => 'span'));
|
||||
echo $this->Paginator->next(__('next') . ' »', array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'next disabled', 'escape' => false, 'disabledTag' => 'span'));
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<table class="table table-striped table-hover table-condensed">
|
||||
<tr>
|
||||
<th><?php echo $this->Paginator->sort('id');?></th>
|
||||
<th><?php echo __('Default');?></th>
|
||||
<th><?php echo $this->Paginator->sort('name');?></th>
|
||||
<th><?php echo $this->Paginator->sort('permission', __('Permissions'));?></th>
|
||||
<?php
|
||||
foreach ($permFlags as $k => $flags):
|
||||
?>
|
||||
<th title="<?php echo h($flags['title']); ?>"><?php echo $this->Paginator->sort($k, $flags['text']);?></th>
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
</tr><?php
|
||||
foreach ($list as $item): ?>
|
||||
<tr>
|
||||
<td class="short"><?php echo h($item['Role']['id']); ?> </td>
|
||||
<td class="short" style="text-align:center;width:20px;"><div class="icon-<?php echo $default_role_id == $item['Role']['id'] ? __('ok') : __('remove') ?>" role="img" aria-label="<?php echo $default_role_id == $item['Role']['id'] ? __('Yes') : __('No') ?>"></div></td>
|
||||
<td><?php echo h($item['Role']['name']); ?> </td>
|
||||
<td class="short"><?php echo h($options[$item['Role']['permission']]); ?> </td>
|
||||
<?php
|
||||
foreach ($permFlags as $k => $flags) {
|
||||
$flagName = Inflector::Humanize(substr($k, 5));
|
||||
echo sprintf(
|
||||
'<td class="short"><span class="%s" role="img" aria-label="%s" title="%s"></span> </td>',
|
||||
($item['Role'][$k]) ? 'icon-ok' : '',
|
||||
($item['Role'][$k]) ? __('Granted') : __('Not granted'),
|
||||
sprintf(
|
||||
__('%s permission %s'),
|
||||
h($flagName),
|
||||
$item['Role'][$k] ? 'granted' : 'denied'
|
||||
)
|
||||
|
||||
);
|
||||
}
|
||||
?>
|
||||
</tr><?php
|
||||
endforeach; ?>
|
||||
</table>
|
||||
<p>
|
||||
<?php
|
||||
echo $this->Paginator->counter(array(
|
||||
'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
|
||||
));
|
||||
?>
|
||||
</p>
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<?php
|
||||
echo $this->Paginator->prev('« ' . __('previous'), array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'prev disabled', 'escape' => false, 'disabledTag' => 'span'));
|
||||
echo $this->Paginator->numbers(array('modulus' => 20, 'separator' => '', 'tag' => 'li', 'currentClass' => 'active', 'currentTag' => 'span'));
|
||||
echo $this->Paginator->next(__('next') . ' »', array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'next disabled', 'escape' => false, 'disabledTag' => 'span'));
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'globalActions', 'menuItem' => 'roles'));
|
||||
$fields = [
|
||||
[
|
||||
'name' => __('ID'),
|
||||
'sort' => 'Role.id',
|
||||
'data_path' => 'Role.id'
|
||||
],
|
||||
[
|
||||
'name' => __('Default'),
|
||||
'data_path' => 'Role.default',
|
||||
'element' => 'toggle',
|
||||
'url' => '/admin/roles/set_default',
|
||||
'url_params_data_paths' => ['Role.id'],
|
||||
'checkbox_class' => 'defaultRoleCheckbox',
|
||||
'beforeHook' => "$('.defaultRoleCheckbox').prop('checked', false); $(this).prop('checked', true);",
|
||||
'requirement' => $isSiteAdmin,
|
||||
],
|
||||
[
|
||||
'name' => __('Default'),
|
||||
'data_path' => 'Role.default',
|
||||
'element' => 'boolean',
|
||||
'colors' => true,
|
||||
'requirement' => !$isSiteAdmin,
|
||||
],
|
||||
[
|
||||
'name' => __('Name'),
|
||||
'sort' => 'Role.name',
|
||||
'data_path' => 'Role.name'
|
||||
],
|
||||
[
|
||||
'name' => __('Permission'),
|
||||
'sort' => 'Role.permission',
|
||||
'element' => 'custom',
|
||||
'function' => function (array $row) use ($options) {
|
||||
return $options[$row['Role']['permission']];
|
||||
}
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($permFlags as $k => $permFlag) {
|
||||
$fields[] = [
|
||||
'name' => $isAdmin ? $permFlag['text'] : Inflector::Humanize(substr($k, 5)),
|
||||
'header_title' => $permFlag['title'],
|
||||
'sort' => 'Role.' . $k,
|
||||
'data_path' => 'Role.' . $k,
|
||||
'element' => 'boolean',
|
||||
'rotate_header' => $isAdmin,
|
||||
'class' => $isAdmin ? 'rotate' : '',
|
||||
'colors' => true,
|
||||
];
|
||||
}
|
||||
|
||||
$fields[] = [
|
||||
'name' => __('Memory Limit'),
|
||||
'sort' => 'Role.memory_limit',
|
||||
'data_path' => 'Role.memory_limit',
|
||||
'decorator' => function($value) use ($default_memory_limit) {
|
||||
return empty($value) ? $default_memory_limit : h($value);
|
||||
},
|
||||
'requirement' => $isAdmin,
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => __('Max execution time'),
|
||||
'sort' => 'Role.max_execution_time',
|
||||
'data_path' => 'Role.max_execution_time',
|
||||
'decorator' => function($value) use ($default_max_execution_time) {
|
||||
return (empty($value) ? $default_max_execution_time : h($value)) . ' s';
|
||||
},
|
||||
'requirement' => $isAdmin,
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => __('Searches / 15 mins'),
|
||||
'sort' => 'Role.rate_limit_count',
|
||||
'data_path' => 'Role.rate_limit_count',
|
||||
'decorator' => function($value) {
|
||||
return (empty($value) ? __('Unlimited') : h($value));
|
||||
},
|
||||
'requirement' => $isAdmin,
|
||||
];
|
||||
|
||||
if ($isSiteAdmin) {
|
||||
$actions = [
|
||||
[
|
||||
'url' => $baseurl . '/admin/roles/edit',
|
||||
'url_params_data_paths' => array(
|
||||
'Role.id'
|
||||
),
|
||||
'icon' => 'edit',
|
||||
],
|
||||
[
|
||||
'onclick' => sprintf(
|
||||
'openGenericModal(\'%s/admin/roles/delete/[onclick_params_data_path]\');',
|
||||
$baseurl
|
||||
),
|
||||
'onclick_params_data_path' => 'Role.id',
|
||||
'icon' => 'trash',
|
||||
]
|
||||
];
|
||||
} else {
|
||||
$actions = [];
|
||||
}
|
||||
|
||||
echo $this->element('genericElements/IndexTable/scaffold', [
|
||||
'scaffold_data' => [
|
||||
'data' => [
|
||||
'data' => $data,
|
||||
'top_bar' => [
|
||||
'pull' => 'right',
|
||||
'children' => [
|
||||
[
|
||||
'type' => 'simple',
|
||||
'children' => [
|
||||
'data' => [
|
||||
'type' => 'simple',
|
||||
'text' => __('Add role'),
|
||||
'fa-icon' => 'plus',
|
||||
'class' => 'btn btn-primary',
|
||||
'onClick' => 'openGenericModal',
|
||||
'onClickParams' => [
|
||||
sprintf(
|
||||
'%s/admin/roles/add',
|
||||
$baseurl
|
||||
)
|
||||
],
|
||||
'requirement' => $isSiteAdmin,
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => 'search',
|
||||
'button' => __('Filter'),
|
||||
'placeholder' => __('Enter value to search'),
|
||||
'searchKey' => 'quickFilter'
|
||||
]
|
||||
]
|
||||
],
|
||||
'fields' => $fields,
|
||||
'title' => empty($ajax) ? __('Roles') : false,
|
||||
'description' => empty($ajax) ? __('Instance specific permission roles.') : false,
|
||||
'actions' => $actions,
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
|
|
@ -226,7 +226,8 @@
|
|||
'User.id'
|
||||
),
|
||||
'icon' => 'eye',
|
||||
'title' => __('View')
|
||||
'title' => __('View'),
|
||||
'dbclickAction' => true,
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -8,6 +8,14 @@ $title = Inflector::singularize(Inflector::humanize(Inflector::underscore($this-
|
|||
</button>
|
||||
<h3 id="genericModalLabel"><?= __('Delete %s', h($title)) ?></h3>
|
||||
</div>
|
||||
<?php if ($validationError): ?>
|
||||
<div class="modal-body modal-body-long">
|
||||
<p><?= h($validationError) ?></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary cancel-button" data-dismiss="modal"><?= __('Cancel') ?></button>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="modal-body modal-body-long">
|
||||
<p><?= __('Are you sure you want to delete %s #%s?', h($title), h($id)) ?></p>
|
||||
</div>
|
||||
|
@ -20,6 +28,7 @@ $title = Inflector::singularize(Inflector::humanize(Inflector::underscore($this-
|
|||
?>
|
||||
<button type="button" class="btn btn-secondary cancel-button" data-dismiss="modal"><?= __('Cancel') ?></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).keydown(function(e) {
|
||||
|
|
|
@ -2687,3 +2687,39 @@ a.orgImg {
|
|||
.misp-error-container {
|
||||
margin: 0 20px;
|
||||
}
|
||||
|
||||
th.rotate {
|
||||
/* Something you can count on */
|
||||
height: 100px;
|
||||
white-space: nowrap;
|
||||
vertical-align: inherit !important;
|
||||
}
|
||||
|
||||
th.rotate > div {
|
||||
transform:
|
||||
/* Magic Numbers */
|
||||
translate(15px, 30px)
|
||||
/* 45 is really 360 - 45 */
|
||||
rotate(315deg);
|
||||
width: 25px;
|
||||
}
|
||||
|
||||
th.rotate > div > span {
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
td.rotate {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
th.rotate, td.rotate {
|
||||
width: 25px;
|
||||
}
|
||||
|
||||
th.rotate + th:not(.rotate) {
|
||||
padding-left: 30px;
|
||||
}
|
||||
|
||||
td.rotate + td:not(.rotate) {
|
||||
padding-left: 30px;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,15 @@ $(document).ready(function() {
|
|||
initCodeMirror()
|
||||
toggleSaveButton(false)
|
||||
}
|
||||
setMode(defaultMode)
|
||||
var mode = defaultMode;
|
||||
if (window.location.hash) {
|
||||
// Switch to mode by using #[mode_name] in URL
|
||||
var anchor = window.location.hash.substr(1);
|
||||
if ((canEdit && (anchor === 'editor' || anchor === 'splitscreen')) || anchor === 'viewer' || anchor === 'raw') {
|
||||
mode = anchor;
|
||||
}
|
||||
}
|
||||
setMode(mode)
|
||||
if (canEdit) {
|
||||
setEditorData(originalRaw);
|
||||
|
||||
|
@ -337,20 +345,20 @@ function setMode(mode) {
|
|||
$mardownViewerToolbar.find('button[data-togglemode="' + mode + '"]').addClass('btn-inverse')
|
||||
hideAll()
|
||||
$editorContainer.css('width', '');
|
||||
if (mode == 'raw') {
|
||||
if (mode === 'raw') {
|
||||
$rawContainer.show()
|
||||
}
|
||||
if (mode == 'splitscreen') {
|
||||
if (mode === 'splitscreen') {
|
||||
$resizableHandle.show()
|
||||
$splitContainer.addClass('split-actif')
|
||||
} else {
|
||||
$resizableHandle.hide()
|
||||
$splitContainer.removeClass('split-actif')
|
||||
}
|
||||
if (mode == 'viewer' || mode == 'splitscreen') {
|
||||
if (mode === 'viewer' || mode === 'splitscreen') {
|
||||
$viewerContainer.show()
|
||||
}
|
||||
if (mode == 'editor' || mode == 'splitscreen') {
|
||||
if (mode === 'editor' || mode === 'splitscreen') {
|
||||
$editorContainer.show({
|
||||
duration: 0,
|
||||
complete: function() {
|
||||
|
|
|
@ -2211,6 +2211,7 @@ function cancelSearch() {
|
|||
$('#quickFilterButton').click();
|
||||
}
|
||||
|
||||
// Deprecated, when possible use runIndexQuickFilterFixed that is cleaner
|
||||
function runIndexQuickFilter(preserveParams, url, target) {
|
||||
if (typeof passedArgsArray === "undefined") {
|
||||
var passedArgsArray = [];
|
||||
|
@ -2274,6 +2275,54 @@ function runIndexQuickFilter(preserveParams, url, target) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} preserveParams
|
||||
* @param {string} url
|
||||
* @param {string} [target]
|
||||
*/
|
||||
function runIndexQuickFilterFixed(preserveParams, url, target) {
|
||||
var $quickFilterField = $('#quickFilterField');
|
||||
var searchKey;
|
||||
if ($quickFilterField.data('searchkey')) {
|
||||
searchKey = $quickFilterField.data('searchkey');
|
||||
} else {
|
||||
searchKey = 'searchall';
|
||||
}
|
||||
if ($quickFilterField.val().trim().length > 0) {
|
||||
preserveParams[searchKey] = encodeURIComponent($quickFilterField.val().trim());
|
||||
} else {
|
||||
delete preserveParams[searchKey]
|
||||
}
|
||||
for (var key in preserveParams) {
|
||||
if (typeof key == 'number') {
|
||||
url += "/" + preserveParams[key];
|
||||
} else if (key !== 'page') {
|
||||
url += "/" + key + ":" + preserveParams[key];
|
||||
}
|
||||
}
|
||||
|
||||
if (target !== undefined) {
|
||||
$.ajax({
|
||||
beforeSend: function () {
|
||||
$(".loading").show();
|
||||
},
|
||||
success: function (data) {
|
||||
$(target).html(data);
|
||||
},
|
||||
error: function() {
|
||||
showMessage('fail', 'Could not fetch the requested data.');
|
||||
},
|
||||
complete: function() {
|
||||
$(".loading").hide();
|
||||
},
|
||||
type: "get",
|
||||
url: url
|
||||
});
|
||||
} else {
|
||||
window.location.href = url;
|
||||
}
|
||||
}
|
||||
|
||||
function executeFilter(passedArgs, url) {
|
||||
for (var key in passedArgs) url += "/" + key + ":" + passedArgs[key];
|
||||
window.location.href=url;
|
||||
|
@ -5392,13 +5441,18 @@ function loadClusterRelations(clusterId) {
|
|||
}
|
||||
|
||||
function submitGenericFormInPlace() {
|
||||
var $genericForm = $('.genericForm');
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: $('.genericForm').attr('action'),
|
||||
data: $('.genericForm').serialize(), // serializes the form's elements.
|
||||
success: function(data)
|
||||
{
|
||||
$('#genericModal').remove();
|
||||
url: $genericForm.attr('action'),
|
||||
data: $genericForm.serialize(), // serializes the form's elements.
|
||||
success: function(data) {
|
||||
if (typeof data === "object" && data.hasOwnProperty('redirect')) {
|
||||
window.location = data.redirect;
|
||||
return;
|
||||
}
|
||||
|
||||
$('#genericModal').modal('hide').remove();
|
||||
$('body').append(data);
|
||||
$('#genericModal').modal();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue