diff --git a/pandora_console/godmode/wizards/HostDevices.class.php b/pandora_console/godmode/wizards/HostDevices.class.php index e4e0e97fdc..1c20eb04e3 100755 --- a/pandora_console/godmode/wizards/HostDevices.class.php +++ b/pandora_console/godmode/wizards/HostDevices.class.php @@ -581,113 +581,83 @@ class HostDevices extends Wizard if (isset($this->page) === false || $this->page == 0 ) { - $form = []; - // Input task name. - $form['inputs'][] = [ - 'label' => ''.__('Task name').'', - 'arguments' => [ + // Comment input + $comment_input ='
'; + + $comment_input .= $this->printInput([ + 'name' => 'comment', + 'rows' => 1, + 'columns' => 1, + 'value' => $this->task['description'], + 'type' => 'textarea', + 'size' => 25, + 'class' => 'discovery_textarea_input', + 'return' => true + ]); + + // Task input + $taskname_input_label = '
'; + + $taskname_input = $this->printInput([ 'name' => 'taskname', 'value' => $this->task['name'], 'type' => 'text', 'size' => 25, - ], - ]; + 'class' => 'discovery_full_width_input' + ]); - if (isset($this->task['id_rt']) === true) { - // Propagate id. - $form['inputs'][] = [ - 'arguments' => [ - 'name' => 'task', - 'value' => $this->task['id_rt'], - 'type' => 'hidden', - ], - ]; - } + // Network input + $network_input_label .= '
'.ui_print_help_tip(__('You can specify several networks, separated by commas, for example: 192.168.50.0/24,192.168.60.0/24'), true).'
'; - // Input task name. - $form['inputs'][] = [ - 'label' => ''.__('Comment').'', - 'arguments' => [ - 'name' => 'comment', - 'value' => $this->task['description'], - 'type' => 'text', - 'size' => 25, - ], - ]; - - // Input Discovery Server. - $form['inputs'][] = [ - 'label' => ''.__('Discovery server').''.ui_print_help_tip( - __('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'), - true - ), - 'arguments' => [ - 'type' => 'select_from_sql', - 'sql' => sprintf( - 'SELECT id_server, name - FROM tserver - WHERE server_type = %d - ORDER BY name', - SERVER_TYPE_DISCOVERY - ), - 'name' => 'id_recon_server', - 'selected' => $this->task['id_recon_server'], - 'return' => true, - ], - ]; - - // Input Network. - $form['inputs'][] = [ - - 'label' => ''.__('Network').''.ui_print_help_tip( - __('You can specify several networks, separated by commas, for example: 192.168.50.0/24,192.168.60.0/24'), - true - ), - 'arguments' => [ + $network_input = $this->printInput([ 'name' => 'network', 'value' => $this->task['subnet'], 'type' => 'text', 'size' => 25, - ], - ]; + 'class' => 'discovery_full_width_input', + ]); - // Input Group. - $form['inputs'][] = [ - 'label' => ''.__('Group').'', - 'arguments' => [ - 'name' => 'id_group', - 'returnAllGroup' => false, - 'privilege' => 'PM', - 'type' => 'select_groups', - 'selected' => $this->task['id_group'], - 'return' => true, - ], - ]; - // Interval and schedules. + // Discovery server input + $discovery_server_select_label = '
'.ui_print_help_tip(__('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'), true).'
'; + + $discovery_server_select = $this->printInput([ + 'type' => 'select_from_sql', + 'sql' => sprintf( + 'SELECT id_server, name + FROM tserver + WHERE server_type = %d + ORDER BY name', + SERVER_TYPE_DISCOVERY + ), + 'name' => 'id_recon_server', + 'selected' => $this->task['id_recon_server'], + 'return' => true, + 'style' => 'width: 100%', + ]); + + // Interval input $interv_manual = 0; if ((int) $this->task['interval_sweep'] == 0) { $interv_manual = 1; } - // Schedule. - $form['inputs'][] = [ - 'label' => ''.__('Interval').''.ui_print_help_tip( - __('Manual interval means that it will be executed only On-demand'), - true - ), - 'arguments' => [ - 'type' => 'select', - 'selected' => $interv_manual, - 'fields' => [ - 0 => __('Defined'), - 1 => __('Manual'), - ], - 'name' => 'interval_manual_defined', - 'return' => true, + $interval_input_label = '
'.ui_print_help_tip(__('Manual interval means that it will run only on demand.'), true).'
'; + + $interval_input = $this->printInput([ + 'type' => 'select', + 'selected' => $interv_manual, + 'fields' => [ + 0 => __('Defined'), + 1 => __('Manual'), ], - 'extra' => ''.html_print_extended_select_for_time( + 'name' => 'interval_manual_defined', + 'return' => true, + 'style' => 'float: right;' + ]); + + $interval_input_extra = ''.html_print_extended_select_for_time( 'interval', $this->task['interval_sweep'], '', @@ -700,36 +670,37 @@ class HostDevices extends Wizard ).ui_print_help_tip( __('The minimum recomended interval for Recon Task is 5 minutes'), true - ).'', - ]; + ).''; - $str = __('Next'); - if (isset($this->task['id_rt']) === true) { - $str = __('Update and continue'); + // Group select + $group_select = '
'; + + $group_select .= $this->printInput([ + 'name' => 'id_group', + 'returnAllGroup' => false, + 'privilege' => 'PM', + 'type' => 'select_groups', + 'selected' => $this->task['id_group'], + 'return' => true, + 'class' => 'discovery_list_input', + 'size' => 9, + ]); + + if (isset($this->task['id_rt']) === true) { + //Propagate ID + $task_hidden = $this->printInput([ + 'name' => 'task', + 'value' => $this->task['id_rt'], + 'type' => 'hidden' + ]); } - // Submit button. - $form['inputs'][] = [ - 'arguments' => [ - 'name' => 'submit', - 'label' => $str, - 'type' => 'submit', - 'attributes' => 'class="sub next"', - 'return' => true, - ], - ]; - $task_url = ''; if (isset($this->task['id_rt'])) { $task_url = '&task='.$this->task['id_rt']; } - $form['form'] = [ - 'method' => 'POST', - 'action' => $this->url.'&mode=netscan&page='.($this->page + 1).$task_url, - ]; - // Default. $interval = 600; $unit = 60; @@ -738,24 +709,62 @@ class HostDevices extends Wizard $unit = $this->getTimeUnit($interval); } - $form['js'] = ' -$("select#interval_manual_defined").change(function() { - if ($("#interval_manual_defined").val() == 1) { - $("#interval_manual_container").hide(); - $("#text-interval_text").val(0); - $("#hidden-interval").val(0); - } - else { - $("#interval_manual_container").show(); - $("#text-interval_text").val(10); - $("#hidden-interval").val('.$interval.'); - $("#interval_units").val('.$unit.'); - } -}).change();'; - // XXX: Could be improved validating inputs before continue (JS) // Print NetScan page 0. - $this->printForm($form); + //$this->printForm($form); + + echo '
'; + echo $task_hidden; + + echo '
+
+
' + .'
'.html_print_image ("images/wizard/netscan_green.png", true, array ("title" => __('Close'), "style" => 'width: 60%;'), false).'
' + .'
'.$interval_input_label.'
'.$interval_input.'
'.$interval_input_extra.'
' + .'
+ +
+
'.$taskname_input_label.'
'.$taskname_input.'
' + .'
'.$discovery_server_select_label.$discovery_server_select.'
' + .'
'.$network_input_label.'
'.$network_input.'
' + .'
' + .'
'.$group_select.'
' + .'
' + + .'
+
+ '.$comment_input.' +
+
' + .'
'; + + $str = __('Next'); + + if (isset($this->task['id_rt']) === true) { + $str = __('Update and continue'); + } + + echo '
'.html_print_submit_button($str, 'submit', false, 'class="sub next"', true).'
'; + echo '
'; + + echo ''; + } } @@ -783,7 +792,7 @@ $("select#interval_manual_defined").change(function() { ]; $form['inputs'][] = [ - 'extra' => '

Please, configure task '.io_safe_output($this->task['name']).'

', + 'extra' => '

Please, configure task '.io_safe_output($this->task['name']).'

', ]; // Input: Module template. @@ -799,7 +808,6 @@ $("select#interval_manual_defined").change(function() { 'selected' => $this->task['id_network_profile'], 'nothing_value' => 0, 'nothing' => __('None'), - ], ]; @@ -850,7 +858,7 @@ $("select#interval_manual_defined").change(function() { 'action' => $this->url.'&mode=netscan&page='.($this->page + 1).'&task='.$this->task['id_rt'], ]; - $this->printForm($form); + $this->printForm($form, false, true); } if ($this->page == 2) { diff --git a/pandora_console/godmode/wizards/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php index fde2b411c0..011e906cfa 100644 --- a/pandora_console/godmode/wizards/Wizard.main.php +++ b/pandora_console/godmode/wizards/Wizard.main.php @@ -479,7 +479,8 @@ class Wizard ((isset($data['keys_field']) === true) ? $data['keys_field'] : 'id_grupo'), ((isset($data['strict_user']) === true) ? $data['strict_user'] : false), ((isset($data['delete_groups']) === true) ? $data['delete_groups'] : false), - ((isset($data['include_groups']) === true) ? $data['include_groups'] : false) + ((isset($data['include_groups']) === true) ? $data['include_groups'] : false), + ((isset($data['size']) === true) ? $data['size'] : false) ); case 'submit': @@ -636,7 +637,7 @@ class Wizard * * @return string HTML code. */ - public function printForm(array $data, bool $return=false) + public function printForm(array $data, bool $return=false, bool $print_white_box=false) { $form = $data['form']; $inputs = $data['inputs']; @@ -662,13 +663,27 @@ class Wizard error_log('Error executing wizard callback: ', $e->getMessage()); } - $output = ''; + $result .= ''; $i = 0; $table = new StdClasS(); @@ -142,6 +146,7 @@ if ($progress_task_discovery) { $table->data[$i][1] .= $summary['summary']['WMI']; $table->data[$i++][1] .= ''; + $result .= '
'.__('Summary').'
'; $result .= html_print_table($table, true).''; } else { $global_progress = -1; diff --git a/pandora_console/include/class/CustomNetScan.class.php b/pandora_console/include/class/CustomNetScan.class.php index 7477594637..bd0adba3f1 100644 --- a/pandora_console/include/class/CustomNetScan.class.php +++ b/pandora_console/include/class/CustomNetScan.class.php @@ -438,7 +438,7 @@ class CustomNetScan extends Wizard // Input task name. $form['inputs'][] = [ - 'label' => ''.__('Task name').'', + 'label' => __('Task name'), 'arguments' => [ 'name' => 'taskname', 'value' => $this->task['name'], @@ -460,7 +460,7 @@ class CustomNetScan extends Wizard // Input task description. $form['inputs'][] = [ - 'label' => ''.__('Comment').'', + 'label' => __('Comment'), 'arguments' => [ 'name' => 'comment', 'value' => $this->task['description'], @@ -471,7 +471,7 @@ class CustomNetScan extends Wizard // Input Discovery Server. $form['inputs'][] = [ - 'label' => ''.__('Discovery server').''.ui_print_help_tip( + 'label' => __('Discovery server').ui_print_help_tip( __('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'), true ), @@ -492,7 +492,7 @@ class CustomNetScan extends Wizard // Input Group. $form['inputs'][] = [ - 'label' => ''.__('Group').'', + 'label' => __('Group'), 'arguments' => [ 'name' => 'id_group', 'returnAllGroup' => false, @@ -511,7 +511,7 @@ class CustomNetScan extends Wizard // Schedule. $form['inputs'][] = [ - 'label' => ''.__('Interval').''.ui_print_help_tip( + 'label' => __('Interval').ui_print_help_tip( __('Manual interval means that it will be executed only On-demand'), true ), @@ -594,7 +594,7 @@ class CustomNetScan extends Wizard // XXX: Could be improved validating inputs before continue (JS) // Print NetScan page 0. - $this->printForm($form); + $this->printForm($form, false, true); } } @@ -602,7 +602,7 @@ class CustomNetScan extends Wizard $name_ipam = 'IPAM Recon'; // Recon script. $form['inputs'][] = [ - 'label' => ''.__('Recon script').'', + 'label' => __('Recon script'), 'arguments' => [ 'type' => 'select_from_sql', 'sql' => sprintf( @@ -643,7 +643,7 @@ class CustomNetScan extends Wizard ); $form['inputs'][] = [ - 'label' => ''.__('Explanation').'', + 'label' => __('Explanation').'', 'arguments' => [ 'type' => 'textarea', 'rows' => 4, @@ -652,6 +652,7 @@ class CustomNetScan extends Wizard 'value' => $explanation, 'return' => true, 'attributes' => 'style="width: 388px;"', + 'class' => 'discovery_textarea_input' ], ]; @@ -663,8 +664,9 @@ class CustomNetScan extends Wizard 'name' => 'macro_name', 'value' => 'macro_value', 'type' => 'text', - 'size' => 100, + 'size' => 50, 'return' => true, + ], ]; diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 4cb405d154..8feab63553 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -436,7 +436,8 @@ function html_print_select_groups( $keys_field='id_grupo', $strict_user=false, $delete_groups=false, - $include_groups=false + $include_groups=false, + $size=false ) { global $config; @@ -481,7 +482,8 @@ function html_print_select_groups( $class, $disabled, $style, - $option_style + $option_style, + $size ); if ($return) { @@ -549,13 +551,11 @@ function html_print_select( $attributes .= ' onchange="'.$script.'"'; } - if (!empty($multiple)) { - if ($size !== false) { - $attributes .= ' multiple="multiple" size="'.$size.'"'; - } else { - $attributes .= ' multiple="multiple" size="10"'; - } - } + if ($size !== false) + $attributes .= ' size="'.$size.'"'; + + if (!empty($multiple)) + $attributes .= ' multiple="multiple"'; if (!empty($class)) { $attributes .= ' class="'.$class.'"'; @@ -1774,7 +1774,8 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $ */ function html_print_textarea($name, $rows, $columns, $value='', $attributes='', $return=false, $class='') { - $output = ''; diff --git a/pandora_console/include/graphs/functions_d3.php b/pandora_console/include/graphs/functions_d3.php index 5ce06e982f..dfbcb46234 100644 --- a/pandora_console/include/graphs/functions_d3.php +++ b/pandora_console/include/graphs/functions_d3.php @@ -415,7 +415,7 @@ function d3_progress_bubble($id, $percentile, $width, $height, $color, $unit='%' } -function progress_circular_bar($id, $percentile, $width, $height, $color, $unit='%', $text='', $fill_color='#FFFFFF') +function progress_circular_bar($id, $percentile, $width, $height, $color, $unit='%', $text='', $fill_color='#FFFFFF', $transition=1) { global $config; @@ -427,7 +427,7 @@ function progress_circular_bar($id, $percentile, $width, $height, $color, $unit= $output .= '
"; $output .= include_javascript_d3(true); $output .= ""; return $output; diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js index 51dae061ec..d989c5f55f 100644 --- a/pandora_console/include/graphs/pandora.d3.js +++ b/pandora_console/include/graphs/pandora.d3.js @@ -1988,7 +1988,8 @@ function print_circular_progress_bar( color, unit, label, - label_color + label_color, + transition ) { var twoPi = Math.PI * 2; var radius = width / 2; @@ -2120,15 +2121,19 @@ function print_circular_progress_bar( var progress = startPercent; - (function loops() { - updateProgress(progress); + if (transition == 0) + updateProgress(endPercent); + else { + (function loops() { + updateProgress(progress); - if (count > 0) { - count--; - progress += step; - setTimeout(loops, 30); - } - })(); + if (count > 0) { + count--; + progress += step; + setTimeout(loops, 30); + } + })(); + } } function print_interior_circular_progress_bar( diff --git a/pandora_console/include/styles/discovery.css b/pandora_console/include/styles/discovery.css index 34e9b98255..51b4e98c10 100644 --- a/pandora_console/include/styles/discovery.css +++ b/pandora_console/include/styles/discovery.css @@ -156,11 +156,118 @@ span.breadcrumb_link { color: #95b750; } -.form_grid_items { - overflow: hidden; +/* + * Discovery forms structure + */ + +.edit_discovery_info { + display: flex; + align-items: center; + padding-top: 25px; } -.form_grid_items .form_grid_item { - float: left; + +.edit_discovery_input { + align-items: center; + margin-bottom: 25px; +} + +/* + * Discovery text inputs + */ + +.discovery_label_hint { + display: flex; +} + +label { + color: #343434 !important; + font-size: 1.5em; + font-family: "lato-bolder", "Open Sans", sans-serif !important; + font-weight: bold; + margin: 0px 0px 5px 0px; +} + +.discovery_full_width_input { + width: 100%; +} + +select { + font-family: "lato-bolder", "Open Sans", sans-serif !important; + font-size: 1.6em !important; + color: #686868; +} + +select > option { + font-family: "lato-bolder", "Open Sans", sans-serif !important; + font-size: 1em !important; +} + +li > input[type=text], li > input[type=password], .discovery_text_input > input[type=password], .discovery_text_input > input[type=text], #interval_manual > input[type=text] { + background-color: transparent !important; + border: none; + border-radius: 0 !important; + border-bottom: 1px solid #343434; + padding: 0px 0px 2px 0px; + box-sizing: border-box; + margin-bottom: 4px; + font-family: "lato-bolder", "Open Sans", sans-serif !important; + font-size: 1.6em; +} + +li > input[type=text]:focus, li > input[type=password]:focus, .discovery_text_input > input[type=password]:focus, .discovery_text_input > input[type=text]:focus, #interval_manual > input[type=text]:focus { + font-weight: bold; +} + +#interval_manual > input[type=text] { + width: 50px; + margin-left: 10px; + margin-right: 10px; +} + +.discovery_list_input { + font-family: "lato-bolder", "Open Sans", sans-serif !important; + font-size: 1.6em !important; + color: #686868; + width: 100%; + height: 240px; + border: 1px solid #CBCBCB; + overflow-y: auto; +} + +.discovery_list_input option { + font-family: "lato-bolder", "Open Sans", sans-serif !important; + font-size: 1.1em !important; + padding-left: 30%; +} + +.discovery_list_input option:checked { + background: #1aab8e -webkit-linear-gradient(bottom, #7db742 0%, #7db742 100%); + color: #fff; +} + +.discovery_textarea_input { + background-color: #fbfbfb !important; + padding-left: 10px; + width: 100%; + height: 100px; + max-height: 100px; + max-width: 100%; + -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ + -moz-box-sizing: border-box; /* Firefox, other Gecko */ box-sizing: border-box; - padding: 10px; + resize: none; + font-family: "lato-bolder", "Open Sans", sans-serif !important; + font-size: 1.4em !important; } + +a.tip { + margin-left: 8px; +} + +.inline_switch > label { + float: right; +} + +.discovery_interval_select_width { + width: 90%; +} \ No newline at end of file