Exemplo n.º 1
0
def process(request,*kw,**kwargs):
    if request.method == 'GET':
        if 'select' in request.GET:             #via menu, go to select form
            formout = forms.SelectProcess()
            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 '2incoming' in request.POST:        #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,soort='fromprocess')
            return incoming(request)
        elif '2outgoing' in request.POST:        #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,soort='fromprocess')
            return outgoing(request)
        elif 'fromselect' in request.POST:        #coming from select criteria screen
            formin = forms.SelectProcess(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
        else:
            formin = forms.ViewProcess(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
            elif '2select' in request.POST:         #coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectProcess(formin.cleaned_data)
                return viewlib.render(request,formout)
            else:                                    #coming from ViewIncoming
                viewlib.handlepagination(request.POST,formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.ta.objects.filter(status=PROCESS,statust=ERROR)
    pquery = viewlib.filterquery(query,cleaned_data)
    formout = forms.ViewProcess(initial=cleaned_data)
    return viewlib.render(request,formout,pquery)
Exemplo n.º 2
0
def confirm(request, *kw, **kwargs):
    if request.method == "GET":
        if "select" in request.GET:  # via menu, go to select form
            formout = forms.SelectConfirm()
            return viewlib.render(request, formout)
        else:  # via menu, go to view form for last run
            cleaned_data = {"page": 1, "sortedby": "ts", "sortedasc": False}
    else:  # request.method == 'POST'
        if "2incoming" in request.POST:  # coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST, type="confirm2in")
            return incoming(request)
        elif "2outgoing" in request.POST:  # coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST, type="confirm2out")
            return outgoing(request)
        elif "fromselect" in request.POST:  # coming from select criteria screen
            formin = forms.SelectConfirm(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
        else:
            formin = forms.ViewConfirm(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
            elif (
                "2select" in request.POST
            ):  # coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectConfirm(formin.cleaned_data)
                return viewlib.render(request, formout)
            else:  # coming from ViewIncoming
                viewlib.handlepagination(request.POST, formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.ta.objects.filter(confirmasked=True).all()
    pquery = viewlib.filterquery(query, cleaned_data)
    formout = forms.ViewConfirm(initial=cleaned_data)
    return viewlib.render(request, formout, pquery)
Exemplo n.º 3
0
def document(request,*kw,**kwargs):
    if request.method == 'GET':
        if 'select' in request.GET:             #via menu, go to select form
            formout = forms.SelectDocument()
            return viewlib.render(request,formout)
        else:                                   #via menu, parse recevied parameters
            cleaned_data = {'page':1,'sortedby':'idta','sortedasc':False}
            cleaned_data['lastrun'] = bool(int(request.GET.get('lastrun',0)))
            cleaned_data['status'] = int(request.GET.get('status',0))
    else:                                  # request.method == 'POST'
        if 'fromselect' in request.POST:        #coming from select criteria screen
            formin = forms.SelectDocument(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
        else:
            formin = forms.ViewDocument(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
            if '2select' in request.POST:         #coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectDocument(formin.cleaned_data)
                return viewlib.render(request,formout)
            elif 'retransmit' in request.POST:        #coming from Documents, no reportidta
                idta = request.POST[u'retransmit']
                filereport = models.filereport.objects.get(idta=int(idta),statust=DONE)
                filereport.retransmit = not filereport.retransmit
                filereport.save()
            else:                                    #coming from ViewIncoming
                viewlib.handlepagination(request.POST,formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.ta.objects.filter(django.db.models.Q(status=SPLITUP)|django.db.models.Q(status=TRANSLATED))
    pquery = viewlib.filterquery(query,cleaned_data)
    viewlib.trace_document(pquery)
    formout = forms.ViewDocument(initial=cleaned_data)
    return viewlib.render(request,formout,pquery)
Exemplo n.º 4
0
def confirm(request, *kw, **kwargs):
    if request.method == 'GET':
        if 'select' in request.GET:  #via menu, go to select form
            formout = forms.SelectConfirm()
            return viewlib.render(request, formout)
        else:  #via menu, go to view form for last run
            cleaned_data = {'page': 1, 'sortedby': 'ts', 'sortedasc': False}
    else:  # request.method == 'POST'
        if '2incoming' in request.POST:  #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,
                                                        type='confirm2in')
            return incoming(request)
        elif '2outgoing' in request.POST:  #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,
                                                        type='confirm2out')
            return outgoing(request)
        elif 'fromselect' in request.POST:  #coming from select criteria screen
            formin = forms.SelectConfirm(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
        else:
            formin = forms.ViewConfirm(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
            elif '2select' in request.POST:  #coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectConfirm(formin.cleaned_data)
                return viewlib.render(request, formout)
            else:  #coming from ViewIncoming
                viewlib.handlepagination(request.POST, formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.ta.objects.filter(confirmasked=True).all()
    pquery = viewlib.filterquery(query, cleaned_data)
    formout = forms.ViewConfirm(initial=cleaned_data)
    return viewlib.render(request, formout, pquery)
Exemplo n.º 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)
Exemplo n.º 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)
        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)
Exemplo n.º 7
0
def outgoing(request,*kw,**kwargs):
    if request.method == 'GET':
        if 'select' in request.GET:             #via menu, go to select form
            formout = forms.SelectOutgoing()
            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 '2incoming' in request.POST:        #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,soort='out2in')
            return incoming(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='out2confirm')
            return process(request)
        elif 'fromselect' in request.POST:        #coming from select criteria screen
            formin = forms.SelectOutgoing(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
        else:
            formin = forms.ViewOutgoing(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
            elif '2select' in request.POST:         #coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectOutgoing(formin.cleaned_data)
                return viewlib.render(request,formout)
            elif 'retransmit' in request.POST:        #coming from ViewIncoming
                ta_object = models.ta.objects.get(idta=int(request.POST[u'retransmit']))
                if ta_object.statust != RESEND:     #can only resend last file
                    ta_object.retransmit = not ta_object.retransmit
                    ta_object.save()
            elif 'resendall' in request.POST:
                #select all objects with parameters and set retransmit
                query = models.ta.objects.filter(status=EXTERNOUT)
                outgoingfiles = viewlib.filterquery2(query,formin.cleaned_data)
                for outgoingfile in outgoingfiles:       #can only resend last file
                    if outgoingfile.statust != RESEND:
                        outgoingfile.retransmit = not outgoingfile.retransmit
                        outgoingfile.save()
            elif 'noautomaticretry' in request.POST:        #coming from ViewIncoming
                ta_object = models.ta.objects.get(idta=int(request.POST[u'noautomaticretry']))
                if ta_object.statust == ERROR:
                    ta_object.statust = NO_RETRY
                    ta_object.save()
            else:                                    #coming from ViewIncoming
                viewlib.handlepagination(request.POST,formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.ta.objects.filter(status=EXTERNOUT)
    pquery = viewlib.filterquery(query,cleaned_data)
    formout = forms.ViewOutgoing(initial=cleaned_data)
    return viewlib.render(request,formout,pquery)
Exemplo n.º 8
0
def outgoing(request, *kw, **kwargs):
    if request.method == 'GET':
        if 'select' in request.GET:  #via menu, go to select form
            formout = forms.SelectOutgoing()
            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 '2incoming' in request.POST:  #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,
                                                        type='out2in')
            return incoming(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='out2confirm')
            return process(request)
        elif 'fromselect' in request.POST:  #coming from select criteria screen
            formin = forms.SelectOutgoing(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
        else:
            formin = forms.ViewOutgoing(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
            elif '2select' in request.POST:  #coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectOutgoing(formin.cleaned_data)
                return viewlib.render(request, formout)
            elif 'retransmit' in request.POST:  #coming from ViewIncoming
                ta = models.ta.objects.get(
                    idta=int(request.POST[u'retransmit']))
                ta.retransmit = not ta.retransmit
                ta.save()
            else:  #coming from ViewIncoming
                viewlib.handlepagination(request.POST, formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.ta.objects.filter(status=EXTERNOUT, statust=DONE).all()
    pquery = viewlib.filterquery(query, cleaned_data)
    formout = forms.ViewOutgoing(initial=cleaned_data)
    return viewlib.render(request, formout, pquery)
Exemplo n.º 9
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)
Exemplo n.º 10
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)
Exemplo n.º 11
0
def reports(request, *kw, **kwargs):
    #~ print 'reports received',kw,kwargs,request.POST,request.GET
    if request.method == 'GET':
        if 'select' in request.GET:  #via menu, go to select form
            formout = forms.SelectReports()
            return viewlib.render(request, formout)
        else:  #via menu, go to view form
            cleaned_data = {'page': 1, 'sortedby': 'ts', 'sortedasc': False}
    else:  # request.method == 'POST'
        if 'fromselect' in request.POST:  #coming from select criteria screen
            formin = forms.SelectReports(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
        else:
            formin = forms.ViewReports(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
            if '2select' in request.POST:  #coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectReports(formin.cleaned_data)
                return viewlib.render(request, formout)
            elif 'report2incoming' in request.POST:  #coming from ViewIncoming, go to incoming
                request.POST = viewlib.preparereport2view(
                    request.POST, int(request.POST['report2incoming']))
                return incoming(request)
            elif 'report2outgoing' in request.POST:  #coming from ViewIncoming, go to incoming
                request.POST = viewlib.preparereport2view(
                    request.POST, int(request.POST['report2outgoing']))
                return outgoing(request)
            elif 'report2process' in request.POST:  #coming from ViewIncoming, go to incoming
                request.POST = viewlib.preparereport2view(
                    request.POST, int(request.POST['report2process']))
                return process(request)
            elif 'report2errors' in request.POST:  #coming from ViewIncoming, go to incoming
                newpost = viewlib.preparereport2view(
                    request.POST, int(request.POST['report2errors']))
                newpost['statust'] = ERROR
                request.POST = newpost
                return incoming(request)
            else:  #coming from ViewIncoming
                viewlib.handlepagination(request.POST, formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.report.objects.all()
    pquery = viewlib.filterquery(query, cleaned_data)
    formout = forms.ViewReports(initial=cleaned_data)
    return viewlib.render(request, formout, pquery)
Exemplo n.º 12
0
def outgoing(request, *kw, **kwargs):
    if request.method == "GET":
        if "select" in request.GET:  # via menu, go to select form
            formout = forms.SelectOutgoing()
            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 "2incoming" in request.POST:  # coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST, type="out2in")
            return incoming(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="out2confirm")
            return process(request)
        elif "fromselect" in request.POST:  # coming from select criteria screen
            formin = forms.SelectOutgoing(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
        else:
            formin = forms.ViewOutgoing(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
            elif (
                "2select" in request.POST
            ):  # coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectOutgoing(formin.cleaned_data)
                return viewlib.render(request, formout)
            elif "retransmit" in request.POST:  # coming from ViewIncoming
                ta = models.ta.objects.get(idta=int(request.POST[u"retransmit"]))
                ta.retransmit = not ta.retransmit
                ta.save()
            else:  # coming from ViewIncoming
                viewlib.handlepagination(request.POST, formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.ta.objects.filter(status=EXTERNOUT, statust=DONE).all()
    pquery = viewlib.filterquery(query, cleaned_data)
    formout = forms.ViewOutgoing(initial=cleaned_data)
    return viewlib.render(request, formout, pquery)
Exemplo n.º 13
0
def document(request, *kw, **kwargs):
    if request.method == 'GET':
        if 'select' in request.GET:  #via menu, go to select form
            formout = forms.SelectDocument()
            return viewlib.render(request, formout)
        elif 'all' in request.GET:  #via menu, go to all runs
            cleaned_data = {'page': 1, 'sortedby': 'idta', 'sortedasc': False}
        else:  #via menu, go to view form for last run
            cleaned_data = {
                'page': 1,
                'lastrun': True,
                'sortedby': 'idta',
                'sortedasc': False
            }
    else:  # request.method == 'POST'
        if 'fromselect' in request.POST:  #coming from select criteria screen
            formin = forms.SelectDocument(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
        else:
            formin = forms.ViewDocument(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
            elif '2select' in request.POST:  #coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectDocument(formin.cleaned_data)
                return viewlib.render(request, formout)
            elif 'retransmit' in request.POST:  #coming from Documents, no reportidta
                idta = request.POST[u'retransmit']
                filereport = models.filereport.objects.get(idta=int(idta),
                                                           statust=DONE)
                filereport.retransmit = not filereport.retransmit
                filereport.save()
            else:  #coming from ViewIncoming
                viewlib.handlepagination(request.POST, formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.ta.objects.filter(
        django.db.models.Q(status=SPLITUP)
        | django.db.models.Q(status=TRANSLATED)).all()
    pquery = viewlib.filterquery(query, cleaned_data)
    viewlib.trace_document(pquery)
    formout = forms.ViewDocument(initial=cleaned_data)
    return viewlib.render(request, formout, pquery)
Exemplo n.º 14
0
def reports(request,*kw,**kwargs):
    #~ print 'reports received',kw,kwargs,request.POST,request.GET
    if request.method == 'GET':
        if 'select' in request.GET:             #via menu, go to select form
            formout = forms.SelectReports()
            return viewlib.render(request,formout)
        else:                              #via menu, go to view form
            cleaned_data = {'page':1,'sortedby':'ts','sortedasc':False}
    else:                                  # request.method == 'POST'
        if 'fromselect' in request.POST:        #coming from select criteria screen
            formin = forms.SelectReports(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
        else:
            formin = forms.ViewReports(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
            if '2select' in request.POST:         #coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectReports(formin.cleaned_data)
                return viewlib.render(request,formout)
            elif 'report2incoming' in request.POST:         #coming from ViewIncoming, go to incoming
                request.POST = viewlib.preparereport2view(request.POST,int(request.POST['report2incoming']))
                return incoming(request)
            elif 'report2outgoing' in request.POST:         #coming from ViewIncoming, go to incoming
                request.POST = viewlib.preparereport2view(request.POST,int(request.POST['report2outgoing']))
                return outgoing(request)
            elif 'report2process' in request.POST:         #coming from ViewIncoming, go to incoming
                request.POST = viewlib.preparereport2view(request.POST,int(request.POST['report2process']))
                return process(request)
            elif 'report2errors' in request.POST:         #coming from ViewIncoming, go to incoming
                newpost = viewlib.preparereport2view(request.POST,int(request.POST['report2errors']))
                newpost['statust'] = ERROR
                request.POST = newpost
                return incoming(request)
            else:                                    #coming from ViewIncoming
                viewlib.handlepagination(request.POST,formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.report.objects.all()
    pquery = viewlib.filterquery(query,cleaned_data)
    formout = forms.ViewReports(initial=cleaned_data)
    return viewlib.render(request,formout,pquery)
Exemplo n.º 15
0
def outgoing(request,*kw,**kwargs):
    if request.method == 'GET':
        if 'select' in request.GET:             #via menu, go to select form
            formout = forms.SelectOutgoing()
            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 '2incoming' in request.POST:        #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,type='out2in')
            return incoming(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='out2confirm')
            return process(request)
        elif 'fromselect' in request.POST:        #coming from select criteria screen
            formin = forms.SelectOutgoing(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
        else:
            formin = forms.ViewOutgoing(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
            elif '2select' in request.POST:         #coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectOutgoing(formin.cleaned_data)
                return viewlib.render(request,formout)
            elif 'retransmit' in request.POST:        #coming from ViewIncoming
                ta = models.ta.objects.get(idta=int(request.POST[u'retransmit']))
                ta.retransmit = not ta.retransmit
                ta.save()
            else:                                    #coming from ViewIncoming
                viewlib.handlepagination(request.POST,formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.ta.objects.filter(status=EXTERNOUT,statust=DONE).all()
    pquery = viewlib.filterquery(query,cleaned_data)
    formout = forms.ViewOutgoing(initial=cleaned_data)
    return viewlib.render(request,formout,pquery)
Exemplo n.º 16
0
def process(request,*kw,**kwargs):
    if request.method == 'GET':
        if 'select' in request.GET:             #via menu, go to select form
            formout = forms.SelectProcess()
            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 '2incoming' in request.POST:        #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,soort='fromprocess')
            return incoming(request)
        elif '2outgoing' in request.POST:        #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,soort='fromprocess')
            return outgoing(request)
        elif 'fromselect' in request.POST:        #coming from select criteria screen
            formin = forms.SelectProcess(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
        else:
            if 'retry' in request.POST:
                idta = request.POST[u'retry']
                ta_object = models.ta.objects.get(idta=int(idta))
                ta_object.retransmit = not ta_object.retransmit
                ta_object.save()
            formin = forms.ViewProcess(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
            elif '2select' in request.POST:         #coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectProcess(formin.cleaned_data)
                return viewlib.render(request,formout)
            else:                                    #coming from ViewIncoming
                viewlib.handlepagination(request.POST,formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.ta.objects.filter(status=PROCESS,statust=ERROR).all()
    pquery = viewlib.filterquery(query,cleaned_data)
    formout = forms.ViewProcess(initial=cleaned_data)
    return viewlib.render(request,formout,pquery)
Exemplo n.º 17
0
def document(request, *kw, **kwargs):
    if request.method == "GET":
        if "select" in request.GET:  # via menu, go to select form
            formout = forms.SelectDocument()
            return viewlib.render(request, formout)
        elif "all" in request.GET:  # via menu, go to all runs
            cleaned_data = {"page": 1, "sortedby": "idta", "sortedasc": False}
        else:  # via menu, go to view form for last run
            cleaned_data = {"page": 1, "lastrun": True, "sortedby": "idta", "sortedasc": False}
    else:  # request.method == 'POST'
        if "fromselect" in request.POST:  # coming from select criteria screen
            formin = forms.SelectDocument(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
        else:
            formin = forms.ViewDocument(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
            elif (
                "2select" in request.POST
            ):  # coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectDocument(formin.cleaned_data)
                return viewlib.render(request, formout)
            elif "retransmit" in request.POST:  # coming from Documents, no reportidta
                idta = request.POST[u"retransmit"]
                filereport = models.filereport.objects.get(idta=int(idta), statust=DONE)
                filereport.retransmit = not filereport.retransmit
                filereport.save()
            else:  # coming from ViewIncoming
                viewlib.handlepagination(request.POST, formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.ta.objects.filter(django.db.models.Q(status=SPLITUP) | django.db.models.Q(status=TRANSLATED)).all()
    pquery = viewlib.filterquery(query, cleaned_data)
    viewlib.trace_document(pquery)
    formout = forms.ViewDocument(initial=cleaned_data)
    return viewlib.render(request, formout, pquery)
Exemplo n.º 18
0
def confirm(request,*kw,**kwargs):
    if request.method == 'GET':
        if 'select' in request.GET:             #via menu, go to select form
            formout = forms.SelectConfirm()
            return viewlib.render(request,formout)
        else:                              #via menu, go to view form for last run
            cleaned_data = {'page':1,'sortedby':'ts','sortedasc':False}
    else:                                  # request.method == 'POST'
        if '2incoming' in request.POST:        #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,type='confirm2in')
            return incoming(request)
        elif '2outgoing' in request.POST:        #coming from ViewIncoming, go to outgoing form using same criteria
            request.POST = viewlib.changepostparameters(request.POST,type='confirm2out')
            return outgoing(request)
        elif 'fromselect' in request.POST:        #coming from select criteria screen
            formin = forms.SelectConfirm(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
        elif 'confirm' in request.POST:        #coming from 'star' menu 'Manual confirm'
            ta = models.ta.objects.get(idta=int(request.POST[u'confirm']))
            if ta.confirmed == False and ta.confirmtype.startswith('ask'):
                ta.confirmed = True
                ta.confirmidta = '-1'   # to indicate a manual confirmation
                ta.save()
                request.user.message_set.create(message='Manual confirmed.')
            else:
                request.user.message_set.create(message='Manual confirm not possible.')
            # then just refresh the current view
            formin = forms.ViewConfirm(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
        else:
            formin = forms.ViewConfirm(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
            elif '2select' in request.POST:         #coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectConfirm(formin.cleaned_data)
                return viewlib.render(request,formout)
            else:                                    #coming from ViewIncoming
                viewlib.handlepagination(request.POST,formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.ta.objects.filter(confirmasked=True).all()
    pquery = viewlib.filterquery(query,cleaned_data)
    formout = forms.ViewConfirm(initial=cleaned_data)
    return viewlib.render(request,formout,pquery)