Beispiel #1
0
 def post(self):
     user_hash = self.get_current_user().get('user_id')
     assigned_to = self.get_argument('select-user')
     task = self.get_argument('select-chapter')
     print assigned_to, task
     CheckCredentials.assign_task(user_hash, task, assigned_to)
     self.redirect('/dashboard')
Beispiel #2
0
 def get_users_or_tasks(self, entry):
     if 'hod' in entry.keys():
         users = CheckCredentials.get_users(entry['user_id'])
         raise tornado.gen.Return(users)
     else:
         tasks = CheckCredentials.get_user_tasks(entry['user_id'])
         raise tornado.gen.Return(tasks)
Beispiel #3
0
 def post(self):
     user_id = self.get_body_argument("get_user_id")
     chapter_id = self.get_body_argument("get_chapter_id")
     hod_id = self.get_current_user().get("user_id", '')
     remarks = self.get_body_argument("message")
     print user_id
     print remarks
     CheckCredentials.reassign_task(hod_id, user_id, remarks, chapter_id)
     self.redirect("/dashboard")
Beispiel #4
0
 def post(self):
     user_hash = self.get_current_user().get("user_id")
     fileinfo = self.request.files['filearg']
     # dp = self.get_body_argument("filearg")
     fname = fileinfo[0]['filename']
     fbody = fileinfo[0]['body']
     image = yield self.upload_dp(fbody, fname)
     image_id = image.get("hdpi", '')
     CheckCredentials.add_profile_image(user_hash, image_id)
     self.redirect("/profile")
Beispiel #5
0
 def post(self):
     user_id = self.get_argument("re-assign", '')
     hod_id = self.get_current_user().get("user_id", '')
     chapter_id = self.get_argument("get_chapter")
     if user_id:
         self.redirect('/reassign_form?user_hash={}&chapter_id={}'.\
             format(user_id, chapter_id))
     else:
         user_id = self.get_argument("complete")
         CheckCredentials.mark_task_complete(hod_id, user_id, chapter_id)
         self.redirect('/dashboard')
Beispiel #6
0
 def post(self):
     fileinfo = self.request.files['filearg']
     user_hash = self.get_current_user().get('user_id')
     for f in fileinfo:
         fname = f['filename']
         fbody = f['body']
         # print fbody, '@!@!@!@!'
         image = yield self.upload(fbody, fname)
         doc_id = image.get('hdpi', '')
         CheckCredentials.save_user_doc(user_hash, doc_id)
     self.redirect('/dashboard')
     # print 'uploaded' if upload else 'uploading'
     print 'bhag!'
Beispiel #7
0
    def post(self):

        self.hod_user_hash = self.get_current_user().get('user_id')
        email_address = self.get_argument('email', '')
        password = self.get_argument('password', '')
        name = self.get_argument('name', '')
        # age = self.get_argument('age', '')
        birthdate = self.get_argument('birthDate', '')
        # chapter = self.get_argument('chapter')
        print self.hod_user_hash
        CheckCredentials.save_user(self.hod_user_hash, name,\
        email_address, password, birthdate)
        print 'let\'s check'

        self.redirect('/dashboard')
Beispiel #8
0
 def get(self):
     if not self.get_current_user():
         self.redirect('/login')
     else:
         user_hash = self.get_current_user().get('user_id')
         available_users = CheckCredentials.get_available_users(user_hash)
         self.render('assign_task.html', users=available_users)
Beispiel #9
0
 def get(self):
     # user = self.get_current_user()
     # print user
     if not self.get_current_user():
         self.redirect('/login')
     else:
         user_hash = self.get_current_user().get('user_id')
         doc_id = CheckCredentials.get_files(user_hash)
         self.render('user_files.html', doc_id=doc_id)
Beispiel #10
0
 def get(self):
     # user = self.get_current_user()
     # print user
     if not self.get_current_user():
         self.redirect('/login')
     else:
         user_hash = self.get_current_user().get('user_id')
         video_id = CheckCredentials.get_videos(user_hash)
         print video_id
         self.render('watch_video.html', video_id=video_id)
Beispiel #11
0
 def post(self):
     fileinfo = self.request.files['filearg']
     user_hash = self.get_current_user().get('user_id')
     # ['filearg']
     for f in fileinfo:
         fname = f['filename']
         fpath = video_dir + fname
         fbody = f['body']
         print fname
         new_file = open(video_dir + fname, 'ar+')
         print new_file
         if not new_file.read():
             new_file.write(fbody)
             new_file.close()
             video_id = yield self.upload_video(fpath, 'Check chunk size')
             self.redirect('/your_videos')
             CheckCredentials.save_user_video(user_hash, video_id)
         else:
             self.write('the file already exists')
Beispiel #12
0
    def post(self):
        login_response = {}

        email_address = self.get_argument('email', '')
        password = self.get_argument('password', '')
        name = self.get_argument('name', '')
        age = self.get_argument('age', '')
        user_type = self.get_argument('types')

        if not email_address:
            login_response.update({
                'success': False,
                'msg': 'Please enter your email address.'
            })
        elif not password:
            login_response.update({
                'success': False,
                'msg': 'Please enter your password.'
            })
        else:
            print name
            register = CheckCredentials.save(email_address, password,\
                                         name, age, user_type)
            self.redirect('/login')
Beispiel #13
0
    def post(self):

        login_response = {}

        email_address = self.get_argument('uname', '')
        password = self.get_argument('psw', '')

        if not email_address:
            login_response.update({
                'success': False,
                'msg': 'Please enter your email address.'
            })
        elif not password:
            login_response.update({
                'success': False,
                'msg': 'Please enter your password.'
            })
        else:
            self.user = CheckCredentials.check(email_address, password)
            if self.user:
                self.set_current_user(self.user)
                self.redirect("/dashboard")
            else:
                self.redirect('/login')
Beispiel #14
0
 def get(self):
     user_hash = self.get_current_user().get("user_id")
     user_profile = CheckCredentials.get_user_profile(user_hash)
     self.render("user_profile.html", profile=user_profile)
Beispiel #15
0
 def get_user_content(self, user_hash):
     raise tornado.gen.Return(CheckCredentials.get_user_task(user_hash))
Beispiel #16
0
 def check_task_status(self, user_hash):
     raise tornado.gen.Return(CheckCredentials.get_user_tasks(user_hash))
Beispiel #17
0
 def save_user_written_content(self, user_hash, content, chapter_id):
     raise tornado.gen.Return(CheckCredentials.save_user_content(user_hash, content, \
         chapter_id))
Beispiel #18
0
 def get_user_task_content(self):
     user_id = self.get_argument('user_hash', '')
     # print user_id
     raise tornado.gen.Return(
         (user_id, CheckCredentials.get_user_task(user_id)))
Beispiel #19
0
 def send_user_content_for_review(self, user_hash, content, user_email,
                                  chapter_id):
     raise tornado.gen.Return(
         CheckCredentials.final_user_submission(user_hash, content,
                                                user_email, chapter_id))
Beispiel #20
0
 def post(self):
     user_hash = self.get_current_user().get('user_id')
     image_id = self.get_body_argument('image')
     print image_id
     # print image
     CheckCredentials.delete_image(user_hash, image_id)