Ejemplo n.º 1
0
    def get(self):
        the_get = Get()
        im_user_id = the_get.get_id(self)

        im_user_instance = IMUser()
        ohho_user_instance = OHHOUser()

        im_user = im_user_instance.get_by_id(im_user_id)
        username = ""
        token = ""
        name = ""
        if im_user:
            ohho_user = ohho_user_instance.get_by_id(im_user.account_id)
            username = ohho_user.username
            if im_user.token is not None:
                token = im_user.token
            if im_user.name is not None:
                name = im_user.name
            state = im_user.state

        return self.render(IM_USER_DETAIL_HTML,
                           username=username,
                           token=token,
                           name=name,
                           state=state,
                           im_user_id=im_user_id,
                           detail_url=IM_USER_DETAIL_URL,
                           list_url=IM_USER_LIST_URL
                           )
Ejemplo n.º 2
0
    def get(self):
        user_instance = DBOHHOUser()
        cellphone_instance = DBCellphone()
        relation_instance = DBOHHOUserAndCellphoneRelation()

        the_get = Get()
        relation_id = the_get.get_id(self)
        username = ""
        cellphone_key = ""
        state = False
        if relation_id:
            relation = relation_instance.get_by_id(relation_id)
            if relation:
                state = relation.state
                user = user_instance.get_by_id(relation.user_id)
                username = user.username if user else ""
                cellphone = cellphone_instance.get_by_id(relation.cellphone_id)
                cellphone_key = cellphone.key if cellphone else ""

        return self.render(USER_AND_CELLPHONE_DETAIL_HTML,
                           username=username,
                           cellphone_key=cellphone_key,
                           state=state,
                           relation_id=relation_id,
                           detail_url=USER_AND_CELLPHONE_DETAIL_URL,
                           list_url=USER_AND_CELLPHONE_LIST_URL)
Ejemplo n.º 3
0
 def get(self):
     the_get = Get()
     group_id = the_get.get_id(self)
     if group_id:
         instance_staff = DBOHHOStaff()
         instance_group_staff_relation = OHHOPermission().group_and_staff
         staffs = instance_staff.get_query()
         staffs = instance_staff.get_valid(staffs)
         staffs = instance_staff.get_all(staffs)
         staff_list = list()
         group_staff_list = list()
         group_staffs = instance_group_staff_relation.get_by_group_id(
             group_id)
         group_staffs = instance_group_staff_relation.get_all(group_staffs)
         if staffs:
             for staff in staffs:
                 if group_staffs:
                     for group_staff in group_staffs:
                         if staff.username == group_staff.username:
                             group_staff_list.append(staff)
                 staff_list.append(staff)
         staff_list = list(set(staff_list) - set(group_staff_list))
         return self.render(
             PERMISSION_GROUP_STAFF_RELATION_HTML,
             add_url=PERMISSION_GROUP_STAFF_RELATION_ADD_URL,
             delete_url=PERMISSION_GROUP_STAFF_RELATION_DELETE_URL,
             list_url=PERMISSION_GROUP_BACKSTAGE_LIST_URL,
             group_id=group_id,
             staff_list=staff_list,
             group_staff_list=group_staff_list,
         )
     else:
         return self.redirect(PERMISSION_GROUP_BACKSTAGE_LIST_URL)
Ejemplo n.º 4
0
    def get(self):
        the_get = Get()
        the_id = the_get.get_id(self)
        instance = Hint()
        obj = instance.get_by_id(the_id)
        name = obj.name if obj else ""
        key = obj.key if obj else ""
        description = obj.description if obj else ""
        parent = instance.get_by_id(obj.parent_id) if obj else None
        parent_id = parent.id if parent else 0
        parent_name = parent.name if parent else ""
        parent_key = parent.key if parent else ""
        parent_description = parent.description if parent else ""
        message = ""

        return self.render(BASE_HINT_BACKSTAGE_DELETE_HTML,
                           name=name,
                           key=key,
                           description=description,
                           parent_id=parent_id,
                           parent_name=parent_name,
                           parent_key=parent_key,
                           parent_description=parent_description,
                           delete_url=BASE_HINT_BACKSTAGE_DELETE_URL,
                           list_url=BASE_HINT_BACKSTAGE_LIST_URL,
                           message=message)
    def get(self):
        the_get = Get()
        user_instance = User()
        relation_instance = UserAndMatchCondition()

        user_and_match_condition_id = the_get.get_id(self)
        relation = relation_instance.get_by_id(user_and_match_condition_id)
        username = ""
        match_condition_id = ""
        name = ""
        if relation:
            user = user_instance.get_by_id(relation.user_id)
            username = user.username
            if relation.match_condition_id is not None:
                match_condition_id = relation.match_condition_id
            if relation.name is not None:
                name = relation.name

        return self.render(USER_AND_MATCH_CONDITION_DETAIL_HTML,
                           username=username,
                           name=name,
                           match_condition_id=match_condition_id,
                           user_and_match_condition_id=user_and_match_condition_id,
                           detail_url=USER_AND_MATCH_CONDITION_DETAIL_URL,
                           list_url=USER_AND_MATCH_CONDITION_LIST_URL
                           )
 def get(self):
     the_get = Get()
     group_id = the_get.get_id(self)
     if group_id:
         instance_user = DBOHHOUser()
         instance_group_user_relation = OHHOPermission().group_and_user
         users = instance_user.get_query()
         users = instance_user.get_valid(users)
         users = instance_user.get_all(users)
         user_list = list()
         group_user_list = list()
         group_users = instance_group_user_relation.get_by_group_id(
             group_id)
         group_users = instance_group_user_relation.get_all(group_users)
         if users:
             for user in users:
                 if group_users:
                     for group_user in group_users:
                         if user.username == group_user.username:
                             group_user_list.append(user)
                 user_list.append(user)
         user_list = list(set(user_list) - set(group_user_list))
         return self.render(
             PERMISSION_GROUP_USER_RELATION_HTML,
             add_url=PERMISSION_GROUP_USER_RELATION_ADD_URL,
             delete_url=PERMISSION_GROUP_USER_RELATION_DELETE_URL,
             list_url=PERMISSION_GROUP_BACKSTAGE_LIST_URL,
             group_id=group_id,
             user_list=user_list,
             group_user_list=group_user_list,
         )
     else:
         return self.redirect(PERMISSION_GROUP_BACKSTAGE_LIST_URL)
Ejemplo n.º 7
0
    def get(self):
        the_get = Get()
        relation_id = the_get.get_id(self)
        username = ""
        identity_id = ""
        state = False
        user_instance = DBOHHOUser()
        device_instance = DBOHHODevice()
        relation_instance = DBOHHOUserAndDeviceRelation()
        if relation_id:
            relation = relation_instance.get_by_id(relation_id)
            if relation:
                state = relation.state
                user = user_instance.get_by_id(relation.user_id)
                username = user.username if user else ""
                device = device_instance.get_by_id(relation.device_id)
                identity_id = device.identity_id if device else ""

        return self.render(
            USER_AND_DEVICE_DELETE_HTML,
            username=username,
            identity_id=identity_id,
            state=state,
            detail_url=USER_AND_DEVICE_DETAIL_URL,
            list_url=USER_AND_DEVICE_LIST_URL,
            delete_url=USER_AND_DEVICE_DELETE_URL,
        )
Ejemplo n.º 8
0
 def get(self):
     the_get = Get()
     group_id = the_get.get_id(self)
     instance = OHHOPermission()
     if group_id:
         group_obj = instance.group.get_by_id(group_id)
     return self.render(PERMISSION_GROUP_BACKSTAGE_DELETE_HTML,
                        group_obj=group_obj,
                        delete_url=PERMISSION_GROUP_BACKSTAGE_DELETE_URL,
                        list_url=PERMISSION_GROUP_BACKSTAGE_LIST_URL)
Ejemplo n.º 9
0
 def get(self):
     the_get = Get()
     page_id = the_get.get_id(self)
     instance = OHHOPermission()
     if page_id:
         page_obj = instance.page.get_by_id(page_id)
     return self.render(PERMISSION_PAGE_BACKSTAGE_DELETE_HTML,
                        page_obj=page_obj,
                        detail_url=PERMISSION_PAGE_BACKSTAGE_DETAIL_URL,
                        delete_url=PERMISSION_PAGE_BACKSTAGE_DELETE_URL,
                        list_url=PERMISSION_PAGE_BACKSTAGE_LIST_URL
                        )
Ejemplo n.º 10
0
    def get(self):
        the_get = Get()
        instance = OHHOPermission()
        group_id = the_get.get_id(self)
        message = the_get.get_data(self)
        group_name = ""
        if group_id:
            group_id = int(group_id)
            group = instance.group.get_by_id(group_id)
            if group:
                group_name = group.name

        all_page = instance.page.get_query()
        page_ids = [p.id for p in all_page] if all_page else []

        query_group_and_page = instance.group_and_page.get_query()
        query_group_and_page = instance.group_and_page.get_by_group_id(
            query_group_and_page, group_id)
        permission_ids = [p.page_permission_id for p in query_group_and_page
                          ] if query_group_and_page else []

        query_page_permission = instance.page_permission.get_query()
        query_page_permission = instance.page_permission.get_by_page_permission_ids(
            query_page_permission, permission_ids)
        permission_page_ids = [q.page_id for q in query_page_permission
                               ] if query_page_permission else []

        the_page_ids = OHHOOperation.list_minus_list(page_ids,
                                                     permission_page_ids)
        rest_page_list = list()
        for page_id in the_page_ids:
            page = instance.page.get_by_id(page_id)
            temp = dict()
            if page:
                temp["page_id"] = page.id
                temp["page_description"] = page.description
                temp["page_name"] = page.name
            if temp:
                rest_page_list.append(temp)

        return self.render(
            PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_ADD_HTML,
            group_id=group_id,
            rest_page_list=rest_page_list,
            group_name=group_name,
            home_list_url=MANAGEMENT_PERMISSION_HOME_URL,
            list_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_LIST_URL +
            "?id=" + str(group_id),
            detail_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_DETAIL_URL,
            add_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_ADD_URL + "?id=" +
            str(group_id),
            delete_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_DELETE_URL,
            message=message)
Ejemplo n.º 11
0
    def get(self):
        the_get = Get()
        instance = MatchLabel()
        match_label_id = the_get.get_id(self)
        match_label = instance.get_by_id(match_label_id)
        match_label_dict = instance.get_information(match_label)

        return self.render(BASE_MATCH_LABEL_DETAIL_HTML,
                           label=match_label_dict,
                           match_label_id=match_label_id,
                           detail_url=BASE_MATCH_LABEL_DETAIL_URL,
                           list_url=BASE_MATCH_LABEL_LIST_URL)
Ejemplo n.º 12
0
    def get(self):
        instance = UserDisplayConfiguration()
        the_get = Get()
        userDisplayConfig_id = the_get.get_id(self)
        query_obj = ""
        if userDisplayConfig_id:
            query_obj = instance.get(userDisplayConfig_id)

        return self.render(BASE_USER_DISPLAY_CONFIG_DETAIL_HTML,
                           detail_url=BASE_USER_DISPLAY_CONFIG_DETAIL_URL,
                           list_url=BASE_USER_DISPLAY_CONFIG_LIST_URL,
                           query_obj=query_obj)
Ejemplo n.º 13
0
    def get(self):
        the_get = Get()
        instance = MatchCondition()
        match_condition_id = the_get.get_id(self)
        match_condition = instance.get_by_id(match_condition_id)
        match_condition_dict = instance.get_information(match_condition)

        return self.render(BASE_MATCH_CONDITION_DETAIL_HTML,
                           condition=match_condition_dict,
                           match_condition_id=match_condition_id,
                           detail_url=BASE_MATCH_CONDITION_DETAIL_URL,
                           list_url=BASE_MATCH_CONDITION_LIST_URL
                           )
Ejemplo n.º 14
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.º 15
0
    def get(self):
        the_get = Get()
        country_code_id = the_get.get_id(self)
        name = ""
        instance = CountryCode()
        if country_code_id:
            country_code = instance.get(country_code_id)
            country_name = country_code.country_name
            country_code = country_code.country_code

        return self.render(BASE_COUNTRY_CODE_BACKSTAGE_DETAIL_HTML,
                           country_name=country_name,
                           country_code=country_code,
                           country_code_id=country_code_id,
                           detail_url=BASE_COUNTRY_CODE_BACKSTAGE_DETAIL_URL,
                           list_url=BASE_COUNTRY_CODE_BACKSTAGE_LIST_URL)
Ejemplo n.º 16
0
    def get(self):
        the_get = Get()
        sensitive_id = the_get.get_id(self)
        instance = SensitiveBackstage()
        sensitive_object = instance.get_by_id(sensitive_id)
        name = ""
        if sensitive_object:
            name = sensitive_object.word

        return self.render(BASE_SENSITIVE_BACKSTAGE_DETAIL_HTML,
                           name=name,
                           sensitive_id=sensitive_id,
                           detail_url=BASE_SENSITIVE_BACKSTAGE_DETAIL_URL,
                           list_url=BASE_SENSITIVE_BACKSTAGE_LIST_URL,
                           add_url=BASE_SENSITIVE_BACKSTAGE_ADD_URL,
                           delete_url=BASE_SENSITIVE_BACKSTAGE_DELETE_URL)
Ejemplo n.º 17
0
    def get(self):
        the_get = Get()
        body_type_id = the_get.get_id(self)
        name = ""
        state = False
        instance = BodyType()
        if body_type_id:
            body_type = instance.get(body_type_id)
            name = body_type.name
            state = body_type.state

        return self.render(BASE_BODY_TYPE_DETAIL_HTML,
                           name=name,
                           state=state,
                           body_type_id=body_type_id,
                           detail_url=BASE_BODY_TYPE_DETAIL_URL,
                           list_url=BASE_BODY_TYPE_LIST_URL)
Ejemplo n.º 18
0
    def get(self):
        the_get = Get()
        drink_id = the_get.get_id(self)
        name = ""
        state = False
        instance = Drink()
        if drink_id:
            drink = instance.get(drink_id)
            name = drink.name
            state = drink.state

        return self.render(BASE_DRINK_DETAIL_HTML,
                           name=name,
                           state=state,
                           drink_id=drink_id,
                           detail_url=BASE_DRINK_DETAIL_URL,
                           list_url=BASE_DRINK_LIST_URL)
Ejemplo n.º 19
0
    def get(self):
        the_get = Get()
        smoke_id = the_get.get_id(self)
        name = ""
        state = False
        instance = Smoke()
        if smoke_id:
            smoke = instance.get(smoke_id)
            name = smoke.name
            state = smoke.state

        return self.render(BASE_SMOKE_DETAIL_HTML,
                           name=name,
                           state=state,
                           smoke_id=smoke_id,
                           detail_url=BASE_SMOKE_DETAIL_URL,
                           list_url=BASE_SMOKE_LIST_URL)
Ejemplo n.º 20
0
    def get(self):
        the_get = Get()
        work_domain_id = the_get.get_id(self)
        name = ""
        state = False
        instance = WorkDomain()
        if work_domain_id:
            work_domain = instance.get(work_domain_id)
            name = work_domain.name
            state = work_domain.state

        return self.render(BASE_WORK_DOMAIN_DETAIL_HTML,
                           name=name,
                           state=state,
                           work_domain_id=work_domain_id,
                           detail_url=BASE_WORK_DOMAIN_DETAIL_URL,
                           list_url=BASE_WORK_DOMAIN_LIST_URL)
Ejemplo n.º 21
0
    def get(self):
        the_get = Get()
        profession_id = the_get.get_id(self)
        name = ""
        state = False
        instance = Profession()
        if profession_id:
            profession = instance.get(profession_id)
            name = profession.name
            state = profession.state

        return self.render(BASE_PROFESSION_DETAIL_HTML,
                           name=name,
                           state=state,
                           profession_id=profession_id,
                           detail_url=BASE_PROFESSION_DETAIL_URL,
                           list_url=BASE_PROFESSION_LIST_URL)
Ejemplo n.º 22
0
 def get(self):
     the_get = Get()
     parent_id = the_get.get_id(self)
     if not parent_id:
         parent_id = 0
     instance = Hint()
     obj = instance.get_by_id(parent_id)
     parent_name = obj.name if obj else "==未定义=="
     parent_key = obj.key if obj else "==未定义=="
     return self.render(BASE_HINT_BACKSTAGE_ADD_HTML,
                        add_url=BASE_HINT_BACKSTAGE_ADD_URL,
                        list_url=BASE_HINT_BACKSTAGE_LIST_URL,
                        parent_id=parent_id,
                        parent_name=parent_name,
                        parent_key=parent_key,
                        name="",
                        key="",
                        description="",
                        message="",
                        )
Ejemplo n.º 23
0
    def get(self):
        the_get = Get()
        the_id = the_get.get_id(self)
        instance = InterestBackstage()
        obj = instance.get_by_id(the_id)
        name = obj.name if obj else ""
        key = obj.key if obj else ""
        parent = instance.get_by_id(obj.parent_id) if obj else None
        parent_id = parent.id if parent else 0
        parent_name = parent.name if parent else ""
        parent_key = parent.key if parent else ""
        message = ""

        return self.render(BASE_INTEREST_BACKSTAGE_DETAIL_HTML,
                           name=name,
                           key=key,
                           parent_id=parent_id,
                           parent_name=parent_name,
                           parent_key=parent_key,
                           detail_url=BASE_INTEREST_BACKSTAGE_DETAIL_URL,
                           list_url=BASE_INTEREST_BACKSTAGE_LIST_URL,
                           message=message)
    def get(self):
        the_get = Get()
        instance = OHHOPermission()
        group_id = the_get.get_id(self)
        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_and_page.get_query()
        group_name = ""

        if group_id:
            query = instance.group_and_page.get_by_group_id(query, group_id)
            group = instance.group.get_by_id(group_id)
            if group:
                group_name = group.name

        query, count = instance.group_and_page.get_some(query, offset, limit)
        # query = query
        # count = instance.page_permission.get_count(query)
        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()

        group_permissions = list()
        if query:
            for q in query:
                temp = dict()
                page_permission = instance.page_permission.get_by_id(
                    q.page_permission_id)
                if page_permission:
                    temp["group_id"] = group_id
                    temp["page_permission_id"] = q.page_permission_id
                    page = instance.page.get_by_id(page_permission.page_id)
                    if page:
                        temp["page_description"] = page.description
                        temp["page_name"] = page.name
                    temp["insert"] = page_permission.insert
                    temp["update"] = page_permission.update
                    temp["select"] = page_permission.select
                    temp["delete"] = page_permission.delete
                if temp:
                    group_permissions.append(temp)

        return self.render(
            PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_LIST_HTML,
            group_name=group_name,
            group_permissions=group_permissions,
            pages=page_list,
            previous=previous,
            next=next,
            page=page,
            home_list_url=MANAGEMENT_PERMISSION_HOME_URL,
            list_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_LIST_URL,
            detail_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_DETAIL_URL,
            add_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_ADD_URL + "?id=" +
            str(group_id),
            delete_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_DELETE_URL,
        )
    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,
        )