def images(request): context = setConstants({}, prmz, request) if request.method == 'GET' and request.GET != {}: context['searchValues'] = request.GET prmz.MAXFACETS = 0 if 'keyword' in request.GET: context['keyword'] = request.GET['keyword'] if 'accession' in request.GET: context['accession'] = request.GET['accession'] context['maxresults'] = 1 context['maxresults'] = prmz.MAXRESULTS # use the grid display fields (we only show two of the required ones) context['displayType'] = 'grid' # it's an image browser, so only return items with images... context['pixonly'] = 'true' # do search loginfo('imagebrowser', 'start imagebrowser search', context, request) context = doSearch(context, prmz, request) context['additionalInfo'] = AdditionalInfo.objects.filter(live=True) return render(request, 'showImages.html', context) else: context = setConstants({}, prmz, request) context['pgNum'] = 10 context['maxresults'] = 20 return render(request, 'showImages.html', context)
def get_item(request, itemid): searchfield = '' for i in prmz.FIELDS['Search']: if 'objectno' in i['fieldtype']: searchfield = i['name'] break requestObject = { searchfield: itemid, 'resultsOnly': 'true', 'displayType': 'full' } form = forms.Form(requestObject) if form.is_valid(): context = {'searchValues': requestObject} context = doSearch(context, prmz, request) if '/media/' in request.path_info: context['permalink_display'] = 'media' else: context['permalink_display'] = 'object' loginfo('permalinks', 'results.%s' % context['displayType'], context, request) return render(request, 'search.html', context)
def skeleton(request): if request.method == 'GET' and request.GET != {}: context = {'searchValues': dict(request.GET.iteritems())} context = doSearch(context, prmz, request) else: context = setConstants({}, prmz, request) loginfo(logger, 'start search', context, request) context['additionalInfo'] = AdditionalInfo.objects.filter(live=True) return render(request, 'osteo.html', context)
def retrieveResults(request): if request.method == 'POST' and request.POST != {}: requestObject = request.POST form = forms.Form(requestObject) if form.is_valid(): context = {'searchValues': requestObject} context = doSearch(context, prmz, request) loginfo('internal', 'results.%s' % context['displayType'], context, request) return render(request, 'searchResults.html', context)
def retrieveResults(request): if request.method == 'POST' and request.POST != {}: requestObject = dict(request.POST.iteritems()) form = forms.Form(requestObject) if form.is_valid(): context = {'searchValues': requestObject} context = doSearch(context, prmz) loginfo(logger, 'results.%s' % context['displayType'], context, request) return render(request, 'searchResults.html', context)
def search(request): if request.method == "GET" and request.GET != {}: context = {"searchValues": dict(request.GET.iteritems())} context = doSearch(context, prmz, request) else: context = setConstants({}, prmz, request) loginfo(logger, "start search", context, request) context["additionalInfo"] = AdditionalInfo.objects.filter(live=True) return render(request, "search.html", context)
def search(request): if request.method == 'GET' and request.GET != {}: context = {'searchValues': dict(request.GET.iteritems())} context = doSearch(context, prmz) else: context = setConstants({}, prmz) loginfo(logger, 'start search', context, request) context['additionalInfo'] = AdditionalInfo.objects.filter(live=True) return render(request, 'ucjeps_searchmedia.html', context)
def retrieveResults(request): if request.method == "POST" and request.POST != {}: requestObject = dict(request.POST.iteritems()) form = forms.Form(requestObject) if form.is_valid(): context = {"searchValues": requestObject} context = doSearch(context, prmz, request) loginfo(logger, "results.%s" % context["displayType"], context, request) return render(request, "searchResults.html", context)
def search(request): if request.method == 'GET' and request.GET != {}: context = {'searchValues': request.GET} context = doSearch(context, prmz, request) else: context = setConstants({}, prmz, request) loginfo('internal', 'start search', context, request) context['additionalInfo'] = AdditionalInfo.objects.filter(live=True) return render(request, 'search.html', context)
def search(request): if request.method == 'GET' and request.GET != {}: context = {'searchValues': dict(request.GET.iteritems())} context = doSearch(context, adhocprmz, request) else: context = setConstants({}, adhocprmz, request) loginfo('adhocreports', 'start adhocreport', context, request) context['additionalInfo'] = AdditionalInfo.objects.filter(live=True) return render(request, 'adhocreports.html', context)
def search(request): if request.method == 'GET' and request.GET != {}: context = {'searchValues': dict(request.GET.iteritems())} context = doSearch(context, prmz, request) else: context = setConstants({}, prmz, request) loginfo(logger, 'start search', context, request) context['additionalInfo'] = AdditionalInfo.objects.filter(live=True) context['extra_nav'] = {'href': '../skeleton', 'id': 'skeleton', 'name': 'Skeleton'} return render(request, 'search.html', context)
def retrieveResults(request): if request.method == 'POST' and request.POST != {}: requestObject = dict(request.POST.iteritems()) form = forms.Form(requestObject) if form.is_valid(): context = {'searchValues': requestObject} context = doSearch(context, adhocprmz, request) loginfo(logger, 'results.%s' % context['displayType'], context, request) return render(request, 'adhocresults.html', context)
def skeleton(request): if request.method == 'GET' and request.GET != {}: # context = {'searchValues': dict(request.GET.iteritems())} aggregate, search_keys = gatherosteoparms(dict(request.GET.iteritems())) requestObject = {'querystring': (' OR '.join(aggregate)), 'url': 'url', 'special': 'true'} context = {'searchValues': requestObject} context['aggregate'] = search_keys context = doSearch(context, prmz, request) else: context = setConstants({}, prmz, request) loginfo(logger, 'start skeleton search', context, request) context['additionalInfo'] = AdditionalInfo.objects.filter(live=True) context['extra_nav'] = {'href': '../search', 'id': 'search', 'name': 'Metadata Search'} return render(request, 'osteo.html', context)
def get_item(request, itemid): searchfield = '' for i in prmz.FIELDS['Search']: if 'objectno' in i['fieldtype']: searchfield = i['name'] break requestObject = {searchfield: itemid, 'resultsOnly': 'true', 'displayType': 'full'} form = forms.Form(requestObject) if form.is_valid(): context = {'searchValues': requestObject} context = doSearch(context, prmz, request) loginfo(logger, 'results.%s' % context['displayType'], context, request) return render(request, 'search.html', context)
def index(request): context = setConstants({}, prmz) # http://blog.mobileesp.com/ # the middleware must be installed for the following to work... if request.is_phone: context['device'] = 'phone' elif request.is_tablet: context['device'] = 'tablet' else: context['device'] = 'other' if request.method == 'GET': context['searchValues'] = request.GET prmz.MAXFACETS = 0 if 'keyword' in request.GET: context['keyword'] = request.GET['keyword'] if 'accession' in request.GET: context['accession'] = request.GET['accession'] context['maxresults'] = 1 if 'submit' in request.GET: context['maxresults'] = prmz.MAXRESULTS if "Metadata" in request.GET['submit']: context['resultType'] = 'metadata' context['displayType'] = 'full' elif "Images" in request.GET['submit']: context['resultType'] = 'images' context['pixonly'] = 'true' context['displayType'] = 'grid' elif "Lucky" in request.GET['submit']: context['resultType'] = 'metadata' context['maxresults'] = 1 else: context['resultType'] = 'metadata' # do search loginfo(logger, 'start imaginator search', context, request) context = doSearch(context, prmz) context['additionalInfo'] = AdditionalInfo.objects.filter(live=True) return render(request, 'imagineImages.html', context) else: return render(request, 'imagineImages.html', context)
def facetJSON(request): if request.method == 'GET' and request.GET != {}: requestObject = dict(request.GET.iteritems()) form = forms.Form(requestObject) if form.is_valid(): context = {'searchValues': requestObject} context = doSearch(context, prmz, request) loginfo(logger, 'results.%s' % context['displayType'], context, request) #del context['FIELDS'] #del context['facets'] if not 'items' in context: return accesscontrolalloworigin(json.dumps('error')) else: return accesscontrolalloworigin(json.dumps({'facets': context['facets'],'fields': context['fields']})) else: return accesscontrolalloworigin(json.dumps('no data seen'))
def retrieveJSON(request): if request.method == 'GET' and request.GET != {}: requestObject = dict(request.GET.iteritems()) form = forms.Form(requestObject) if form.is_valid(): context = {'searchValues': requestObject} context = doSearch(context, prmz, request) loginfo(logger, 'results.%s' % context['displayType'], context, request) #del context['FIELDS'] #del context['facets'] if not 'items' in context: return HttpResponse(json.dumps('error')) else: return HttpResponse(json.dumps({'items': context['items'],'labels': context['labels']})) else: return HttpResponse(json.dumps('no data seen'))
def images(request): context = setConstants({}, prmz, request) # http://blog.mobileesp.com/ # the middleware must be installed for the following to work... if request.is_phone: context['device'] = 'phone' elif request.is_tablet: context['device'] = 'tablet' else: context['device'] = 'other' if request.method == 'GET' and request.GET != {}: context['searchValues'] = request.GET prmz.MAXFACETS = 0 if 'keyword' in request.GET: context['keyword'] = request.GET['keyword'] if 'accession' in request.GET: context['accession'] = request.GET['accession'] context['maxresults'] = 1 context['maxresults'] = prmz.MAXRESULTS # use the grid display fields (we only show two of the required ones) context['displayType'] = 'grid' # it's an image browser, so only return items with images... context['pixonly'] = 'true' # do search loginfo(logger, 'start imagebrowser search', context, request) context = doSearch(context, prmz, request) context['additionalInfo'] = AdditionalInfo.objects.filter(live=True) return render(request, 'showImages.html', context) else: context = setConstants({}, prmz, request) context['pgNum'] = 10 context['maxresults'] = 20 return render(request, 'showImages.html', context)
def index(request): context = setConstants({}, prmz, request) if request.method == 'GET': context['searchValues'] = request.GET prmz.MAXFACETS = 0 # default display type is Full context['displayType'] = 'full' if 'keyword' in request.GET: context['keyword'] = request.GET['keyword'] if 'accession' in request.GET: context['accession'] = request.GET['accession'] context['maxresults'] = 1 if 'submit' in request.GET: context['maxresults'] = prmz.MAXRESULTS if "Metadata" in request.GET['submit']: context['resultType'] = 'metadata' elif "Images" in request.GET['submit']: context['resultType'] = 'images' context['pixonly'] = 'true' elif "Lucky" in request.GET['submit']: context['resultType'] = 'metadata' context['maxresults'] = 1 else: context['resultType'] = 'metadata' # do search loginfo('imaginator', 'start imaginator search', context, request) context = doSearch(context, prmz, request) context['additionalInfo'] = AdditionalInfo.objects.filter(live=True) return render(request, 'imagineImages.html', context) else: return render(request, 'imagineImages.html', context)
def index(request): context = setConstants({}, prmz, request) if request.method == 'GET': context['searchValues'] = request.GET prmz.MAXFACETS = 0 if 'keyword' in request.GET: context['keyword'] = request.GET['keyword'] if 'accession' in request.GET: context['accession'] = request.GET['accession'] context['maxresults'] = 1 if 'submit' in request.GET: context['maxresults'] = prmz.MAXRESULTS if "Metadata" in request.GET['submit']: context['resultType'] = 'metadata' context['displayType'] = 'full' elif "Images" in request.GET['submit']: context['resultType'] = 'images' context['pixonly'] = 'true' context['displayType'] = 'grid' elif "Lucky" in request.GET['submit']: context['resultType'] = 'metadata' context['maxresults'] = 1 else: context['resultType'] = 'metadata' # do search loginfo(logger, 'start imaginator search', context, request) context = doSearch(context, prmz, request) context['additionalInfo'] = AdditionalInfo.objects.filter(live=True) return render(request, 'imagineImages.html', context) else: return render(request, 'imagineImages.html', context)
def setup_solr_search(queryterms, context, prmz, request): context['searchValues']['querystring'] = ' OR '.join(queryterms) context['searchValues']['url'] = '' context['searchValues']['maxresults'] = prmz.MAXRESULTS loginfo(logger, 'start grouper search', context, request) return doSearch(context, prmz, request)
def curator(request): context = { 'additionalInfo': AdditionalInfo.objects.filter(live=True), 'maxresults': prmz.MAXRESULTS } if request.method == 'GET': context['score'] = 0 context['wrong'] = 0 context['right'] = 0 context['start'] = 0 if 'pane' in request.POST: if request.POST['pane'] == 'guess': context['searchValues'] = request.POST context['count'] = 0 prmz.MAXFACETS = 20 # default display type is Grid if 'score' in request.POST: context['score'] = int(request.POST['score']) context['right'] = int(request.POST['right']) context['wrong'] = int(request.POST['wrong']) if 'keyword' in request.POST: context['keyword'] = request.POST['keyword'] if 'accession' in request.POST: context['accession'] = request.POST['accession'] context['maxresults'] = 1 if 'pixonly' in request.POST: context['pixonly'] = 'true' else: context['pixonly'] = 'false' if 'submit' in request.POST: if "Seed" == request.POST[ 'submit'] or "Metadata" in request.POST['submit']: context['resultType'] = 'oddthingout' elif "selectfields" in request.POST['submit']: context['resultType'] = 'question' elif "Start" in request.POST[ 'submit'] or "Next" in request.POST['submit']: context['resultType'] = 'question' elif "Images" in request.POST['submit']: context['resultType'] = 'images' context['pixonly'] = 'true' elif "Lucky" in request.POST['submit']: context['resultType'] = 'metadata' context['maxresults'] = 1 else: context['resultType'] = 'metadata' loginfo('curator', 'start curator search', context, request) context = doSearch(context, prmz, request) context['start'] = int(request.POST['start']) + 1 if context['count'] >= 1000: number_in_play = min(prmz.MAXRESULTS, context['count']) number_of_items = 6 max_number_of_sets = 15 context['questions'] = organize(context['items'], number_of_items, max_number_of_sets) #context['questions'] = organize(context['items'], 6, int(request.POST['sets'])) else: context[ 'errormsg'] = 'need to find at least 1000 objects to play!' # record_range = random.sample(range(number_in_play - 1), number_of_items) # context['items'] = [context['items'][i] for i in record_range] pass # context['items'] = context['items'][0] return render(request, 'curator.html', context) else: return render(request, 'curator.html', context)
def setup_solr_search(queryterms, context, prmz, request): context['searchValues']['querystring'] = ' OR '.join(queryterms) context['searchValues']['url'] = '' context['searchValues']['maxresults'] = prmz.MAXRESULTS loginfo('grouper', 'start grouper search', context, request) return doSearch(context, prmz, request)