Exemple #1
0
def detail(request, *kw, **kwargs):
    ''' in: the idta, either as parameter in or out. 
        in: is idta of incoming file.
        out: idta of outgoing file, need to trace back for incoming file. 
        return list of ta's for display in detail template. 
        This list is formatted and ordered for display.
        first, get a tree (trace) starting with the incoming ta ;
        than make up the details for the trace
    '''
    if request.method == 'GET':
        if 'inidta' in request.GET:
            rootta = models.ta.objects.get(idta=int(request.GET['inidta']))
            viewlib.gettrace(rootta)
            detaillist = viewlib.trace2detail(rootta)
            return django.shortcuts.render_to_response(
                'bots/detail.html', {
                    'detaillist': detaillist,
                    'rootta': rootta,
                },
                context_instance=django.template.RequestContext(request))
        else:
            #trace back to root:
            rootta = viewlib.django_trace_origin(int(request.GET['outidta']),
                                                 {'status': EXTERNIN})[0]
            viewlib.gettrace(rootta)
            detaillist = viewlib.trace2detail(rootta)
            return django.shortcuts.render_to_response(
                'bots/detail.html', {
                    'detaillist': detaillist,
                    'rootta': rootta,
                },
                context_instance=django.template.RequestContext(request))
Exemple #2
0
def detail(request, *kw, **kwargs):
    """ in: the idta, either as parameter in or out. 
        in: is idta of incoming file.
        out: idta of outgoing file, need to trace back for incoming file. 
        return list of ta's for display in detail template. 
        This list is formatted and ordered for display.
        first, get a tree (trace) starting with the incoming ta ;
        than make up the details for the trace
    """
    if request.method == "GET":
        if "inidta" in request.GET:
            rootta = models.ta.objects.get(idta=int(request.GET["inidta"]))
            viewlib.gettrace(rootta)
            detaillist = viewlib.trace2detail(rootta)
            return django.shortcuts.render_to_response(
                "bots/detail.html",
                {"detaillist": detaillist, "rootta": rootta},
                context_instance=django.template.RequestContext(request),
            )
        else:
            # trace back to root:
            rootta = viewlib.django_trace_origin(int(request.GET["outidta"]), {"status": EXTERNIN})[0]
            viewlib.gettrace(rootta)
            detaillist = viewlib.trace2detail(rootta)
            return django.shortcuts.render_to_response(
                "bots/detail.html",
                {"detaillist": detaillist, "rootta": rootta},
                context_instance=django.template.RequestContext(request),
            )
Exemple #3
0
def incoming(request, *kw, **kwargs):
    if request.method == 'GET':
        if 'select' in request.GET:  #via menu, go to select form
            formout = forms.SelectIncoming()
            return viewlib.render(request, formout)
        elif 'all' in request.GET:  #via menu, go to all runs
            cleaned_data = {'page': 1, 'sortedby': 'ts', 'sortedasc': False}
        else:  #via menu, go to view form for last run
            cleaned_data = {
                'page': 1,
                'lastrun': True,
                'sortedby': 'ts',
                'sortedasc': False
            }
    else:  # request.method == 'POST'
        if '2outgoing' in request.POST:  #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,
                                                        type='in2out')
            return outgoing(request)
        elif '2process' in request.POST:  #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,
                                                        type='2process')
            return process(request)
        elif '2confirm' in request.POST:  #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,
                                                        type='in2confirm')
            return process(request)
        elif 'fromselect' in request.POST:  #coming from select criteria screen
            formin = forms.SelectIncoming(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
        else:  #coming from ViewIncoming
            formin = forms.ViewIncoming(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
            elif '2select' in request.POST:  #go to select form using same criteria
                formout = forms.SelectIncoming(formin.cleaned_data)
                return viewlib.render(request, formout)
            elif 'retransmit' in request.POST:  #coming from ViewIncoming
                idta, reportidta = request.POST[u'retransmit'].split('-')
                filereport = models.filereport.objects.get(
                    idta=int(idta), reportidta=int(reportidta))
                filereport.retransmit = not filereport.retransmit
                filereport.save()
            elif 'delete' in request.POST:  #coming from ViewIncoming
                idta = int(request.POST[u'delete'])
                #~ query = models.filereport.objects.filter(idta=int(idta)).all().delete()
                models.filereport.objects.filter(idta=idta).delete()
                ta = models.ta.objects.get(idta=idta)
                viewlib.gettrace(ta)
                viewlib.trace2delete(ta)
            else:  #coming from ViewIncoming
                viewlib.handlepagination(request.POST, formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.filereport.objects.all()
    pquery = viewlib.filterquery(query, cleaned_data, incoming=True)
    formout = forms.ViewIncoming(initial=cleaned_data)
    return viewlib.render(request, formout, pquery)
Exemple #4
0
def incoming(request,*kw,**kwargs):
    if request.method == 'GET':
        if 'select' in request.GET:             #via menu, go to select form
            formout = forms.SelectIncoming()
            return viewlib.render(request,formout)
        else:                                   #via menu, parse recevied parameters
            cleaned_data = {'page':1,'sortedby':'idta','sortedasc':False,'lastrun':bool(int(request.GET.get('lastrun',0)))}
    else:                                  # request.method == 'POST'
        if '2outgoing' in request.POST:        #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,soort='in2out')
            return outgoing(request)
        elif '2process' in request.POST:        #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,soort='2process')
            return process(request)
        elif '2confirm' in request.POST:        #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,soort='in2confirm')
            return process(request)
        elif 'fromselect' in request.POST:        #coming from select criteria screen
            formin = forms.SelectIncoming(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
        else:                                   #coming from ViewIncoming
            formin = forms.ViewIncoming(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
            elif '2select' in request.POST:         #go to select form using same criteria
                formout = forms.SelectIncoming(formin.cleaned_data)
                return viewlib.render(request,formout)
            elif 'delete' in request.POST:        #coming from ViewIncoming
                idta = int(request.POST[u'delete'])
                #~ query = models.filereport.objects.filter(idta=int(idta)).all().delete()
                models.filereport.objects.filter(idta=idta).delete()
                ta_object = models.ta.objects.get(idta=idta)
                viewlib.gettrace(ta_object)
                viewlib.trace2delete(ta_object)
            elif 'retransmit' in request.POST:
                idta = request.POST[u'retransmit']
                filereport = models.filereport.objects.get(idta=int(idta))
                if filereport.fromchannel:   #for resend files fromchannel has no value. (do not rereceive resend items)
                    filereport.retransmit = not filereport.retransmit
                    filereport.save()
            elif 'rereceiveall' in request.POST:
                #select all objects with parameters and set retransmit
                query = models.filereport.objects.all()
                incomingfiles = viewlib.filterquery2(query,formin.cleaned_data)
                for incomingfile in incomingfiles:   #for resend files fromchannel has no value. (do not rereceive resend items)
                    if incomingfile.fromchannel:
                        incomingfile.retransmit = not incomingfile.retransmit
                        incomingfile.save()
            else:                                    #coming from ViewIncoming
                viewlib.handlepagination(request.POST,formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.filereport.objects.all()
    pquery = viewlib.filterquery(query,cleaned_data,incoming=True)
    formout = forms.ViewIncoming(initial=cleaned_data)
    return viewlib.render(request,formout,pquery)
Exemple #5
0
def incoming(request,*kw,**kwargs):
    if request.method == 'GET':
        if 'select' in request.GET:             #via menu, go to select form
            formout = forms.SelectIncoming()
            return viewlib.render(request,formout)
        elif 'all' in request.GET:             #via menu, go to all runs
            cleaned_data = {'page':1,'sortedby':'ts','sortedasc':False}
        else:                              #via menu, go to view form for last run
            cleaned_data = {'page':1,'lastrun':True,'sortedby':'ts','sortedasc':False}
    else:                                  # request.method == 'POST'
        if '2outgoing' in request.POST:        #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,type='in2out')
            return outgoing(request)
        elif '2process' in request.POST:        #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,type='2process')
            return process(request)
        elif '2confirm' in request.POST:        #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,type='in2confirm')
            return process(request)
        elif 'fromselect' in request.POST:        #coming from select criteria screen
            formin = forms.SelectIncoming(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
        else:                                   #coming from ViewIncoming
            formin = forms.ViewIncoming(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
            elif '2select' in request.POST:         #go to select form using same criteria
                formout = forms.SelectIncoming(formin.cleaned_data)
                return viewlib.render(request,formout)
            elif 'retransmit' in request.POST:        #coming from ViewIncoming
                idta,reportidta = request.POST[u'retransmit'].split('-')
                filereport = models.filereport.objects.get(idta=int(idta),reportidta=int(reportidta))
                filereport.retransmit = not filereport.retransmit
                filereport.save()
            elif 'delete' in request.POST:        #coming from ViewIncoming
                idta = int(request.POST[u'delete'])
                #~ query = models.filereport.objects.filter(idta=int(idta)).all().delete()
                models.filereport.objects.filter(idta=idta).delete()
                ta = models.ta.objects.get(idta=idta)
                viewlib.gettrace(ta)
                viewlib.trace2delete(ta)
            else:                                    #coming from ViewIncoming
                viewlib.handlepagination(request.POST,formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.filereport.objects.all()
    pquery = viewlib.filterquery(query,cleaned_data,incoming=True)
    formout = forms.ViewIncoming(initial=cleaned_data)
    return viewlib.render(request,formout,pquery)
Exemple #6
0
def incoming(request, *kw, **kwargs):
    if request.method == "GET":
        if "select" in request.GET:  # via menu, go to select form
            formout = forms.SelectIncoming()
            return viewlib.render(request, formout)
        elif "all" in request.GET:  # via menu, go to all runs
            cleaned_data = {"page": 1, "sortedby": "ts", "sortedasc": False}
        else:  # via menu, go to view form for last run
            cleaned_data = {"page": 1, "lastrun": True, "sortedby": "ts", "sortedasc": False}
    else:  # request.method == 'POST'
        if "2outgoing" in request.POST:  # coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST, type="in2out")
            return outgoing(request)
        elif "2process" in request.POST:  # coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST, type="2process")
            return process(request)
        elif "2confirm" in request.POST:  # coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST, type="in2confirm")
            return process(request)
        elif "fromselect" in request.POST:  # coming from select criteria screen
            formin = forms.SelectIncoming(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
        else:  # coming from ViewIncoming
            formin = forms.ViewIncoming(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
            elif "2select" in request.POST:  # go to select form using same criteria
                formout = forms.SelectIncoming(formin.cleaned_data)
                return viewlib.render(request, formout)
            elif "retransmit" in request.POST:  # coming from ViewIncoming
                idta, reportidta = request.POST[u"retransmit"].split("-")
                filereport = models.filereport.objects.get(idta=int(idta), reportidta=int(reportidta))
                filereport.retransmit = not filereport.retransmit
                filereport.save()
            elif "delete" in request.POST:  # coming from ViewIncoming
                idta = int(request.POST[u"delete"])
                # ~ query = models.filereport.objects.filter(idta=int(idta)).all().delete()
                models.filereport.objects.filter(idta=idta).delete()
                ta = models.ta.objects.get(idta=idta)
                viewlib.gettrace(ta)
                viewlib.trace2delete(ta)
            else:  # coming from ViewIncoming
                viewlib.handlepagination(request.POST, formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.filereport.objects.all()
    pquery = viewlib.filterquery(query, cleaned_data, incoming=True)
    formout = forms.ViewIncoming(initial=cleaned_data)
    return viewlib.render(request, formout, pquery)
Exemple #7
0
def detail(request,*kw,**kwargs):
    ''' in: the idta, either as parameter in or out.
        in: is idta of incoming file.
        out: idta of outgoing file, need to trace back for incoming file.
        return list of ta's for display in detail template.
        This list is formatted and ordered for display.
        first, get a tree (trace) starting with the incoming ta ;
        than make up the details for the trace
    '''
    if request.method == 'GET':
        if 'inidta' in request.GET: #detail for incoming screen
            rootta = models.ta.objects.get(idta=int(request.GET['inidta']))
        else:                       #detail for outgoing: trace back to EXTERNIN first
            rootta = viewlib.django_trace_origin(int(request.GET['outidta']),{'status':EXTERNIN})[0]
        viewlib.gettrace(rootta)
        detaillist = viewlib.trace2detail(rootta)
        return django.shortcuts.render_to_response('bots/detail.html', {'detaillist':detaillist,'rootta':rootta,},context_instance=django.template.RequestContext(request))