Added tags select field

This commit is contained in:
Arturo Gonzalez 2017-05-16 16:37:48 +02:00
parent 5e2a65d6b8
commit 1361ecd2e9
2 changed files with 29 additions and 0 deletions

View File

@ -303,6 +303,13 @@ $table->data['form_modules_3'][1] = html_print_select($status_list,
'status_module', 'selected', '', __('All'), AGENT_MODULE_STATUS_ALL, true);
$table->data['form_modules_3'][3] = '';
$tags = tags_get_user_tags();
$table->rowstyle['form_modules_4'] = 'vertical-align: top;';
$table->rowclass['form_modules_4'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_4'][0] = __('Tags');
$table->data['form_modules_4'][1] = html_print_select ($tags, 'tags[]',
$tags_name, false, __('Any'), -1, true, true, 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');
@ -662,8 +669,10 @@ $(document).ready (function () {
clean_lists();
$(".select_modules_row").css('display', '<?php echo $modules_row?>');
$(".select_agents_row").css('display', '<?php echo $agents_row?>');
$(".select_modules_row_2").css('display', 'none');
// Trigger change to refresh selection when change selection mode
$("#agents_selection_mode").change (function() {
@ -720,6 +729,13 @@ $(document).ready (function () {
var status_module = $('#status_module').val();
if (status_module != '-1')
params['status_module'] = status_module;
var tags_to_search = $('#tags').val();
if (tags_to_search != null) {
if (tags_to_search[0] != -1) {
params['tags'] = tags_to_search;
}
}
$("#module_loading").show ();
$("tr#delete_table-edit1, tr#delete_table-edit0, tr#delete_table-edit2").hide ();
@ -926,6 +942,7 @@ $(document).ready (function () {
else if(selector == 'modules') {
$(".select_agents_row").hide();
$(".select_modules_row").show();
$("#module_type").trigger("change");
}
});
@ -1041,6 +1058,16 @@ $(document).ready (function () {
}
});
$("#tags").change(function() {
selector = $("#form_edit input[name=selection_mode]:checked").val();
if(selector == 'agents') {
$("#id_agents").trigger("change");
}
else if(selector == 'modules') {
$("#module_type").trigger("change");
}
});
});
function disabled_status () {

View File

@ -549,6 +549,8 @@ if (is_ajax ()) {
// Use 0 as not received
$id_tipo_modulo = (int) get_parameter ('id_tipo_modulo', 0);
$status_modulo = (int) get_parameter ('status_module', -1);
$tags = (array) get_parameter ('tags', array());
// Filter
$filter = array();