#8252 Move up and down fields
This commit is contained in:
parent
a40efcfee5
commit
90d4cfa0db
|
@ -45,7 +45,7 @@ if ($default != 0) {
|
||||||
'token' => 'event_fields',
|
'token' => 'event_fields',
|
||||||
'value' => $event_fields,
|
'value' => $event_fields,
|
||||||
];
|
];
|
||||||
// update 'event_fields' in tconfig table to keep the value at update.
|
// Update 'event_fields' in tconfig table to keep the value at update.
|
||||||
$result = db_process_sql_update(
|
$result = db_process_sql_update(
|
||||||
'tconfig',
|
'tconfig',
|
||||||
$values,
|
$values,
|
||||||
|
@ -147,7 +147,7 @@ $table->data[1][1] .= '<br><br><br><br><a href="javascript:">'.html_print_image(
|
||||||
|
|
||||||
$table->data[0][1] = '';
|
$table->data[0][1] = '';
|
||||||
$table->data[0][2] = '<b>'.__('Fields selected').'</b>';
|
$table->data[0][2] = '<b>'.__('Fields selected').'</b>';
|
||||||
$table->data[1][2] = html_print_select(
|
$table->data[1][2] = '<div class="flex_justify">'.html_print_select(
|
||||||
$result_selected,
|
$result_selected,
|
||||||
'fields_selected[]',
|
'fields_selected[]',
|
||||||
true,
|
true,
|
||||||
|
@ -162,6 +162,25 @@ $table->data[1][2] = html_print_select(
|
||||||
'width: 300px'
|
'width: 300px'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$table->data[1][2] .= '<div id="sort_arrows" class="flex-column">';
|
||||||
|
$table->data[1][2] .= '<a href="javascript:">'.html_print_image(
|
||||||
|
'images/darrowup.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'onclick' => 'sortUpDown(\'up\');',
|
||||||
|
'title' => __('Move down selected fields'),
|
||||||
|
]
|
||||||
|
).'</a>';
|
||||||
|
$table->data[1][2] .= '<a href="javascript:">'.html_print_image(
|
||||||
|
'images/darrowdown.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'onclick' => 'sortUpDown(\'down\');',
|
||||||
|
'title' => __('Move up selected fields'),
|
||||||
|
]
|
||||||
|
).'</a>';
|
||||||
|
$table->data[1][2] .= '</div></div>';
|
||||||
|
|
||||||
echo '<form id="custom_events" method="post" action="index.php?sec=geventos&sec2=godmode/events/events§ion=fields&pure='.$config['pure'].'">';
|
echo '<form id="custom_events" method="post" action="index.php?sec=geventos&sec2=godmode/events/events§ion=fields&pure='.$config['pure'].'">';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
|
@ -174,7 +193,7 @@ echo '</div>';
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* <![CDATA[ */
|
/* <![CDATA[ */
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
|
|
||||||
$("#right").click (function () {
|
$("#right").click (function () {
|
||||||
jQuery.each($("select[name='fields_available[]'] option:selected"), function (key, value) {
|
jQuery.each($("select[name='fields_available[]'] option:selected"), function (key, value) {
|
||||||
field_name = $(value).html();
|
field_name = $(value).html();
|
||||||
|
@ -186,9 +205,9 @@ $(document).ready (function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#left").click (function () {
|
$("#left").click (function () {
|
||||||
var current_fields_size = ($('#fields_selected option').length);
|
var current_fields_size = ($('#fields_selected option').length);
|
||||||
var selected_fields = [];
|
var selected_fields = [];
|
||||||
var selected_fields_total = '';
|
var selected_fields_total = '';
|
||||||
|
|
||||||
|
@ -214,7 +233,7 @@ $(document).ready (function () {
|
||||||
move_left();
|
move_left();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#submit-upd_button").click(function () {
|
$("#submit-upd_button").click(function () {
|
||||||
$("#fields_selected").find("option[value='0']").remove();
|
$("#fields_selected").find("option[value='0']").remove();
|
||||||
$('#fields_selected option').map(function() {
|
$('#fields_selected option').map(function() {
|
||||||
|
@ -223,7 +242,7 @@ $(document).ready (function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function move_left(){
|
function move_left() {
|
||||||
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
|
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
|
||||||
field_name = $(value).html();
|
field_name = $(value).html();
|
||||||
if (field_name != <?php echo "'".__('None')."'"; ?>) {
|
if (field_name != <?php echo "'".__('None')."'"; ?>) {
|
||||||
|
@ -234,4 +253,16 @@ function move_left(){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Change the order (to up or down).
|
||||||
|
function sortUpDown(mode) {
|
||||||
|
$("#fields_selected option:selected").each(function() {
|
||||||
|
const field = $(this);
|
||||||
|
|
||||||
|
if (field.length) {
|
||||||
|
(mode === 'up') ? field.first().prev().before(field): field.last().next().after(field);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -7483,6 +7483,11 @@ div.graph div.legend table {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.flex_justify {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
.span_priority {
|
.span_priority {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 10px;
|
height: 10px;
|
||||||
|
|
Loading…
Reference in New Issue