Ejemplo n.º 1
0
 def post(self):
     #username = self.get_secure_cookie("user")
     curpath = self.request.path
     user_id = self.get_argument('user_id')
     password = self.get_argument('password')
     realname = self.get_argument('realname')
     email = self.get_argument('email')
     mobile = self.get_argument('mobile')
     status = self.get_argument('status')
     if password:
         op_cursor.execute(
             update_user_sql.format(user_id=user_id,
                                    password=password,
                                    realname=realname,
                                    email=email,
                                    mobile=mobile,
                                    status=status))
     else:
         op_cursor.execute(
             update_user_sql1.format(user_id=user_id,
                                     realname=realname,
                                     email=email,
                                     mobile=mobile,
                                     status=status))
     self.redirect("/user/index")
Ejemplo n.º 2
0
 def get(self, id):
     username = self.get_secure_cookie("user")
     curpath = self.request.path
     func = curpath[1:].split("/")[0]
     op_cursor.execute(globals()["_".join(curpath[1:].split("/")[:-1]) +
                                 '_sql'].format(id=id))
     self.redirect("/{0}/index".format(func))
Ejemplo n.º 3
0
 def getDatalist(self):
     datalist = []
     op_cursor.execute(globals()[self.rpath + "_data_sql"])
     parent_menus = op_cursor.fetchall()
     head = [c[0] for c in op_cursor.description]
     for menus in parent_menus:
         datalist.append(dict(zip(head,menus)))
     return datalist
Ejemplo n.º 4
0
 def getDatalist(self):
     datalist = []
     op_cursor.execute(globals()[self.rpath + "_data_sql"])
     parent_menus = op_cursor.fetchall()
     head = [c[0] for c in op_cursor.description]
     for menus in parent_menus:
         datalist.append(dict(zip(head, menus)))
     return datalist
Ejemplo n.º 5
0
 def menu_record_tree(self):
     datalist = []
     op_cursor.execute("SELECT menu_id,menu_title FROM `admin_menu` WHERE `parent_id`=0")
     parent_menus = op_cursor.fetchall()
     head = [c[0] for c in op_cursor.description]
     for menus in parent_menus:
         datalist.append(dict(zip(head,menus)))
     return datalist
Ejemplo n.º 6
0
 def menu_record_tree(self):
     datalist = []
     op_cursor.execute(
         "SELECT menu_id,menu_title FROM `admin_menu` WHERE `parent_id`=0")
     parent_menus = op_cursor.fetchall()
     head = [c[0] for c in op_cursor.description]
     for menus in parent_menus:
         datalist.append(dict(zip(head, menus)))
     return datalist
Ejemplo n.º 7
0
 def post(self):
     self.request.arguments
     op_cursor.execute(globals()[self.rpath + "_sql"].format(
         menu_title=menu_title,
         menu_url=menu_url,
         parent_id=parent_id,
         menu_level=menu_level,
         menu_icon=menu_icon))
     self.redirect(self.page)
Ejemplo n.º 8
0
 def post(self):
     #username = self.get_secure_cookie("user")
     curpath =  self.request.path
     newUserName = self.get_argument('username')
     password = self.get_argument('password')
     realname = self.get_argument('realname')
     email = self.get_argument('email')
     mobile = self.get_argument('mobile')
     status = self.get_argument('status')
     op_cursor.execute(add_user_sql.format(username=newUserName,password=password,realname=realname,email=email,mobile=mobile,status=status))
     self.redirect("/user/index")
Ejemplo n.º 9
0
 def post(self):
     #username = self.get_secure_cookie("user")
     curpath =  self.request.path
     user_id = self.get_argument('user_id')
     password = self.get_argument('password')
     realname = self.get_argument('realname')
     email = self.get_argument('email')
     mobile = self.get_argument('mobile')
     status = self.get_argument('status')
     if password:
         op_cursor.execute(update_user_sql.format(user_id=user_id,password=password,realname=realname,email=email,mobile=mobile,status=status))
     else:
         op_cursor.execute(update_user_sql1.format(user_id=user_id,realname=realname,email=email,mobile=mobile,status=status))
     self.redirect("/user/index")
Ejemplo n.º 10
0
 def __init__(self,*request,**kwargs):
     super(TableHandler,self).__init__(request[0], request[1])
     rpath = request[1].path[1:].replace("/",'_')
     rdslist = op_cursor.execute(globals()[ rpath + '_sql' ])
     self.hide = globals().get( rpath + '_hide' ,[])
     self.headers = [c[0] for c in op_cursor.description]
     self.rdsinfo = op_cursor.fetchall()
Ejemplo n.º 11
0
 def __init__(self, *request, **kwargs):
     super(TableHandler, self).__init__(request[0], request[1])
     rpath = request[1].path[1:].replace("/", '_')
     rdslist = op_cursor.execute(globals()[rpath + '_sql'])
     self.hide = globals().get(rpath + '_hide', [])
     self.headers = [c[0] for c in op_cursor.description]
     self.rdsinfo = op_cursor.fetchall()
Ejemplo n.º 12
0
 def post(self):
     #username = self.get_secure_cookie("user")
     curpath = self.request.path
     newUserName = self.get_argument('username')
     password = self.get_argument('password')
     realname = self.get_argument('realname')
     email = self.get_argument('email')
     mobile = self.get_argument('mobile')
     status = self.get_argument('status')
     op_cursor.execute(
         add_user_sql.format(username=newUserName,
                             password=password,
                             realname=realname,
                             email=email,
                             mobile=mobile,
                             status=status))
     self.redirect("/user/index")
Ejemplo n.º 13
0
 def get_user_list(self):
     user = op_cursor.execute(globals()[self.request.path[1:].replace("/",'_')+'_sql'])
     users = op_cursor.fetchall()
     head = [c[0] for c in op_cursor.description]
     datalist = []
     for user in users:
         datalist.append(dict(zip(head,user)))
     return datalist
Ejemplo n.º 14
0
 def get_user_list(self):
     user = op_cursor.execute(
         globals()[self.request.path[1:].replace("/", '_') + '_sql'])
     users = op_cursor.fetchall()
     head = [c[0] for c in op_cursor.description]
     datalist = []
     for user in users:
         datalist.append(dict(zip(head, user)))
     return datalist
Ejemplo n.º 15
0
    def post(self):
        username = self.get_secure_cookie("user")
        curpath = self.request.path
        menu_title = self.get_argument('menu_title').encode("utf8")
        menu_url = self.get_argument('menu_url')
        parent_id = int(self.get_argument('parent_id'))
        status = int(self.get_argument('status'))
        if parent_id == 0:
            menu_level = 1
            menu_icon = "icon-dashboard"
        else:
            menu_level = 2
            menu_icon = "icon-list"
        op_cursor.execute(
            add_menu_sql.format(menu_title=menu_title,
                                menu_url=menu_url,
                                parent_id=parent_id,
                                menu_level=menu_level,
                                menu_icon=menu_icon))
        if parent_id != 0:
            op_cursor.execute(add_privilege_sql.format(menu_title=menu_title))
            op_cursor.execute(
                add_provilege_to_role_sql.format(menu_title=menu_title))
            models.tools.user_menus[username] = models.tools._get_menu(
                username)

        self.redirect("/menu/index")
Ejemplo n.º 16
0
    def post(self):
        username = self.get_secure_cookie("user")
        curpath =  self.request.path
        menu_title = self.get_argument('menu_title').encode("utf8")
        menu_url = self.get_argument('menu_url')
        parent_id = int(self.get_argument('parent_id'))
        status = int(self.get_argument('status'))
        if parent_id==0:
            menu_level = 1
            menu_icon = "icon-dashboard"
        else:
            menu_level = 2
            menu_icon = "icon-list"
        op_cursor.execute(add_menu_sql.format(menu_title=menu_title,menu_url=menu_url,parent_id=parent_id,menu_level=menu_level,menu_icon=menu_icon))
        if parent_id!=0:
            op_cursor.execute(add_privilege_sql.format(menu_title=menu_title))
            op_cursor.execute(add_provilege_to_role_sql.format(menu_title=menu_title))
            models.tools.user_menus[username] = models.tools._get_menu(username)

        self.redirect("/menu/index")
Ejemplo n.º 17
0
def ping_db():
    print 'ping db'
    op_cursor.execute('select 1')
Ejemplo n.º 18
0
 def getrecord(sef,user_id):
     op_cursor.execute(user_info_sql.format(user_id=user_id))
     head = [c[0] for c in op_cursor.description]
     userinfo = op_cursor.fetchone()
     record = dict(zip(head,userinfo))
     return record
Ejemplo n.º 19
0
 def get(self,id):
     username = self.get_secure_cookie("user")
     curpath =  self.request.path
     func = curpath[1:].split("/")[0]
     op_cursor.execute(globals()[ "_".join(curpath[1:].split("/")[:-1]) + '_sql' ].format(id=id))
     self.redirect("/{0}/index".format(func))
Ejemplo n.º 20
0
 def post(self):
     self.request.arguments 
     op_cursor.execute(globals()[self.rpath + "_sql"].format(menu_title=menu_title,menu_url=menu_url,parent_id=parent_id,menu_level=menu_level,menu_icon=menu_icon))
     self.redirect(self.page)
Ejemplo n.º 21
0
 def getrecord(sef, user_id):
     op_cursor.execute(user_info_sql.format(user_id=user_id))
     head = [c[0] for c in op_cursor.description]
     userinfo = op_cursor.fetchone()
     record = dict(zip(head, userinfo))
     return record
Ejemplo n.º 22
0
def ping_db():
    print 'ping db'
    op_cursor.execute('select 1')