--- /dev/null
+<form class="mkdru-search">
+ <input type="text" size="50"/>
+ <input type="submit" value="Search"/>
+</form>
+<form class="mkdru-dropdowns">
+ Sort by
+ <select class="mkdru-sort">
+ <option value="relevance" selected="selected">relevance</option>
+ <option value="title:1">title</option>
+ <option value="date:0">newest</option>
+ <option value="date:1">oldest</option>
+ </select>
+ and show
+ <select class="mkdru-perpage">
+ <option value="10">10</option>
+ <option value="20" selected="selected">20</option>
+ <option value="30">30</option>
+ <option value="50">50</option>
+ </select>
+ per page.
+</form>
+++ /dev/null
-.mkdru-results ul {
- margin: 0;
- padding: 0;
-}
-
-.mkdru-results ul li {
- list-style-type: none;
- list-style-image: none;
- background: none;
- margin: 0;
- padding: 0;
-}
-
-.mkdru-above-below {
- border-style: solid none;
- border-width: 1px;
-}
-
-.mkdru-post-search {
- display: none;
-}
-
-.mkdru-search {
- text-align:center;
-}
-
-.mkdru-search input[type='text'] {
- width: 80%;
-}
+++ /dev/null
-<div class="mkdru">
- <form class="mkdru-search">
- <input type="text" size="50"/>
- <input type="submit" value="Search"/>
- </form>
- <div class="mkdru-dropdowns">
- <form>
- Sort by
- <select id="mkdru-sort">
- <option value="relevance" selected="selected">relevance</option>
- <option value="title:1">title</option>
- <option value="date:0">newest</option>
- <option value="date:1">oldest</option>
- </select>
- and show
- <select id="mkdru-perpage">
- <option value="10">10</option>
- <option value="20" selected="selected">20</option>
- <option value="30">30</option>
- <option value="50">50</option>
- </select>
- per page.
- </form>
- </div>
- <div class="mkdru-post-search">
- <div class="mkdru-above mkdru-above-below"><span class="mkdru-pager"></span><span class="mkdru-counts"></span></div>
- <div id="mkdru-navi"></div>
- <ul id="mkdru-results"></ul>
- <div class="mkdru-below mkdru-above-below"><span class="mkdru-pager"></span></div>
- </div>
-</div>
--- /dev/null
+<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-navi"></div>
+ <ul class="mkdru-result-list"></ul>
+ <div class="mkdru-below mkdru-above-below"><span class="mkdru-pager"></span></div>
+</div>
i + 1 + mkdru.recPerPage *
(mkdru.curPage - 1));
}
- $('#mkdru-results').html(html);
+ $('.mkdru-result-list').html(html);
+ $('.mkdru-results').show();
};
mkdru.pz2Status = function (data) {
var html = "";
for (var i = 0; i < data.xtargets.length && i < mkdru.sourceMax; i++ ) {
html += Drupal.theme('mkdruTerm', data.xtargets[i].name, data.xtargets[i].freq,
- 'mkdru-facet-link-source', data.xtargets[i].id);
+ 'mkdru-facet-source', data.xtargets[i].id);
}
- $('#mkdru-sources').html(html);
+ $('.mkdru-facet-sources').html(html);
html = "";
for (var i = 0; i < data.subject.length && i < mkdru.subjectMax; i++ ) {
html += Drupal.theme('mkdruTerm', data.subject[i].name, data.subject[i].freq,
- 'mkdru-facet-link-subject', data.subject[i].id);
+ 'mkdru-facet-subject', data.subject[i].id);
}
- $('#mkdru-subjects').html(html);
+ $('.mkdru-facet-subjects').html(html);
html = "";
for (var i = 0; i < data.author.length && i < mkdru.authorMax; i++ ) {
html += Drupal.theme('mkdruTerm', data.author[i].name, data.author[i].freq,
- 'mkdru-facet-link-author', data.author[i].id);
+ 'mkdru-facet-author', data.author[i].id);
}
- $('#mkdru-authors').html(html);
+ $('.mkdru-facet-authors').html(html);
- $('.mkdru-facet-link-source').bind('click', function (e) {
+ $('.mkdru-facet-source').bind('click', function (e) {
mkdru.limitTarget(this.getAttribute('target_id'), this.firstChild.nodeValue);
return false;
});
- $('.mkdru-facet-link-subject').bind('click', function (e) {
+ $('.mkdru-facet-subject').bind('click', function (e) {
mkdru.limitQuery('su', this.firstChild.nodeValue);
return false;
});
- $('.mkdru-facet-link-author').bind('click', function (e) {
+ $('.mkdru-facet-author').bind('click', function (e) {
mkdru.limitQuery('au', this.firstChild.nodeValue);
return false;
});
mkdru.pollDropDowns();
mkdru.search();
mkdru.submitted = true;
- $('.mkdru-post-search').show();
return false;
};
};
mkdru.pollDropDowns = function () {
- mkdru.recPerPage = $('#mkdru-perpage').attr('value');
- mkdru.curSort = $('#mkdru-sort').attr('value');
+ mkdru.recPerPage = $('.mkdru-perpage').attr('value');
+ mkdru.curSort = $('.mkdru-sort').attr('value');
if (!mkdru.submitted) return false;
mkdru.resetPage();
mkdru.pz2.show(0, mkdru.recPerPage, mkdru.curSort);
$(document).ready(function () {
$('.mkdru-search').bind('submit', mkdru.submitQuery);
$('.mkdru-search input:text').attr('value', '');
- $('#mkdru-perpage').bind('change', function () { mkdru.pollDropDowns() });
- $('#mkdru-sort').bind('change', function () { mkdru.pollDropDowns() });
+ $('.mkdru-perpage').bind('change', function () { mkdru.pollDropDowns() });
+ $('.mkdru-sort').bind('change', function () { mkdru.pollDropDowns() });
mkdru.pz2 = new pz2( { "onshow": mkdru.pz2Show,
"showtime": 500, //each timer (show, stat, term, bytarget) can be specified this way
"pazpar2path": mkdru.pazpar2path,
--- /dev/null
+.mkdru-search {
+ text-align:center;
+}
+
+.mkdru-search input[type='text'] {
+ width: 80%;
+}
+
+.mkdru-results {
+ display: none;
+}
+
+.mkdru-result-list {
+ margin: 0;
+ padding: 0;
+}
+
+.mkdru-result-list li {
+ list-style-type: none;
+ list-style-image: none;
+ background: none;
+ margin: 0;
+ padding: 0;
+}
+
+.mkdru-above-below {
+ float: clear;
+ border-style: solid none;
+ border-width: 1px;
+}
+
+.mkdru-counts {
+ float: right;
+}
+
+.mkdru-result a {
+ font-weight: bold;
+}
'name' => t("Z39.50/SRU metasearch interface"),
'module' => 'mkdru',
'description' => t("Metasearch interface for Z39.50/SRU and other targets via a Pazpar2/Service Proxy backend"),
-
)
);
}
// 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.
- drupal_add_css(drupal_get_path('module', 'mkdru') .'/mkdru-page.css');
+ drupal_add_css(drupal_get_path('module', 'mkdru') .'/mkdru.css');
}
/**
* Implementation of hook_delete().
- *
- * When a node is deleted, we need to remove all related records from our table.
*/
function mkdru_delete($node) {
// Deleting by nid covers all revisions.
*/
function mkdru_theme() {
return array(
- 'mkdru_page' => array(
- 'template' => 'mkdru-page',
+ 'mkdru_form' => array(
+ 'template' => 'mkdru-form',
'arguments' => array(),
),
- 'mkdru_page_js' => array(
+ 'mkdru_results' => array(
+ 'template' => 'mkdru-results',
+ 'arguments' => array(),
+ ),
+ 'mkdru_js' => array(
'arguments' => array('node' => NULL),
),
// 'mkdru_block_facet' => array(
/**
* Theme function to include Javascript search client and deps
*/
-function theme_mkdru_page_js($node) {
+function theme_mkdru_js($node) {
$path = drupal_get_path('module', 'mkdru');
// Include client library.
drupal_add_js(variable_get('pz2_js_path', 'pazpar2/js') . '/pz2.js', 'module', 'footer');
* Implementation of hook_view()
*/
function mkdru_view($node, $teaser = FALSE, $page = FALSE) {
- $node->content['mkdru_page_js'] = array(
- '#value' => theme('mkdru_page_js', $node),
+ $node->content['mkdru_js'] = array(
+ '#value' => theme('mkdru_js', $node),
'#weight' => 0,
);
- $node->content['mkdru_page'] = array(
- '#value' => theme('mkdru_page'),
+ $node->content['mkdru_form'] = array(
+ '#value' => theme('mkdru_form'),
'#weight' => 1,
);
+ $node->content['mkdru_results'] = array(
+ '#value' => theme('mkdru_results'),
+ '#weight' => 2,
+ );
return $node;
}
// return $block;
case 'mkdru_sources':
$block['subject'] = t('Source');
- $block['content'] = '<div id="mkdru-sources"> </div>';
+ $block['content'] = '<div class="mkdru-facet mkdru-facet-sources"> </div>';
return $block;
case 'mkdru_subjects':
$block['subject'] = t('Subject');
- $block['content'] = '<div id="mkdru-subjects"> </div>';
+ $block['content'] = '<div class="mkdru-facet mkdru-facet-subjects"> </div>';
return $block;
case 'mkdru_authors':
$block['subject'] = t('Author');
- $block['content'] = '<div id="mkdru-authors"> </div>';
+ $block['content'] = '<div class="mkdru-facet mkdru-facet-authors"> </div>';
return $block;
}
}
Drupal.theme.prototype.mkdruResult = function(hit, num) {
- var html = [];
- html.push('<li class="record" id="recdiv_' + hit.recid + '" >'
- + '<span>' + num + '. </span>'
- + '<a href="#" id="rec_' + hit.recid
- + '"><b>'
- + hit["md-title"] + ' </b></a>');
+ var html = "";
+ html += '<li class="mkdru-result" id="recdiv_' + hit.recid + '" >'
+ + '<span>' + num + '. </span>'
+ + '<a href="#" id="rec_' + hit.recid + '">'
+ + hit["md-title"] + '</a> ';
if (hit["md-title-remainder"] !== undefined) {
- html.push('<span>' + hit["md-title-remainder"] + ' </span>');
+ html += '<span>' + hit["md-title-remainder"] + ' </span>';
}
if (hit["md-title-responsibility"] !== undefined) {
- html.push('<span><i>'+hit["md-title-responsibility"]+'</i></span>');
+ html += '<span><i>'
+ + hit["md-title-responsibility"]
+ + '</i></span>';
}
- html.push('</li>');
- return (html.join(''));
+ html += '</li>';
+ return (html);
};
Drupal.theme.prototype.mkdruPager = function (data, curPage, pages) {
? firstClkbl + 2*onsides
: pages;
- var prev = '<span id="prev"><< Prev</span><b> | </b>';
+ var prev = '<span id="prev"><< Prev</span> | ';
if (curPage > 1)
var prev = '<a href="#" class="mkdru-prev">'
- +'<< Prev</a><b> | </b>';
+ +'<< Prev</a> | ';
var middle = '';
for(var i = firstClkbl; i <= lastClkbl; i++) {