Merge branch 'ent-2094-Añadir-buscador-en-operaciones-masivas' into 'develop'
Add module filter by text -#2094 See merge request artica/pandorafms!2520
This commit is contained in:
commit
3a76f331c8
|
@ -177,6 +177,9 @@ $table->data['operations'][1] .= html_print_checkbox('copy_alerts', 1, true, tru
|
|||
$table->data['operations'][1] .= html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true);
|
||||
$table->data['operations'][1] .= '</span>';
|
||||
|
||||
$table->data['form_modules_filter'][0] = __('Filter Modules');
|
||||
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
|
||||
|
||||
$table->data[1][0] = __('Modules');
|
||||
$table->data[1][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">';
|
||||
$table->data[1][1] .= html_print_select(
|
||||
|
@ -302,6 +305,8 @@ echo '<h3 class="error invisible" id="message"> </h3>';
|
|||
ui_require_jquery_file('form');
|
||||
ui_require_jquery_file('pandora.controls');
|
||||
?>
|
||||
|
||||
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
var module_alerts;
|
||||
|
@ -478,6 +483,9 @@ $(document).ready (function () {
|
|||
}
|
||||
$("#fieldset_targets").show ();
|
||||
$("#target_modules, #target_alerts").enable ();
|
||||
//Filter modules. Call the function when the select is fully loaded.
|
||||
var textNoData = "<?php echo __('None'); ?>";
|
||||
filterByText($('#target_modules'), $("#text-filter_modules"), textNoData);
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
|
|
@ -429,6 +429,11 @@ $table->data['form_modules_3'][1] = html_print_select(
|
|||
);
|
||||
$table->data['form_modules_3'][3] = '';
|
||||
|
||||
$table->rowstyle['form_modules_filter'] = 'vertical-align: top;';
|
||||
$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2';
|
||||
$table->data['form_modules_filter'][0] = __('Filter Modules');
|
||||
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
|
||||
|
||||
$table->rowstyle['form_modules_2'] = 'vertical-align: top;';
|
||||
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
|
||||
$table->data['form_modules_2'][0] = __('Modules');
|
||||
|
@ -571,6 +576,7 @@ if ($selection_mode == 'modules') {
|
|||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
|
@ -650,6 +656,9 @@ $(document).ready (function () {
|
|||
});
|
||||
$("#module_loading").hide();
|
||||
$("#module_name").removeAttr ("disabled");
|
||||
//Filter modules. Call the function when the select is fully loaded.
|
||||
var textNoData = "<?php echo __('None'); ?>";
|
||||
filterByText($('#module_name'), $("#text-filter_modules"), textNoData);
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
|
|
@ -388,6 +388,11 @@ $table->data['form_modules_4'][1] = html_print_select(
|
|||
true
|
||||
);
|
||||
|
||||
$table->rowstyle['form_modules_filter'] = 'vertical-align: top;';
|
||||
$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2';
|
||||
$table->data['form_modules_filter'][0] = __('Filter Modules');
|
||||
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
|
||||
|
||||
$table->rowstyle['form_modules_2'] = 'vertical-align: top;';
|
||||
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
|
||||
$table->data['form_modules_2'][0] = __('Modules');
|
||||
|
@ -1247,6 +1252,9 @@ $(document).ready (function () {
|
|||
});
|
||||
$("#module_loading").hide ();
|
||||
$("#module_name").removeAttr ("disabled");
|
||||
//Filter modules. Call the function when the select is fully loaded.
|
||||
var textNoData = "<?php echo __('None'); ?>";
|
||||
filterByText($('#module_name'), $("#text-filter_modules"), textNoData);
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
|
|
@ -1223,3 +1223,42 @@ function get_explanation_recon_script(id, id_rt, url) {
|
|||
|
||||
taskManager.addTask(xhr);
|
||||
}
|
||||
|
||||
// Filter modules in a select (bulk operations)
|
||||
function filterByText(selectbox, textbox, textNoData) {
|
||||
return selectbox.each(function() {
|
||||
var select = selectbox;
|
||||
var options = [];
|
||||
$(select)
|
||||
.find("option")
|
||||
.each(function() {
|
||||
options.push({ value: $(this).val(), text: $(this).text() });
|
||||
});
|
||||
$(select).data("options", options);
|
||||
$(textbox).bind("change keyup", function() {
|
||||
var options = $(select)
|
||||
.empty()
|
||||
.scrollTop(0)
|
||||
.data("options");
|
||||
var search = $(this).val();
|
||||
var regex = new RegExp(search, "gi");
|
||||
$.each(options, function(i) {
|
||||
var option = options[i];
|
||||
if (option.text.match(regex) !== null) {
|
||||
$(select).append(
|
||||
$("<option>")
|
||||
.text(option.text)
|
||||
.val(option.value)
|
||||
);
|
||||
}
|
||||
});
|
||||
if ($(select)[0].length == 0) {
|
||||
$(select).append(
|
||||
$("<option>")
|
||||
.text(textNoData)
|
||||
.val(textNoData)
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue