Ejemplo n.º 1
0
    def register_post(self):
        if (c.userid != "false"):
            redirect(url('/users/register?m=3'))

        if request.method == 'POST':
            c.form = RegisterForm(request.POST)
            if c.form.is_valid():
                newuser = model.user()
                # check to see if email allready exists
                email_users = meta.Session.query(model.user)

                if (validate_email(c.form.cleaned_data['email'])):
                    c.email = "invalid"
                    print("invalid email")
                    return render("/users/register.mako")

                newuser.email = c.form.cleaned_data['email']

                newuser.organization = c.form.cleaned_data['organization']
                newuser.password = c.form.cleaned_data['password']
                print("c.form.cleaned_data['password']",
                      c.form.cleaned_data['password'])
                newuser.salt = "salt"
                meta.Session.add(newuser)
                meta.Session.commit()

                return render("/users/succ_register.mako")
            else:
                c.form = RegisterForm(request.POST)
        return render("/users/register.mako")
Ejemplo n.º 2
0
    def register_post(self):
        if (c.userid != "false"):
             redirect(url('/users/register?m=3'))
           
        if request.method == 'POST':
            c.form = RegisterForm(request.POST)
            if c.form.is_valid():
                newuser= model.user()
                # check to see if email allready exists
                email_users = meta.Session.query(model.user)

                if (validate_email(c.form.cleaned_data['email'])):
                    c.email = "invalid"
                    print "invalid email"
                    return render("/users/register.mako")


                newuser.email = c.form.cleaned_data['email']

                newuser.organization = c.form.cleaned_data['organization']
                newuser.password =      c.form.cleaned_data['password']
                print "c.form.cleaned_data['password']", c.form.cleaned_data['password']
                newuser.salt =  "salt"
                meta.Session.add(newuser)
                meta.Session.commit()

                return render("/users/succ_register.mako")
            else:
                c.form = RegisterForm(request.POST)
        return render("/users/register.mako")
Ejemplo n.º 3
0
    def login_validate(self):
        if (c.userid != "false"):
             redirect(url('/users/login?m=2'))
        session['logged_in'] = True
        session.save()    
            
        if request.method == 'POST':
            c.form = LoginForm(request.POST)
            if c.form.is_valid():

                userid = authenticate_user(c.form.cleaned_data['email'], \
                         c.form.cleaned_data['password'])
                print "hellooooo", c.form.cleaned_data['email'], c.form.cleaned_data['password']
                if (userid != "invalid" ):
                    session['userid'] = userid
                    session.save()
                    print session['userid']
                    redirect(url('/'))
                    c.login = "******"
                else:
                 c.login = "******"

            else:
                 c.form = LoginForm(request.POST)

        return render("/users/login.mako")
Ejemplo n.º 4
0
    def job_table_view(self):

        user_jobs = meta.Session.query(model.job).all()

        c.jobs = paginate.Page(user_jobs, items_per_page=10)
        total_pages = len(user_jobs)/10 + 1

        #jobs = meta.Session.query(model.job)
        #if (len(user_jobs)!=0):
         #   print "\njobs------\n",jobs.first().jobinfo[1].key, jobs.first().jobinfo[1].value

        # to check if user visiting this page for  the first time and
        #assign the latest jobs page,page_num tell which page to show


        page_num  =   total_pages
        if ('page' in request.params) and request.params['page']. isdigit() and (int(request.params['page']) <= total_pages):
                page_num =int(request.params['page'])

        if 'm' in request.params:
                c.display_message = "Job successfully submitted and your Job ID is " \
                + str(request.params['id'])

        c.jobs = paginate.Page(user_jobs, page=page_num, items_per_page=10)
        c.pagenums=c.jobs.pager()
        c.pagenumber = page_num
        return render("/job_table_view.mako")
Ejemplo n.º 5
0
    def job_insert(self):
        if (c.userid == "false"):
             redirect(url('/users/login?m=1'))

        #extra_questions = get_questions(request)
        #form = UserCreationForm(request.POST or None, extra=extra_questions)

        if request.method == 'POST':
            appname  = request.POST['appname']
            if (appname =='tophatfusion'):
               c.form = tophatfusionForm(request.POST,request.POST )
            elif (appname =='bfast') :
               c.form = bfastForm(request.POST,request.POST )
            elif (appname =='chipseq') :
               c.form = chipseqForm(request.POST,request.POST )

            if c.form.is_valid():
                #add using job queue
                jobid =add_job(c.userid)

                for key in c.form.cleaned_data:
                    print "key", key
                    print "value", c.form.cleaned_data[key]
                    newjobinfo = model.jobinfo()
                    newjobinfo.key = key
                    newjobinfo.value = c.form.cleaned_data[key]
                    newjobinfo.submitted_time = time.asctime()
                    newjobinfo.jobid = jobid
                    add_jobinfo(newjobinfo)

                update_job_status(jobid, str(JOBSTATES.NEW))
                redirect(url('/ngs/job_table_view?m=1&id=' + str(jobid) ))
            else:
                return render('/forms/chipseq_form.mako')
Ejemplo n.º 6
0
    def job_insert(self):
        if (c.userid == "false"):
             redirect(url('/users/login?m=1'))

        #extra_questions = get_questions(request)
        #form = UserCreationForm(request.POST or None, extra=extra_questions)

        if request.method == 'POST':
            appname  = request.POST['appname']
            if (appname =='tophatfusion'):
               c.form = tophatfusionForm(request.POST,request.POST )
            elif (appname =='bfast') :
               c.form = bfastForm(request.POST,request.POST )
            elif (appname =='chipseq') :
               c.form = chipseqForm(request.POST,request.POST )

            if c.form.is_valid():
                #add using job queue
                jobid =add_job(c.userid)

                for key in c.form.cleaned_data:
                    print("key", key)
                    print("value", c.form.cleaned_data[key])
                    newjobinfo = model.jobinfo()
                    newjobinfo.key = key
                    newjobinfo.value = c.form.cleaned_data[key]
                    newjobinfo.submitted_time = time.asctime()
                    newjobinfo.jobid = jobid
                    add_jobinfo(newjobinfo)

                update_job_status(jobid, str(JOBSTATES.NEW))
                redirect(url('/ngs/job_table_view?m=1&id=' + str(jobid) ))
            else:
                return render('/forms/chipseq_form.mako')
Ejemplo n.º 7
0
    def job_table_view(self):

        user_jobs = meta.Session.query(model.job).all()

        c.jobs = paginate.Page(user_jobs, items_per_page=10)
        total_pages = len(user_jobs)/10 + 1

        #jobs = meta.Session.query(model.job)
        #if (len(user_jobs)!=0):
         #   print "\njobs------\n",jobs.first().jobinfo[1].key, jobs.first().jobinfo[1].value

        # to check if user visiting this page for  the first time and
        #assign the latest jobs page,page_num tell which page to show


        page_num  =   total_pages
        if ('page' in request.params) and request.params['page']. isdigit() and (int(request.params['page']) <= total_pages):
                page_num =int(request.params['page'])

        if 'm' in request.params:
                c.display_message = "Job successfully submitted and your Job ID is " \
                + str(request.params['id'])

        c.jobs = paginate.Page(user_jobs, page=page_num, items_per_page=10)
        c.pagenums=c.jobs.pager()
        c.pagenumber = page_num
        return render("/job_table_view.mako")
Ejemplo n.º 8
0
    def login_validate(self):
        if (c.userid != "false"):
            redirect(url('/users/login?m=2'))
        session['logged_in'] = True
        session.save()

        if request.method == 'POST':
            c.form = LoginForm(request.POST)
            if c.form.is_valid():

                userid = authenticate_user(c.form.cleaned_data['email'], \
                         c.form.cleaned_data['password'])
                print("hellooooo", c.form.cleaned_data['email'],
                      c.form.cleaned_data['password'])
                if (userid != "invalid"):
                    session['userid'] = userid
                    session.save()
                    print(session['userid'])
                    redirect(url('/'))
                    c.login = "******"
                else:
                    c.login = "******"

            else:
                c.form = LoginForm(request.POST)

        return render("/users/login.mako")
Ejemplo n.º 9
0
    def register(self):
        if 'm' in request.params:
            m = request.params['m']

            if (int(m) ==3):
                c.display_message = "Please log out before you register "    
        elif (c.userid != "false"):
             redirect(url('/users/regitser?m=3'))
        
        c.form = RegisterForm()
        return render('/users/register.mako')
Ejemplo n.º 10
0
    def register(self):
        if 'm' in request.params:
            m = request.params['m']

            if (int(m) == 3):
                c.display_message = "Please log out before you register "
        elif (c.userid != "false"):
            redirect(url('/users/regitser?m=3'))

        c.form = RegisterForm()
        return render('/users/register.mako')
Ejemplo n.º 11
0
    def login(self):
        #h.flash('Please login')

        if 'm' in request.params:
           m = request.params['m']
           if (int(m) ==1):
               c.display_message = "Please log in before you submit a job "
           if (int(m) ==2):
               c.display_message = "Please log out before you login "
           if (int(m) ==4):
               c.display_message = "Please log in before you delete a job "
                
        elif (c.userid != "false"):
             redirect(url('/users/login?m=2'))
             
        c.form = LoginForm()
        return render('/users/login.mako')
Ejemplo n.º 12
0
    def login(self):
        #h.flash('Please login')

        if 'm' in request.params:
            m = request.params['m']
            if (int(m) == 1):
                c.display_message = "Please log in before you submit a job "
            if (int(m) == 2):
                c.display_message = "Please log out before you login "
            if (int(m) == 4):
                c.display_message = "Please log in before you delete a job "

        elif (c.userid != "false"):
            redirect(url('/users/login?m=2'))

        c.form = LoginForm()
        return render('/users/login.mako')
Ejemplo n.º 13
0
 def dalliance(self):
     """ dalliance visual"""
     return render('/dalliance.mako')
Ejemplo n.º 14
0
 def bfast_form(self):
     if (c.userid == "false"):
          redirect(url('/users/login?m=1'))
     c.form = bfastForm()
     return render('/forms/bfast_form.mako')
Ejemplo n.º 15
0
 def using_bfast(self):
     return render('/pages/using_bfast.mako')
Ejemplo n.º 16
0
 def resources(self):
     return render('/pages/resources.mako')
Ejemplo n.º 17
0
 def software(self):
     return render('/pages/software.mako')
Ejemplo n.º 18
0
 def about(self):
     return render('/pages/about.mako')
Ejemplo n.º 19
0
 def using_tophatfusion(self):
     return render('/pages/using_tophatfusion.mako')
Ejemplo n.º 20
0
 def tophatfusion_form(self):
     if (c.userid == "false"):
          redirect(url('/users/login?m=1'))
     c.form = tophatfusionForm()
     return render('/forms/tophatfusion_form.mako')
Ejemplo n.º 21
0
 def using_chipseq(self):
     return render('/pages/using_chipseq.mako')
Ejemplo n.º 22
0
 def contact(self):
     return render('/pages/contact.mako')
Ejemplo n.º 23
0
 def bfast_form(self):
     if (c.userid == "false"):
          redirect(url('/users/login?m=1'))
     c.form = bfastForm()
     return render('/forms/bfast_form.mako')
Ejemplo n.º 24
0
 def software(self):
     return render('/pages/software.mako')
Ejemplo n.º 25
0
 def trac(self):
     return render('/pages/trac.mako')
Ejemplo n.º 26
0
 def resources(self):
     return render('/pages/resources.mako')
Ejemplo n.º 27
0
 def chipseq_form(self):
     if (c.userid == "false"):
          redirect(url('/users/login?m=1'))
     c.form = chipseqForm()
     return render('/forms/chipseq_form.mako')
Ejemplo n.º 28
0
 def about(self):
     return render('/pages/about.mako')
Ejemplo n.º 29
0
    def index(self):

        return render('/pages/index.mako')
Ejemplo n.º 30
0
    def index(self):

        return render('/pages/index.mako')
Ejemplo n.º 31
0
 def using_chipseq(self):
     return render('/pages/using_chipseq.mako')
Ejemplo n.º 32
0
 def tophatfusion_view(self):
     """ dalliance visual"""
     jobid= request.params['id']
     if jobid is None:
        redirect(url('/ngs/job_table_view'))
     return render('/results/result_'+ jobid+'.mako')
Ejemplo n.º 33
0
 def using_bfast(self):
     return render('/pages/using_bfast.mako')
Ejemplo n.º 34
0
 def chipseq_form(self):
     if (c.userid == "false"):
          redirect(url('/users/login?m=1'))
     c.form = chipseqForm()
     return render('/forms/chipseq_form.mako')
Ejemplo n.º 35
0
 def trac(self):
     return render('/pages/trac.mako')
Ejemplo n.º 36
0
 def dalliance(self):
     """ dalliance visual"""
     return render('/dalliance.mako')
Ejemplo n.º 37
0
 def contact(self):
     return render('/pages/contact.mako')
Ejemplo n.º 38
0
 def tophatfusion_view(self):
     """ dalliance visual"""
     jobid= request.params['id']
     if jobid is None:
        redirect(url('/ngs/job_table_view'))
     return render('/results/result_'+ jobid+'.mako')
Ejemplo n.º 39
0
 def tophatfusion_form(self):
     if (c.userid == "false"):
          redirect(url('/users/login?m=1'))
     c.form = tophatfusionForm()
     return render('/forms/tophatfusion_form.mako')
Ejemplo n.º 40
0
 def using_tophatfusion(self):
     return render('/pages/using_tophatfusion.mako')