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)
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)
def process(request,*kw,**kwargs): if request.method == 'GET': if 'select' in request.GET: #from menu:select->process form = forms.SelectProcess() return django.shortcuts.render(request, form.template, {'form': form}) else: #from menu:run->process cleaned_data = {'page':1,'sortedby':'idta','sortedasc':False,'lastrun':bool(viewlib.save_int(request.GET.get('lastrun',0)))} #go to default process-query using these default parameters else: #request.method == 'POST' if 'fromselect' in request.POST: #from SelectProcess form formin = forms.SelectProcess(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) elif '2incoming' in request.POST: #coming from ViewProcess, go to incoming form using same criteria request.POST = viewlib.changepostparameters(request.POST,soort='fromprocess') return incoming(request) elif '2outgoing' in request.POST: #coming from ViewProcess, go to outgoing form using same criteria request.POST = viewlib.changepostparameters(request.POST,soort='fromprocess') return outgoing(request) else: formin = forms.ViewProcess(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) elif '2select' in request.POST: #coming from ViewProcess, change the selection criteria, go to select form form = forms.SelectProcess(formin.cleaned_data) return django.shortcuts.render(request, form.template, {'form': form}) else: #coming from ViewProcess viewlib.handlepagination(request.POST,formin.cleaned_data) cleaned_data = formin.cleaned_data #normal process-query with parameters query = models.ta.objects.filter(status=PROCESS,statust=ERROR) pquery = viewlib.filterquery(query,cleaned_data) form = forms.ViewProcess(initial=cleaned_data) return django.shortcuts.render(request, form.template, {'form': form,'queryset':pquery})
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)
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)
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)
def outgoing(request,*kw,**kwargs): if request.method == 'GET': if 'select' in request.GET: #from menu:select->outgoing form = forms.SelectOutgoing() return django.shortcuts.render(request, form.template, {'form': form}) else: #from menu:run->outgoing cleaned_data = {'page':1,'sortedby':'idta','sortedasc':False,'lastrun':bool(viewlib.save_int(request.GET.get('lastrun',0)))} #go to default outgoing-query using these default parameters else: #request.method == 'POST' if 'fromselect' in request.POST: #from SelectOutgoing form formin = forms.SelectOutgoing(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) #go to default outgoing-query using parameters from select screen elif '2incoming' in request.POST: #from ViewOutgoing form, using button 'incoming (same selection)' request.POST = viewlib.changepostparameters(request.POST,soort='out2in') return incoming(request) elif '2process' in request.POST: #from ViewOutgoing form, using button 'process errors (same selection)' request.POST = viewlib.changepostparameters(request.POST,soort='2process') return process(request) elif '2confirm' in request.POST: #from ViewOutgoing form, using button 'confirm (same selection)' request.POST = viewlib.changepostparameters(request.POST,soort='out2confirm') return confirm(request) else: #from ViewOutgoing form, check this form first formin = forms.ViewOutgoing(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) elif '2select' in request.POST: #from ViewOutgoing form using button change selection form = forms.SelectOutgoing(formin.cleaned_data) return django.shortcuts.render(request, form.template, {'form': form}) elif 'retransmit' in request.POST: #from ViewOutgoing form using star resend ta_object = models.ta.objects.get(idta=viewlib.save_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: #from ViewOutgoing form using button 'resend all' #select all objects with parameters and set retransmit query = models.ta.objects.filter(status=EXTERNOUT) outgoingfiles = viewlib.filterquery(query,formin.cleaned_data,paginate=False) 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: #from ViewOutgoing form using star 'no automaticretry' ta_object = models.ta.objects.get(idta=viewlib.save_int(request.POST[u'noautomaticretry'])) if ta_object.statust == ERROR: ta_object.statust = NO_RETRY ta_object.save() else: #from ViewIncoming, next page etc viewlib.handlepagination(request.POST,formin.cleaned_data) cleaned_data = formin.cleaned_data #normal outgoing-query with parameters query = models.ta.objects.filter(status=EXTERNOUT) pquery = viewlib.filterquery(query,cleaned_data) form = forms.ViewOutgoing(initial=cleaned_data) return django.shortcuts.render(request, form.template, {'form': form,'queryset':pquery})
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)
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)
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)
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)
def process(request, *kw, **kwargs): if request.method == 'GET': if 'select' in request.GET: #from menu:select->process form = forms.SelectProcess() return django.shortcuts.render(request, form.template, {'form': form}) else: #from menu:run->process cleaned_data = { 'page': 1, 'sortedby': 'idta', 'sortedasc': False, 'lastrun': bool(viewlib.save_int(request.GET.get('lastrun', 0))) } #go to default process-query using these default parameters else: #request.method == 'POST' if 'fromselect' in request.POST: #from SelectProcess form formin = forms.SelectProcess(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) elif '2incoming' in request.POST: #coming from ViewProcess, go to incoming form using same criteria request.POST = viewlib.changepostparameters(request.POST, soort='fromprocess') return incoming(request) elif '2outgoing' in request.POST: #coming from ViewProcess, go to outgoing form using same criteria request.POST = viewlib.changepostparameters(request.POST, soort='fromprocess') return outgoing(request) else: formin = forms.ViewProcess(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) elif '2select' in request.POST: #coming from ViewProcess, change the selection criteria, go to select form form = forms.SelectProcess(formin.cleaned_data) return django.shortcuts.render(request, form.template, {'form': form}) else: #coming from ViewProcess viewlib.handlepagination(request.POST, formin.cleaned_data) cleaned_data = formin.cleaned_data #normal process-query with parameters query = models.ta.objects.filter(status=PROCESS, statust=ERROR) pquery = viewlib.filterquery(query, cleaned_data) form = forms.ViewProcess(initial=cleaned_data) return django.shortcuts.render(request, form.template, { 'form': form, 'queryset': pquery })
def confirm(request,*kw,**kwargs): if request.method == 'GET': if 'select' in request.GET: #from menu:select->confirm form = forms.SelectConfirm() return django.shortcuts.render(request, form.template, {'form': form}) else: #from menu:run->confirm cleaned_data = {'page':1,'sortedby':'idta','sortedasc':False} #go to default confirm-query using these default parameters else: #request.method == 'POST' if 'fromselect' in request.POST: #from SelectConfirm form formin = forms.SelectConfirm(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) elif '2incoming' in request.POST: #coming from ViewConfirm, go to incoming form using same criteria request.POST = viewlib.changepostparameters(request.POST,soort='confirm2in') return incoming(request) elif '2outgoing' in request.POST: #coming from ViewConfirm, go to outgoing form using same criteria request.POST = viewlib.changepostparameters(request.POST,soort='confirm2out') return outgoing(request) elif 'confirm' in request.POST: #coming ViewConfirm, using star 'Manual confirm' ta_object = models.ta.objects.get(idta=viewlib.save_int(request.POST[u'confirm'])) if ta_object.confirmed == False and ta_object.confirmtype.startswith('ask'): ta_object.confirmed = True ta_object.confirmidta = '-1' # to indicate a manual confirmation ta_object.save() messages.add_message(request, messages.INFO, _(u'Manual confirmed.')) else: messages.add_message(request, messages.INFO, _(u'Manual confirm not possible.')) # then just refresh the current view formin = forms.ViewConfirm(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) else: formin = forms.ViewConfirm(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form':formin}) elif '2select' in request.POST: #coming from ViewConfirm, change the selection criteria, go to select form form = forms.SelectConfirm(formin.cleaned_data) return django.shortcuts.render(request, form.template, {'form':form}) else: #coming from ViewConfirm, next page etc viewlib.handlepagination(request.POST,formin.cleaned_data) cleaned_data = formin.cleaned_data #normal confirm-query with parameters query = models.ta.objects.filter(confirmasked=True) pquery = viewlib.filterquery(query,cleaned_data) form = forms.ViewConfirm(initial=cleaned_data) return django.shortcuts.render(request, form.template, {'form':form, 'queryset':pquery})
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)
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)
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)
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)
def incoming(request,*kw,**kwargs): if request.method == 'GET': if 'select' in request.GET: #from menu:select->incoming form = forms.SelectIncoming() return django.shortcuts.render(request, form.template, {'form': form}) #go to the SelectIncoming form else: #from menu:run->incoming cleaned_data = {'page':1,'sortedby':'idta','sortedasc':False,'lastrun':bool(viewlib.save_int(request.GET.get('lastrun',0)))} #go to default incoming-query using these default parameters else: #request.method == 'POST' if 'fromselect' in request.POST: #from SelectIncoming form formin = forms.SelectIncoming(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) #go to default report-query using parameters from select screen elif '2outgoing' in request.POST: #from ViewIncoming form, using button 'outgoing (same selection)' request.POST = viewlib.changepostparameters(request.POST,soort='in2out') return outgoing(request) elif '2process' in request.POST: #from ViewIncoming form, using button 'process errors (same selection)' request.POST = viewlib.changepostparameters(request.POST,soort='2process') return process(request) elif '2confirm' in request.POST: #from ViewIncoming form, using button 'confirm (same selection)' request.POST = viewlib.changepostparameters(request.POST,soort='in2confirm') return confirm(request) else: #from ViewIncoming form, check this form first formin = forms.ViewIncoming(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) elif '2select' in request.POST: #from ViewIncoming form using button change selection form = forms.SelectIncoming(formin.cleaned_data) return django.shortcuts.render(request, form.template, {'form': form}) elif 'delete' in request.POST: #from ViewIncoming form using star delete if request.user.is_staff or request.user.is_superuser: idta = viewlib.save_int(request.POST[u'delete']) #delete from filereport models.filereport.objects.filter(idta=idta).delete() #get ta_object ta_object = models.ta.objects.get(idta=idta) #delete as much as possible in ta table viewlib.delete_from_ta(ta_object) else: notification = _(u'No rights for this operation.') botsglobal.logger.info(notification) messages.add_message(request, messages.INFO, notification) elif 'retransmit' in request.POST: #from ViewIncoming form using star rereceive idta = request.POST[u'retransmit'] filereport = models.filereport.objects.get(idta=viewlib.save_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: #from ViewIncoming form using button 'rereceive all' #select all objects with parameters and set retransmit query = models.filereport.objects.all() incomingfiles = viewlib.filterquery(query,formin.cleaned_data,paginate=False) 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: #from ViewIncoming, next page etc viewlib.handlepagination(request.POST,formin.cleaned_data) cleaned_data = formin.cleaned_data #normal incoming-query with parameters query = models.filereport.objects.all() pquery = viewlib.filterquery(query,cleaned_data,incoming=True) form = forms.ViewIncoming(initial=cleaned_data) return django.shortcuts.render(request, form.template, {'form': form,'queryset':pquery})
def confirm(request, *kw, **kwargs): if request.method == 'GET': if 'select' in request.GET: #from menu:select->confirm form = forms.SelectConfirm() return django.shortcuts.render(request, form.template, {'form': form}) else: #from menu:run->confirm cleaned_data = {'page': 1, 'sortedby': 'idta', 'sortedasc': False} #go to default confirm-query using these default parameters else: #request.method == 'POST' if 'fromselect' in request.POST: #from SelectConfirm form formin = forms.SelectConfirm(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) elif '2incoming' in request.POST: #coming from ViewConfirm, go to incoming form using same criteria request.POST = viewlib.changepostparameters(request.POST, soort='confirm2in') return incoming(request) elif '2outgoing' in request.POST: #coming from ViewConfirm, go to outgoing form using same criteria request.POST = viewlib.changepostparameters(request.POST, soort='confirm2out') return outgoing(request) elif 'confirm' in request.POST: #coming ViewConfirm, using star 'Manual confirm' ta_object = models.ta.objects.get( idta=viewlib.save_int(request.POST[u'confirm'])) if ta_object.confirmed == False and ta_object.confirmtype.startswith( 'ask'): ta_object.confirmed = True ta_object.confirmidta = '-1' # to indicate a manual confirmation ta_object.save() messages.add_message(request, messages.INFO, _(u'Manual confirmed.')) else: messages.add_message(request, messages.INFO, _(u'Manual confirm not possible.')) # then just refresh the current view formin = forms.ViewConfirm(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) else: formin = forms.ViewConfirm(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) elif '2select' in request.POST: #coming from ViewConfirm, change the selection criteria, go to select form form = forms.SelectConfirm(formin.cleaned_data) return django.shortcuts.render(request, form.template, {'form': form}) else: #coming from ViewConfirm, next page etc viewlib.handlepagination(request.POST, formin.cleaned_data) cleaned_data = formin.cleaned_data #normal confirm-query with parameters query = models.ta.objects.filter(confirmasked=True) pquery = viewlib.filterquery(query, cleaned_data) form = forms.ViewConfirm(initial=cleaned_data) return django.shortcuts.render(request, form.template, { 'form': form, 'queryset': pquery })
def outgoing(request, *kw, **kwargs): if request.method == 'GET': if 'select' in request.GET: #from menu:select->outgoing form = forms.SelectOutgoing() return django.shortcuts.render(request, form.template, {'form': form}) else: #from menu:run->outgoing cleaned_data = { 'page': 1, 'sortedby': 'idta', 'sortedasc': False, 'lastrun': bool(viewlib.save_int(request.GET.get('lastrun', 0))) } #go to default outgoing-query using these default parameters else: #request.method == 'POST' if 'fromselect' in request.POST: #from SelectOutgoing form formin = forms.SelectOutgoing(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) #go to default outgoing-query using parameters from select screen elif '2incoming' in request.POST: #from ViewOutgoing form, using button 'incoming (same selection)' request.POST = viewlib.changepostparameters(request.POST, soort='out2in') return incoming(request) elif '2process' in request.POST: #from ViewOutgoing form, using button 'process errors (same selection)' request.POST = viewlib.changepostparameters(request.POST, soort='2process') return process(request) elif '2confirm' in request.POST: #from ViewOutgoing form, using button 'confirm (same selection)' request.POST = viewlib.changepostparameters(request.POST, soort='out2confirm') return confirm(request) else: #from ViewOutgoing form, check this form first formin = forms.ViewOutgoing(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) elif '2select' in request.POST: #from ViewOutgoing form using button change selection form = forms.SelectOutgoing(formin.cleaned_data) return django.shortcuts.render(request, form.template, {'form': form}) elif 'retransmit' in request.POST: #from ViewOutgoing form using star resend ta_object = models.ta.objects.get( idta=viewlib.save_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: #from ViewOutgoing form using button 'resend all' #select all objects with parameters and set retransmit query = models.ta.objects.filter(status=EXTERNOUT) outgoingfiles = viewlib.filterquery(query, formin.cleaned_data, paginate=False) 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: #from ViewOutgoing form using star 'no automaticretry' ta_object = models.ta.objects.get( idta=viewlib.save_int(request.POST[u'noautomaticretry'])) if ta_object.statust == ERROR: ta_object.statust = NO_RETRY ta_object.save() else: #from ViewIncoming, next page etc viewlib.handlepagination(request.POST, formin.cleaned_data) cleaned_data = formin.cleaned_data #normal outgoing-query with parameters query = models.ta.objects.filter(status=EXTERNOUT) pquery = viewlib.filterquery(query, cleaned_data) form = forms.ViewOutgoing(initial=cleaned_data) return django.shortcuts.render(request, form.template, { 'form': form, 'queryset': pquery })
def incoming(request, *kw, **kwargs): if request.method == 'GET': if 'select' in request.GET: #from menu:select->incoming form = forms.SelectIncoming() return django.shortcuts.render( request, form.template, {'form': form}) #go to the SelectIncoming form else: #from menu:run->incoming cleaned_data = { 'page': 1, 'sortedby': 'idta', 'sortedasc': False, 'lastrun': bool(viewlib.save_int(request.GET.get('lastrun', 0))) } #go to default incoming-query using these default parameters else: #request.method == 'POST' if 'fromselect' in request.POST: #from SelectIncoming form formin = forms.SelectIncoming(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) #go to default report-query using parameters from select screen elif '2outgoing' in request.POST: #from ViewIncoming form, using button 'outgoing (same selection)' request.POST = viewlib.changepostparameters(request.POST, soort='in2out') return outgoing(request) elif '2process' in request.POST: #from ViewIncoming form, using button 'process errors (same selection)' request.POST = viewlib.changepostparameters(request.POST, soort='2process') return process(request) elif '2confirm' in request.POST: #from ViewIncoming form, using button 'confirm (same selection)' request.POST = viewlib.changepostparameters(request.POST, soort='in2confirm') return confirm(request) else: #from ViewIncoming form, check this form first formin = forms.ViewIncoming(request.POST) if not formin.is_valid(): return django.shortcuts.render(request, formin.template, {'form': formin}) elif '2select' in request.POST: #from ViewIncoming form using button change selection form = forms.SelectIncoming(formin.cleaned_data) return django.shortcuts.render(request, form.template, {'form': form}) elif 'delete' in request.POST: #from ViewIncoming form using star delete if request.user.is_staff or request.user.is_superuser: idta = viewlib.save_int(request.POST[u'delete']) #delete from filereport models.filereport.objects.filter(idta=idta).delete() #get ta_object ta_object = models.ta.objects.get(idta=idta) #delete as much as possible in ta table viewlib.delete_from_ta(ta_object) else: notification = _(u'No rights for this operation.') botsglobal.logger.info(notification) messages.add_message(request, messages.INFO, notification) elif 'retransmit' in request.POST: #from ViewIncoming form using star rereceive idta = request.POST[u'retransmit'] filereport = models.filereport.objects.get( idta=viewlib.save_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: #from ViewIncoming form using button 'rereceive all' #select all objects with parameters and set retransmit query = models.filereport.objects.all() incomingfiles = viewlib.filterquery(query, formin.cleaned_data, paginate=False) 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: #from ViewIncoming, next page etc viewlib.handlepagination(request.POST, formin.cleaned_data) cleaned_data = formin.cleaned_data #normal incoming-query with parameters query = models.filereport.objects.all() pquery = viewlib.filterquery(query, cleaned_data, incoming=True) form = forms.ViewIncoming(initial=cleaned_data) return django.shortcuts.render(request, form.template, { 'form': form, 'queryset': pquery })