mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
add firts changes
This commit is contained in:
parent
14999b7b84
commit
d4720c2260
@ -13,6 +13,8 @@
|
|||||||
require_once 'include/functions_messages.php';
|
require_once 'include/functions_messages.php';
|
||||||
require_once 'include/functions_servers.php';
|
require_once 'include/functions_servers.php';
|
||||||
require_once 'include/functions_notifications.php';
|
require_once 'include/functions_notifications.php';
|
||||||
|
require_once 'include/ajax/order_interpreter.php';
|
||||||
|
ui_require_css_file('order_interpreter');
|
||||||
|
|
||||||
// Check permissions
|
// Check permissions
|
||||||
// Global errors/warnings checking.
|
// Global errors/warnings checking.
|
||||||
@ -120,8 +122,13 @@ if ($config['menu_type'] == 'classic') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
|
$search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
|
||||||
onkeyup="javascript: fieldKeyWordEmpty = false;" class="search_input" />';
|
onkeyup="showinterpreter()" class="search_input" />';
|
||||||
|
|
||||||
|
$search_bar .= '<div
|
||||||
|
id="result_order"
|
||||||
|
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>';
|
||||||
@ -630,7 +637,14 @@ if ($config['menu_type'] == 'classic') {
|
|||||||
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
|
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
|
||||||
|
|
||||||
var new_chat = <?php echo (int) $_SESSION['new_chat']; ?>;
|
var new_chat = <?php echo (int) $_SESSION['new_chat']; ?>;
|
||||||
|
|
||||||
|
function showinterpreter(){
|
||||||
|
if( $('#keywords').val() === ''){
|
||||||
|
$('#result_order').hide();
|
||||||
|
}else {
|
||||||
|
$('#result_order').show();
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Loads modal from AJAX to add feedback.
|
* Loads modal from AJAX to add feedback.
|
||||||
*/
|
*/
|
||||||
|
62
pandora_console/include/ajax/order_interpreter.php
Normal file
62
pandora_console/include/ajax/order_interpreter.php
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Order interpreter ajax controller.
|
||||||
|
*
|
||||||
|
* @category OrderInterpreter
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage New Installation Welcome Window
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
require_once $config['homedir'].'/include/class/OrderInterpreter.class.php';
|
||||||
|
if (is_ajax() === false) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ajaxPage = 'include/ajax/order_interpreter';
|
||||||
|
|
||||||
|
// Control call flow.
|
||||||
|
try {
|
||||||
|
// User access and validation is being processed on class constructor.
|
||||||
|
$order_interpreter = new OrderInterpreter(true, $ajaxPage);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ajax controller.
|
||||||
|
$method = get_parameter('method', '');
|
||||||
|
|
||||||
|
if (method_exists($order_interpreter, $method) === true) {
|
||||||
|
if ($order_interpreter->ajaxMethod($method) === true) {
|
||||||
|
$order_interpreter->{$method}();
|
||||||
|
} else {
|
||||||
|
$order_interpreter->error('Unavailable method.');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$order_interpreter->error('Method not found. ['.$method.']');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Stop any execution.
|
||||||
|
exit;
|
157
pandora_console/include/class/OrderInterpreter.class.php
Normal file
157
pandora_console/include/class/OrderInterpreter.class.php
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Welcome to Pandora FMS feature.
|
||||||
|
*
|
||||||
|
* @category Class
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Order Interpreter
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class OrderInterpreter.
|
||||||
|
*/
|
||||||
|
class OrderInterpreter extends Wizard
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allowed methods to be called using AJAX request.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $AJAXMethods = ['getResult'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Url of controller.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $ajaxController;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a JSON error.
|
||||||
|
*
|
||||||
|
* @param string $msg Error message.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function error($msg)
|
||||||
|
{
|
||||||
|
echo json_encode(
|
||||||
|
['error' => $msg]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if target method is available to be called using AJAX.
|
||||||
|
*
|
||||||
|
* @param string $method Target method.
|
||||||
|
*
|
||||||
|
* @return boolean True allowed, false not.
|
||||||
|
*/
|
||||||
|
public function ajaxMethod($method)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
// Check access.
|
||||||
|
check_login();
|
||||||
|
|
||||||
|
return in_array($method, $this->AJAXMethods);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param boolean $must_run Must run or not.
|
||||||
|
* @param string $ajax_controller Controller.
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
* @throws Exception On error.
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
$ajax_controller='include/ajax/order_interpreter'
|
||||||
|
) {
|
||||||
|
$this->ajaxController = $ajax_controller;
|
||||||
|
$this->pages_name = [
|
||||||
|
0 => __('Agent view'),
|
||||||
|
1 => __('Agent Management'),
|
||||||
|
2 => __('Manage Agents'),
|
||||||
|
3 => __('Manage Policies'),
|
||||||
|
];
|
||||||
|
$this->pages_url = [
|
||||||
|
0 => ui_get_full_url(),
|
||||||
|
1 => ui_get_full_url(),
|
||||||
|
2 => ui_get_full_url(),
|
||||||
|
3 => ui_get_full_url(),
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to print order interpreted on header search input.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function getResult()
|
||||||
|
{
|
||||||
|
// Take value from input search.
|
||||||
|
$text = get_parameter('text', '');
|
||||||
|
|
||||||
|
foreach ($this->pages_name as $key => $value) {
|
||||||
|
if (preg_match('/'.$text.'/', $value)) {
|
||||||
|
echo 'pene gordo';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load JS content.
|
||||||
|
* function that enables the functions to the buttons when its action is
|
||||||
|
* completed.
|
||||||
|
* Assign the url of each button.
|
||||||
|
*
|
||||||
|
* @return string HTML code for javascript functionality.
|
||||||
|
*/
|
||||||
|
public function loadJS()
|
||||||
|
{
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
return ob_get_clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
29
pandora_console/include/styles/order_interpreter.css
Normal file
29
pandora_console/include/styles/order_interpreter.css
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
div.show_result_interpreter {
|
||||||
|
background-position: center right 10px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 17px;
|
||||||
|
background-color: #f2f6f7;
|
||||||
|
padding: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
padding-left: 0px;
|
||||||
|
margin: 0;
|
||||||
|
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;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user