コード例 #1
0
 def _init_template_info(self, ps):
     roleUsers = {}
     for role in state.ProjectRoles:
         roleUsers[role['id']] = soc_right_proxy.get_users_by_usergroup(userGroupID = config.SOCPMConfig['RoleUserGroup'][role['id']])            
         
     ps['roleUsers'] = roleUsers
     ps['projectRoles'] = state.ProjectRoles
     ps['projectStatus'] = state.ProjectStatus
     ps['products'] = product_logic.ProductLogic.instance().query_all_by_active()        
     return ps
コード例 #2
0
    def _init_template_info(self, ps):
        roleUsers = {}
        for role in state.ProjectRoles:
            roleUsers[role['id']] = soc_right_proxy.get_users_by_usergroup(
                userGroupID=config.SOCPMConfig['RoleUserGroup'][role['id']])

        ps['roleUsers'] = roleUsers
        ps['projectRoles'] = state.ProjectRoles
        ps['projectStatus'] = state.ProjectStatus
        ps['products'] = product_logic.ProductLogic.instance(
        ).query_all_by_active()
        return ps
コード例 #3
0
ファイル: task_handler.py プロジェクト: maincoder/SOCProject
 def _get_user_list(self):
     users = []
     for role in state.ProjectRoles:
         title = role['name']
         us = soc_right_proxy.get_users_by_usergroup(userGroupID = config.SOCPMConfig['RoleUserGroup'][role['id']])
         if None != us and len(us) > 0:
             for u in us:
                 t = True
                 for user in users:
                     if user['userName'] == u['userName']:
                         t = False
                         break
                 if True == t:
                     users.append(u)
     return users
コード例 #4
0
 def _get_user_list(self):
     users = []
     for role in state.ProjectRoles:
         title = role['name']
         us = soc_right_proxy.get_users_by_usergroup(
             userGroupID=config.SOCPMConfig['RoleUserGroup'][role['id']])
         if None != us and len(us) > 0:
             for u in us:
                 t = True
                 for user in users:
                     if user['userName'] == u['userName']:
                         t = False
                         break
                 if True == t:
                     users.append(u)
     return users
コード例 #5
0
    def post(self):
        ps = self.get_page_config('创建产品')
        if ps['isedit']:
            ps['title'] = self.get_page_title('编辑产品')

        product = self.get_args(['userName', 'name', 'userRealName', 'remark'], '')
        product['status'] = int(self.get_arg('status', '0'))
        product['id'] = int(self.get_arg('id', '0'))
        ps['product'] = product
        ps['users'] = soc_right_proxy.get_users_by_usergroup(userGroupID = config.SOCPMConfig['RoleUserGroup'][state.productManagerRoleID])
        msg = self.check_str_empty_input(product, ['name', 'userName'])
        if str_helper.is_null_or_empty(msg) == False:
            ps['msg'] = msg
            self.render('admin/product/add_or_edit.html', **ps)
            return        
        product['user'] = self.get_oper_user()
        if ps['isedit']:
            # self.check_oper_right(right = state.operEdit)
            try:
                info = product_logic.ProductLogic.instance().update(id = product['id'], name = product['name'], 
                        userName = product['userName'], userRealName = product['userRealName'], status = product['status'],
                        remark = product['remark'], user = product['user'])
                if info:
                    self.redirect(ps['siteDomain'] + 'Admin/Product/List')
                    return
                else:
                    ps['msg'] = state.ResultInfo.get(101, '')
            except error.ProjectError as e:
                ps['msg'] = e.msg
        else:
            # self.check_oper_right(right = state.operAdd)
            try:
                info = product_logic.ProductLogic.instance().add(name = product['name'], 
                        userName = product['userName'], userRealName = product['userRealName'], status = product['status'],
                        remark = product['remark'], user = product['user'])
                if info > 0:
                    self.redirect(ps['siteDomain'] + 'Admin/Product/List')
                    return
                else:
                    ps['msg'] = state.ResultInfo.get(101, '')
            except error.ProjectError as e:
                ps['msg'] = e.msg
        ps = self.format_none_to_empty(ps)
        self.render('admin/product/add_or_edit.html', **ps)
コード例 #6
0
 def get(self):
     ps = self.get_page_config('创建产品')
     ps['users'] = soc_right_proxy.get_users_by_usergroup(userGroupID = config.SOCPMConfig['RoleUserGroup'][state.productManagerRoleID])
     if ps['isedit']:
         # self.check_oper_right(right = state.operEdit)
         ps['title'] = self.get_page_title('编辑产品')
         id = int(self.get_arg('id', '0'))
         product = product_logic.ProductLogic.instance().query_one(id)
         if None == product:
             ps['msg'] = state.ResultInfo.get(110001, '')
             ps['gotoUrl'] = ps['siteDomain'] + 'Admin/Product/List'
             product = {'id':'','name':'','userName':'','userRealName':'','remark':'','status':1,'creater':'','createTime':'','lastUpdater':'','lastUpdateTime':''}
     else:
         # self.check_oper_right(right = state.operAdd)
         product = self.get_args(['name', 'userName', 'userRealName', 'remark'], '')
         product['status'] = int(self.get_arg('status', '0'))
         product['id'] = int(self.get_arg('id', '0'))
         # if product['userRealName'] == '' and len(ps['users']) > 0:
         #     product['userRealName'] = ps['users'][0]['userRealName']
     ps['product'] = product
     self.render('admin/product/add_or_edit.html', **ps)