eQSL default msg add function (english lang)

pull/2744/head
abarrau 2023-11-29 14:17:58 +01:00
rodzic 7351fe58fa
commit d3a1f9ab76
12 zmienionych plików z 107 dodań i 15 usunięć

Wyświetl plik

@ -48,6 +48,11 @@ class QSO extends CI_Controller {
$this->form_validation->set_rules('callsign', 'Callsign', 'required');
$this->form_validation->set_rules('locator', 'Locator', 'callback_check_locator');
// [eQSL default msg] GET user options (option_type='eqsl_default_qslmsg'; option_name='key_station_id'; option_key=station_id) //
$this->load->model('user_options_model');
$options_object = $this->user_options_model->get_options('eqsl_default_qslmsg',array('option_name'=>'key_station_id','option_key'=>$data['active_station_profile']))->result();
$data['qslmsg'] = (isset($options_object[0]->option_value))?$options_object[0]->option_value:'';
if ($this->form_validation->run() == FALSE)
{
$data['page_title'] = "Add QSO";

Wyświetl plik

@ -55,8 +55,14 @@ class Station extends CI_Controller {
}
else
{
$this->stations->add();
if (($station_id = $this->stations->add()) !== false) {
// [eQSL default msg] ADD to user options (option_type='eqsl_default_qslmsg'; option_name='key_station_id'; option_key=station_id; option_value=value) //
$eqsl_default_qslmsg = xss_clean($this->input->post('eqsl_default_qslmsg', true));
if (!empty(trim($eqsl_default_qslmsg))) {
$this->load->model('user_options_model');
$this->user_options_model->set_option('eqsl_default_qslmsg','key_station_id',array($station_id=>$eqsl_default_qslmsg));
}
}
redirect('station');
}
}
@ -68,11 +74,25 @@ class Station extends CI_Controller {
$data['page_title'] = lang('station_location_edit') . $data['my_station_profile']->station_profile_name;
if ($this->form_validation->run() == FALSE) {
// [eQSL default msg] GET from user options (option_type='eqsl_default_qslmsg'; option_name='key_station_id'; option_key=station_id) //
$this->load->model('user_options_model');
$options_object = $this->user_options_model->get_options('eqsl_default_qslmsg',array('option_name'=>'key_station_id','option_key'=>$id))->result();
$data['eqsl_default_qslmsg'] = (isset($options_object[0]->option_value))?$options_object[0]->option_value:'';
$this->load->view('interface_assets/header', $data);
$this->load->view('station_profile/edit');
$this->load->view('interface_assets/footer');
} else {
$this->stations->edit();
if ($this->stations->edit() !== false) {
// [eQSL default msg] ADD to user options (option_type='eqsl_default_qslmsg'; option_name='key_station_id'; option_key=station_id; option_value=value) //
$eqsl_default_qslmsg = xss_clean($this->input->post('eqsl_default_qslmsg', true));
$this->load->model('user_options_model');
if (!empty(trim($eqsl_default_qslmsg))) {
$this->user_options_model->set_option('eqsl_default_qslmsg','key_station_id',array($id=>$eqsl_default_qslmsg));
} else {
$this->user_options_model->del_option('eqsl_default_qslmsg','key_station_id',array('option_key'=>$id));
}
}
$data['notice'] = lang('station_location') . $this->security->xss_clean($this->input->post('station_profile_name', true)) . " Updated";
@ -163,6 +183,9 @@ class Station extends CI_Controller {
$this->load->model('stations');
if ($this->stations->check_station_is_accessible($id)) {
$this->stations->delete($id);
// [eQSL default msg] DELETE user options //
$this->load->model('user_options_model');
$this->user_options_model->del_option('eqsl_default_qslmsg','key_station_id',array('option_key'=>$id));
}
redirect('station');
}
@ -208,4 +231,18 @@ class Station extends CI_Controller {
echo json_encode($json);
}
// [eQSL default msg] Function return options from this station (but can be general use) //
public function get_options() {
$return_json = array();
$option_type = $this->input->post('option_type');
$option_name = $this->input->post('option_name');
$option_key = $this->input->post('option_key');
if (!empty($option_type) && !empty($option_name) && ($option_key>0)) {
$this->load->model('user_options_model');
$options_object = $this->user_options_model->get_options($option_type,array('option_name'=>$option_name,'option_key'=>$option_key))->result();
$return_json[$option_type] = (isset($options_object[0]->option_value))?$options_object[0]->option_value:'';
}
header('Content-Type: application/json');
echo json_encode($return_json);
}
}

Wyświetl plik

@ -26,6 +26,8 @@ $lang['qso_dok_helptext'] = 'For example: Q03';
$lang['qso_notes_helptext'] = 'Note content is used within Cloudlog only and is not exported to other services.';
$lang['qsl_notes_helptext'] = 'This note content is exported to QSL services like eqsl.cc.';
$lang['qso_eqsl_qslmsg_helptext'] = "Get the default message for eQSL, for this station.";
// Button Text on /qso Display
$lang['qso_btn_reset_qso'] = 'Reset';

Wyświetl plik

@ -94,6 +94,8 @@ $lang['station_location_signature_name_hint'] = "Station Signature (e.g. GMA).."
$lang['station_location_signature_info'] = "Signature Information";
$lang['station_location_signature_info_hint'] = "Station Signature Info (e.g. DA/NW-357).";
$lang['station_location_eqsl_hint'] = 'The QTH Nickname which is configured in your eQSL Profile';
$lang['station_location_eqsl_defaultqslmsg'] = "Default QSLMSG";
$lang['station_location_eqsl_defaultqslmsg_hint'] = "You can define a default message that will be populated and sent for each QSO for this station location. Max length:";
$lang['station_location_qrz_subscription'] = 'Subscription Required';
$lang['station_location_qrz_hint'] = "Find your API key on <a href='https://logbook.qrz.com/logbook' target='_blank'>the QRZ.com Logbook settings page";
$lang['station_location_qrz_realtime_upload'] = 'QRZ.com Logbook Realtime Upload';

Wyświetl plik

@ -260,6 +260,13 @@ class Logbook_model extends CI_Model {
$station = $this->check_station($station_id);
$data['station_id'] = $station_id;
// [eQSL default msg] add info to QSO for Contest or SFLE //
if (empty($data['COL_QSLMSG']) && (($this->input->post('isSFLE')==true) || (!empty($data['COL_CONTEST_ID'])))) {
$this->load->model('user_options_model');
$options_object = $this->user_options_model->get_options('eqsl_default_qslmsg',array('option_name'=>'key_station_id','option_key'=>$station_id))->result();
$data['COL_QSLMSG'] = (isset($options_object[0]->option_value))?$options_object[0]->option_value:'';
}
if (strpos(trim($station['station_gridsquare']), ',') !== false) {
$data['COL_MY_VUCC_GRIDS'] = strtoupper(trim($station['station_gridsquare']));
} else {

Wyświetl plik

@ -114,8 +114,13 @@ class Stations extends CI_Model {
'webadifrealtime' => xss_clean($this->input->post('webadifrealtime', true)),
);
// Insert Records
$this->db->insert('station_profile', $data);
// Insert Records & return insert id //
if ($this->db->insert('station_profile', $data)===true) {
$station_user_list = $this->all_of_user()->result();
if ((count($station_user_list)>0) && (isset($station_user_list[intval(count($station_user_list)-1)]->station_id))) {
return $station_user_list[intval(count($station_user_list)-1)]->station_id;
}
}
}
function edit() {

Wyświetl plik

@ -16,16 +16,32 @@ class User_options_model extends CI_Model {
}
}
public function get_options($option_type) {
public function get_options($option_type, $option_array=null) {
$uid=$this->session->userdata('user_id');
$sql='select option_name,option_key,option_value from user_options where user_id=? and option_type=?';
return $this->db->query($sql, array($uid, $option_type));
$sql_more = "";
$array_sql_value = array($uid, $option_type);
if (is_array($option_array)) {
foreach ($option_array as $key => $value) {
$sql_more .= ' and '.$key.'=?';
$array_sql_value[] = $value;
}
}
$sql='select option_name,option_key,option_value from user_options where user_id=? and option_type=?'.$sql_more;
return $this->db->query($sql, $array_sql_value);
}
public function del_option($option_type, $option_name) {
public function del_option($option_type, $option_name, $option_array=null) {
$uid=$this->session->userdata('user_id');
$sql='delete from user_options where user_id=? and option_type=? and option_name=?';
return $this->db->query($sql, array($uid, $option_type,$option_name));
$sql_more = "";
$array_sql_value = array($uid, $option_type, $option_name);
if (is_array($option_array)) {
foreach ($option_array as $key => $value) {
$sql_more .= ' and '.$key.'=?';
$array_sql_value[] = $value;
}
}
$sql='delete from user_options where user_id=? and option_type=? and option_name=?'.$sql_more;
return $this->db->query($sql, $array_sql_value);
}
}

Wyświetl plik

@ -1239,7 +1239,11 @@ $(document).on('keypress',function(e) {
$('#transmit_power').val('');
},
});
// [eQSL default msg] change value on change station profle //
qso_set_eqsl_qslmsg(stationProfile,false,'.qso_panel');
});
// [eQSL default msg] change value on clic //
$('.qso_panel .qso_eqsl_qslmsg_update').off('click').on('click',function() { qso_set_eqsl_qslmsg($('.qso_panel #stationProfile').val(),true,'.qso_panel'); });
<?php if ($this->session->userdata('user_qth_lookup') == 1) { ?>
$('#qth').focusout(function() {

Wyświetl plik

@ -511,13 +511,14 @@
</div>
<div class="mb-3 row">
<div class="col-sm-9">
<label for="qslmsg"><?php echo lang('general_word_notes'); ?></label>
<label for="qslmsg"><?php echo lang('general_word_notes'); ?><span class="qso_eqsl_qslmsg_update" title="<?php echo lang('qso_eqsl_qslmsg_helptext'); ?>"><i class="fas fa-redo-alt"></i></span></label>
<div class="alert alert-info" role="alert">
<span class="badge text-bg-info"><?php echo lang('general_word_info'); ?></span> <?php echo lang('qsl_notes_helptext'); ?>
</div>
</div>
<div class="col-sm-9">
<textarea type="text" class="form-control" id="qslmsg" name="qslmsg" rows="5"><?php echo $qso->COL_QSLMSG; ?></textarea>
<textarea type="text" class="form-control" id="qslmsg" name="qslmsg" rows="5" maxlength="240"><?php echo $qso->COL_QSLMSG; ?></textarea>
<div id="qslmsg_hide" style="display:none;"><?php echo $qso->COL_QSLMSG; ?></div>
</div>
</div>

Wyświetl plik

@ -532,8 +532,9 @@
<span class="badge text-bg-info"><?php echo lang('general_word_info'); ?></span> <?php echo lang('qsl_notes_helptext'); ?>
</div>
<div class="mb-3">
<label for="qslmsg"><?php echo lang('general_word_notes'); ?></label>
<textarea type="text" class="form-control" id="qslmsg" name="qslmsg" rows="5"></textarea>
<label for="qslmsg"><?php echo lang('general_word_notes'); ?><span class="qso_eqsl_qslmsg_update" title="<?php echo lang('qso_eqsl_qslmsg_helptext'); ?>"><i class="fas fa-redo-alt"></i></span></label>
<textarea type="text" class="form-control" id="qslmsg" name="qslmsg" rows="5" maxlength="240"><?php echo $qslmsg; ?></textarea>
<div id="qslmsg_hide" style="display:none;"><?php echo $qslmsg; ?></div>
</div>
</div>
</div>

Wyświetl plik

@ -249,6 +249,12 @@
<small id="eqslhelp" class="form-text text-muted"><?php echo lang("station_location_eqsl_hint"); ?></small>
</div>
<div class="mb-3">
<label for="eqslDefaultQSLMsg"><?php echo lang("station_location_eqsl_defaultqslmsg"); ?></label>
<textarea class="form-control" name="eqsl_default_qslmsg" id="eqslDefaultQSLMsg" aria-describedby="eqsldefaultqslmsghelp" maxlength="240" rows="2" style="width:100%;"></textarea>
<small id="eqsldefaultqslmsghelp" class="form-text text-muted"><?php echo lang("station_location_eqsl_defaultqslmsg_hint"); ?> 240.</small>
</div>
<div class="mb-3">
<label for="clublogrealtime"><?php echo lang("station_location_clublog_realtime_upload"); ?></label>
<select class="form-select" id="clublogrealtime" name="clublogrealtime">

Wyświetl plik

@ -352,6 +352,12 @@
<input type="text" class="form-control" name="eqslnickname" id="eqslNickname" aria-describedby="eqslhelp" value="<?php if(set_value('eqslnickname') != "") { echo set_value('eqslnickname'); } else { echo $my_station_profile->eqslqthnickname; } ?>">
<small id="eqslhelp" class="form-text text-muted"><?php echo lang("station_location_eqsl_hint"); ?></small>
</div>
<div class="mb-3">
<label for="eqslDefaultQSLMsg"><?php echo lang("station_location_eqsl_defaultqslmsg"); ?></label>
<?php $eqsl_default_qslmsg = (set_value('eqsl_default_qslmsg') != "")?set_value('eqsl_default_qslmsg'):$eqsl_default_qslmsg; ?>
<textarea class="form-control" name="eqsl_default_qslmsg" id="eqslDefaultQSLMsg" aria-describedby="eqsldefaultqslmsghelp" maxlength="240" rows="2" style="width:100%;" value="<?php echo $eqsl_default_qslmsg; ?>"><?php echo $eqsl_default_qslmsg; ?></textarea>
<small id="eqsldefaultqslmsghelp" class="form-text text-muted"><?php echo lang("station_location_eqsl_defaultqslmsg_hint"); ?> 240.</small>
</div>
</div>
</div>
</div>