Пример #1
0
    def get(self, *args, **kwargs):
        # username = self.get_argument('user')
        username = tornado.escape.json_decode(self.current_user)
        usermod = user_mod.UserModel()
        userinfo = usermod.find_user(username)

        # print(userinfo)

        haveseen = []
        if userinfo['haveseen'] != None:
            haveseen = userinfo['haveseen'].split(' ')

        haventseen = []
        for i in range(1, len(alg_list.alg) + 1):
            if str(i) not in haveseen:
                haventseen.append(i)

        logmod = log_mod.LogModel()
        userloginfo = logmod.find_log_from_userid(userinfo['id'])

        # print(userinfo['id'], 'userloginfo', userloginfo)

        self.render(
            'index.html',
            userinfo=userinfo,
            alglist=alg_list.alg,
            haveseen=haveseen,
            haventseen=haventseen,
            userloginfo=userloginfo,
        )
Пример #2
0
 def get(self):
     # url : contain log id
     logid = self.get_argument('logid')
     username = tornado.escape.json_decode(self.current_user)
     logmod = log_mod.LogModel()
     loginfo = logmod.find_log_by_id(logid)
     self.render(
         'logs_content.html',
         username=username,
         alg_list=alg_list.alg,
         loginfo=loginfo,
     )
Пример #3
0
    def get(self):

        username = tornado.escape.json_decode(self.current_user)
        usermod = user_mod.UserModel()
        userinfo = usermod.find_user(username)
        logmod = log_mod.LogModel()
        userloginfo = logmod.find_log_from_userid(userinfo['id'])
        self.render(
            'logs_manager.html',
            username=username,
            userloginfo=userloginfo,
            alg_list=alg_list.alg,
        )
Пример #4
0
    def post(self):
        logtitle = self.get_argument('title')
        logcontent = self.get_argument('content')
        logalgid = self.get_argument('algid')
        username = tornado.escape.json_decode(self.current_user)
        print('-->', username)
        usermod = user_mod.UserModel()
        userinfo = usermod.find_user(username)
        userid = userinfo['id']
        print('userid : ', userid)

        logmod = log_mod.LogModel()
        logcreate = logmod.create_log(userid, logalgid, logtitle, logcontent)
        print(logcreate)
Пример #5
0
 def post(self):
     logid = self.get_argument('logid')
     content = self.get_argument('content')
     logmod = log_mod.LogModel()
     loginfo = logmod.update_log(logid, content)
     self.write("Failed !")
Пример #6
0
 def post(self):
     delid = self.get_argument('delid')[3:]
     logmod = log_mod.LogModel()
     aftid = logmod.delete_log(delid)
     print('delid:', delid)
     self.write(str(aftid))