def index(request): '''Staff Training Central Homepage ''' context = {} context['http_service'] = request.META['HTTP_SERVICE'] dpdpindx = Dpdpindx() dpdpindx.send.webtoken = request.META['HTTP_TOKEN'] dpdpindx.send.component = PROJECT_UTD_DEFAULTS['component'] try: dpdpindx.call_broker_once(service=request.META['HTTP_SERVICE']) except UTBrokerError as exception: context['exception_msg'] = str(exception) return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,)) if dpdpindx.recv.return_code.startswith('X'): context['exception_msg'] = dpdpindx.recv.return_msg return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,)) context['dpdpindx'] = dpdpindx return render_to_response("index.html", UTDirectContext(request, context, defaults=defaults, document_title= 'Staff Training Central'))
def delete_class(request, action='', component=0, unique_number='', course_category='', course_number=''): '''Delete Class''' context = {} context['http_service'] = request.META['HTTP_SERVICE'] pda = Utdp9euw() pda.send.webtoken = request.META['HTTP_TOKEN'] pda.send.action = action pda.send.component = component pda.send.class_unique_number = unique_number pda.send.course_category = course_category pda.send.course_number = course_number if 'delete_submitted' in request.POST: context['delete_submitted'] = True try: pda.call_broker_once(service=request.META['HTTP_SERVICE']) except UTBrokerError as exception: context['exception_msg'] = str(exception) return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,)) if pda.recv.return_code.startswith('X'): context['exception_msg'] = pda.recv.return_msg return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,)) context['action'] = action context['component'] = component context['class_unique_number'] = unique_number context['course_id'] = pda.send.course_id context['course_category'] = pda.send.course_category context['course_number'] = pda.send.course_number context['return_code'] = pda.recv.return_code context['return_msg'] = pda.recv.return_msg print 'course category', pda.recv.course_category if not pda.recv.return_code: if 'delete_submitted' in request.POST: return redirect('class_list_b', component = pda.recv.component, course_cat = pda.recv.course_category, course_num = pda.recv.course_number, success = 'Y', unique_number = pda.send.class_unique_number ) return render_to_response("class_delete.html", UTDirectContext(request, context, defaults=defaults, document_title= 'Delete Class'))
def classdetails(request, unique_number='', success='', action=''): '''Given unique number input, will return class details''' context = {} context['TIME_HHII'] = TIME_HHII context['http_service'] = request.META['HTTP_SERVICE'] context['success'] = success context['action'] = action pda = Utdp9erw() pda.send.webtoken = request.META['HTTP_TOKEN'] pda.send.component = PROJECT_UTD_DEFAULTS['component'] pda.send.class_unique_number = unique_number or request.GET.get('unique_number', '') context['service'] = request.META['HTTP_SERVICE'] try: pda.call_broker_once(service=request.META['HTTP_SERVICE']) except UTBrokerError as exception: context['exception_msg'] = str(exception) return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,)) if pda.recv.return_code.startswith('X'): context['return_msg'] = pda.recv.return_msg context['return_code'] = pda.recv.return_code return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,)) context['pda'] = pda context['class_unique_number_send'] = pda.send.class_unique_number context['instructor_eid_1'] = pda.recv.instructor_eid[0] context['instructor_type_1'] = pda.recv.instructor_type[0] context['instructor_eid_2'] = pda.recv.instructor_eid[1] context['instructor_type_2'] = pda.recv.instructor_type[1] context['instructor_eid_3'] = pda.recv.instructor_eid[2] context['instructor_type_3'] = pda.recv.instructor_type[2] context['instructors'] = pda.recv.instructor_info if 'form_submitted' in request.GET: context['form_submitted'] = True return render_to_response("class_details.html", UTDirectContext(request, context, defaults=defaults, document_title= 'Class Details Search',))
def classroster(request): '''given unique number input, will return class roster''' context = {} context['http_service'] = request.META['HTTP_SERVICE'] utdprosw = Utdprosw() utdprosw.send.webtoken = request.META['HTTP_TOKEN'] utdprosw.send.component = PROJECT_UTD_DEFAULTS['component'] utdprosw.send.class_unique_number = request.GET.get('class_unique', '') if 'next_page_submitted' in request.GET: utdprosw.send.paging_isn = request.GET.get('paging_isn', '') utdprosw.send.paging_name = request.GET.get('paging_name', '') context['next_page_submitted'] = True elif 'form_submitted' in request.GET: utdprosw.send.paging_name = request.GET.get('start_name', '') context['form_submitted'] = True try: utdprosw.call_broker_once(service=request.META['HTTP_SERVICE']) except UTBrokerError as exception: context['exception_msg'] = str(exception) return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,)) if utdprosw.recv.return_code.startswith('X'): context['return_msg'] = utdprosw.recv.return_msg context['return_code'] = utdprosw.recv.return_code return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,)) context['utdprosw'] = utdprosw if utdprosw.recv.number_instructors_returned: context['instructors'] = utdprosw.recv.instructor_info[:int(utdprosw.recv.number_instructors_returned)] if utdprosw.recv.number_enrollees_returned: context['enrollees'] = utdprosw.recv.enrollee_info[:int(utdprosw.recv.number_enrollees_returned)] return render_to_response("class_roster.html", UTDirectContext(request, context, defaults=defaults, document_title= 'Class Roster Search',))
def index(request): context = UTDirectContext( request, {}, defaults=defaults, access_context='P', document_title='Important Minor and Certificate Links for Students') return render_to_response("student_links/student_links.html", context)
def search(request): """Allows searching by EID of student.""" context = {} defaults = PROJECT_UTD_DEFAULTS error = False nrdpsclg = Nrdpsclg() nrdpsclg.send.webtoken = request.META['HTTP_TOKEN'] try: nrdpsclg.call_broker_once(service=request.META['HTTP_SERVICE']) except UTBrokerError as err: messages.error(request, err) error = True if nrdpsclg.recv.return_code: logging.error('User: {0} - {1} ({2})'.format( request.META['HTTP_UTLOGIN_EID'], nrdpsclg.recv.return_msg, nrdpsclg.recv.return_code)) messages.error(request, nrdpsclg.recv.return_msg) error = True if error: return render_to_response( 'log.html', UTDirectContext( request, context, defaults=defaults, document_title='Error', )) if request.GET.get('search_eid', False): eid = re.match(r'^\w{3,8}', request.GET['search_eid']) if not eid: messages.error(request, "Invalid EID entered.") else: return redirect('logs_by_eid', eid=request.GET['search_eid']) context['recv'] = nrdpsclg.recv context['send'] = nrdpsclg.send return render_to_response( "log.html", UTDirectContext(request, context, defaults=defaults))
def student_credential(request, doc_nbr=''): defaults = PROJECT_UTD_DEFAULTS context = {} form_submitted = False nrdpscru = Nrdpscru() nrdpscru.send.webtoken = request.META['HTTP_TOKEN'] nrdpscru.send.doc_nbr = doc_nbr display_as_static = False if 'submit' in request.POST: form_submitted = True if request.POST.get('catalog_beg_ccyy', 0): nrdpscru.send.catalog_beg_ccyy = request.POST.get( 'catalog_beg_ccyy', 0) nrdpscru.send.catalog_beg_s = '9' else: nrdpscru.send.catalog_beg_ccyy = '0' nrdpscru.send.catalog_beg_s = '0' nrdpscru.send.catalog_end = request.POST.get('catalog_end', 0) if request.POST.get('effective_ccyys', 0): nrdpscru.send.effective_ccyys = request.POST.get( 'effective_ccyys', 0) else: nrdpscru.send.effective_ccyys = 0 if request.POST.get('coursework_satisfied_ccyys'): nrdpscru.send.coursework_satisfied_ccyys = request.POST.get( 'coursework_satisfied_ccyys', 0) else: nrdpscru.send.coursework_satisfied_ccyys = 0 if request.POST.get('conferred_ccyys'): nrdpscru.send.conferred_ccyys = request.POST.get( 'conferred_ccyys', 0) else: nrdpscru.send.conferred_ccyys = 0 nrdpscru.send.status = request.POST.get('status', '') nrdpscru.send.comments = request.POST.get('comments', '').encode( 'ascii', 'ignore') nrdpscru.send.update = 'Y' try: nrdpscru.call_broker_once(service=request.META['HTTP_SERVICE']) except (UTBrokerError), error_info: error_msg = str(error_info) return render_to_response( 'error.html', UTDirectContext( request, {'error_msg': error_msg}, defaults=defaults, document_title='Broker Error', ))
def course_cat_list (request, component=0): '''Retrieves Course Category List''' context = {} context['http_service'] = request.META['HTTP_SERVICE'] dpdpccls = Dpdpccls() try: dpdpccls.send.webtoken = request.META['HTTP_TOKEN'] dpdpccls.send.component = component dpdpccls.call_broker_once(service=request.META['HTTP_SERVICE']) except UTBrokerError, e: context['exception_msg'] = str(e) return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults))
def course_num_list(request, component, course_cat): '''Retrieves Course Number list for a given category''' context = {} context['http_service'] = request.META['HTTP_SERVICE'] dpdpcrsl = Dpdpcrsl() try: dpdpcrsl.send.webtoken = request.META['HTTP_TOKEN'] dpdpcrsl.send.component = component dpdpcrsl.send.course_category = course_cat dpdpcrsl.call_broker_once(service=request.META['HTTP_SERVICE']) except UTBrokerError, e: context['exception_msg'] = str(e) return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,))
def class_list(request, component, course_cat, course_num, success='', unique_number=''): '''Retrieves a Class List for a given component and course id''' context = {} context['http_service'] = request.META['HTTP_SERVICE'] context['success'] = success context['unique_number'] = unique_number dpdplist = Dpdplist() try: dpdplist.send.webtoken = request.META['HTTP_TOKEN'] dpdplist.send.component = component dpdplist.send.course_category = course_cat dpdplist.send.course_number = course_num dpdplist.call_broker_once(service=request.META['HTTP_SERVICE']) except UTBrokerError, e: context['exception_msg'] = str(e) return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,))
def reports(request): defaults = PROJECT_UTD_DEFAULTS context = {} nrdpscrv = Nrdpscrv() nrdpscrv.send.webtoken = request.META['HTTP_TOKEN'] if 'counts_submitted' in request.GET \ or 'code_submitted' in request.GET \ or 'eid_submitted' in request.GET: nrdpscrv.send.form_submitted = 'X' if 'counts_submitted' in request.GET: nrdpscrv.send.counts_submitted = 'X' if 'code_submitted' in request.GET: nrdpscrv.send.code_or_eid_submitted = 'X' nrdpscrv.send.code_or_eid_input = 'C' + request.GET.get('code') if 'eid_submitted' in request.GET: nrdpscrv.send.code_or_eid_submitted = 'X' nrdpscrv.send.code_or_eid_input = 'E' + request.GET.get('eid') try: nrdpscrv.call_broker_once(service=request.META['HTTP_SERVICE']) except (UTBrokerError), error_info: error_msg = str(error_info) return render_to_response( 'error.html', UTDirectContext( request, {'error_msg': error_msg}, defaults=defaults, document_title='Broker Error', ))
def search_by_code(request): defaults = PROJECT_UTD_DEFAULTS context = {} results = [] submit = True form_submitted = False nrdpscrc = Nrdpscrc() if 'code_submitted' in request.GET: nrdpscrv = Nrdpscrv() nrdpscrv.send.webtoken = request.META['HTTP_TOKEN'] nrdpscrv.send.form_submitted = 'X' nrdpscrv.send.code_or_eid_submitted = 'X' nrdpscrv.send.code_or_eid_input = 'C' + request.GET.get('code') try: nrdpscrv.call_broker_once(service=request.META['HTTP_SERVICE']) except (UTBrokerError), error_info: error_msg = str(error_info) return render_to_response( 'error.html', UTDirectContext( request, {'error_msg': error_msg}, defaults=defaults, document_title='Broker Error', )) context['nrdpscrv.recv'] = nrdpscrv.recv context['nrdpscrv.send'] = nrdpscrv.send context['job_number'] = nrdpscrv.recv.job_numbers[0] if nrdpscrv.send.form_submitted and not nrdpscrv.recv.return_code: messages.success(request, "The report has been successfully submitted.")
def portal(request): """Checks appropriate security and renders page of compliance related links.""" nrdpcp50 = Nrdpcp50() nrdpcp50.send.webtoken = request.META['HTTP_TOKEN'] nrdpcp50.send.ip_address = request.META['REMOTE_ADDR'] # **************************************************************************** # # Broker Call # **************************************************************************** # try: nrdpcp50.call_broker_once(service=request.META['HTTP_SERVICE']) except UTBrokerError, error_info: exception_msg = str(error_info) return render_to_response( 'error.html', UTDirectContext( request, {'exception_msg': exception_msg}, defaults=defaults, document_title='Broker Error', ))
def late_add_inbox(request): defaults = PROJECT_UTD_DEFAULTS context = {} results = [] submit = True form_submitted = False nrdpscrl = Nrdpscrl() if request.GET.get('sort_direction') == None: sort_direction = DEFAULT_SORT_DIRECTION else: sort_direction = request.GET.get('sort_direction') if sort_direction == 'A': next_sort_direction = 'D' else: next_sort_direction = 'A' nrdpscrl.send.webtoken = request.META['HTTP_TOKEN'] while submit: try: nrdpscrl.call_broker_once(service=request.META['HTTP_SERVICE']) except (UTBrokerError), error_info: error_msg = str(error_info) return render_to_response( 'error.html', UTDirectContext( request, {'error_msg': error_msg}, defaults=defaults, document_title='Broker Error', )) for item in nrdpscrl.recv.recs_returned: if item.doc_nbr: print item.credential_desc_long catalog = '' conferred_ccyys = '' if item.catalog_beg != '0': catalog = item.catalog_beg[0:4] + '-' + item.catalog_end[ 0:4] if item.conferred_ccyys != '0': conferred_ccyys = item.conferred_ccyys results.append({ 'eid': item.eid, 'name': item.name, 'type': item.type, 'doc_nbr': item.doc_nbr, 'status': item.status, 'credential_code': item.credential_code, 'credential_desc_long': item.credential_desc_long, 'pursuing': item.pursuing, 'effective_ccyys': item.effective_ccyys, 'catalog': catalog, 'conferred_ccyys': conferred_ccyys, }) if not nrdpscrl.recv.paging_isn: submit = False if 'csv' in request.GET.get('export', ''): return inbox_download(results) nrdpscrl.send.paging_isn = nrdpscrl.recv.paging_isn
while submit == True: nrdpscrr.send.paging_isn = nrdpscrr.recv.paging_isn nrdpscrr.send.paging_data_source = nrdpscrr.recv.paging_data_source try: nrdpscrr.call_broker_once(service=request.META['HTTP_SERVICE']) except (UTBrokerError), error_info: error_msg = str(error_info) return render_to_response( 'error.html', UTDirectContext( request, {'error_msg': error_msg}, defaults=defaults, document_title='Broker Error', )) for item in nrdpscrr.recv.recs_returned: catalog = '' conferred_ccyys = '' if item.catalog_beg != '0': catalog = item.catalog_beg[0:4] + '-' + item.catalog_end[0:4] if item.conferred_ccyys != '0': conferred_ccyys = item.conferred_ccyys if item.doc_nbr: results.append({ 'eid': item.eid, 'name': item.name, 'doc_nbr': item.doc_nbr,
def logs_by_eid(request, eid=""): """Returns all records related to a given EID.""" context = {} defaults = PROJECT_UTD_DEFAULTS error = False nrdpsclg = Nrdpsclg() nrdpsclg.send.webtoken = request.META['HTTP_TOKEN'] nrdpsclg.send.search_eid = eid.encode('ascii', 'ignore') nrdpsclg.send.paging_isn = request.GET.get('paging_isn', 0) nrdpsclg.send.paging_create_date_cymd = request.GET.get( 'paging_create_date_cymd', 0) nrdpsclg.send.paging_create_time = request.GET.get('paging_create_time', 0) try: nrdpsclg.call_broker_once(service=request.META['HTTP_SERVICE']) except UTBrokerError as err: messages.error(request, err) error = True if nrdpsclg.recv.return_code: logging.error('User: {0} - {1} ({2})'.format( request.META['HTTP_UTLOGIN_EID'], nrdpsclg.recv.return_msg, nrdpsclg.recv.return_code)) messages.error(request, nrdpsclg.recv.return_msg) error = True if error: return render_to_response( 'log.html', UTDirectContext( request, context, defaults=defaults, document_title='Error', )) logs = [] for log in nrdpsclg.recv.recs_returned: if log.doc_nbr: if log.log_code == 'USTAT' or log.log_code == 'UCMST': log.old_value = STATUS.get(log.old_value, '') log.new_value = STATUS.get(log.new_value, '') logs.append({ 'log_desc': log.log_desc, 'credential_code': log.credential_code, 'old_value': log.old_value, 'new_value': log.new_value, 'create_id': log.create_id, 'create_date_display': datetime.strptime(str(log.create_date_cymd), '%Y%m%d').strftime("%m/%d/%Y"), 'create_time_display': datetime.strptime( str(log.create_time).zfill(7)[0:6], '%H%M%S').strftime("%I:%M %p"), }) context['recv'] = nrdpsclg.recv context['send'] = nrdpsclg.send context['logs'] = logs document_title = 'Logs for {0}'.format(eid) return render_to_response( "log.html", UTDirectContext(request, context, defaults=defaults, document_title=document_title))
def store_class(request, action='', component=0, unique_number='', course_category='', course_number=''): '''Store a New Class''' context = {} context['TIME_HHII'] = TIME_HHII context['YEAR'] = YEAR context['MONTH'] = MONTH context['DAY'] = DAY context['LOCATION'] = LOCATION context['http_service'] = request.META['HTTP_SERVICE'] pda = Utdp9euw() pda.send.webtoken = request.META['HTTP_TOKEN'] pda.send.action = action pda.send.component = component pda.send.class_unique_number = request.POST.get('class_unique_number', '') pda.send.course_id = request.POST.get('course_id', '') pda.send.course_category = course_category pda.send.course_number = course_number pda.send.class_meeting_cy = request.POST.get('class_meeting_cy', '') pda.send.class_meeting_m = request.POST.get('class_meeting_m', '') pda.send.class_meeting_d = request.POST.get('class_meeting_d', '') pda.send.enrollment_limit = request.POST.get('enrollment_limit', 0) pda.send.student_fee = request.POST.get('student_fee', 0) pda.send.class_begin_time_hhii = request.POST.get('class_begin_time_hhii', '') pda.send.class_end_time_hhii = request.POST.get('class_end_time_hhii', '') pda.send.location = request.POST.get('location', '') pda.send.instructor_eid[0] = request.POST.get('instructor_eid_1', '') pda.send.instructor_type[0] = request.POST.get('instructor_type_1', '') pda.send.instructor_eid[1] = request.POST.get('instructor_eid_2', '') pda.send.instructor_type[1] = request.POST.get('instructor_type_2', '') pda.send.instructor_eid[2] = request.POST.get('instructor_eid_3', '') pda.send.instructor_type[2] = request.POST.get('instructor_type_3', '') pda.send.misc_instructions = request.POST.get('misc_instructions', '') if 'form_submitted' in request.POST: context['form_submitted'] = True pda.send.course_category = request.POST.get('course_category', '') pda.send.course_number = request.POST.get('course_number', '') try: pda.call_broker_once(service=request.META['HTTP_SERVICE']) except UTBrokerError as exception: context['exception_msg'] = str(exception) return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,)) if pda.recv.return_code.startswith('X'): context['return_code'] = pda.recv.return_code context['return_msg'] = pda.recv.return_msg return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,)) if pda.recv.return_code: # In case of error, the context dictionary below will allow the form to retain # the user inputs. context['pda'] = pda context['action'] = action context['instructor_eid_1'] = pda.send.instructor_eid[0] context['instructor_type_1'] = pda.send.instructor_type[0] context['instructor_eid_2'] = pda.send.instructor_eid[1] context['instructor_type_2'] = pda.send.instructor_type[1] context['instructor_eid_3'] = pda.send.instructor_eid[2] context['instructor_type_3'] = pda.send.instructor_type[2] context['misc_instructions'] = pda.send.misc_instructions context['instructors'] = pda.send.instructor_info return render_to_response("class_maintenance.html", UTDirectContext(request, context, defaults=defaults, document_= 'Class Maintenance')) return redirect('class_details_b', unique_number = pda.recv.new_unique_number, success = 'Y', action = 'S')
try: dpdpccls.send.webtoken = request.META['HTTP_TOKEN'] dpdpccls.send.component = component dpdpccls.call_broker_once(service=request.META['HTTP_SERVICE']) except UTBrokerError, e: context['exception_msg'] = str(e) return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults)) context['dpdpccls'] = dpdpccls return render_to_response("course_cat_list.html", UTDirectContext(request, context, defaults=defaults,)) def course_num_list(request, component, course_cat): '''Retrieves Course Number list for a given category''' context = {} context['http_service'] = request.META['HTTP_SERVICE'] dpdpcrsl = Dpdpcrsl() try: dpdpcrsl.send.webtoken = request.META['HTTP_TOKEN'] dpdpcrsl.send.component = component dpdpcrsl.send.course_category = course_cat dpdpcrsl.call_broker_once(service=request.META['HTTP_SERVICE'])
defaults=defaults, document_title='Broker Error', )) # **************************************************************************** # # Display # **************************************************************************** # context = {} # this is all used for debug pda_send_dict = OrderedDict() pda_recv_dict = OrderedDict() for field in nrdpmnmn.send: pda_send_dict[field] = getattr(nrdpmnmn.send, field) for field in nrdpmnmn.recv: pda_recv_dict[field] = getattr(nrdpmnmn.recv, field) context['pda_send_dict'] = pda_send_dict context['pda_recv_dict'] = pda_recv_dict context['pda_meta_dict'] = {'envo': request.META['HTTP_SERVICE']} context['recv'] = nrdpmnmn.recv context['send'] = nrdpmnmn.send if nrdpmnmn.recv.auth_to_change == 'X': defaults = PROJECT_UTD_DEFAULTS_AUTH else: defaults = PROJECT_UTD_DEFAULTS return render_to_response( "edit.html", UTDirectContext(request, context, defaults=defaults))
def update_class(request, action='', component=0, unique_number='', course_category='', course_number=''): '''Update a Class''' context = {} context['TIME_HHII'] = TIME_HHII context['YEAR'] = YEAR context['MONTH'] = MONTH context['DAY'] = DAY context['LOCATION'] = LOCATION context['http_service'] = request.META['HTTP_SERVICE'] context['action'] = action if request.method == 'GET': utdp9erw = Utdp9erw() utdp9erw.send.webtoken = request.META['HTTP_TOKEN'] utdp9erw.send.component = PROJECT_UTD_DEFAULTS['component'] utdp9erw.send.class_unique_number = unique_number or request.GET.get('unique_number', '') try: utdp9erw.call_broker_once(service=request.META['HTTP_SERVICE']) except UTBrokerError as exception: context['exception_msg'] = str(exception) return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,)) if utdp9erw.recv.return_code.startswith('X'): context['return_msg'] = utdp9erw.recv.return_msg context['return_code'] = utdp9erw.recv.return_code return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,)) context['pda'] = utdp9erw context['instructor_eid_1'] = utdp9erw.recv.instructor_eid[0] context['instructor_type_1'] = utdp9erw.recv.instructor_type[0] context['instructor_eid_2'] = utdp9erw.recv.instructor_eid[1] context['instructor_type_2'] = utdp9erw.recv.instructor_type[1] context['instructor_eid_3'] = utdp9erw.recv.instructor_eid[2] context['instructor_type_3'] = utdp9erw.recv.instructor_type[2] context['instructors'] = utdp9erw.recv.instructor_info if utdp9erw.recv.nbr_of_instructors: context['instructors'] = utdp9erw.recv.instructor_info[:int(utdp9erw.recv.nbr_of_instructors)] return render_to_response("class_maintenance.html", UTDirectContext(request, context, defaults=defaults, document_title= 'Class Maintenance')) utdp9euw = Utdp9euw() utdp9euw.send.webtoken = request.META['HTTP_TOKEN'] utdp9euw.send.action = action utdp9euw.send.component = component utdp9euw.send.class_unique_number = unique_number utdp9euw.send.class_meeting_cy = request.POST.get('class_meeting_cy', '') utdp9euw.send.class_meeting_m = request.POST.get('class_meeting_m', '') utdp9euw.send.class_meeting_d = request.POST.get('class_meeting_d', '') utdp9euw.send.enrollment_limit = request.POST.get('enrollment_limit', 0) utdp9euw.send.student_fee = request.POST.get('student_fee', 0) utdp9euw.send.class_begin_time_hhii = request.POST.get('class_begin_time_hhii', '') utdp9euw.send.class_end_time_hhii = request.POST.get('class_end_time_hhii', '') utdp9euw.send.location = request.POST.get('location', '') utdp9euw.send.instructor_eid[0] = request.POST.get('instructor_eid_1', '') utdp9euw.send.instructor_type[0] = request.POST.get('instructor_type_1', '') utdp9euw.send.instructor_eid[1] = request.POST.get('instructor_eid_2', '') utdp9euw.send.instructor_type[1] = request.POST.get('instructor_type_2', '') utdp9euw.send.instructor_eid[2] = request.POST.get('instructor_eid_3', '') utdp9euw.send.instructor_type[2] = request.POST.get('instructor_type_3', '') utdp9euw.send.misc_instructions = request.POST.get('misc_instructions', '') if 'form_submitted' in request.POST: context['form_submitted'] = True utdp9euw.send.course_category = request.POST.get('course_category', '') utdp9euw.send.course_number = request.POST.get('course_number', '') try: utdp9euw.call_broker_once(service=request.META['HTTP_SERVICE']) except UTBrokerError as exception: context['exception_msg'] = str(exception) return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,)) if utdp9euw.recv.return_code.startswith('X'): context['exception_msg'] = dpdpindx.recv.return_msg return render_to_response("utd_error.html", UTDirectContext(request, context, defaults=defaults,)) if utdp9euw.recv.return_code: context['pda'] = utdp9euw context['instructor_eid_1'] = utdp9euw.recv.instructor_eid[0] context['instructor_type_1'] = utdp9euw.recv.instructor_type[0] context['instructor_eid_2'] = utdp9euw.recv.instructor_eid[1] context['instructor_type_2'] = utdp9euw.recv.instructor_type[1] context['instructor_eid_3'] = utdp9euw.recv.instructor_eid[2] context['instructor_type_3'] = utdp9euw.recv.instructor_type[2] context['instructors'] = utdp9euw.recv.instructor_info context['new_unique_number_for_store'] = utdp9euw.recv.new_unique_number return render_to_response("class_maintenance.html", UTDirectContext(request, context, defaults=defaults, document_title= 'Class Maintenance')) return redirect('class_details_b', unique_number = utdp9euw.send.class_unique_number, success = 'Y', action = 'U')
def edit(request, stat_ty_schl_fos_seq): nrdpmnmn = Nrdpmnmn() nrdpmnmn.send.webtoken = request.META['HTTP_TOKEN'] nrdpmnmn.send.stat_ty_schl_fos_seq = stat_ty_schl_fos_seq nrdpmnmn.send.lo_ccyys = request.POST.get('lo_ccyys', '') nrdpmnmn.send.hi_ccyys = request.POST.get('hi_ccyys', '') nrdpmnmn.send.max_students = request.POST.get('max_students', '') nrdpmnmn.send.total_hours = request.POST.get('total_hours', '') nrdpmnmn.send.desc_short = request.POST.get('desc_short', '').encode('ascii', 'ignore') nrdpmnmn.send.desc_long = request.POST.get('desc_long', '').encode('ascii', 'ignore') nrdpmnmn.send.auto_approve = request.POST.get('auto_approve', '') nrdpmnmn.send.cip_code = request.POST.get('cip_code', '').encode('ascii', 'ignore') nrdpmnmn.send.cred_level = request.POST.get('cred_level', '') nrdpmnmn.send.url = request.POST.get('url', '').encode('ascii', 'ignore') nrdpmnmn.send.on_off_sw = request.POST.get('on_off_sw', '') nrdpmnmn.send.cohort_description = request.POST.get( 'cohort_description', '').encode('ascii', 'ignore') nrdpmnmn.send.related_major_code[0] = request.POST.get( 'related_major_code_1', '') nrdpmnmn.send.related_major_code[1] = request.POST.get( 'related_major_code_2', '') nrdpmnmn.send.related_major_code[2] = request.POST.get( 'related_major_code_3', '') nrdpmnmn.send.related_major_code[3] = request.POST.get( 'related_major_code_4', '') nrdpmnmn.send.related_major_code[4] = request.POST.get( 'related_major_code_5', '') nrdpmnmn.send.related_major_code[5] = request.POST.get( 'related_major_code_6', '') nrdpmnmn.send.related_major_code[6] = request.POST.get( 'related_major_code_7', '') nrdpmnmn.send.related_major_code[7] = request.POST.get( 'related_major_code_8', '') nrdpmnmn.send.related_major_code[8] = request.POST.get( 'related_major_code_9', '') nrdpmnmn.send.related_major_code[9] = request.POST.get( 'related_major_code_10', '') nrdpmnmn.send.action = request.POST.get('deactivate_sw', '') if nrdpmnmn.send.stat_ty_schl_fos_seq == '': nrdpmnmn.send.minor_type = request.POST.get('minor_type', '') nrdpmnmn.send.school = request.POST.get('school', '') nrdpmnmn.send.field_of_study = request.POST.get('field_of_study', '') nrdpmnmn.send.sequence_nbr = request.POST.get('sequence_nbr', '') if request.method == 'POST': if 'update' in request.POST: nrdpmnmn.send.action = "U" elif 'create' in request.POST: nrdpmnmn.send.action = "S" # nrdpmnmp.send.ip_address = request.META['REMOTE_ADDR'] # **************************************************************************** # # Broker Call # **************************************************************************** # try: nrdpmnmn.call_broker_once(service=request.META['HTTP_SERVICE']) except (UTBrokerError), error_info: exception_msg = str(error_info) return render_to_response( 'error.html', UTDirectContext( request, {'exception_msg': exception_msg}, defaults=defaults, document_title='Broker Error', ))
def index(request): context = {} return render_to_response( "links.html", UTDirectContext(request, context, defaults=defaults))