Ejemplo n.º 1
0
    def get(self):
        the_get = Get()
        instance = SensitiveBackstage()
        query = instance.get_all()
        name = the_get.get_name(self)
        if name:
            query = instance.find_by_name(query, name)

        page = the_get.get_page(self)
        data_count_per_page = the_get.get_data_count_per_page(self)
        page_count_per_page = the_get.get_page_count_per_page(self)
        offset = (page - 1) * data_count_per_page
        limit = data_count_per_page

        query, count = instance.get_some(query, offset, limit)
        total_page = int(ceil(count / data_count_per_page))
        pagination = Pagination(total_page, page, data_count_per_page, page_count_per_page)
        page_list, previous, next = pagination.get_page_list_of_this_page()

        return self.render(BASE_SENSITIVE_BACKSTAGE_LIST_HTML,
                           sensitive_list=query,
                           pages=page_list,
                           previous=previous,
                           next=next,
                           page=page,
                           name=name,
                           home_list_url=MANAGEMENT_BASE_HOME_URL,
                           list_url=BASE_SENSITIVE_BACKSTAGE_LIST_URL,
                           detail_url=BASE_SENSITIVE_BACKSTAGE_DETAIL_URL,
                           add_url=BASE_SENSITIVE_BACKSTAGE_ADD_URL,
                           delete_url=BASE_SENSITIVE_BACKSTAGE_DELETE_URL,
                           )
Ejemplo n.º 2
0
    def get(self):
        the_get = Get()
        name = the_get.get_name(self)
        state = the_get.get_state(self)
        if name is None:
            name = ""
        if state is None:
            state = ""

        print("state", end=":")
        print(state)
        page = the_get.get_page(self)
        data_count_per_page = the_get.get_data_count_per_page(self)
        page_count_per_page = the_get.get_page_count_per_page(self)
        offset = (page - 1) * data_count_per_page
        limit = data_count_per_page

        instance = BodyType()

        query = instance.get_all()

        if name:
            query = instance.find_by_name(query, name)
        if state:
            if state == "1":
                print("state is 1")
                query = instance.get_valid(query)
            else:
                print("state is not 1")
                query = instance.get_invalid(query)

        query, count = instance.get_some(query, offset, limit)
        total_page = int(ceil(count / data_count_per_page))
        pagination = Pagination(total_page, page, data_count_per_page,
                                page_count_per_page)
        page_list, previous, next = pagination.get_page_list_of_this_page()

        return self.render(BASE_BODY_TYPE_LIST_HTML,
                           body_types=query,
                           pages=page_list,
                           previous=previous,
                           next=next,
                           page=page,
                           home_list_url=MANAGEMENT_BASE_HOME_URL,
                           list_url=BASE_BODY_TYPE_LIST_URL,
                           detail_url=BASE_BODY_TYPE_DETAIL_URL,
                           add_url=BASE_BODY_TYPE_ADD_URL,
                           name=name,
                           state=state)
Ejemplo n.º 3
0
    def get(self):
        the_get = Get()
        instance = Hint()
        page = the_get.get_page(self)
        submit = the_get.get_submit(self)
        data_count_per_page = the_get.get_data_count_per_page(self)
        page_count_per_page = the_get.get_page_count_per_page(self)
        parent_id = the_get.get_id(self)
        if not parent_id:
            parent_id = 0
        name = the_get.get_name(self)
        OHHOLog.print_log(submit)
        if submit:
            query = instance.get_all()
        elif not parent_id:
            query = instance.get_by_parent_id(None)
        else:
            query = instance.get_by_parent_id(parent_id)

        offset = (page - 1) * data_count_per_page
        limit = data_count_per_page

        if name is not None:
            query = instance.find_by_name(query, name)
        else:
            name = ""

        query, count = instance.get_some(query, offset, limit)
        total_page = int(ceil(count / data_count_per_page))
        pagination = Pagination(total_page, page, data_count_per_page,
                                page_count_per_page)
        page_list, previous, next = pagination.get_page_list_of_this_page()

        return self.render(
            BASE_HINT_BACKSTAGE_LIST_HTML,
            hints=query,
            pages=page_list,
            previous=previous,
            next=next,
            page=page,
            home_list_url=MANAGEMENT_BASE_HOME_URL,
            list_url=BASE_HINT_BACKSTAGE_LIST_URL,
            detail_url=BASE_HINT_BACKSTAGE_DETAIL_URL,
            add_url=BASE_HINT_BACKSTAGE_ADD_URL,
            delete_url=BASE_HINT_BACKSTAGE_DELETE_URL,
            name=name,
            parent_id=parent_id,
        )
Ejemplo n.º 4
0
 def get(self):
     the_request = Get()
     self.set_format(the_request.get_format(self))
     instance = LogicTestAddPhonePosition()
     position_dict = the_request.get_map_information(self)
     position_dict["name"] = the_request.get_name(self)
     position_dict["environment"] = self.get_argument("environment")
     position_dict["timestamp"] = self.get_argument("timestamp")
     position_dict["input_distance"] = self.get_argument("input_distance")
     position_dict["aoi"] = self.get_argument("aoi")
     position_dict["position_time"] = self.get_argument("position_time")
     result = Result.result_failed()
     success = instance.add(position_dict)
     if success:
         result = Result.result_success()
     return self.response(result)
Ejemplo n.º 5
0
    def get(self):
        the_get = Get()
        instance = WorkDomain()
        name = the_get.get_name(self)
        state = the_get.get_state(self)
        if name is None:
            name = ""
        if state is None:
            state = ""

        page = the_get.get_page(self)
        data_count_per_page = the_get.get_data_count_per_page(self)
        page_count_per_page = the_get.get_page_count_per_page(self)
        offset = (page - 1) * data_count_per_page
        limit = data_count_per_page

        query = instance.get_all()

        if name:
            query = instance.find_by_name(query, name)
        if state:
            if state == "1":
                query = instance.get_valid(query)
            else:
                query = instance.get_invalid(query)

        query, count = instance.get_some(query, offset, limit)
        total_page = int(ceil(count / data_count_per_page))
        pagination = Pagination(total_page, page, data_count_per_page,
                                page_count_per_page)
        page_list, previous, next = pagination.get_page_list_of_this_page()

        return self.render(BASE_WORK_DOMAIN_LIST_HTML,
                           work_domains=query,
                           pages=page_list,
                           previous=previous,
                           next=next,
                           page=page,
                           home_list_url=MANAGEMENT_BASE_HOME_URL,
                           list_url=BASE_WORK_DOMAIN_LIST_URL,
                           detail_url=BASE_WORK_DOMAIN_DETAIL_URL,
                           add_url=BASE_WORK_DOMAIN_ADD_URL,
                           name=name,
                           state=state)
Ejemplo n.º 6
0
    def get(self):
        the_get = Get()
        instance = OHHOPermission()
        name = the_get.get_name(self)
        if name is None:
            name = ""
        page = the_get.get_page(self)
        data_count_per_page = the_get.get_data_count_per_page(self)
        page_count_per_page = the_get.get_page_count_per_page(self)
        offset = (page - 1) * data_count_per_page
        limit = data_count_per_page

        query = instance.group.get_all()

        if name:
            query = instance.group.get_by_name(query, name)

        query, count = instance.group.get_some(query, offset, limit)
        total_page = int(ceil(count / data_count_per_page))
        pagination = Pagination(total_page, page, data_count_per_page,
                                page_count_per_page)
        page_list, previous, next = pagination.get_page_list_of_this_page()

        return self.render(
            PERMISSION_GROUP_BACKSTAGE_LIST_HTML,
            groups=query,
            pages=page_list,
            previous=previous,
            next=next,
            page=page,
            home_list_url=MANAGEMENT_PERMISSION_HOME_URL,
            list_url=PERMISSION_GROUP_BACKSTAGE_LIST_URL,
            detail_url=PERMISSION_GROUP_BACKSTAGE_DETAIL_URL,
            add_url=PERMISSION_GROUP_BACKSTAGE_ADD_URL,
            delete_url=PERMISSION_GROUP_BACKSTAGE_DELETE_URL,
            add_group_staff_relation_url=
            PERMISSION_GROUP_STAFF_RELATION_ADD_URL,
            group_page_relation_list_url=
            PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_LIST_URL,
            name=name,
        )
Ejemplo n.º 7
0
    def get(self):
        the_get = Get()
        instance = CountryCode()
        country_name = the_get.get_name(self)
        if country_name is None or not country_name:
            country_name = ""
        page = the_get.get_page(self)
        data_count_per_page = the_get.get_data_count_per_page(self)
        page_count_per_page = the_get.get_page_count_per_page(self)
        offset = (page - 1) * data_count_per_page
        limit = data_count_per_page

        query = instance.get_all()

        if country_name:
            query = instance.get_by_country_name(country_name)

        query, count = instance.get_some(query, offset, limit)
        total_page = int(ceil(count / data_count_per_page))
        pagination = Pagination(total_page, page, data_count_per_page,
                                page_count_per_page)
        page_list, previous, next = pagination.get_page_list_of_this_page()

        return self.render(
            BASE_COUNTRY_CODE_BACKSTAGE_LIST_HTML,
            country_codes=query,
            pages=page_list,
            previous=previous,
            next=next,
            page=page,
            home_list_url=MANAGEMENT_BASE_HOME_URL,
            list_url=BASE_COUNTRY_CODE_BACKSTAGE_LIST_URL,
            detail_url=BASE_COUNTRY_CODE_BACKSTAGE_DETAIL_URL,
            add_url=BASE_COUNTRY_CODE_BACKSTAGE_ADD_URL,
            delete_url=BASE_COUNTRY_CODE_BACKSTAGE_DELETE_URL,
            country_name=country_name,
        )
    def get(self):
        the_get = Get()
        user_instance = User()
        relation_instance = UserAndMatchCondition()

        username = the_get.get_username(self)
        name = the_get.get_name(self)
        match_condition_ids = the_get.get_id(self)

        if username is None:
            username = ""
        if name is None:
            name = ""
        if match_condition_ids is None:
            match_condition_ids = ""

        query = relation_instance.find(username, name, match_condition_ids)

        page = the_get.get_page(self)
        data_count_per_page = the_get.get_data_count_per_page(self)
        page_count_per_page = the_get.get_page_count_per_page(self)
        offset = (page - 1) * data_count_per_page
        limit = data_count_per_page

        query, count = relation_instance.get_some(query, offset, limit)
        total_page = int(ceil(count / data_count_per_page))
        pagination = Pagination(total_page, page, data_count_per_page,
                                page_count_per_page)
        page_list, previous, next = pagination.get_page_list_of_this_page()
        relations = list()
        for u in query:
            temp = dict()
            temp["id"] = u.id
            temp["user_id"] = u.user_id
            temp["match_condition_id"] = u.match_condition_id
            if u.name is not None:
                temp["name"] = u.name
            else:
                temp["name"] = ""
            the_user = user_instance.get_by_id(u.user_id)
            if the_user:
                temp["username"] = the_user.username
            else:
                temp["username"] = ""
            relations.append(temp)

        return self.render(
            USER_AND_MATCH_CONDITION_LIST_HTML,
            relations=relations,
            pages=page_list,
            previous=previous,
            next=next,
            page=page,
            list_url=USER_AND_MATCH_CONDITION_LIST_URL,
            detail_url=USER_AND_MATCH_CONDITION_DETAIL_URL,
            add_url=USER_AND_MATCH_CONDITION_ADD_URL,
            delete_url=USER_AND_MATCH_CONDITION_DELETE_URL,
            username=username,
            name=name,
            match_condition_ids=match_condition_ids,
        )