<%def name="formSearchFields()"> ${self.searchExpressions('form')} ${self.orderBy(app_globals.searchLocations['form'])} ${self.limit()} ${self.additionalFormSearchFilters()} <%def name="fileSearchFields()"> ${self.searchExpressions('file')} ${self.orderBy(app_globals.searchLocations['file'])} ${self.additionalFileSearchFilters()} <%def name="collectionSearchFields()"> ${self.searchExpressions('collection')} ${self.orderBy(app_globals.searchLocations['collection'])} ${self.additionalCollectionSearchFilters()} <%def name="searchExpressions(entity)">
Search Expression 1
  1. ${h.text(name='searchTerm1', tabindex=1)} ${h.select(name='searchType1', selected_values="", options=app_globals.searchTypes, tabindex=2)} ${h.select(name='searchLocation1', selected_values="transcription", options=app_globals.searchLocations[entity], tabindex=3)}
${h.select(name='andOrNot', selected_values="and", options=app_globals.andOrNot, tabindex=4)}
Search Expression 2
  1. ${h.text(name='searchTerm2', tabindex=5)} ${h.select(name='searchType2', selected_values="", options=app_globals.searchTypes, tabindex=6)} ${h.select(name='searchLocation2', selected_values="gloss", options=app_globals.searchLocations[entity], tabindex=7)}
<%def name="additionalFormSearchFilters()"> <%doc> Additional Form Search Filters (ASF). Use the searchFilter(), searchDateFilter() and searchIntegerFiler() defs to add more ASFs if desired. ${self.searchFiltersHeader()} <% grammaticalities = [(x, x) for x in app_globals.grammaticalities if x] %> ${self.searchFilter(['speaker'], ['is', 'is not'], ['any of'], [(speaker.id, speaker.firstName + ' ' + speaker.lastName) for speaker in app_globals.speakers], 1)} ${self.searchFilter(['elicitor', 'enterer', 'verifier'], ['is', 'is not'], ['any of'], [(user.id, user.firstName + ' ' + user.lastName) for user in app_globals.users if user.role != u'viewer'], 2)} ${self.searchFilter(['source'], ['is', 'is not'], ['any of'], [(source.id, source.authorLastName + ', ' + source.authorFirstName[0].upper() + '. ' + unicode(source.year) + '. ' + source.title[:10] + '...') for source in app_globals.sources] , 3)} ${self.searchFilter([('grammaticality', 'grammaticality')], ['is', 'is not'], ['any of'], grammaticalities, 4)} ${self.searchFilter([('glossGrammaticality', 'gloss grammaticality')], ['contains', 'does not contain'], ['all of', 'any of'], grammaticalities, 5)} ${self.searchFilter([('elicitationMethod', 'elicitation method')], ['is', 'is not'], ['any of'], [(elicitationMethod.id, elicitationMethod.name) for elicitationMethod in app_globals.elicitationMethods], 6)} ${self.searchFilter([('syntacticCategory', 'syntactic category')], ['is', 'is not'], ['any of'], [(syncat.id, syncat.name) for syncat in app_globals.syncats], 7)} ${self.searchFilter(['keywords'], ['contains', 'does not contain'], ['all of', 'any of'], [(keyword.id, keyword.name) for keyword in app_globals.keywords], 8)} ${self.searchDateFilter(0)} ${self.searchDateFilter(1)} ${self.searchDateFilter(2)} ${self.searchDateFilter(3)} ${self.searchIntegerFilter('form', 0)} ${searchEmptyFilter(['speaker', 'elicitor', 'enterer', 'verifier', 'elicitationMethod', 'syntacticCategory', 'source'], ['', 'is null', 'is not null'], 0)} ${searchEmptyFilter(['elicitor', 'enterer', 'speaker', 'verifier', 'elicitationMethod', 'syntacticCategory', 'source'], ['', 'is null', 'is not null'], 1)} ${searchEmptyFilter(['enterer', 'elicitor', 'speaker', 'verifier', 'elicitationMethod', 'syntacticCategory', 'source'], ['', 'is null', 'is not null'], 2)} ${searchEmptyFilter(['transcription', 'morphemeBreak', 'morphemeGloss', 'comments', 'speakerComments', 'grammaticality', 'phoneticTranscription', 'syntacticCategoryString', 'morphemeBreakIDs', 'morphemeGlossIDs', ], ['', 'is an empty string', 'is not an empty string'], 3)} ${searchEmptyFilter(['morphemeBreak', 'transcription', 'morphemeGloss', 'comments', 'speakerComments', 'grammaticality', 'syntacticCategoryString', 'phoneticTranscription', 'morphemeBreakIDs', 'morphemeGlossIDs', ], ['', 'is an empty string', 'is not an empty string'], 4)} ${searchEmptyFilter(['morphemeGloss', 'transcription', 'phoneticTranscription', 'morphemeBreak', 'comments', 'speakerComments', 'grammaticality', 'syntacticCategoryString', 'morphemeBreakIDs', 'morphemeGlossIDs', ], ['', 'is an empty string', 'is not an empty string'], 5)} ${self.searchFiltersFooter()} <%def name="additionalFileSearchFilters()"> <%doc> Additional File Search Filters (ASF). Use the searchFilter() and searchDateFilter() defs to add more ASFs if desired. ${self.searchFiltersHeader()} ${self.searchFilter([('MIMEtype', 'MIME type')], ['is', 'is not'], ['any of'], [(key, key) for key in sorted(app_globals.allowedFileTypes.keys())], 1)} ${self.searchFilter(['elicitor', 'enterer'], ['is', 'is not'], ['any of'], [(user.id, user.firstName + ' ' + user.lastName) for user in app_globals.users if user.role != u'viewer'], 2)} ${self.searchFilter(['speaker'], ['is', 'is not'], ['any of'], [(speaker.id, speaker.firstName + ' ' + speaker.lastName) for speaker in app_globals.speakers], 3)} ${self.searchFilter([('utteranceType', 'utterance type')], ['is', 'is not'], ['any of'], [('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 name="additionalCollectionSearchFilters()"> <%doc> Additional Collection Search Filters (ASF). Use the searchFilter() and searchDateFilter() defs to add more ASFs if desired. ${self.searchFiltersHeader()} ${self.searchFilter(['elicitor', 'enterer'], ['is', 'is not'], ['any of'], [(user.id, user.firstName + ' ' + user.lastName) for user in app_globals.users if user.role != u'viewer'], 0)} ${self.searchFilter(['speaker'], ['is', 'is not'], ['any of'], [(speaker.id, speaker.firstName + ' ' + speaker.lastName) for speaker in app_globals.speakers], 1)} ${self.searchFilter(['source'], ['is', 'is not'], ['any of'], [(source.id, source.authorLastName + ', ' + source.authorFirstName[0].upper() + '. ' + unicode(source.year) + '. ' + source.title[:10] + '...') for source in app_globals.sources], 2)} ${self.searchDateFilter(0)} ${self.searchDateFilter(1)} ${self.searchDateFilter(2)} ${self.searchDateFilter(3)} ${self.searchIntegerFilter('collection', 0)} ${self.searchFiltersFooter()} <%def name="searchFiltersHeader()">
% if hasattr(c, 'viewRestrictors') and c.viewRestrictors: Additional Search Filters -
    % else: Additional Search Filters +
      % endif <%def name="searchFiltersFooter()">
<%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 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 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 name="searchEmptyFilter(entity, options, index)">
  • ${h.select(name='emptyRestrictors-%s.location' % (index), selected_values='', options=entity, tabindex=8)} ${h.select(name='emptyRestrictors-%s.relation' % (index), selected_values='', options=options, tabindex=8)}
  • <%def name="orderBy(columns, selected='id')">
    Order By
    1. ${h.select(name='orderByColumn', selected_values='', options=columns, tabindex=8)} ${h.select(name='orderByDirection', selected_values='', options=[('desc', 'descending'), ('asc', 'ascending')], tabindex=8)}
    <%def name="limit()">
    Limit
    <%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)}