Station setup (#175)

* The start of station setup

* Added modals new logbook and new location

* Added 1st JSON-Create Logbook (PHP)

* Added 1st JSON-Create Logbook (JS)

* Changed to small buttons

* A bit more errorhandling (JS)

* Moved collecting of params to controller and added errorhandling

* Added Delete-Function (with confirmation)

* Moved view to new folder and added delete Logbook

* Added AJAX for setActive Book

* Added AJAX for setActiveBook (JS)

* Partially working reload logbook table

* Dynamic loading of logbooks (PHP)

* Dynamic loading of logbooks (JS)

* Reload location table

* Removed duplicate return statement

* Fixed Zoo of params to JSON-Out

* Fixed RenderBug (not yet finished) at JS

* Fixed DT error

* Fixed CSS

* Changed setActiveStation from link to Ajax (PHP)

* Changed setActiveStation from link to Ajax (JS)

* Added confirmation to changeActiveStation

* Changed EmptyStation to AJAX (PHP)

* Changed EmptyStation to AJAX (JS)

* Changed DeleteStation to AJAX (JS)

* Changed DeleteStation to AJAX (PHP)

* Tidy up code a little

* Re-added favorites

* Ajaxyfing favorite location

* Fixed clicking on favorite

* Fixed favorite star

* Tweaked new logbook dialog

* Fixed public search badge

* Fix badges on first load

* Reloads stations on load

* Redirect to station setup

* Re-added translation

* Fixed more badges

* Added menu item translation

* Header with translated menu

* Updated warning links on dashboard to go to station setup

* Added missing lang lines for Polish and Czech

* Changed links in Quickswitch to station setup

* station setup in quickswitcher

* Make station location ID a separate (and sortable) column

* Added missing ID

* Relocated eQSL-Thing to station_model to reduce redundancies

* Removed Debug-Stuff

* Moved get_options to get_default_eqsl_message within QSO-Controller

* Moved generic get_options to more specific get_eqsl_default_message

* Removed loading of options_model, since it is already loaded via "autload"...

* dynamic quickswitcher

* disabled button for active location

* typo

* removed empty unused function

* comment

* reload stationsetup list if we are on this page

* don't grey out the locations

* dynamic loading in both directions

* rename function to make it more clear

* readability

---------

Co-authored-by: int2001 <joerg@dj7nt.de>
Co-authored-by: Joerg (DJ7NT) <int2001@users.noreply.github.com>
Co-authored-by: HB9HIL <fabian.berg@hb9hil.org>
Co-authored-by: phl0 <github@florian-wolters.de>
This commit is contained in:
Andreas Kristiansen
2024-03-03 21:52:51 +01:00
committed by GitHub
parent 1335d915c6
commit 4bbfe1b07e
59 changed files with 1353 additions and 427 deletions

View File

@@ -69,7 +69,7 @@
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light main-nav" id="header-menu">
<div class="container">
<a class="navbar-brand" href="<?php echo site_url(); ?>"><img class="headerLogo" src="<?php echo base_url(); ?>assets/logo/<?php echo $this->optionslib->get_logo('header_logo'); ?>.png" alt="Logo" /></a>
<a class="navbar-brand" href="<?php echo site_url(); ?>"><img class="headerLogo" src="<?php echo base_url(); ?>assets/logo/<?php echo $this->optionslib->get_logo('header_logo'); ?>.png" alt="Logo" /></a>
<?php if (ENVIRONMENT == "development") { ?>
<span class="badge text-bg-danger"><?php echo lang('menu_badge_developer_mode'); ?></span>
<?php } ?>
@@ -309,8 +309,7 @@
$quickswitch_enabled = ($this->user_options_model->get_options('header_menu', array('option_name' => 'locations_quickswitch'))->row()->option_value ?? 'false');
if ($quickswitch_enabled != 'true') {
?>
<li><a class="dropdown-item" href="<?php echo site_url('logbooks'); ?>" title="Manage station logbooks"><i class="fas fa-home"></i> <?php echo lang('menu_station_logbooks'); ?></a></li>
<li><a class="dropdown-item" href="<?php echo site_url('station'); ?>" title="Manage station locations"><i class="fas fa-home"></i> <?php echo lang('menu_station_locations'); ?></a></li>
<li><a class="dropdown-item" href="<?php echo site_url('stationsetup'); ?>" title="Manage station setup"><i class="fas fa-home"></i> <?php echo lang('menu_station_setup'); ?></a></li>
<?php } ?>
<li><a class="dropdown-item" href="<?php echo site_url('band'); ?>" title="Manage Bands"><i class="fas fa-cog"></i> <?php echo lang('menu_bands'); ?></a></li>
@@ -372,32 +371,56 @@
</li>
<?php
if ($quickswitch_enabled == 'true') { ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#"><i class="fas fa-map-marker-alt"></i> | <i class="fas fa-book"></i></a>
<ul class="dropdown-menu dropdown-menu-right header-dropdown">
<li><a class="dropdown-item disabled"><?php echo lang('menu_select_location'); ?>:</a></li>
<?php
$location_favorites = $this->user_options_model->get_options('station_location', array('option_name' => 'is_favorite', 'option_value' => 'true'));
$current_active_location = $this->stations->find_active();
$active_badge = '<span class="badge bg-success ms-2">'.lang('general_word_active').'</span>';
foreach ($location_favorites->result() as $row) {
$profile_info = $this->stations->profile($row->option_key)->row();
$station_profile_name = ($profile_info) ? $profile_info->station_profile_name : 'Unknown Location';
$new_active = $row->option_key;
if ($new_active != $current_active_location) { ?>
<li><a type="button" onclick="set_active_location('<?php echo $current_active_location; ?>', '<?php echo $new_active; ?>')" class="dropdown-item"><i class="fas fa-map-marker-alt me-2"></i><?php echo $station_profile_name; ?></a></li>
<?php } else { ?>
<li><a class="dropdown-item"><i class="fas fa-map-marker-alt me-2"></i><?php echo $station_profile_name;
echo $active_badge; ?></a></li>
<?php } ?>
<?php } ?>
<li><a class="dropdown-item" href="<?php echo site_url('station'); ?>" title="Manage station logbooks"><?php echo lang('menu_select_location_show_all'); ?>...</a></li>
<div class="dropdown-divider"></div>
<li><a class="dropdown-item disabled"><?php echo lang('gen_hamradio_active_logbook'); ?>:<span class="badge text-bg-info ms-1"><?php echo $this->logbooks_model->find_name($this->session->userdata('active_station_logbook')); ?></span></a></li>
<li><a class="dropdown-item" href="<?php echo site_url('logbooks'); ?>" title="Manage station locations"><?php echo lang('menu_choose_another_logbook'); ?>...</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#"><i class="fas fa-map-marker-alt"></i> | <i class="fas fa-book"></i></a>
<ul class="dropdown-menu dropdown-menu-right header-dropdown">
<li><a class="dropdown-item disabled"><?php echo lang('menu_select_location'); ?>:</a></li>
<?php
// let's get all stations for the logged in user
$all_user_locations = $this->stations->all_of_user($this->session->userdata('user_id'));
// and the set favourites as array
$location_favorites_result = $this->user_options_model->get_options('station_location', array('option_name' => 'is_favorite', 'option_value' => 'true'));
$location_favorites = $location_favorites_result->result_array();
// also we need the current active station
$current_active_location = $this->stations->find_active();
// iterate through all available stations
foreach ($all_user_locations->result() as $row) {
// get information about this station like the name and the station id
$profile_info = $this->stations->profile($row->station_id)->row();
$station_profile_name = ($profile_info) ? $profile_info->station_profile_name : 'Unknown Location';
$station_id = $row->station_id;
// the active badge, not shown by default
$active_badge = '<span id="quickswitcher_active_badge_' . $station_id . '" class="badge bg-success ms-2 d-none">' . lang('general_word_active') . '</span>';
// only continue if the station id is a favourite and show the station in the list
$is_favorite = false;
foreach ($location_favorites as $favorite) {
if ($favorite['option_value'] == true && $favorite['option_key'] == $station_id) {
$is_favorite = true;
break;
}
}
if ($is_favorite) { ?>
<li id="quickswitcher_list_item_<?php echo $station_id; ?>">
<a id="quickswitcher_list_button_<?php echo $station_id; ?>" type="button" onclick="set_active_loc_quickswitcher('<?php echo $station_id; ?>')" class="dropdown-item quickswitcher">
<i class="fas fa-map-marker-alt me-2"></i><?php echo $station_profile_name; echo $active_badge; ?>
</a>
</li>
<?php }
} ?>
<div class="dropdown-divider"></div>
<li><a class="dropdown-item quickswitcher disabled"><?php echo lang('gen_hamradio_active_logbook'); ?>:<span class="badge text-bg-info ms-1"><?php echo $this->logbooks_model->find_name($this->session->userdata('active_station_logbook')); ?></span></a></li>
<div class="dropdown-divider"></div>
<li><a class="dropdown-item" href="<?php echo site_url('stationsetup'); ?>" title="Manage station locations"><?php echo lang('menu_station_setup'); ?>...</a></li>
</ul>
</li>
<?php }
// Can add extra menu items by defining them in options. The format is json.
// Useful to add extra things in Wavelog without the need for modifying files. If you add extras, these files will not be overwritten when updating.
//
@@ -448,4 +471,4 @@
}
});
});
</script>
</script>