Skip to content

Commit

Permalink
2.57.4 Signal active status now a series of visible checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
classaxe committed Jul 31, 2023
1 parent 48c4cbc commit 45012c0
Show file tree
Hide file tree
Showing 13 changed files with 158 additions and 55 deletions.
27 changes: 14 additions & 13 deletions public/css/style.css
@@ -1,8 +1,8 @@
/*
* Project: RXX - NDB Logging Database
* Homepage: https://rxx.classaxe.com
* Version: 2.57.1
* Date: 2023-07-26
* Version: 2.57.4
* Date: 2023-07-31
* Licence: LGPL
* Copyright: 2023 Martin Francis
*/
Expand Down Expand Up @@ -2057,23 +2057,15 @@ table.logsessions tbody tr.selected td {
width: 115px;
}
.signal_list #form_recently {
width: 95px;
width: 185px;
}
.signal_list label[for="form_within"] {
width: 65px !important;
padding-left: 1em !important;
padding-right: 0.25em !important;
}
.signal_list #form_within {
width: 85px;
}
.signal_list label[for="form_active"] {
width: 65px !important;
padding-left: 1em !important;
padding-right: 0.25em !important;
}
.signal_list #form_active {
width: 125px;
width: 185px;
}
.signal_list #form_personalise,
.signal_list #form_listener {
Expand Down Expand Up @@ -2243,6 +2235,7 @@ table.logsessions tbody tr.selected td {
line-height: 1em;
}
fieldset#form_type legend,
fieldset#form_status legend,
fieldset#form_offsets legend,
fieldset#form_hidenotes legend,
fieldset#form_morse legend,
Expand All @@ -2255,10 +2248,18 @@ fieldset#form_range_units legend {
padding: 0 0.5em 0 0;
color: #000000;
}
fieldset#form_type legend {
fieldset#form_type legend,
fieldset#form_status legend {
text-align: left;
width: 130px;
}
fieldset#form_status div {
margin: 0;
}
fieldset#form_status div label {
min-width: 5em;
margin: 0 0.25em;
}
fieldset#form_offsets legend,
fieldset#form_hidenotes legend,
fieldset#form_morse legend,
Expand Down
2 changes: 1 addition & 1 deletion public/css/style.min.css

Large diffs are not rendered by default.

29 changes: 25 additions & 4 deletions public/js/functions.js
@@ -1,7 +1,7 @@
/*
* Project: RXX - NDB Logging Database
* Homepage: https://rxx.classaxe.com
* Version: 2.57.3
* Version: 2.57.4
* Date: 2023-07-31
* Licence: LGPL
* Copyright: 2023 Martin Francis
Expand Down Expand Up @@ -594,6 +594,13 @@ var COMMON_FORM = {
}
},

/* [ Ensure that at least one option is checked for signal type checkboxes ] */
setStatusDefault : function() {
if ($('fieldset#form_status div :checkbox:checked').length === 0) {
$('fieldset#form_status div :checkbox[value=1]').prop('checked', true);
}
},

/* [ Enable 'All' checkbox to select / unselect all signal types ] */
setTypesAllAction : function () {
$('fieldset#form_type div :checkbox[value=ALL]').click(function () {
Expand Down Expand Up @@ -2324,6 +2331,19 @@ var shareableLink = {
return (defaultSorting !== f1.val() ? '&sort=' + f1.val() : '') +
(defaultOrder !== f2.val() ? '&order=' + f2.val() : '');
},
getFromStatus: function() {
var status = [], url;
$("fieldset#form_status div input").each(function() {
if ($(this).is(':checked')) {
status.push($(this).prop('value'));
}
});
if (0 === status.length) {
status = [1];
}
url = '&status=' + $.uniqueSort(status).join(',');
return (url === '&status=1' ? '' : url);
},
getFromTypes: function() {
var types = [], url;
$("fieldset#form_type div input").each(function() {
Expand Down Expand Up @@ -2366,6 +2386,7 @@ var shareableLink = {
var base = this.getBaseUrl('signals');
var url =
this.getFromTypes() +
this.getFromStatus() +
this.getFromField('rww_focus') +
this.getFromField('call') +
this.getFromPair('khz') +
Expand All @@ -2378,7 +2399,6 @@ var shareableLink = {
this.getFromField('notes') +
this.getFromField('recently') +
this.getFromField('within') +
this.getFromField('active') +

this.getFromListeners() +
this.getFromRadioGroup('listener_invert', [ '1' ]) +
Expand Down Expand Up @@ -2837,6 +2857,7 @@ var SIGNALS_FORM = {
s.setPaperSizeAction();

s.setRwwFocusAction();
c.setStatusDefault();
c.setTypesStyles();
c.setTypesDefault();
c.setTypesAllAction();
Expand Down Expand Up @@ -3216,19 +3237,19 @@ var SIGNALS_FORM = {
$('#form_show').val('');
$('fieldset#form_type div :checkbox').prop('checked', false);
$('fieldset#form_type div :checkbox[value=NDB]').prop('checked', true);
$('fieldset#form_status div :checkbox').prop('checked', false);
$('fieldset#form_status div :checkbox[value=1]').prop('checked', true);
$('#form_call').val('');
$('#form_khz_1').val('');
$('#form_khz_2').val('');
$('#form_channels').prop('selectedIndex', 0);
$('#form_active').prop('selectedIndex', 0);
$('#form_recently').prop('selectedIndex', 0);
$('#form_within').prop('selectedIndex', 0);
$('#form_personalise').prop('selectedIndex', 0);
$('#form_morse_0').prop('checked', 1);
$('#form_hidenotes_1').prop('checked', 1);
$('#form_offsets_0').prop('checked', 1);
$('#form_notes').val('');

$('#form_states').val('');
$('#form_sp_itu_clause').prop('selectedIndex', 0);
$('#form_countries').val('');
Expand Down
4 changes: 2 additions & 2 deletions public/js/functions.min.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions src/Controller/Web/Base.php
Expand Up @@ -361,6 +361,19 @@ protected function setRwwFocusFromRequest(&$args, $request)
}
}

protected function setStatusFromRequest(&$args, $request)
{
$value = $this->getValueFromRequestOrCookie($request, 'status');
if ($value) {
$status = strtoupper($value);
$values = explode(',', $status);
$args['status'] = [];
foreach ($values as $v) {
$args['status'][] = $v;
}
}
}

protected function setTimezoneFromRequest(&$args, $request)
{
$value = $this->getValueFromRequestOrCookie($request, 'timezone', false);
Expand Down
7 changes: 6 additions & 1 deletion src/Controller/Web/Signals/Collection.php
Expand Up @@ -249,7 +249,10 @@ private function setActiveColumns() {
private function setArgsAfterPostTweaks()
{
if (empty($this->args['type'])) {
$this->args['type'][] = 'NDB';
$this->args['type'][] = 'NDB';
}
if (empty($this->args['status'])) {
$this->args['status'][] = '1';
}
$this->args['isAdmin'] = $this->isAdmin;
$this->args['signalTypes'] = $this->typeRepository->getSignalTypesSearched($this->args['type']);
Expand Down Expand Up @@ -324,6 +327,7 @@ private function setArgsInitial()
'show' => '',
'sp_itu_clause' => '',
'states' => '',
'status' => [1],
'system' => $this->system,
'type' => [],
'signalTypes' => [0],
Expand Down Expand Up @@ -431,6 +435,7 @@ private function setArgsFromRequest($r, $withPageNumber = true)
$this->setPagingFromRequest($this->args, $r, $withPageNumber);

$this->setTypeFromRequest($this->args, $r);
$this->setStatusFromRequest($this->args, $r);
$this->setRwwFocusFromRequest($this->args, $r);
$this->setValueFromRequest($this->args, $r, 'call');
$this->setPairFromRequest($this->args, $r, 'khz');
Expand Down
28 changes: 12 additions & 16 deletions src/Form/Signals/Collection.php
Expand Up @@ -81,6 +81,18 @@ public function buildForm(FormBuilderInterface $formBuilder, array $options)
'multiple' => true
]
)
->add(
'status',
ChoiceType::class,
[
'attr' => [ 'legend' => 'Status' ],
'choices' => [ 'Active' => '1', 'Inactive' => '2', 'Decommissioned' => '3' ],
'data' => $options['status'],
'expanded' => true,
'label' => false,
'multiple' => true
]
)
->add(
'call',
TextType::class,
Expand Down Expand Up @@ -205,22 +217,6 @@ public function buildForm(FormBuilderInterface $formBuilder, array $options)
'required' => false
]
)
->add(
'active',
ChoiceType::class,
[
'choices' => [
'All' => '',
'All inc Decomm' => '4',
'Active' => '1',
'Inactive' => '2',
'Decommissioned' => '3',
],
'data' => $options['active'],
'label' => 'Status',
'required' => false
]
)

// Loggings Section:
->add(
Expand Down
44 changes: 42 additions & 2 deletions src/Repository/SignalRepository.php
Expand Up @@ -424,6 +424,46 @@ private function _addFilterSystem()
return $this;
}

private function _addFilterStatus()
{
if (isset($this->args['status'])) {
$status = $this->args['status'];
if (!in_array('1', $status) && !in_array('2', $status) && !in_array('3', $status)) {
// NOTHING
$this->query['where'][] = '(1 = 0)';
}
if (!in_array('1', $status) && !in_array('2', $status) && in_array('3', $status)) {
// DECOM
$this->query['where'][] = '(s.decommissioned = 1)';
}
if (!in_array('1', $status) && in_array('2', $status) && !in_array('3', $status)) {
// INACTIVE
$this->query['where'][] = '(s.active = 0 && s.decommissioned = 0)';
}
if (!in_array('1', $status) && in_array('2', $status) && in_array('3', $status)) {
// INACTIVE OR DECOM
$this->query['where'][] = '(s.active = 0 || s.decommissioned = 1)';
}
if (in_array('1', $status) && !in_array('2', $status) && !in_array('3', $status)) {
// ACTIVE
$this->query['where'][] = '(s.active = 1)';
}
if (in_array('1', $status) && !in_array('2', $status) && in_array('3', $status)) {
// ACTIVE OR DECOM
$this->query['where'][] = '(s.active = 1 || s.decommissioned = 1)';
}
if (in_array('1', $status) && in_array('2', $status) && !in_array('3', $status)) {
// ACTIVE OR INACTIVE
$this->query['where'][] = '(s.decommissioned = 0)';
}
if (in_array('1', $status) && in_array('2', $status) && in_array('3', $status)) {
// ACTIVE OR INACTIVE OR DECOM
// No filter
}
}
return $this;
}

private function _addFilterTypes()
{
$in = $this->_buildInParamsList('type', $this->args['signalTypes'] ?? false, '', '');
Expand Down Expand Up @@ -880,7 +920,6 @@ public function getFilteredSignals($system, $args)
->_setArgs($system, $args)
->_addFromTables()
->_addFilterRecently()
->_addFilterActive()
->_addFilterCall()
->_addFilterChannels()
->_addFilterFreq()
Expand All @@ -889,6 +928,7 @@ public function getFilteredSignals($system, $args)
->_addFilterRange()
->_addFilterRegion()
->_addFilterStatesAndCountries()
->_addFilterStatus()
->_addFilterTypes();

if (isset($args['show']) && $args['show'] === 'map') {
Expand Down Expand Up @@ -986,7 +1026,6 @@ public function getFilteredSignalsCount($system, $args)
->_addSelectColumnCountSignal()
->_addFromTables()
->_addFilterRecently()
->_addFilterActive()
->_addFilterCall()
->_addFilterChannels()
->_addFilterFreq()
Expand All @@ -995,6 +1034,7 @@ public function getFilteredSignalsCount($system, $args)
->_addFilterRange()
->_addFilterRegion()
->_addFilterStatesAndCountries()
->_addFilterStatus()
->_addFilterTypes();

if (isset($args['show']) && $args['show'] === 'map') {
Expand Down
26 changes: 15 additions & 11 deletions src/css/include/signal/form.less
Expand Up @@ -57,23 +57,15 @@
width: 115px;
}
#form_recently {
width: 95px;
width: 185px;
}
label[for="form_within"] {
width: 65px !important;
padding-left: 1em !important;
padding-right: 0.25em !important;
}
#form_within {
width: 85px;
}
label[for="form_active"] {
width: 65px !important;
padding-left: 1em !important;
padding-right: 0.25em !important;
}
#form_active {
width: 125px;
width: 185px;
}
#form_personalise,
#form_listener {
Expand Down Expand Up @@ -247,6 +239,7 @@
}

fieldset#form_type,
fieldset#form_status,
fieldset#form_offsets,
fieldset#form_hidenotes,
fieldset#form_morse,
Expand All @@ -261,12 +254,23 @@ fieldset#form_range_units {
color: #000000;
}
}
fieldset#form_type{
fieldset#form_type,
fieldset#form_status {
legend {
text-align: left;
width: @width[label];
}
}
fieldset#form_status {
div {
margin: 0;
label {
min-width: 5em;
margin: 0 0.25em;
}
}
}

fieldset#form_offsets,
fieldset#form_hidenotes,
fieldset#form_morse,
Expand Down
7 changes: 7 additions & 0 deletions src/js/common.js
Expand Up @@ -326,6 +326,13 @@ var COMMON_FORM = {
}
},

/* [ Ensure that at least one option is checked for signal type checkboxes ] */
setStatusDefault : function() {
if ($('fieldset#form_status div :checkbox:checked').length === 0) {
$('fieldset#form_status div :checkbox[value=1]').prop('checked', true);
}
},

/* [ Enable 'All' checkbox to select / unselect all signal types ] */
setTypesAllAction : function () {
$('fieldset#form_type div :checkbox[value=ALL]').click(function () {
Expand Down

0 comments on commit 45012c0

Please sign in to comment.