// Listing schema class function schema() { this.addPropertyGroup = function(inID, inName) { this.propertyGroups.push(new propertyGroup(inID, inName)); } this.addProperty = function(inPGID, inID, inName, inType, inSearchCondition, inSearchSort) { this.getPropertyGroupByID(inPGID).addProperty(inID, inName, inType, inSearchCondition, inSearchSort); } this.addChoice = function(inPGID, inPID, inValue) { this.getPropertyGroupByID(inPGID).getPropertyByID(inPID).addChoice(inValue); } this.getPropertyGroupByID = function(inID) { var i = 0; while (i < this.propertyGroups.length && this.propertyGroups[i].id != inID) i++; if (i < this.propertyGroups.length) return this.propertyGroups[i]; else return false; } // Constructor // Vars this.propertyGroups = []; } function propertyGroup(inID, inName) { this.addProperty = function(inID, inName, inType, inSearchCondition, inSearchSort) { this.properties.push(new property(inID, inName, inType, inSearchCondition, inSearchSort)); } this.getPropertyByID = function(inID) { var i = 0; while (i < this.properties.length && this.properties[i].id != inID) i++; if (i < this.properties.length) return this.properties[i]; else return false; } // Constructor this.properties = []; this.id = inID; this.name = inName; } function property(inID, inName, inType, inSearchCondition, inSearchSort) { this.addChoice = function(inValue) { this.choices.push(inValue); } // Vars this.id = inID; this.name = inName; this.type = inType; this.searchCondition = inSearchCondition; this.searchSort = inSearchSort; this.choices = []; }