// Set up namespace and some state.
var mkdru = {
- // Settings to pass to pz2.js
- useSessions: Drupal.settings.mkdru.use_sessions === '1',
+ settings: JSON.parse(Drupal.settings.mkdru.settings),
// Variables
active: false,
pz2: null,
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 || 10
- },
- subject: {
- displayName: Drupal.settings.mkdru.subject_dname || "Subject",
- orderWeight: Drupal.settings.mkdru.source_weight || 2,
- pz2Name: 'subject',
- 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 || 10,
- multiLimit: false,
- limiter: 'au'
- }
- },
// State; Keys limit_{facet key} will also be initialised
defaultState: {
page: 1,
state: {},
realm: ''
};
-
-
+// Convenient references
+mkdru.facets = mkdru.settings.facets;
// Wrapper for jQuery
(function ($) {
"onstat": mkdru.pz2Status,
"onterm": mkdru.pz2Term,
"termlist": termlist.join(','),
- "usesessions" : mkdru.useSessions,
+ "usesessions" : mkdru.settings.useSessions,
"showResponseType": mkdru.showResponseType,
"onrecord": mkdru.pz2Record,
"autoInit": false } );
}
//not running against SP? init, otherwise authenticate
- if (mkdru.useSessions) {
+ if (mkdru.settings.use_sessions) {
mkdru.pz2.init();
} else {
//runnin against SP