Show result in normal window

This commit is contained in:
marcos 2019-12-03 18:19:32 +01:00
parent 14b8379ccb
commit 7eec91b946
3 changed files with 37 additions and 44 deletions

View File

@ -124,11 +124,8 @@ if ($config['menu_type'] == 'classic') {
$search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');" $search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
onkeyup="showinterpreter()" class="search_input" />'; onkeyup="showinterpreter()" class="search_input" />';
$search_bar .= '<div
id="result_order" $search_bar .= '<div id="result_order" style="display:grid"></div>';
class="show_result_interpreter"
style="display:none">Go to Agent Management<br>
Go to Agent view</div>';
// $search_bar .= 'onClick="javascript: document.quicksearch.submit()"'; // $search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />"; $search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
$search_bar .= '</form>'; $search_bar .= '</form>';
@ -629,7 +626,7 @@ if ($config['menu_type'] == 'classic') {
}); });
} }
// Resize event // Resize event.
window.addEventListener("resize", function() { window.addEventListener("resize", function() {
attatch_to_image(); attatch_to_image();
}); });
@ -645,7 +642,7 @@ if ($config['menu_type'] == 'classic') {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "ajax.php", url: "ajax.php",
dataType: "text", dataType: "html",
data: { data: {
page: 'include/ajax/order_interpreter', page: 'include/ajax/order_interpreter',
method: 'getResult', method: 'getResult',
@ -653,7 +650,8 @@ if ($config['menu_type'] == 'classic') {
}, },
success: function (data) { success: function (data) {
console.log(data); console.log(data);
}, $('#result_order').html(data);
},
error: function (data) { error: function (data) {
console.error("Fatal error in AJAX call to interpreter order", data) console.error("Fatal error in AJAX call to interpreter order", data)
} }

View File

@ -99,16 +99,24 @@ class OrderInterpreter extends Wizard
) { ) {
$this->ajaxController = $ajax_controller; $this->ajaxController = $ajax_controller;
$this->pages_name = [ $this->pages_name = [
0 => __('Agent view'), 0 => __('Tactical View'),
1 => __('Agent Management'), 1 => __('Agent Management'),
2 => __('Manage Agents'), 2 => __('List Alerts'),
3 => __('Manage Policies'), 3 => __('Manage Policies'),
]; ];
$this->pages_url = [ $this->pages_url = [
0 => ui_get_full_url(), 0 => ui_get_full_url(
1 => ui_get_full_url(), 'index.php?sec=view&sec2=operation/agentes/tactical'
2 => ui_get_full_url(), ),
3 => ui_get_full_url(), 1 => ui_get_full_url(
'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente'
),
2 => ui_get_full_url(
'index.php?sec=galertas&sec2=godmode/alerts/alert_list'
),
3 => ui_get_full_url(
'index.php?sec=gmodules&sec2=enterprise/godmode/policies/policies'
),
]; ];
} }
@ -119,18 +127,22 @@ class OrderInterpreter extends Wizard
* *
* @return array * @return array
*/ */
public function getResult():array public function getResult()
{ {
// Take value from input search. // Take value from input search.
$text = get_parameter('text', ''); $text = get_parameter('text', '');
$array_found = []; $array_found = [];
echo '<div id="result_order" class="show_result_interpreter">';
echo '<ul>';
foreach ($this->pages_name as $key => $value) { foreach ($this->pages_name as $key => $value) {
if (preg_match('/.*'.$text.'.*/', $value)) { if (preg_match('/.*'.$text.'.*/', $value)) {
$array_found[$key] = '<input id='.$key.'><a href="'.$this->pages_url[$key].'">'.$value.'</a>'; echo '<li>';
echo '<img src="http://localhost/pandora_console/images/arrow_right_green.png">';
echo 'GO TO <a href="'.$this->pages_url[$key].'">'.$value.'</a><br>';
} }
} }
return $array_found; echo '</ul></div';
} }

View File

@ -1,29 +1,12 @@
div.show_result_interpreter { div.show_result_interpreter {
background-position: center right 10px; background-color: #fff;
background-repeat: no-repeat; color: #000;
background-size: 17px; border: 1px solid #e2e2e2;
background-color: #f2f6f7; border-top-left-radius: 4px;
padding: 0px; border-top-right-radius: 4px;
padding-right: 0px; padding-left: 10px;
padding-left: 0px; padding-top: 5px;
padding-right: 0px; padding-bottom: 5px;
padding-left: 0px; box-shadow: 0px 0px 15px -4px #dadada;
margin: 0; z-index: 1;
margin-top: 0px;
margin-left: 0px;
margin-left: 0px;
width: 300px;
height: 30px;
margin-left: 2px;
padding-left: 15px;
padding-right: 40px;
color: rgb(0, 0, 0);
font-family: "Open Sans", sans-serif;
font-size: 8.5pt;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
border-color: #1a1919;
margin-top: 1px;
} }