%def name="formSearchFields()">
${self.searchExpressions('form')}
${self.orderBy(app_globals.searchLocations['form'])}
${self.additionalFormSearchFilters()}
%def>
<%def name="fileSearchFields()">
${self.searchExpressions('file')}
${self.orderBy(app_globals.searchLocations['file'])}
${self.additionalFileSearchFilters()}
%def>
<%def name="collectionSearchFields()">
${self.searchExpressions('collection')}
${self.orderBy(app_globals.searchLocations['collection'])}
${self.additionalCollectionSearchFilters()}
%def>
<%def name="searchExpressions(entity)">
${h.select(name='andOrNot', selected_values="and", options=app_globals.andOrNot, tabindex=4)}
%def>
<%def name="additionalFormSearchFilters()">
<%doc>
Additional Form Search Filters (ASF)
use the searchFilter(), searchDateFilter() and searchIntegerFiler() defs to add more ASFs if desired
%doc>
${self.searchFiltersHeader()}
${self.searchFilter(['speaker'], ['is', 'is not'], ['any of'], [(None, 'empty')] + app_globals.speakers, 1)}
${self.searchFilter(['elicitor', 'enterer', 'verifier'], ['is', 'is not'], ['any of'], [(None, 'empty')] + app_globals.users, 2)}
${self.searchFilter(['source'], ['is', 'is not'], ['any of'], [(None, 'empty')] + app_globals.sources, 3)}
${self.searchFilter([('grammaticality', 'grammaticality')], ['is', 'is not'], ['any of'], [(None, 'empty'), ('*', '*'), ('?', '?')], 4)}
${self.searchFilter([('glossGrammaticality', 'gloss grammaticality')], ['contains', 'does not contain'], ['all of', 'any of'], [(None, 'empty'), ('*', '*'), ('?', '?')], 5)}
${self.searchFilter([('elicitationMethod', 'elicitation method')], ['is', 'is not'], ['any of'], [(None, 'empty')] + app_globals.elicitationMethods, 6)}
${self.searchFilter([('syntacticCategory', 'syntactic category')], ['is', 'is not'], ['any of'], [(None, 'empty')] + app_globals.syncats, 7)}
${self.searchFilter(['keywords'], ['contains', 'does not contain'], ['all of', 'any of'], [(None, 'empty')] + app_globals.keywords, 8)}
${self.searchDateFilter(0)}
${self.searchDateFilter(1)}
${self.searchDateFilter(2)}
${self.searchDateFilter(3)}
${self.searchFiltersFooter()}
%def>
<%def name="additionalFileSearchFilters()">
<%doc>
Additional File Search Filters (ASF)
use the searchFilter() and searchDateFilter() defs to add more ASFs if desired
%doc>
${self.searchFiltersHeader()}
${self.searchFilter([('MIMEtype', 'MIME type')], ['is', 'is not'], ['any of'], [(None, 'empty')] + [('"' + key + '"', key) for key in sorted(app_globals.allowedFileTypes.keys())], 1)}
${self.searchFilter(['elicitor', 'enterer'], ['is', 'is not'], ['any of'], [(None, 'empty')] + app_globals.users, 2)}
${self.searchFilter(['speaker'], ['is', 'is not'], ['any of'], [(None, 'empty')] + app_globals.speakers, 3)}
${self.searchFilter([('utteranceType', 'utterance type')], ['is', 'is not'], ['any of'], [(None, 'empty'), ('Object Language Utterance', 'Object Language Utterance'), ('Metalanguage Utterance', 'Metalanguage Utterance'), ('Mixed Utterance', 'Mixed Utterance')], 4)}
${self.searchDateFilter(0)}
${self.searchDateFilter(1)}
${self.searchDateFilter(2)}
${self.searchDateFilter(3)}
${self.searchIntegerFilter('file', 0, ['', 'bytes', 'KB', 'MB', 'GB'])}
${self.searchFiltersFooter()}
%def>
<%def name="additionalCollectionSearchFilters()">
<%doc>
Additional Collection Search Filters (ASF)
use the searchFilter() and searchDateFilter() defs to add more ASFs if desired
%doc>
${self.searchFiltersHeader()}
${self.searchFilter(['elicitor', 'enterer'], ['is', 'is not'], ['any of'], [(None, 'empty')] + app_globals.users, 0)}
${self.searchFilter(['speaker'], ['is', 'is not'], ['any of'], [(None, 'empty')] + app_globals.speakers, 1)}
${self.searchFilter(['source'], ['is', 'is not'], ['any of'], [(None, 'empty')] + app_globals.sources, 2)}
${self.searchDateFilter(0)}
${self.searchDateFilter(1)}
${self.searchDateFilter(2)}
${self.searchDateFilter(3)}
${self.searchIntegerFilter('collection', 0)}
${self.searchFiltersFooter()}
%def>
<%def name="searchFiltersHeader()">
%def>
<%def name="searchFilter(locations, containsNots, allAnyOfs, options, index)">
${h.select(name='restrictors-%s.location'%(index), selected_values='', options=locations, tabindex=8)}
${h.select(name='restrictors-%s.containsNot'%(index), selected_values='', options=containsNots, tabindex=8)}
${h.select(name='restrictors-%s.allAnyOf'%(index), selected_values='', options=allAnyOfs, tabindex=8)}
%def>
<%def name="searchDateFilter(index)">
${h.select(name='dateRestrictors-%s.location'%(index), selected_values='', options=[('dateElicited', 'date elicited'), ('datetimeEntered', 'date entered'), ('datetimeModified', 'date modified')], tabindex=8)}
${h.select(name='dateRestrictors-%s.relation'%(index), selected_values='', options=[('', 'is'), ('not_', 'is not'), ('earlier_than', 'is earlier than'), ('later_than', 'is later than')], tabindex=8)}
${h.text(name='dateRestrictors-%s.date'%(index), size='10', maxlength='10', tabindex=8)}
(mm/dd/yyyy)
%def>
<%def name="searchIntegerFilter(entity, index, units=None)">
${h.select(name='integerRestrictors-%s.location'%(index), selected_values='', options=app_globals.searchIntegerFilterLocations[entity], tabindex=8)}
${h.select(name='integerRestrictors-%s.relation'%(index), selected_values='', options=[('==', 'is'), ('!=', 'is not'), ('lt', 'is less than'), ('gt', 'is greater than')], tabindex=8)}
${h.text(name='integerRestrictors-%s.integer'%(index), size='10', maxlength='10', tabindex=8)}
% if units:
${h.select(name='integerRestrictors-%s.unit'%(index), selected_values='', options=units, tabindex=8)}
% endif
%def>
<%def name="orderBy(columns, selected='id')">
%def>
<%def name="dictionarySearch()">
<%
choices = [
(
'ol',
'%s to %s' % (app_globals.objectLanguageName,
app_globals.metaLanguageName)
),
(
'ml',
'%s to %s' % (app_globals.metaLanguageName,
app_globals.objectLanguageName)
)
]
%>
${h.text(name='dictionarySearchTerm', size='40', tabindex=1)}
${h.select(name='dictionarySearchType', selected_values="", options=choices, tabindex=2)}
%def>