#
# Browse configuration
#

# number of seconds to keep cached browses around
# set to 0 to disable caching
cache_timeout = 0

# Configuration for object browse
ca_objects = {
	name = _(Objects),
	facets = {
		entity_facet = {
			# 'type' can equal authority, attribute, fieldList, normalizedDates
			type = authority,		
			table = ca_entities,
			relationship_table = ca_objects_x_entities,
			restrict_to_types = [],
			
			groupings = {
				label = _(Name), 
				relationship_types = _(Role),
				type = _(Type)
			},
			group_mode = alphabetical,
			order_by_label_fields = [surname, forename],
			
			indefinite_article = an,
			label_singular = _(person),
			label_plural = _(people)
		},
		genre_facet = {
			type = authority,
			table = ca_list_items,
			relationship_table = ca_objects_x_vocabulary_terms,
			restrict_to_types = [genre],
			
			group_mode = alphabetical,
			order_by_label_fields = [name_singular],
			
			label_singular = _(genre),
			label_plural = _(genres)
		},
		subject_facet = {
			type = authority,
			table = ca_list_items,
			relationship_table = ca_objects_x_vocabulary_terms,
			restrict_to_types = [subject],
			order_by_label_fields = [name_singular],
			
			group_mode = alphabetical,
			
			label_singular = _(subject),
			label_plural = _(subjects)
		},
		decade_facet = {
			type = normalizedDates,
			element_code = pbcoreDateCreated,
			normalization = decades,
			
			group_mode = none,
			
			label_singular = _(decade),
			label_plural = _(decades)
		},
		occurrence_facet = {
			type = authority,
			table = ca_occurrences,
			generate_facets_for_types = 1,
			relationship_table = ca_objects_x_occurrences,
			restrict_to_types = [],
			
			show_all_when_first_facet = 0,
			
			groupings = {
				label = _(Name), 
				ca_attribute_dates_value:years = _(Years)
			},
			
			group_mode = alphabetical,
			
			label_singular = _(occurrence),
			label_plural = _(occurrences)
		},
		type_facet = {
			type = fieldList,
			field = type_id,
			
			group_mode = none,

			label_singular = _(object type),
			label_plural = _(object types)
		},
		collection_facet = {
			type = authority,
			table = ca_collections,
			relationship_table = ca_objects_x_collections,
			restrict_to_types = [],
			
			group_mode = none,

			label_singular = _(collection),
			label_plural = _(collections)
		}
	}
}

# Configuration for object lot browse
ca_object_lots = {
	name = _(Lots),
	facets = {
		entity_facet = {
			# 'type' can equal authority, attribute, fieldList, normalizedDates
			type = authority,		
			table = ca_entities,
			relationship_table = ca_object_lots_x_entities,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			order_by_label_fields = [surname, forename],
			
			indefinite_article = an,
			label_singular = _(entity),
			label_plural = _(entities)
		},
		place_facet = {
			type = authority,
			table = ca_places,
			relationship_table = ca_object_lots_x_places,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			label_singular = _(place),
			label_plural = _(places)
		},
		collection_facet = {
			type = authority,
			table = ca_collections,
			relationship_table = ca_object_lots_x_collections,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			label_singular = _(collection),
			label_plural = _(collections)
		},
		occurrence_facet = {
			type = authority,
			table = ca_occurrences,
			generate_facets_for_types = 1,
			relationship_table = ca_object_lots_x_occurrences,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			indefinite_article = an,
			label_singular = _(occurrence),
			label_plural = _(occurrences)
		},
		term_facet = {
			type = authority,
			table = ca_list_items,
			relationship_table = ca_object_lots_x_vocabulary_terms,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			label_singular = _(term),
			label_plural = _(terms)
		},
		type_facet = {
			type = fieldList,
			field = type_id,
			
			group_mode = alphabetical,
			
			label_singular = _(type),
			label_plural = _(types)
		},
		status_facet = {
			type = fieldList,
			field = status,
			
			group_mode = alphabetical,
			
			label_singular = _(status),
			label_plural = _(statuses)
		},
		access_facet = {
			type = fieldList,
			field = access,
			
			group_mode = alphabetical,
			
			indefinite_article = an,
			label_singular = _(access status),
			label_plural = _(access statuses)
		}
	}
}
# --------------------------------------------------------------------
# Configuration for entity browse
ca_entities = {
	name = _(Entities),
	facets = {
		place_facet = {
			type = authority,
			table = ca_places,
			relationship_table = ca_entities_x_places,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			label_singular = _(place),
			label_plural = _(places)
		},
		occurrence_facet = {
			type = authority,
			table = ca_occurrences,
			generate_facets_for_types = 1,
			relationship_table = ca_entities_x_occurrences,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			indefinite_article = an,
			label_singular = _(occurrence),
			label_plural = _(occurrences)
		},
		collection_facet = {
			type = authority,
			table = ca_collections,
			relationship_table = ca_entities_x_collections,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			label_singular = _(collection),
			label_plural = _(collections)
		},
		term_facet = {
			type = authority,
			table = ca_list_items,
			relationship_table = ca_entities_x_vocabulary_terms,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			label_singular = _(term),
			label_plural = _(terms)
		},
		type_facet = {
			type = fieldList,
			field = type_id,
			
			group_mode = alphabetical,
			
			label_singular = _(type),
			label_plural = _(types)
		},
		status_facet = {
			type = fieldList,
			field = status,
			
			group_mode = alphabetical,
			
			label_singular = _(status),
			label_plural = _(statuses)
		},
		access_facet = {
			type = fieldList,
			field = access,
			
			group_mode = alphabetical,
			
			indefinite_article = an,
			label_singular = _(access status),
			label_plural = _(access statuses)
		}
	}
}
# --------------------------------------------------------------------
# Configuration for collection browse
ca_collections = {
	name = _(Collections),
	facets = {
		decade_facet = {
			type = normalizedDates,
			element_code = collection_datespan,
			normalization = decades,
			
			group_mode = none,
			
			label_singular = _(decade),
			label_plural = _(decades)
		},
		genre_facet = {
			type = authority,
			table = ca_list_items,
			relationship_table = ca_collections_x_vocabulary_terms,
			restrict_to_relationship_types = [genre],
			
			group_mode = alphabetical,
			order_by_label_fields = [name_singular],
			
			label_singular = _(genre),
			label_plural = _(genres)
		},
		subject_facet = {
			type = authority,
			table = ca_list_items,
			relationship_table = ca_collections_x_vocabulary_terms,
			restrict_to_relationship_types = [subject],
			
			group_mode = alphabetical,
			order_by_label_fields = [name_singular],
			
			label_singular = _(subject),
			label_plural = _(subjects)
		},
		geoloc_facet = {
			type = attribute,
			element_code = georeference,
			restrict_to_types = [],
			
			group_mode = alphabetical,

			label_singular = _(place),
			label_plural = _(places)
		},
		entity_facet = {
			# 'type' can equal authority, attribute, fieldList, normalizedDates
			type = authority,		
			table = ca_entities,
			relationship_table = ca_entities_x_collections,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			order_by_label_fields = [surname, forename],
			
			indefinite_article = an,
			label_singular = _(entity),
			label_plural = _(entities)
		},
		occurrence_facet = {
			type = authority,
			table = ca_occurrences,
			generate_facets_for_types = 1,
			relationship_table = ca_occurrences_x_collections,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			order_by_label_fields = [name],
			
			indefinite_article = an,
			label_singular = _(occurrence),
			label_plural = _(occurrences)
		}
	}
}

# --------------------------------------------------------------------
# Configuration for place browse
ca_places = {
	name = _(Places),
	facets = {
		entity_facet = {
			# 'type' can equal authority, attribute, fieldList, normalizedDates
			type = authority,		
			table = ca_entities,
			relationship_table = ca_entities_x_places,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			order_by_label_fields = [surname, forename],
			
			indefinite_article = an,
			label_singular = _(entity),
			label_plural = _(entities)
		},
		object_facet = {
			type = authority,
			table = ca_objects,
			relationship_table = ca_objects_x_places,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			label_singular = _(object),
			label_plural = _(objects)
		},
		occurrence_facet = {
			type = authority,
			table = ca_occurrences,
			generate_facets_for_types = 1,
			relationship_table = ca_places_x_occurrences,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			indefinite_article = an,
			label_singular = _(occurrence),
			label_plural = _(occurrences)
		},
		term_facet = {
			type = authority,
			table = ca_list_items,
			relationship_table = ca_places_x_vocabulary_terms,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			label_singular = _(term),
			label_plural = _(terms)
		},
		type_facet = {
			type = fieldList,
			field = type_id,
			
			group_mode = alphabetical,
			
			label_singular = _(type),
			label_plural = _(types)
		},
		status_facet = {
			type = fieldList,
			field = status,
			
			group_mode = alphabetical,
			
			label_singular = _(status),
			label_plural = _(statuses)
		},
		access_facet = {
			type = fieldList,
			field = access,
			
			group_mode = alphabetical,
			
			indefinite_article = an,
			label_singular = _(access status),
			label_plural = _(access statuses)
		}
	}
}
# --------------------------------------------------------------------
# Configuration for occurrence browse
ca_occurrences = {
	name = _(Other authorities),
	facets = {
		entity_facet = {
			# 'type' can equal authority, attribute, fieldList, normalizedDates
			type = authority,		
			table = ca_entities,
			relationship_table = ca_entities_x_occurrences,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			order_by_label_fields = [surname, forename],
			
			indefinite_article = an,
			label_singular = _(entity),
			label_plural = _(entities)
		},
		object_facet = {
			type = authority,
			table = ca_objects,
			relationship_table = ca_objects_x_occurrences,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			label_singular = _(object),
			label_plural = _(objects)
		},
		term_facet = {
			type = authority,
			table = ca_list_items,
			relationship_table = ca_occurrences_x_vocabulary_terms,
			restrict_to_types = [],
			
			group_mode = alphabetical,
			
			label_singular = _(term),
			label_plural = _(terms)
		},
		type_facet = {
			type = fieldList,
			field = type_id,
			
			group_mode = alphabetical,
			
			label_singular = _(type),
			label_plural = _(types)
		},
		year_facet = {
			type = normalizedDates,
			element_code = dates,
			normalization = years,
			
			group_mode = alphabetical,
			
			label_singular = _(year),
			label_plural = _(years)
		},
		status_facet = {
			type = fieldList,
			field = status,
			
			group_mode = alphabetical,
			
			label_singular = _(status),
			label_plural = _(statuses)
		},
		access_facet = {
			type = fieldList,
			field = access,
			
			group_mode = alphabetical,
			
			indefinite_article = an,
			label_singular = _(access status),
			label_plural = _(access statuses)
		},
		collection_facet = {
			type = authority,
			table = ca_collections,
			relationship_table = ca_objects_x_collections,
			restrict_to_types = [],
			
			group_mode = none,

			label_singular = _(collection),
			label_plural = _(collections)
		}
	}
}

# --------------------------------------------------------------------
# Configuration for storage location browse
ca_storage_locations = {
	name = _(Storage locations),
	facets = {
		type_facet = {
			type = fieldList,
			field = type_id,
			
			group_mode = alphabetical,
			
			label_singular = _(type),
			label_plural = _(types)
		},
		status_facet = {
			type = fieldList,
			field = status,
			
			group_mode = alphabetical,
			
			label_singular = _(status),
			label_plural = _(statuses)
		}
	}
}
# --------------------------------------------------------------------
