aboutsummaryrefslogtreecommitdiff
path: root/web/webqtl/management/managerMainPage.py
blob: 36f744ad0fce5b1810c0dc10d6c379d470cba20b (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Copyright (C) University of Tennessee Health Science Center, Memphis, TN.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Affero General Public License for more details.
#
# This program is available from Source Forge: at GeneNetwork Project
# (sourceforge.net/projects/genenetwork/).
#
# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010)
# at rwilliams@uthsc.edu and xzhou15@uthsc.edu
#
#
#
# This module is used by GeneNetwork project (www.genenetwork.org)
#
# Created by GeneNetwork Core Team 2010/08/10
#
# Last updated by GeneNetwork Core Team 2010/10/20

import os

from htmlgen import HTMLgen2 as HT

from base.templatePage import templatePage
from utility import webqtlUtil
from base import webqtlConfig

#XZ, 02/06/2009: Xiaodong created this class
class managerMainPage(templatePage):

    def __init__(self, fd):

        templatePage.__init__(self, fd)

        if not self.openMysql():
            return

        ifVerified = None

        ifVerified = fd.formdata.getvalue('ifVerified')

        if ifVerified != 'GN@UTHSC':
            user = fd.formdata.getvalue('user')
            password = fd.formdata.getvalue('password')
            privilege, user_id, userExist = webqtlUtil.authUser(user,password,self.cursor,encrypt = None)[:3]

            if userExist and webqtlConfig.USERDICT[privilege] >= webqtlConfig.USERDICT['admin']:
                ifVerified = True


        if not ifVerified:
            heading = "Error page"
            detail = ["You do not have privilege to change system configuration."]
            self.error(heading=heading,detail=detail)
            return
	else:
            TD_LR = HT.TD(height=200,width="100%", bgColor='#eeeeee')
            
            heading = "Please click button to make your selection"

            createUserAccountForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='createUserAccountForm', submit=HT.Input(type='hidden'))
            createUserAccountForm.append(
                HT.Input(type='button', name='', value='Manage User Accounts', Class="button", onClick="submitToNewWindow(this.form);"),
                HT.Input(type='hidden',name='FormID',value='createUserAccount'),
                HT.Input(type='hidden',name='ifVerified',value='GN@UTHSC')
            )

            assignUserToDatasetForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='assignUserToDatasetForm', submit=HT.Input(type='hidden'))
            assignUserToDatasetForm.append(
                HT.Input(type='button', name='', value='Manage Confidential Datasets', Class="button", onClick="submitToNewWindow(this.form);"),
                HT.Input(type='hidden',name='FormID',value='assignUserToDataset'),
                HT.Input(type='hidden',name='ifVerified',value='GN@UTHSC')
            )

            deletePhenotypeTraitForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='deletePhenotypeTraitForm', submit=HT.Input(type='hidden'))
            deletePhenotypeTraitForm.append(
                HT.Input(type='button', name='', value='Delete Phenotype Trait', Class="button", onClick="submitToNewWindow(this.form);"),
                HT.Input(type='hidden',name='FormID',value='deletePhenotypeTrait'),
                HT.Input(type='hidden',name='ifVerified',value='GN@UTHSC'),
                HT.Input(type='hidden',name='status',value='input')
            )

            exportPhenotypeDatasetForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='exportPhenotypeDatasetForm', submit=HT.Input(type='hidden'))
            exportPhenotypeDatasetForm.append(
                HT.Input(type='button', name='', value='Export Phenotype Dataset', Class="button", onClick="submitToNewWindow(this.form);"),
                HT.Input(type='hidden',name='FormID',value='exportPhenotypeDataset'),
                HT.Input(type='hidden',name='ifVerified',value='GN@UTHSC'),
                HT.Input(type='hidden',name='status',value='input')
            )

            updateGenotypeForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='updateGenotypeForm', submit=HT.Input(type='hidden'))
            updateGenotypeForm.append(
                HT.Input(type='button', name='', value='Update Genotype', Class="button", onClick="submitToNewWindow(this.form);"),
                HT.Input(type='hidden',name='FormID',value='updGeno'),
                HT.Input(type='hidden',name='ifVerified',value='GN@UTHSC')
            )

            editHeaderForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='editHeaderForm', submit=HT.Input(type='hidden'))
            editHeaderForm.append(
                HT.Input(type='button', name='', value='Edit Header', Class="button", onClick="submitToNewWindow(this.form);"),
		HT.Input(type='hidden', name='FormID', value='editHeaderFooter'),
		HT.Input(type='hidden', name='hf', value='h'),
            )

            editFooterForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='editFooterForm', submit=HT.Input(type='hidden'))
            editFooterForm.append(
                HT.Input(type='button', name='', value='Edit Footer', Class="button", onClick="submitToNewWindow(this.form);"),
                HT.Input(type='hidden', name='FormID', value='editHeaderFooter'),
		HT.Input(type='hidden', name='hf', value='f'),
            )

            TD_LR.append(heading, HT.P(),HT.P(), 
			createUserAccountForm, HT.P(),HT.P(), 
			assignUserToDatasetForm, HT.P(),HT.P(), 
			deletePhenotypeTraitForm, HT.P(),HT.P(), 
			exportPhenotypeDatasetForm, HT.P(),HT.P(),
                        updateGenotypeForm, HT.P(),HT.P(),
			editHeaderForm, HT.P(),HT.P(),
			editFooterForm)

            self.dict['body'] =  str(TD_LR)
            self.dict['title'] =  'Manager Main Page'