Add LoTW accepted to edit/create functions

This commit is contained in:
phl0
2024-11-11 17:48:54 +01:00
parent 44c1f0cae2
commit a7ee086197
5 changed files with 40 additions and 11 deletions

View File

@@ -77,10 +77,15 @@ class Satellite extends CI_Controller {
$satellite['name'] = $this->security->xss_clean($this->input->post('name'));
$satellite['exportname'] = $this->security->xss_clean($this->input->post('exportname'));
$satellite['orbit'] = $this->security->xss_clean($this->input->post('orbit'));
if ($this->security->xss_clean($this->input->post('lotw')) == 'Y') {
$satellite['lotw'] = 'Y';
} else {;
$satellite['lotw'] = 'N';
}
$this->satellite_model->saveupdatedsatellite($id, $satellite);
$this->satellite_model->saveupdatedsatellite($id, $satellite);
echo json_encode(array('message' => 'OK'));
return;
return;
}
public function delete() {

View File

@@ -38,19 +38,15 @@ class Satellite_model extends CI_Model {
}
function saveupdatedsatellite($id, $satellite) {
$this->db->where('satellite.id', $id);
$this->db->update('satellite', $satellite);
return true;
$this->db->where('satellite.id', $id);
$this->db->update('satellite', $satellite);
return true;
}
function saveSatelliteMode($id, $satmode) {
$this->db->where('satellitemode.id', $id);
$this->db->update('satellitemode', $satmode);
return true;
$this->db->update('satellitemode', $satmode);
return true;
}
function add() {
@@ -59,6 +55,11 @@ class Satellite_model extends CI_Model {
'exportname' => xss_clean($this->input->post('exportname', true)),
'orbit' => xss_clean($this->input->post('orbit', true)),
);
if (xss_clean($this->input->post('lotw', true)) == 'Y') {
$data['lotw'] = 'Y';
} else {
$data['lotw'] = 'N';
}
$this->db->where('name', xss_clean($this->input->post('name', true)));
$result = $this->db->get('satellite');

View File

@@ -65,6 +65,14 @@
<input type="text" class="form-control" name="downlinkFrequency" id="downlinkFrequency" aria-describedby="downlinkFrequency" required>
<small id="downlinkFrequencyHelp" class="form-text text-muted"><?= __("Enter frequency (in Hz) used for downlink"); ?></small>
</div>
<div class="mb-3 col-md-6">
<label for="lotwAccepted"><?= __("Accepted by LoTW"); ?></label>
<select id="lotwAccepted" class="form-select" name="lotwAccepted">
<option value="Y"><?= __("Yes"); ?></option>
<option value="N" selected="selected"><?= __("No"); ?></option>
</select>
<small id="exportNameInputHelp" class="form-text text-muted"><?= __("Set to yes only if satellite is accepted my LoTW"); ?></small>
</div>
</div>
<button type="button" onclick="createSatellite(this.form);" class="btn btn-sm btn-primary"><i class="fas fa-plus-square"></i> <?= __("Save"); ?></button>

View File

@@ -20,6 +20,19 @@
<input type="text" class="form-control" name="orbit" id="orbit" aria-describedby="orbitHelp" value="<?php if(set_value('band') != "") { echo set_value('band'); } else { echo $satellite->orbit; } ?>" required>
<small id="sorbitHelp" class="form-text text-muted"><?= __("Enter which orbit the satellite has (LEO, MEO, GEO)"); ?></small>
</div>
<div class="mb-3 col-md-6">
<label for="lotwAccepted"><?= __("Accepted by LoTW"); ?></label>
<select id="lotwAccepted" class="form-select" name="lotwAccepted">
<?php if ($satellite->lotw == 'Y') { ?>
<option value="Y" selected="selected"><?= __("Yes"); ?></option>
<option value="N"><?= __("No"); ?></option>
<?php } else { ?>
<option value="Y"><?= __("Yes"); ?></option>
<option value="N" selected="selected"><?= __("No"); ?></option>
<?php } ?>
</select>
<small id="exportNameInputHelp" class="form-text text-muted"><?= __("Set to yes only if satellite is accepted my LoTW"); ?></small>
</div>
</div>
<button type="button" onclick="saveUpdatedSatellite(this.form);" class="btn btn-sm btn-primary"><i class="fas fa-plus-square"></i> <?= __("Save satellite"); ?></button>

View File

@@ -71,6 +71,7 @@ function createSatellite(form) {
'uplinkfrequency': form.uplinkFrequency.value,
'downlinkmode': form.downlinkMode.value,
'downlinkfrequency': form.downlinkFrequency.value,
'lotw': form.lotwAccepted.value,
},
success: function (html) {
location.reload();
@@ -117,6 +118,7 @@ function saveUpdatedSatellite(form) {
data: {'id': form.id.value,
'name': form.nameInput.value,
'exportname': form.exportNameInput.value,
'lotw': form.lotwAccepted.value,
'orbit': form.orbit.value,
},
success: function (html) {