예제 #1
0
def publicsearch(request):

    if request.method == 'GET':
        requestObject = request.GET
    elif request.method == 'POST':
        requestObject = request.POST
    else:
        pass
        #error!

    context = {'items': [], 'searchValues': requestObject, 'displayType': setDisplayType(requestObject)}
    if requestObject != {}:
        form = forms.Form(requestObject)

        if form.is_valid() or request.method == 'GET':

            context = doSearch(SOLRSERVER, SOLRCORE, context)

            if 'csv' in requestObject:
                # Create the HttpResponse object with the appropriate CSV header.
                response = HttpResponse(content_type='text/csv')
                response['Content-Disposition'] = 'attachment; filename="ucjeps.csv"'
                #response.write(u'\ufeff'.encode('utf8'))
                writeCsv(response,context['items'],writeheader=True)
                return response
            elif 'map-bmapper' in requestObject:
                context = setupBMapper(requestObject, context)
            elif 'map-google' in requestObject:
                context = setupGoogleMap(requestObject, context)
            elif 'email' in requestObject:
                pass

    context = setConstants(requestObject, context)

    return render(request, 'publicsearch.html', context)
예제 #2
0
def gmapper(request):
    if request.method == 'POST' and request.POST != {}:
        requestObject = request.POST
        form = forms.Form(requestObject)

        if form.is_valid():
            context = SEARCHRESULTS
            context = setupGoogleMap(requestObject, context)

            loginfo('gmapper', context, request)
            return render(request, 'public_maps.html', context)
예제 #3
0
def gmapper(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 = setupGoogleMap(requestObject, context)

            loginfo('gmapper', context, request)
            return render(request, 'maps.html', context)
예제 #4
0
def gmapper(request):
    if request.method == 'POST' and request.POST != {}:
        requestObject = request.POST
        form = forms.Form(requestObject)

        if form.is_valid():
            context = SEARCHRESULTS
            context = setupGoogleMap(requestObject, context)

            loginfo('gmapper', context, request)
            return render(request, 'maps.html', context)
예제 #5
0
def gmapper(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 = setupGoogleMap(requestObject, context)

            loginfo('gmapper', context, request)
            return render(request, 'maps.html', context)