Status display and some formatting tweaks.
authorJason Skomorowski <jason@indexdata.com>
Thu, 3 Feb 2011 22:56:00 +0000 (23:56 +0100)
committerJason Skomorowski <jason@indexdata.com>
Thu, 3 Feb 2011 22:56:00 +0000 (23:56 +0100)
mkdru-results.tpl.php
mkdru.admin.inc
mkdru.client.js
mkdru.css
mkdru.install
mkdru.module
mkdru.theme.js

index 077d565..1dcfc53 100644 (file)
@@ -1,6 +1,6 @@
 <div class="mkdru-detail"></div>
 <div class="mkdru-results">
 <div class="mkdru-detail"></div>
 <div class="mkdru-results">
-  <div class="mkdru-above mkdru-above-below"><span class="mkdru-pager"></span><span class="mkdru-counts"></span></div>
+  <div class="mkdru-above mkdru-above-below"><span class="mkdru-counts"></span><span class="mkdru-status"></span></div>
   <div class="mkdru-navi"></div>
   <ul class="mkdru-result-list"></ul>
   <div class="mkdru-below mkdru-above-below"><span class="mkdru-pager"></span></div>
   <div class="mkdru-navi"></div>
   <ul class="mkdru-result-list"></ul>
   <div class="mkdru-below mkdru-above-below"><span class="mkdru-pager"></span></div>
index 994cd36..ceaa676 100644 (file)
@@ -1,3 +1,9 @@
+// $Id$
+
+/**
+ * @file
+ * Module config.
+ */
 <?php
 function mkdru_admin_settings() {
   $form['pz2_js_path']=array(
 <?php
 function mkdru_admin_settings() {
   $form['pz2_js_path']=array(
index add8bd1..ae07fe6 100644 (file)
@@ -78,18 +78,15 @@ mkdru.pz2Init = function () {
   if (mkdru.state.query) {
     mkdru.search();
   }
   if (mkdru.state.query) {
     mkdru.search();
   }
-  //mkdru.pz2.stat();
+  mkdru.pz2.stat();
   //mkdru.pz2.bytarget();
 };
 
 mkdru.pz2Show = function (data) {
   mkdru.totalRec = data.merged;
   $('.mkdru-pager').html(mkdru.generatePager());
   //mkdru.pz2.bytarget();
 };
 
 mkdru.pz2Show = function (data) {
   mkdru.totalRec = data.merged;
   $('.mkdru-pager').html(mkdru.generatePager());
-  var countsHtml = Drupal.t('Displaying: ') + (data.start + 1) + 
-    Drupal.t(' to ') + (data.start + data.num) + Drupal.t(' of ')
-    + data.merged + Drupal.t(' (found: ') + data.total + ')';
-  $('.mkdru-counts').html(countsHtml);
-
+  $('.mkdru-counts').html(Drupal.theme('mkdruCounts', data.start + 1,
+                                      data.num, data.merged, data.total));
   var html = "";
   for (var i = 0; i < data.hits.length; i++) {
     html += Drupal.theme('mkdruResult', data.hits[i], 
   var html = "";
   for (var i = 0; i < data.hits.length; i++) {
     html += Drupal.theme('mkdruResult', data.hits[i], 
@@ -108,6 +105,7 @@ mkdru.pz2Show = function (data) {
 };
 
 mkdru.pz2Status = function (data) {
 };
 
 mkdru.pz2Status = function (data) {
+  $('.mkdru-status').html(Drupal.theme('mkdruStatus', data.activeclients, data.clients));
 };
 
 mkdru.pz2Term = function (data) {
 };
 
 mkdru.pz2Term = function (data) {
index ea64f66..1c55ea0 100644 (file)
--- a/mkdru.css
+++ b/mkdru.css
@@ -29,7 +29,7 @@
   border-width: 1px;
 }
 
   border-width: 1px;
 }
 
-.mkdru-counts {
+.mkdru-status {
   float: right;
 }
 
   float: right;
 }
 
index 15f5568..cdbf86b 100644 (file)
@@ -11,7 +11,7 @@
 function mkdru_schema() {
   $schema['mkdru'] = array(
     'description' => t('Stores settings for mkdru nodes.'),
 function mkdru_schema() {
   $schema['mkdru'] = array(
     'description' => t('Stores settings for mkdru nodes.'),
-    'fields' => array (
+    'fields' => array(
       'nid' => array(
         'description' => t('The primary identifier for a node.'),
         'type' => 'int',
       'nid' => array(
         'description' => t('The primary identifier for a node.'),
         'type' => 'int',
@@ -82,4 +82,3 @@ function mkdru_uninstall() {
   // Delete variables
   variable_del('pz2_js_path');
 }
   // Delete variables
   variable_del('pz2_js_path');
 }
-?>
index eae89e1..cb20ab0 100644 (file)
@@ -80,7 +80,7 @@ function mkdru_menu() {
 /**
 * Implementation of hook_init()
 */
 /**
 * Implementation of hook_init()
 */
-function mkdru_init(){
+function mkdru_init() {
   // Applies our module specific CSS to all pages. This works best because
   // all CSS is aggregated and cached so we reduce the number of HTTP 
   // requests and the size is negligible.
   // Applies our module specific CSS to all pages. This works best because
   // all CSS is aggregated and cached so we reduce the number of HTTP 
   // requests and the size is negligible.
index a3a0c0e..7d92e61 100644 (file)
@@ -100,6 +100,16 @@ Drupal.theme.prototype.mkdruPager = function (pages, start, current, total, prev
   return html;
 };
 
   return html;
 };
 
+Drupal.theme.prototype.mkdruCounts = function(first, last, available, total) {
+  return first + Drupal.t(' to ') + last + Drupal.t(' of ') + available
+         + Drupal.t(' available (') + total + Drupal.t(' found)');
+};
+
+Drupal.theme.prototype.mkdruStatus = function(activeClients, clients) {
+  return Drupal.t('Waiting on ') + activeClients + Drupal.t(' out of ')
+         + clients + Drupal.t(' targets');
+};
+
 Drupal.theme.prototype.mkdruFacet = function (terms, facet, max) {
   var html = "";
   for (var i = 0; i < terms.length && i < max; i++ ) {
 Drupal.theme.prototype.mkdruFacet = function (terms, facet, max) {
   var html = "";
   for (var i = 0; i < terms.length && i < max; i++ ) {