$config['ehorus_custom_field'], 'display_on_front' => 1 ); $result = (bool) db_process_sql_insert('tagent_custom_fields', $values); $custom_field_exists = $custom_field_created = $result; } /* Enable table */ $table_enable = new StdClass(); $table_enable->data = array(); $table_enable->width = '100%'; $table_enable->id = 'ehorus-enable-setup'; $table_enable->class = 'databox filters'; $table_enable->size['name'] = '30%'; $table_enable->style['name'] = 'font-weight: bold'; // Enable eHorus $row = array(); $row['name'] = __('Enable eHorus'); $row['control'] = __('Yes').' '.html_print_radio_button ('ehorus_enabled', 1, '', $config['ehorus_enabled'], true).'  '; $row['control'] .= __('No').' '.html_print_radio_button ('ehorus_enabled', 0, '', $config['ehorus_enabled'], true); $row['button'] = html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"', true); $table_enable->data['ehorus_enabled'] = $row; /* Remote config table */ $table_remote = new StdClass(); $table_remote->data = array(); $table_remote->width = '100%'; $table_remote->styleTable = 'margin-bottom: 10px;'; $table_remote->id = 'ehorus-remote-setup'; $table_remote->class = 'databox filters'; $table_remote->size['name'] = '30%'; $table_remote->style['name'] = 'font-weight: bold'; // User $row = array(); $row['name'] = __('User'); $row['control'] = html_print_input_text('ehorus_user', $config['ehorus_user'], '', 30, 100, true); $table_remote->data['ehorus_user'] = $row; // Pass $row = array(); $row['name'] = __('Password'); $row['control'] = html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true); $table_remote->data['ehorus_pass'] = $row; // Directory hostname $row = array(); $row['name'] = __('API Hostname'); $row['control'] = html_print_input_text('ehorus_hostname', $config['ehorus_hostname'], '', 30, 100, true); $row['control'] .= ui_print_help_tip(__('Hostname of the eHorus API') . '. ' . __('Without protocol and port') . '. ' . __('e.g., portal.ehorus.com'), true); $table_remote->data['ehorus_hostname'] = $row; // Directory port $row = array(); $row['name'] = __('API Port'); $row['control'] = html_print_input_text('ehorus_port', $config['ehorus_port'], '', 6, 100, true); $row['control'] .= ui_print_help_tip(__('e.g., 18080'), true); $table_remote->data['ehorus_port'] = $row; // Request timeout $row = array(); $row['name'] = __('Request timeout'); $row['control'] = html_print_input_text('ehorus_req_timeout', $config['ehorus_req_timeout'], '', 3, 10, true); $row['control'] .= ui_print_help_tip(__('Time in seconds to set the maximum time of the requests to the eHorus API') . '. ' . __('0 to disable'), true); $table_remote->data['ehorus_req_timeout'] = $row; // Test $row = array(); $row['name'] = __('Test'); $row['control'] = html_print_button(__('Start'), 'test-ehorus', false, '', 'class="sub next"', true); $row['control'] .= ''; $row['control'] .= ''; $row['control'] .= ''; $row['control'] .= ' '; $table_remote->data['ehorus_test'] = $row; /* Print */ echo '
'; echo ''; html_print_image('include/ehorus/images/ehorus-logo-grey.png'); echo ''; echo '
'; echo '
'; echo __('Remote Management System'); echo '
'; echo ''; echo 'https://ehorus.com'; echo ''; echo '
'; if ($custom_field_created !== null) { ui_print_result_message($custom_field_created, __('Custom field eHorusID created'), __('Error creating custom field')); } if ($custom_field_created) { $info_messsage = __('eHorus has his own agent identifiers'); $info_messsage .= '. ' . __('To store them, it will be necessary to use an agent custom field'); $info_messsage .= '.
' . __('Possibly the eHorus id will have to be filled in by hand for every agent') . '.'; ui_print_info_message($info_messsage); } if ($config['ehorus_enabled'] && !$custom_field_exists) { $error_message = __('The custom field does not exists already'); ui_print_error_message($error_message); } // Form enable echo '
'; html_print_input_hidden('update_config', 1); html_print_table($table_enable); echo '
'; // Form remote if ($config['ehorus_enabled']) { echo '
'; echo "
"; echo "" . __('eHorus API') . ""; html_print_input_hidden ('update_config', 1); html_print_table($table_remote); echo '
'; html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"'); echo '
'; echo "
"; echo '
'; } ?>