Exemplo n.º 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)
Exemplo n.º 2
0
def search(request):
    if request.method == 'GET' and request.GET != {}:
        context = {'searchValues': dict(request.GET.iteritems())}
        context = doSearch(context)

    else:
        context = setConstants({})

    loginfo('start search', context, request)
    context['additionalInfo'] = AdditionalInfo.objects.filter(live=True)
    return render(request, 'search.html', context)
Exemplo n.º 3
0
def search(request):
    if request.method == 'GET' and request.GET != {}:
        context = {'searchValues': dict(request.GET.iteritems())}
        context = doSearch(context)

    else:
        context = setConstants({})

    loginfo('start search', context, request)
    context['additionalInfo'] = AdditionalInfo.objects.filter(live=True)
    return render(request, 'search.html', context)
Exemplo n.º 4
0
def embeddedsearch(request):
    if request.method == 'GET' and request.GET != {}:
        context = {'searchValues': request.GET}
        context = doSearch(SOLRSERVER, SOLRCORE, context)

        global SEARCHRESULTS
        SEARCHRESULTS = context
    else:
        context = {}

    context = setConstants(context)
    loginfo('start search', context, request)
    return render(request, 'public_embeddedsearch.html', context)
Exemplo n.º 5
0
def publicsearch(request):
    if request.method == 'GET' and request.GET != {}:
        context = {'searchValues': request.GET}
        context = doSearch(SOLRSERVER, SOLRCORE, context)

        global SEARCHRESULTS
        SEARCHRESULTS = context
    else:
        context = {}

    context = setConstants(context)
    loginfo('start search', context, request)
    return render(request, 'publicsearch.html', context)
Exemplo n.º 6
0
def search(request):
    if request.method == 'GET' and request.GET != {}:
        context = {'searchValues': request.GET}
        context = doSearch(context)

        #global SEARCHRESULTS
        #SEARCHRESULTS = context
    else:
        context = {}

    context = setConstants(context)
    loginfo('start search', context, request)
    return render(request, 'search.html', context)
Exemplo n.º 7
0
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(SOLRSERVER, SOLRCORE, context)

            global SEARCHRESULTS
            SEARCHRESULTS = context

            context = setConstants(context)

        loginfo('results.%s' % context['displayType'], context, request)
        return render(request, 'public_searchResults.html', context)
Exemplo n.º 8
0
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(SOLRSERVER, SOLRCORE, context)

            global SEARCHRESULTS
            SEARCHRESULTS = context

            context = setConstants(context)

        loginfo('results.%s' % context['displayType'], context, request)
        return render(request, 'searchResults.html', context)
Exemplo n.º 9
0
def tool(request, appname):
    # if we are here, we have been given a particular appname, e.g. "keyinfo", as part of the url
    context = {'applayout': appLayout[appname]}
    if request.method == 'POST':
        form = forms.Form(request.POST)

        if form.is_valid():
            loginfo(appname, context, request)
            context = Dispatch(context, request)
    else:
        form = forms.Form()

    context['form'] = form
    context = setConstants(context, appname)
    loginfo(appname, context, request)
    context['additionalInfo'] = AdditionalInfo.objects.filter(live=True)
    return render(request, 'toolbox.html', context)
Exemplo n.º 10
0
def tool(request, appname):
    # if we are here, we have been given a particular appname, e.g. "keyinfo", as part of the url
    context = {'applayout': appLayout[appname]}
    if request.method == 'POST':
        form = forms.Form(request.POST)

        if form.is_valid():
            loginfo(appname, context, request)
            context = Dispatch(context, request)
    else:
        form = forms.Form()

    context['form'] = form
    context = setConstants(context, appname)
    loginfo(appname, context, request)
    context['additionalInfo'] = AdditionalInfo.objects.filter(live=True)
    return render(request, 'toolbox.html', context)
Exemplo n.º 11
0
def edit(request, entity, csid):

    context = {}
    if request.method == 'GET':
        requestObject = request.GET
        form = forms.Form(requestObject)

        if form.is_valid():
            context['entity'] = entity
            context['csid'] = csid
            loginfo(entity, context, request)
            context = doEdit(request,context)
    else:
        pass

    context = setConstants(context)
    loginfo(entity, context, request)
    return render(request, 'edit.html', context)
Exemplo n.º 12
0
def index(request):
    context = setConstants({'entity' : 'listentities', 'entitytypes' : getEntityList()})
    return render(request, 'edit.html', context)
Exemplo n.º 13
0
def loadNewFields(request, fieldfile):
    loadFields(fieldfile + '.csv')

    context = setConstants({})
    loginfo('loaded fields', context, request)
    return render(request, 'search.html', context)
Exemplo n.º 14
0
def index(request):
    # APPS is a dict of configured webapps, show the list sorted by "app title"
    sorted_apps = sorted(APPS.items(), key=operator.itemgetter(1))
    context = setConstants({'apps': sorted_apps}, 'listapps')
    context['additionalInfo'] = AdditionalInfo.objects.filter(live=True)
    return render(request, 'toolbox.html', context)
Exemplo n.º 15
0
def index(request):
    # APPS is a dict of configured webapps, show the list sorted by "app title"
    sorted_apps = sorted(APPS.items(), key=operator.itemgetter(1))
    context = setConstants({'apps': sorted_apps}, 'listapps')
    context['additionalInfo'] = AdditionalInfo.objects.filter(live=True)
    return render(request, 'toolbox.html', context)
Exemplo n.º 16
0
def loadNewFields(request, fieldfile):
    loadFields(fieldfile + '.csv')

    context = setConstants({})
    loginfo('loaded fields', context, request)
    return render(request, 'search.html', context)