From 76f73dd0a68b29d334e0efdcd7a3102ea0e699fb Mon Sep 17 00:00:00 2001 From: Jakub Skoczen Date: Tue, 2 Oct 2007 10:33:18 +0000 Subject: [PATCH] Removing mk related classes. --- js/pz2.js | 188 +------------------------------------------------------------ 1 file changed, 1 insertion(+), 187 deletions(-) diff --git a/js/pz2.js b/js/pz2.js index de17f71..cb19e78 100644 --- a/js/pz2.js +++ b/js/pz2.js @@ -1,5 +1,5 @@ /* -** $Id: pz2.js,v 1.59 2007-09-28 10:14:09 jakub Exp $ +** $Id: pz2.js,v 1.60 2007-10-02 10:33:18 jakub Exp $ ** pz2.js - pazpar2's javascript client library. */ @@ -848,190 +848,4 @@ Element_getTextContent = function (DOM_Element) } } -/* -********************************************************************************* -** QUERY CLASS ****************************************************************** -********************************************************************************* -*/ - -var pzFilter = function() -{ - this.filterHash = new Array(); - this.filterNums = 0; -}; - -pzFilter.prototype = -{ - addFilter: function(name, value) - { - var filter = {"name": name, "id": value }; - this.filterHash[this.filterHash.length] = filter; - this.filterNums++ - return this.filterHash.length - 1; - }, - - setFilter: function(name, value) - { - this.filterHash = new Array(); - this.filterNums = 0; - this.addFilter(name, value); - }, - - getFilter: function(index) - { - return this.filterHash[index].id; - }, - - getFilterName: function(index) - { - return this.filterHash[index].name; - }, - - removeFilter: function(index) - { - delete this.filterHash[index]; - this.filterNums--; - }, - - clearFilter: function() - { - this.filterHash = new Array(); - this.filterNums = 0; - }, - - getFilterString: function() - { - if( this.filterNums <= 0 ) { - return undefined; - } - - var filter = 'pz:id='; - for(var i = 0; i < this.filterHash.length; i++) - { - if (this.filterHash[i] == undefined) continue; - if (filter > 'pz:id=') filter = filter + '|'; - filter += this.filterHash[i].id; - } - return filter; - } -}; - -var mkState = function() -{ - this.sort = 'relevance'; - this.perPage = 20; - this.page = 0; - this.simpleQuery = ''; - this.singleFilter = null; - this.advTerms = new Array(); - this.numTerms = 0; - this.action = ''; -}; - -mkState.prototype = -{ - reset: function() - { - this.simpleQuery = ''; - this.advTerms = new Array(); - this.simpleFilter = null; - this.numTerms = 0; - }, - - clearSimpleQuery: function() - { - this.simpleQuery = ''; - }, - - addTerm: function(field, value) - { - var term = {"field": field, "value": value}; - this.advTerms[this.numTerms] = term; - this.numTerms++; - }, - - getTermValueByIdx: function(index) - { - return this.advTerms[index].value; - }, - - getTermFieldByIdx: function(index) - { - return this.advTerms[index].field; - }, - - /* semicolon separated list of terms for given field*/ - getTermsByField: function(field) - { - var terms = ''; - for(var i = 0; i < this.advTerms.length; i++) - { - if( this.advTerms[i].field == field ) - terms = terms + this.queryHas[i].value + ';'; - } - return terms; - }, - - addTermsFromList: function(inputString, field) - { - var inputArr = inputString.split(';'); - for(var i=0; i < inputArr.length; i++) - { - if(inputArr[i].length < 3) continue; - this.advTerms[this.numTerms] - = {"field": field, "value": inputArr[i] }; - this.numTerms++; - } - }, - - removeTermByIdx: function(index) - { - this.advTerms.splice(index, 1); - this.numTerms--; - }, - - toCCL: function() - { - var ccl = ''; - if( this.simpleQuery != '') - ccl = this.simpleQuery; - for(var i = 0; i < this.advTerms.length; i++) - { - if (ccl != '') ccl = ccl + ' and '; - ccl = ccl + this.advTerms[i].field - +'="'+this.advTerms[i].value+'"'; - } - return ccl; - }, - - totalLength: function() - { - var simpleLength = this.simpleQuery != '' ? 1 : 0; - return this.advTerms.length + simpleLength; - }, - - clearSingleFilter: function() - { - this.singleFilter = null; - }, - - setSingleFilter: function(name, value) - { - this.singleFilter = {"name": name, "id": value }; - }, - - getSingleFilterName: function() - { - return this.singleFilter.name; - }, - - getSingleFilterString: function() - { - if( this.singleFilter != null ) { - return 'pz:id='+this.singleFilter.id; - } else { - return undefined; - } - } -}; } -- 1.7.10.4