def get(self): user = users.get_current_user() if user: email = user.email() subdomain = ops.getDomainFromEmail(email) isQualityAssurance = ops.isQA(email) isAdmin = ops.isAdmin(email) isSuperAdmin = ops.isSuperAdmin(email) if subdomain != 'jkuat.ac.ke': domain = ops.getDomainFromSubdomain(subdomain) if domain != 'jkuat': self.redirect('/unauthorized') values = defaultValues() values['isQualityAssurance'] = isQualityAssurance values['isAdmin'] = isAdmin values['isSuperAdmin'] = isSuperAdmin wireframe = 'registerDepartment' else: wireframe = 'unauthorised' values = {} values['login_url'] = users.create_login_url('/') app_path = os.path.join( DIRECTORY, os.path.join('templates', '%s.html' % wireframe)) values['app'] = template.render(app_path, values, debug=_DEBUG) path = os.path.join(TEMPLATES_PATH, 'main.html') self.response.out.write(template.render(path, values, debug=_DEBUG))
def get(self): user = users.get_current_user() if user: email = user.email() subdomain = ops.getDomainFromEmail(email) isQualityAssurance = ops.isQA(email) isAdmin = ops.isAdmin(email) isSuperAdmin = ops.isSuperAdmin(email) if subdomain != 'jkuat.ac.ke': domain = ops.getDomainFromSubdomain(subdomain) if domain != 'jkuat': self.redirect('/unauthorized') values = defaultValues() values['isQualityAssurance'] = isQualityAssurance values['isAdmin'] = isAdmin values['isSuperAdmin'] = isSuperAdmin wireframe = 'registerDepartment' else : wireframe = 'unauthorised' values = {} values['login_url'] = users.create_login_url('/') app_path = os.path.join(DIRECTORY, os.path.join('templates', '%s.html' % wireframe)) values['app'] = template.render(app_path, values, debug=_DEBUG) path = os.path.join(TEMPLATES_PATH,'main.html') self.response.out.write(template.render(path, values, debug=_DEBUG))
def get(self): values = defaultValues() wireframe = 'upload_csv' values['isAuthorised'] = True values['isLogged'] = True values['isSuperAdmin'] = ops.isSuperAdmin(users.get_current_user().email()) app_path = os.path.join(TEMPLATES_PATH,'%s.html' % wireframe) values['app'] = template.render(app_path, values, debug=_DEBUG) path = os.path.join(TEMPLATES_PATH,'index.html') self.response.out.write(template.render(path, values, debug=_DEBUG))
def get(self): values = defaultValues() wireframe = 'upload_csv' values['isAuthorised'] = True values['isLogged'] = True values['isSuperAdmin'] = ops.isSuperAdmin( users.get_current_user().email()) app_path = os.path.join(TEMPLATES_PATH, '%s.html' % wireframe) values['app'] = template.render(app_path, values, debug=_DEBUG) path = os.path.join(TEMPLATES_PATH, 'index.html') self.response.out.write(template.render(path, values, debug=_DEBUG))
def get(self): #ops.addPeriod('2015-3','2015-3') #ops.flagApplicant('cs282-9398/2331') values = {} user = users.get_current_user() values['isSuperAdmin'] = False values['isAuthorised'] = False values['isLogged'] = False values['hasApplied'] = False values['statusMessage'] = 'No Reapplication' if ops.reAppIsOpen(): values['statusMessage'] = 'Reapplication Open' if user: email = user.email() subdomain = ops.getDomainFromEmail(email) isAdmin = ops.isAdmin(email) isSuperAdmin = ops.isSuperAdmin(email) if subdomain != 'ku.ac.ke': domain = ops.getDomainFromSubdomain(subdomain) if domain != 'ku': self.redirect('/unauthorized') values = defaultValues() values['isAdmin'] = isAdmin values['isSuperAdmin'] = isSuperAdmin values['isAuthorised'] = True values['isLogged'] = True values['hasApplied'] = ops.hasApplied(email) wireframe = 'home' else: wireframe = 'unauthorised' values = {} values['login_url'] = users.create_login_url('/') if ops.reAppIsOpen(): values['statusMessage'] = 'Reapplication Open' else: values['statusMessage'] = 'No Reapplication' app_path = os.path.join( DIRECTORY, os.path.join('templates', '%s.html' % wireframe)) values['app'] = template.render(app_path, values, debug=_DEBUG) path = os.path.join(TEMPLATES_PATH, 'index.html') self.response.out.write(template.render(path, values, debug=_DEBUG))
def post(self): user = users.get_current_user() email = user.email() form = cgi.FieldStorage() filedata = form['hostupload'] data = filedata.value ops.uploadFile(email, data) values = defaultValues() wireframe = 'upload_csv' values['isAuthorised'] = True values['isLogged'] = True values['isSuperAdmin'] = ops.isSuperAdmin(users.get_current_user().email()) values['upload_message'] = 'File uploaded and will be processed in not more than 10 mins!' app_path = os.path.join(TEMPLATES_PATH,'%s.html' % wireframe) values['app'] = template.render(app_path, values, debug=_DEBUG) path = os.path.join(TEMPLATES_PATH,'index.html') self.response.out.write(template.render(path, values, debug=_DEBUG))
def get(self): #ops.addPeriod('2015-3','2015-3') #ops.flagApplicant('cs282-9398/2331') values = {} user = users.get_current_user() values['isSuperAdmin'] = False values['isAuthorised'] = False values['isLogged'] = False values['hasApplied'] = False values['statusMessage'] = 'No Reapplication' if ops.reAppIsOpen(): values['statusMessage'] = 'Reapplication Open' if user: email = user.email() subdomain = ops.getDomainFromEmail(email) isAdmin = ops.isAdmin(email) isSuperAdmin = ops.isSuperAdmin(email) if subdomain != 'ku.ac.ke': domain = ops.getDomainFromSubdomain(subdomain) if domain != 'ku': self.redirect('/unauthorized') values = defaultValues() values['isAdmin'] = isAdmin values['isSuperAdmin'] = isSuperAdmin values['isAuthorised'] = True values['isLogged'] = True values['hasApplied'] = ops.hasApplied(email) wireframe = 'home' else : wireframe = 'unauthorised' values = {} values['login_url'] = users.create_login_url('/') if ops.reAppIsOpen(): values['statusMessage'] = 'Reapplication Open' else: values['statusMessage'] = 'No Reapplication' app_path = os.path.join(DIRECTORY, os.path.join('templates', '%s.html' % wireframe)) values['app'] = template.render(app_path, values, debug=_DEBUG) path = os.path.join(TEMPLATES_PATH,'index.html') self.response.out.write(template.render(path, values, debug=_DEBUG))
def post(self): user = users.get_current_user() email = user.email() form = cgi.FieldStorage() filedata = form['hostupload'] data = filedata.value ops.uploadFile(email, data) values = defaultValues() wireframe = 'upload_csv' values['isAuthorised'] = True values['isLogged'] = True values['isSuperAdmin'] = ops.isSuperAdmin( users.get_current_user().email()) values[ 'upload_message'] = 'File uploaded and will be processed in not more than 10 mins!' app_path = os.path.join(TEMPLATES_PATH, '%s.html' % wireframe) values['app'] = template.render(app_path, values, debug=_DEBUG) path = os.path.join(TEMPLATES_PATH, 'index.html') self.response.out.write(template.render(path, values, debug=_DEBUG))
def get(self): view_info = self.request.path_info.split('/') values = defaultValues() email = users.get_current_user().email() message = '' if len(view_info)<2: return view = view_info[1] values['isAuthorised'] = True if view == 'student_details': reg_no = self.request.get('regno',None) period = self.request.get('period',None) #Verify Email address and registration number email = users.get_current_user().email() if ops.verifyUser(email, reg_no) or ops.isSuperAdmin(users.get_current_user().email()): pass else: self.redirect('/unauthorized') values['student_details'] = ops.getStudent(reg_no,period) if len(values['student_details']) > 0: wireframe = 'student_details' else: wireframe = 'record_notfound' values['regno'] = reg_no elif view == 'application_first': if ops.hasApplied(email): message = 'You have already applied! You can only apply once!' values['message'] = message wireframe = 'report' elif ops.allocated(email): message = 'You have already been allocated hostel! You can not apply again!' values['message'] = message wireframe = 'report' else: wireframe = 'application_first' elif view == 'application_cont': if ops.hasApplied(email): message = 'You have already applied! You can only apply once!' values['message'] = message wireframe = 'report' elif ops.allocated(email): message = 'You have already been allocated hostel! You can not apply again!' values['message'] = message wireframe = 'report' else: wireframe = 'application_cont' elif view == 'status': periods = ops.getPeriods() values['periods'] = periods wireframe = 'status' elif view == 'unauthorized': wireframe = 'unauthorized' values['isAuthorised'] = False elif view == 'openApp': ops.openApplication() wireframe = 'report' message = 'Hostel Applications are Open!' elif view == 'allowReApp': ops.allowReApplication() wireframe = 'report' message = 'You have allowed hostel Reapplication' elif view == 'disAllowReApp': ops.disAllowReApp() wireframe = 'report' message = 'You have disallowed hostel Re-Application' if ops.reAppIsOpen(): values['statusMessage'] = 'Reapplication Open' else: values['statusMessage'] = 'No Reapplication' values['isLogged'] = True values['message'] = message values['isSuperAdmin'] = ops.isSuperAdmin(users.get_current_user().email()) app_path = os.path.join(TEMPLATES_PATH,'%s.html' % wireframe) values['app'] = template.render(app_path, values, debug=_DEBUG) path = os.path.join(TEMPLATES_PATH,'index.html') self.response.out.write(template.render(path, values, debug=_DEBUG))
def get(self): view_info = self.request.path_info.split('/') values = defaultValues() email = users.get_current_user().email() message = '' if len(view_info) < 2: return view = view_info[1] values['isAuthorised'] = True if view == 'student_details': reg_no = self.request.get('regno', None) period = self.request.get('period', None) #Verify Email address and registration number email = users.get_current_user().email() if ops.verifyUser(email, reg_no) or ops.isSuperAdmin( users.get_current_user().email()): pass else: self.redirect('/unauthorized') values['student_details'] = ops.getStudent(reg_no, period) if len(values['student_details']) > 0: wireframe = 'student_details' else: wireframe = 'record_notfound' values['regno'] = reg_no elif view == 'application_first': if ops.hasApplied(email): message = 'You have already applied! You can only apply once!' values['message'] = message wireframe = 'report' elif ops.allocated(email): message = 'You have already been allocated hostel! You can not apply again!' values['message'] = message wireframe = 'report' else: wireframe = 'application_first' elif view == 'application_cont': if ops.hasApplied(email): message = 'You have already applied! You can only apply once!' values['message'] = message wireframe = 'report' elif ops.allocated(email): message = 'You have already been allocated hostel! You can not apply again!' values['message'] = message wireframe = 'report' else: wireframe = 'application_cont' elif view == 'status': periods = ops.getPeriods() values['periods'] = periods wireframe = 'status' elif view == 'unauthorized': wireframe = 'unauthorized' values['isAuthorised'] = False elif view == 'openApp': ops.openApplication() wireframe = 'report' message = 'Hostel Applications are Open!' elif view == 'allowReApp': ops.allowReApplication() wireframe = 'report' message = 'You have allowed hostel Reapplication' elif view == 'disAllowReApp': ops.disAllowReApp() wireframe = 'report' message = 'You have disallowed hostel Re-Application' if ops.reAppIsOpen(): values['statusMessage'] = 'Reapplication Open' else: values['statusMessage'] = 'No Reapplication' values['isLogged'] = True values['message'] = message values['isSuperAdmin'] = ops.isSuperAdmin( users.get_current_user().email()) app_path = os.path.join(TEMPLATES_PATH, '%s.html' % wireframe) values['app'] = template.render(app_path, values, debug=_DEBUG) path = os.path.join(TEMPLATES_PATH, 'index.html') self.response.out.write(template.render(path, values, debug=_DEBUG))
def get(self): view_info = self.request.path_info.split('/') user = users.get_current_user() email = user.email() values = defaultValues() isQualityAssurance = ops.isQA(email) isAdmin = ops.isAdmin(email) isSuperAdmin = ops.isSuperAdmin(email) values = defaultValues() values['isQualityAssurance'] = isQualityAssurance values['isAdmin'] = isAdmin values['isSuperAdmin'] = isSuperAdmin if len(view_info) < 2: return view = view_info[1] if view == 'student_details': reg_no = self.request.get('regno', None) values['student_details'] = ops.getStudent(reg_no) if len(values['student_details']) > 0: wireframe = 'student_details' else: wireframe = 'record_notfound' values['title'] = 'Kisii University' values['regno'] = reg_no elif view == 'unauthorized': wireframe = 'unauthorized' elif view == 'add_admin': wireframe = 'addadmin' elif view == 'remove_admin': wireframe = 'removeAdmin' elif view == 'add_dept': wireframe = 'addDept' elif view == 'retrieveStudents': wireframe = 'downloadStudents' elif view == 'remove_dept': wireframe = 'removeDept' elif view == 'addDepartment': department_name = self.request.get('department', None) ops.addDepartment(department_name) wireframe = 'recordAdded' elif view == 'addAdministrator': department_name = self.request.get('department', None) emailAddress = self.request.get('emailAddress', None) ops.addAdmins(department_name, emailAddress) wireframe = 'recordAdded' elif view == 'home': department_name = self.request.get('department', None) ops.AddStudent(department_name, values['nickname']) wireframe = 'home' elif view == 'removeDepartment': department_name = self.request.get('department', None) ops.removeDept(department_name) wireframe = 'recordAdded' elif view == 'add_QA': wireframe = 'addQA' elif view == 'addQualityAssurance': emailAddress = self.request.get('emailAddress', None) ops.addQA(emailAddress) wireframe = 'recordAdded' elif view == 'updateStudent': ops.updateStudent(0) wireframe = 'recordAdded' app_path = os.path.join(TEMPLATES_PATH, '%s.html' % wireframe) values['app'] = template.render(app_path, values, debug=_DEBUG) path = os.path.join(TEMPLATES_PATH, 'main.html') self.response.out.write(template.render(path, values, debug=_DEBUG))
def get(self): view_info = self.request.path_info.split('/') user = users.get_current_user() email = user.email() values = defaultValues() isQualityAssurance = ops.isQA(email) isAdmin = ops.isAdmin(email) isSuperAdmin = ops.isSuperAdmin(email) values = defaultValues() values['isQualityAssurance'] = isQualityAssurance values['isAdmin'] = isAdmin values['isSuperAdmin'] = isSuperAdmin if len(view_info)<2: return view = view_info[1] if view == 'student_details': reg_no = self.request.get('regno',None) values['student_details'] = ops.getStudent(reg_no) if len(values['student_details']) > 0: wireframe = 'student_details' else: wireframe = 'record_notfound' values['title'] = 'Kisii University' values['regno'] = reg_no elif view == 'unauthorized': wireframe = 'unauthorized' elif view == 'add_admin': wireframe = 'addadmin' elif view == 'remove_admin': wireframe = 'removeAdmin' elif view == 'add_dept': wireframe = 'addDept' elif view == 'retrieveStudents': wireframe = 'downloadStudents' elif view == 'remove_dept': wireframe = 'removeDept' elif view == 'addDepartment': department_name = self.request.get('department', None) ops.addDepartment(department_name) wireframe = 'recordAdded' elif view == 'addAdministrator': department_name = self.request.get('department', None) emailAddress = self.request.get('emailAddress', None) ops.addAdmins(department_name, emailAddress) wireframe = 'recordAdded' elif view == 'home': department_name = self.request.get('department', None) ops.AddStudent(department_name,values['nickname']) wireframe = 'home' elif view == 'removeDepartment': department_name = self.request.get('department', None) ops.removeDept(department_name) wireframe = 'recordAdded' elif view == 'add_QA': wireframe = 'addQA' elif view == 'addQualityAssurance': emailAddress = self.request.get('emailAddress', None) ops.addQA(emailAddress) wireframe = 'recordAdded' elif view == 'updateStudent': ops.updateStudent(0) wireframe = 'recordAdded' app_path = os.path.join(TEMPLATES_PATH,'%s.html' % wireframe) values['app'] = template.render(app_path, values, debug=_DEBUG) path = os.path.join(TEMPLATES_PATH,'main.html') self.response.out.write(template.render(path, values, debug=_DEBUG))