From df266c1e61953919f80aaf4b6d31a1c433808028 Mon Sep 17 00:00:00 2001 From: Jakub Skoczen Date: Wed, 2 Mar 2011 16:14:47 +0100 Subject: [PATCH] Add theme function to draw facet container Also add elements to control facet dislayName and order. --- mkdru.client.js | 20 ++++++++++++++++---- mkdru.theme.js | 7 ++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/mkdru.client.js b/mkdru.client.js index c73e875..fdb54e6 100644 --- a/mkdru.client.js +++ b/mkdru.client.js @@ -8,21 +8,28 @@ var mkdru = { totalRec: 0, pagerRange: 6, pazpar2Path: Drupal.settings.mkdru.pz2_path, + facetContainerSelector: Drupal.settings.mkdru.facetContainerSelector, // Facets facets: { source: { + displayName: Drupal.settings.mkdru.source_dname || "Source", + orderWeight: Drupal.settings.mkdru.source_weight || 1, pz2Name: 'xtargets', - max: Drupal.settings.mkdru.source_max + max: Drupal.settings.mkdru.source_max || 10 }, subject: { + displayName: Drupal.settings.mkdru.subject_dname || "Subject", + orderWeight: Drupal.settings.mkdru.source_weight || 2, pz2Name: 'subject', - max: Drupal.settings.mkdru.subject_max, + max: Drupal.settings.mkdru.subject_max || 10, multiLimit: true, limiter: 'su' }, author: { + displayName: Drupal.settings.mkdru.author_dname || "Author", + orderWeight: Drupal.settings.mkdru.source_weight || 3, pz2Name: 'author', - max: Drupal.settings.mkdru.author_max, + max: Drupal.settings.mkdru.author_max || 10, multiLimit: false, limiter: 'au' } @@ -116,6 +123,11 @@ mkdru.pz2Status = function (data) { }; mkdru.pz2Term = function (data) { + // if signaled, prepare container client-side + if (mkdru.facetContainerSelector) { + $(mkdru.facetContainerSelector).html(Drupal.theme('mkdruFacetContainer', + data, mkdru.facets)); + } for (var facet in mkdru.facets) { // facet is limited if (mkdru.state['limit_' + facet]) { @@ -409,4 +421,4 @@ $(document).ready(function () { ); } }); -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/mkdru.theme.js b/mkdru.theme.js index 745106e..8051e40 100644 --- a/mkdru.theme.js +++ b/mkdru.theme.js @@ -111,6 +111,7 @@ Drupal.theme.prototype.mkdruStatus = function(activeClients, clients) { }; Drupal.theme.prototype.mkdruFacet = function (terms, facet, max) { + debugger; var html = ""; for (var i = 0; i < terms.length && i < max; i++ ) { html += '' + Drupal.t('Show all...') + '

'; } -}; \ No newline at end of file +}; + +Drupal.theme.prototype.mkdruFacetContainer = function (facets, facetCfg) { + return ""; +}; -- 1.7.10.4