Merge branch 'ent-3499-Numero_de_respuestas_de_eventos_masivas' into 'develop'

add new tocken max events responses

See merge request artica/pandorafms!2180

Former-commit-id: c8b7deddcaa8f290d1b3065158606e21504d2dae
This commit is contained in:
Daniel Rodriguez 2019-02-20 16:11:34 +01:00
commit 9419e68aef
3 changed files with 40 additions and 11 deletions

View File

@ -665,6 +665,20 @@ $table_other->data[12][1] = html_print_input_text(
true
);
$table_other->data[13][0] = __('Events response max. execution');
$table_other->data[13][0] .= ui_print_help_tip(
__('Number of events that will perform the desired action at the same time'),
true
);
$table_other->data[13][1] = html_print_input_text(
'max_execution_event_response',
$config['max_execution_event_response'],
'',
5,
5,
true
);
echo '<form id="form_setup" method="post">';
echo '<fieldset>';

View File

@ -739,6 +739,10 @@ function config_update_config()
if (!config_update_value('max_graph_container', get_parameter('max_graph_container'))) {
$error_update[] = __('Graph container - Max. Items');
}
if (!config_update_value('max_execution_event_response', get_parameter('max_execution_event_response'))) {
$error_update[] = __('Max. execution event response');
}
break;
case 'vis':
@ -1517,6 +1521,10 @@ function config_process_config()
config_update_value('max_graph_container', 10);
}
if (!isset($config['max_execution_event_response'])) {
config_update_value('max_execution_event_response', 10);
}
if (!isset($config['max_macro_fields'])) {
config_update_value('max_macro_fields', 10);
}

View File

@ -983,7 +983,11 @@ if ($group_rep == 2) {
html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"');
echo "<span id='response_loading_dialog' style='display:none'>".html_print_image('images/spinner.gif', true).'</span>';
echo '</form>';
echo '<span id="max_custom_event_resp_msg" style="display:none; color:#FC4444; line-height: 200%;">'.__('A maximum of 10 event custom responses can be selected').'</span>';
echo '<span id="max_custom_event_resp_msg" style="display:none; color:#FC4444; line-height: 200%;">';
echo __(
'A maximum of %s event custom responses can be selected',
$config['max_execution_event_response']
).'</span>';
echo '</div>';
}
}
@ -1012,7 +1016,7 @@ if ($group_rep == 2) {
var total_checked = $(".chk_val:checked").length;
// Limit number of events to apply custom responses to for performance reasons
if (total_checked > 10) {
if (total_checked > <?php echo $config['max_execution_event_response']; ?> ) {
$('#max_custom_event_resp_msg').show();
return;
}
@ -1022,18 +1026,22 @@ if ($group_rep == 2) {
$('#response_loading_dialog').show(function() {
$(".chk_val").each(function() {
if ($(this).is(":checked")) {
//var server_id = $('#hidden-server_id_'+).
event_id = $(this).val();
server_id = $('#hidden-server_id_'+event_id).val();
response['target'] = get_response_target(event_id, response_id, server_id);
response['target'] = get_response_target(
event_id,
response_id,
server_id
);
if (total_checked-1 === counter) end=1;
show_massive_response_dialog(event_id, response_id, response, counter, end);
show_massive_response_dialog(
event_id,
response_id,
response,
counter,
end
);
counter++;
}
});
@ -1087,4 +1095,3 @@ if ($group_rep == 2) {
echo '</div>';
}