diff --git a/application/batch.js b/application/batch.js new file mode 100644 index 00000000..fe015543 --- /dev/null +++ b/application/batch.js @@ -0,0 +1,37 @@ + +/** + * Attaches the batch behavior to progress bars. + */ +Drupal.behaviors.batch = function (context) { + // This behavior attaches by ID, so is only valid once on a page. + if ($('#progress.batch-processed').size()) { + return; + } + $('#progress', context).addClass('batch-processed').each(function () { + var holder = this; + var uri = Drupal.settings.batch.uri; + var initMessage = Drupal.settings.batch.initMessage; + var errorMessage = Drupal.settings.batch.errorMessage; + + // Success: redirect to the summary. + var updateCallback = function (progress, status, pb) { + if (progress == 100) { + pb.stopMonitoring(); + window.location = uri+'&op=finished'; + } + }; + + var errorCallback = function (pb) { + var div = document.createElement('p'); + div.className = 'error'; + $(div).html(errorMessage); + $(holder).prepend(div); + $('#wait').hide(); + }; + + var progress = new Drupal.progressBar('updateprogress', updateCallback, "POST", errorCallback); + progress.setProgress(-1, initMessage); + $(holder).append(progress.element); + progress.startMonitoring(uri+'&op=do', 10); + }); +}; diff --git a/application/controllers/qso.php b/application/controllers/qso.php index 0d85dee8..4dbb2c1b 100644 --- a/application/controllers/qso.php +++ b/application/controllers/qso.php @@ -21,7 +21,7 @@ class QSO extends CI_Controller { $data['notice'] = false; $data['radios'] = $this->cat->radios(); - $data['query'] = $this->logbook_model->last_ten(); + $data['query'] = $this->logbook_model->last_custom('16'); $this->load->library('form_validation'); diff --git a/application/models/logbook_model.php b/application/models/logbook_model.php index 1ca9a1b1..3c7c9249 100644 --- a/application/models/logbook_model.php +++ b/application/models/logbook_model.php @@ -130,6 +130,14 @@ class Logbook_model extends CI_Model { return $this->db->get($this->config->item('table_name')); } + function last_custom($num) { + $this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME'); + $this->db->order_by("COL_TIME_ON", "desc"); + $this->db->limit($num); + + return $this->db->get($this->config->item('table_name')); + } + /* Callsign QRA */ function call_qra($callsign) { diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 575db421..33baee03 100644 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -244,7 +244,7 @@