Fixed new_agent

This commit is contained in:
Daniel Maya 2020-10-20 16:15:42 +02:00
parent fbccb4ac6b
commit 3c95d17482
3 changed files with 10 additions and 10 deletions

View File

@ -149,7 +149,7 @@ if (is_ajax()) {
ui_require_javascript_file('openlayers.pandora'); ui_require_javascript_file('openlayers.pandora');
$new_agent = (bool) get_parameter('new_agent'); $new_agent = (empty($id_agente)) ? true : false;
if (! isset($id_agente) && ! $new_agent) { if (! isset($id_agente) && ! $new_agent) {
db_pandora_audit('ACL Violation', 'Trying to access agent manager witout an agent'); db_pandora_audit('ACL Violation', 'Trying to access agent manager witout an agent');
@ -1222,6 +1222,7 @@ ui_require_jquery_file('bgiframe');
$(document).ready (function() { $(document).ready (function() {
var $id_agent = '<?php echo $id_agente; ?>';
var previous_primary_group_select; var previous_primary_group_select;
$("#grupo").on('focus', function () { $("#grupo").on('focus', function () {
previous_primary_group_select = this.value; previous_primary_group_select = this.value;
@ -1276,12 +1277,14 @@ ui_require_jquery_file('bgiframe');
} }
}); });
paint_qrcode( if (typeof $id_agent !== 'undefined' && $id_agent !== '0') {
"<?php echo ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente); ?>", paint_qrcode(
"#qr_code_agent_view", "<?php echo ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente); ?>",
128, "#qr_code_agent_view",
128 128,
); 128
);
}
$("#text-agente").prop('readonly', true); $("#text-agente").prop('readonly', true);
}); });

View File

@ -754,7 +754,6 @@ if (check_acl($config['id_user'], 0, 'AW')) {
// Create agent button. // Create agent button.
echo '<div style="text-align: right;">'; echo '<div style="text-align: right;">';
echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">'; echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">';
html_print_input_hidden('new_agent', 1);
html_print_submit_button( html_print_submit_button(
__('Create agent'), __('Create agent'),
'crt-2', 'crt-2',

View File

@ -902,7 +902,6 @@ if (!empty($table->data)) {
if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'AM')) { if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'AM')) {
echo '<div style="text-align: right; float: right;">'; echo '<div style="text-align: right; float: right;">';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">'; echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
html_print_input_hidden('new_agent', 1);
html_print_submit_button(__('Create agent'), 'crt', false, 'class="sub next"'); html_print_submit_button(__('Create agent'), 'crt', false, 'class="sub next"');
echo '</form>'; echo '</form>';
echo '</div>'; echo '</div>';
@ -913,7 +912,6 @@ if (!empty($table->data)) {
ui_print_info_message([ 'no_close' => true, 'message' => __('There are no defined agents') ]); ui_print_info_message([ 'no_close' => true, 'message' => __('There are no defined agents') ]);
echo '<div style="text-align: right; float: right;">'; echo '<div style="text-align: right; float: right;">';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">'; echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
html_print_input_hidden('new_agent', 1);
html_print_submit_button(__('Create agent'), 'crt', false, 'class="sub next"'); html_print_submit_button(__('Create agent'), 'crt', false, 'class="sub next"');
echo '</form>'; echo '</form>';
echo '</div>'; echo '</div>';