diff --git a/bash/decoders/acarsdec.sh b/bash/decoders/acarsdec.sh index 56ee911..f61fa57 100755 --- a/bash/decoders/acarsdec.sh +++ b/bash/decoders/acarsdec.sh @@ -87,7 +87,7 @@ if [[ "${adsb_decoder_installed}" == "true" || "${uat_decoder_installed}" == "tr while [[ -z $adsb_device_number ]] ; do adsb_device_number=$(whiptail --backtitle "ACARSDEC Decoder Configuration" \ --title "${adsb_device_number_title}" \ - --inputbox "\nEnter the RTL-SDR device number to assign your ADS-B decoder." \ + --inputbox "Enter the RTL-SDR device number to assign your ADS-B decoder." \ 8 78 \ "${current_adsb_device_number}" 3>&1 1>&2 2>&3) exit_status=$? @@ -112,7 +112,7 @@ if [[ "${adsb_decoder_installed}" == "true" || "${uat_decoder_installed}" == "tr while [[ -z $uat_device_number ]] ; do uat_device_number=$(whiptail --backtitle "ACARSDEC Decoder Configuration" \ --title "${uat_device_number_title}" \ - --inputbox "\nEnter the RTL-SDR device number to assign your UAT decoder." \ + --inputbox "Enter the RTL-SDR device number to assign your UAT decoder." \ 8 78 \ "${current_uat_device_number}" 3>&1 1>&2 2>&3) exit_status=$? @@ -139,7 +139,7 @@ if [[ "${adsb_decoder_installed}" == "true" || "${uat_decoder_installed}" == "tr while [[ -z $acars_device_number ]]; do acars_device_number=$(whiptail --backtitle "ACARSDEC Decoder Configuration" \ --title "${acars_device_number_title}" \ - --inputbox "\nEnter the RTL-SDR device number to assign your ACARSDEC decoder." \ + --inputbox "Enter the RTL-SDR device number to assign your ACARSDEC decoder." \ 8 78 \ "${current_acars_device_number}" 3>&1 1>&2 2>&3) exit_status=$? @@ -159,7 +159,7 @@ if [[ -z $acars_device_number ]]; then acars_device_number="0" fi -current_acars_frequencies="" +current_acars_frequencies="130.025 130.425 130.450 131.125 131.550" if [[ "${acars_decoder_installed}" == "true" ]]; then log_message "Determining which frequencies are currently assigned" exec_start=`get_config "ExecStart" "/etc/systemd/system/acarsdec.service"` diff --git a/build/portal/html/acars.php b/build/portal/html/acars.php index bbb9e3d..ae211c3 100644 --- a/build/portal/html/acars.php +++ b/build/portal/html/acars.php @@ -16,8 +16,17 @@ // The title of this page. $pageData['title'] = "ACARS Messages"; + // Pagination. + $items_per_page = 15; + $page = (isset($_GET['page']) ? $_GET['page'] : 1); + $message_count = $acars->getAcarsMessageCount(); + // Get most recent ACARS messages. - $acarsMessages = $acars->getAcarsMessages(25, 0); + $messages = $acars->getAcarsMessages($items_per_page, ($items_per_page * $page)); + $pageData['acarsMessages'] = $messages; + + // Calculate the number of pagination links to show. + $pageData['pageLinks'] = ceil($message_count / $items_per_page); $template->display($pageData); ?> diff --git a/build/portal/html/classes/acars.class.php b/build/portal/html/classes/acars.class.php index 9d78fca..2b6083b 100644 --- a/build/portal/html/classes/acars.class.php +++ b/build/portal/html/classes/acars.class.php @@ -19,5 +19,22 @@ return $acarsMessages; } + + function getAcarsMessageCount() { + require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php"); + $common = new common(); + + $dsn = "sqlite:".$common->getSetting('acarsserv_database'); + $dbh = new PDO($dsn, null, null, [PDO::SQLITE_ATTR_OPEN_FLAGS => PDO::SQLITE_OPEN_READONLY]); + $sql = "SELECT COUNT(*) FROM Messages"; + $sth = $dbh->prepare($sql); + $sth->execute(); + $number_of_rows = $sth->fetchColumn(); + $sth = NULL; + $dbh = NULL; + $dsn = NULL; + + return $number_of_rows; + } } ?> diff --git a/build/portal/html/templates/default/acars.tpl b/build/portal/html/templates/default/acars.tpl index 25be8da..e85e538 100644 --- a/build/portal/html/templates/default/acars.tpl +++ b/build/portal/html/templates/default/acars.tpl @@ -4,7 +4,7 @@

ACARS Messages


{foreach page:acarsMessages as message} -

{message->FlightNumber}

+

{message->FlightNumber}

Aircarft Registration: {message->Registration}
The first message was received on {message->StartTime} with the last seen {message->LastTime}.
@@ -26,8 +26,13 @@ {/foreach} +

{/area} {area:scripts} -{/area} \ No newline at end of file +{/area}