def render_rtmonitor_page(request): from dbapp.urls import dbapp_url request.dbapp_url = dbapp_url apps = get_all_app_and_models() if HasPerm(request.user, 'contenttypes.can_MonitorAllPage'): template = MonitorAllPage._template position = MonitorAllPage._position help_model_name = MonitorAllPage.__name__ elif HasPerm(request.user, 'contenttypes.can_MonitorAlarmPage'): template = MonitorAlarmPage._template position = MonitorAlarmPage._position help_model_name = MonitorAlarmPage.__name__ return render_to_response(template, RequestContext(request,{ "app_label": "iaccess", "dbapp_url": dbapp_url, "MEDIA_ROOT": MEDIA_ROOT, "apps": apps, "current_app": "iaccess", "myapp": [a for a in apps if a[0]=="iaccess"][0][1], "app_label": "iaccess", "menu_focus": "RTMonitorPage", "position": position, "help_model_name": help_model_name }))
def render_elevatortimeseg_page(request): #print 'lift view' from dbapp.urls import dbapp_url request.dbapp_url = dbapp_url apps = get_all_app_and_models() strtest = [a for a in apps if a[0] == "elevator"][0][1] if HasPerm(request.user, 'contenttypes.can_ElevatorTimesegSetPage'): template = ElevatorTimesegSetPage._template position = ElevatorTimesegSetPage._position searchform = get_searchform(request, AccTimeSeg) help_model_name = ElevatorTimesegSetPage.__name__ if searchform: has_header = True else: has_header = False return render_to_response( template, RequestContext( request, { "app_label": "elevator", "dbapp_url": dbapp_url, "MEDIA_ROOT": MEDIA_ROOT, "apps": apps, "myapp": [a for a in apps if a[0] == "elevator"][0][1], "current_app": "elevator", "menu_focus": "ElevatorTimesegSetPage", "has_header": has_header, "searchform": searchform, "position": position, "help_model_name": help_model_name, }))
def render_floorset_page(request): from dbapp.urls import dbapp_url request.dbapp_url = dbapp_url apps = get_all_app_and_models() #strtest = [a for a in apps if a[0]=="elevator"][0][1] if HasPerm(request.user, 'contenttypes.can_FloorMngPage'): template = FloorMngPage._template position = FloorMngPage._position searchform = get_searchform(request, Device) help_model_name = FloorMngPage.__name__ elif HasPerm(request.user, 'contenttypes.can_FloorSetPage'): #其他跟模型相关的界面需要到模板中重定向 template = "Elevator_Floor_Set.html" position = "" searchform = "" help_model_name = "" #local variable 'searchform' referenced before assignment # else: # template = "Elevator_Floor_Set.html" # position = "" # searchform = "" if searchform: has_header = True else: has_header = False #template = "Elevator_floor_Mng.html" return render_to_response( template, RequestContext( request, { "app_label": "elevator", "dbapp_url": dbapp_url, "MEDIA_ROOT": MEDIA_ROOT, "apps": apps, "myapp": [a for a in apps if a[0] == "elevator"][0][1], "current_app": "elevator", "menu_focus": "FloorSetPage", "has_header": has_header, "searchform": searchform, "position": position, "help_model_name": help_model_name, }))
def render_reportform_page(request): from dbapp.urls import dbapp_url request.dbapp_url = dbapp_url apps = get_all_app_and_models() if HasPerm(request.user, 'contenttypes.can_AllEventReportPage'): model_name = AllEventReportPage._model_name template = AllEventReportPage._template position = AllEventReportPage._position searchform = get_searchform(request, AccRTMonitor) help_model_name = "AllEventReportPage" elif HasPerm(request.user, 'contenttypes.can_AlarmEventReportPage'): model_name = AlarmEventReportPage._model_name template = AlarmEventReportPage._template position = AlarmEventReportPage._position searchform = get_searchform(request, AccRTMonitor) help_model_name = "AllEventReportPage" elif HasPerm(request.user, 'contenttypes.can_EmpLevelReportPage'): model_name = EmpLevelReportPage._model_name template = EmpLevelReportPage._template position = EmpLevelReportPage._position searchform = get_searchform(request, AccLevelSet) help_model_name = "AllEventReportPage" if searchform: has_header = True else: has_header = False return render_to_response( template, RequestContext( request, { "app_label": "iaccess", "dbapp_url": dbapp_url, "MEDIA_ROOT": MEDIA_ROOT, "apps": apps, "model_name": model_name, "current_app": "iaccess", "myapp": [a for a in apps if a[0] == "iaccess"][0][1], "menu_focus": "ReportFormPage", "has_header": has_header, "searchform": searchform, "position": position, "help_model_name": help_model_name }))
def render_empelevatorlevelset_page(request): from dbapp.urls import dbapp_url request.dbapp_url = dbapp_url apps = get_all_app_and_models() if HasPerm(request.user, 'contenttypes.can_EmpElevtorLevelByLevelPage'): model_name = EmpElevtorLevelByLevelPage._model_name template = EmpElevtorLevelByLevelPage._template position = EmpElevtorLevelByLevelPage._position searchform = get_searchform(request, AccLevelSet) help_model_name = EmpElevtorLevelByLevelPage.__name__ elif HasPerm(request.user, 'contenttypes.can_EmpElevatorLevelByEmpPage'): model_name = EmpElevatorLevelByEmpPage._model_name template = EmpElevatorLevelByEmpPage._template position = EmpElevatorLevelByEmpPage._position searchform = get_searchform(request, Employee) help_model_name = EmpElevatorLevelByEmpPage.__name__ if searchform: has_header = True else: has_header = False return render_to_response( template, RequestContext( request, { "app_label": "elevator", "dbapp_url": dbapp_url, "MEDIA_ROOT": MEDIA_ROOT, "apps": apps, "current_app": "elevator", "myapp": [a for a in apps if a[0] == "elevator"][0][1], "menu_focus": "EmpElevatorLevelSetPage", "has_header": has_header, "searchform": searchform, "position": position, "model_name": model_name, "help_model_name": help_model_name }))
def base_data_page(request): from dbapp.urls import dbapp_url request.dbapp_url = dbapp_url apps = get_all_app_and_models() searchform = None model_name = None position = _(u'人事 ->基本资料') help_model_name = None template = CountryPage._template if HasPerm(request.user, 'contenttypes.can_CountryPage'): model_name = CountryPage._model_name template = CountryPage._template position = CountryPage._position searchform = get_searchform(request, Country) help_model_name = CountryPage.__name__ elif HasPerm(request.user, 'contenttypes.can_StatePage'): model_name = StatePage._model_name template = StatePage._template position = StatePage._position searchform = get_searchform(request, State) help_model_name = StatePage.__name__ elif HasPerm(request.user, 'contenttypes.can_CityPage'): model_name = CityPage._model_name template = CityPage._template position = CityPage._position searchform = get_searchform(request, City) help_model_name = CityPage.__name__ elif HasPerm(request.user, 'contenttypes.can_NationalPage'): model_name = NationalPage._model_name template = NationalPage._template position = NationalPage._position searchform = get_searchform(request, National) help_model_name = NationalPage.__name__ elif HasPerm(request.user, 'contenttypes.can_EducationPage'): model_name = EducationPage._model_name template = EducationPage._template position = EducationPage._position searchform = get_searchform(request, Education) help_model_name = EducationPage.__name__ if searchform: has_header = True else: has_header = False return render_to_response( template, RequestContext( request, { "app_label": "personnel", "dbapp_url": dbapp_url, "MEDIA_ROOT": MEDIA_ROOT, "apps": apps, "model_name": model_name, "current_app": "personnel", "myapp": [a for a in apps if a[0] == "personnel"][0][1], "menu_focus": "BaseDataPage", "has_header": has_header, "searchform": searchform, "position": position, "help_model_name": "base_data_page" }))
def render_posform_page(request): from dbapp.urls import dbapp_url request.dbapp_url = dbapp_url apps = get_all_app_and_models() if HasPerm(request.user, 'contenttypes.can_SplitTimePage'): try: ct = ContentType.objects.get_for_model(SplitTime) log_search = "content_type__id=%s" % ct.pk except: log_search = "" model_name = SplitTimePage._model_name template = SplitTimePage._template position = SplitTimePage._position searchform = get_searchform(request, SplitTime) if get_option("POS_IC"): help_model_name = "ic_splittimepage" else: help_model_name = SplitTimePage.__name__ elif HasPerm(request.user, 'contenttypes.can_BatchTimePage'): model_name = BatchTimePage._model_name template = BatchTimePage._template position = BatchTimePage._position searchform = get_searchform(request, BatchTime) if get_option("POS_IC"): help_model_name = "ic_batchtimepage" else: help_model_name = BatchTimePage.__name__ elif HasPerm(request.user, 'contenttypes.can_DiningPage'): model_name = DiningPage._model_name template = DiningPage._template position = DiningPage._position searchform = get_searchform(request, Dininghall) if get_option("POS_IC"): help_model_name = "ic_diningpage" else: help_model_name = DiningPage.__name__ elif HasPerm(request.user, 'contenttypes.can_MealPage'): model_name = MealPage._model_name template = MealPage._template position = MealPage._position searchform = get_searchform(request, Meal) help_model_name = MealPage.__name__ if get_option("POS_IC"): help_model_name = "ic_mealpage" else: help_model_name = MealPage.__name__ elif HasPerm(request.user, 'contenttypes.can_MerchandisePage'): model_name = MerchandisePage._model_name template = MerchandisePage._template position = MerchandisePage._position searchform = get_searchform(request, Merchandise) help_model_name = MerchandisePage.__name__ if get_option("POS_IC"): help_model_name = "ic_merchandisepage" else: help_model_name = MerchandisePage.__name__ elif HasPerm(request.user, 'contenttypes.can_KeyValuePage'): model_name = KeyValuePage._model_name template = KeyValuePage._template position = KeyValuePage._position searchform = get_searchform(request, KeyValue) help_model_name = KeyValuePage.__name__ if get_option("POS_IC"): help_model_name = "ic_keyvaluepage" else: help_model_name = KeyValuePage.__name__ else: template = "pos_informaform.html" position = "" searchform = "" help_model_name = "" log_search = "" if searchform: has_header = True else: has_header = False return render_to_response( template, RequestContext( request, { "app_label": "pos", "dbapp_url": dbapp_url, "MEDIA_ROOT": MEDIA_ROOT, "apps": apps, # "model_name": model_name, "current_app": "pos", "myapp": [a for a in apps if a[0] == "pos"][0][1], "menu_focus": "PosFormPage", "has_header": has_header, "searchform": searchform, "position": position, "help_model_name": help_model_name, "log_search": log_search }))