diff options
Diffstat (limited to 'web/webqtl/schema')
-rwxr-xr-x | web/webqtl/schema/ShowCommentPage.py | 123 | ||||
-rwxr-xr-x | web/webqtl/schema/ShowSchemaPage.py | 194 | ||||
-rwxr-xr-x | web/webqtl/schema/UpdateCommentPage.py | 101 | ||||
-rwxr-xr-x | web/webqtl/schema/__init__.py | 0 |
4 files changed, 0 insertions, 418 deletions
diff --git a/web/webqtl/schema/ShowCommentPage.py b/web/webqtl/schema/ShowCommentPage.py deleted file mode 100755 index 449fd56a..00000000 --- a/web/webqtl/schema/ShowCommentPage.py +++ /dev/null @@ -1,123 +0,0 @@ -# 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 sys - -from htmlgen import HTMLgen2 as HT - -from base.templatePage import templatePage -from base import webqtlConfig - - - -class ShowCommentPage(templatePage): - def __init__(self,fd): - sys.stderr = sys.stdout - - templatePage.__init__(self, fd) - - if not self.openMysql(): - #{ - print 'Content-type: text/html\n' - print 'Can not update the comment of %s' %(TableName) - return - #} - - Cursor_Comment = self.cursor - TableName = fd.formdata.getfirst('TableName') - - SqlCmd = 'select Comment from TableComments where TableName=\'%s\'' %(TableName) - Cursor_Comment.execute(SqlCmd) - Comment = Cursor_Comment.fetchall() - if Comment: - Comment = Comment[0][0] - if str(Comment)=='None': - Comment='' - else: - Comment = '' - - ##########setup HtmlForm Comment########## - HtmlInputHidden_TableName = HT.Input(type='hidden', name='TableName', value=TableName) - HtmlInputHidden_ActionID = HT.Input(type='hidden', name='ActionID', value='UpdateComment') - HtmlTextarea_Comment = HT.Textarea(name='Comment', text=Comment, rows=8, cols=100) - - HtmlForm_Comment = HT.Form(cgi=webqtlConfig.CGIDIR+'main.py?FormID=schemaUpdateComment') - HtmlForm_Comment.append('<B>%s</B><BR><BR>' %(TableName)) #show table's name - HtmlForm_Comment.append('<B><I>Comment:</I></B><BR>') #show table's comment - HtmlForm_Comment.append(HtmlTextarea_Comment) - HtmlForm_Comment.append('<BR>') - HtmlForm_Comment.append(HtmlInputHidden_TableName) - HtmlForm_Comment.append(HtmlInputHidden_ActionID) - - ########################### - #update fields' annotation# - ########################### - HtmlForm_Comment.append('<BR><BR>') - - try: - #{ - HtmlTR_Annotation = [] - Cursor_Comment.execute('desc %s' %(TableName)) - TableDesc = Cursor_Comment.fetchall() - for i in range(0, len(TableDesc)): - #{ - TableField = TableName+'.'+str(TableDesc[i][0]) - TableFieldForeignKey = TableField+'ForeignKey' - TableFieldAnnotation = TableField+'Annotation' - HtmlText_ForeignKey = HT.Input(type='text', name=TableFieldForeignKey, size=20) - HtmlText_Annotation = HT.Input(type='text', name=TableFieldAnnotation, size=80) - - - Cursor_Comment.execute('select Annotation, Foreign_Key from TableFieldAnnotation where TableField=%s', (TableField)) - Annotation = Cursor_Comment.fetchone() - if Annotation: - #{ - if str(Annotation[1]) != 'None': - HtmlText_ForeignKey.value=Annotation[1] - if str(Annotation[0]) != 'None': - HtmlText_Annotation.value=Annotation[0].replace('"', '"') - #} - HtmlTD_Annotation = [] - HtmlTD_Annotation.append(TableField) - HtmlTD_Annotation.append(HtmlText_ForeignKey) - HtmlTD_Annotation.append(HtmlText_Annotation) - - HtmlTR_Annotation.append(HtmlTD_Annotation) - #} - - HtmlTable_Annotation= HT.Table(border=0, width='0%', heading=['Field', 'Foreign_Key', 'Annotation'], body = HtmlTR_Annotation) - HtmlForm_Comment.append(HtmlTable_Annotation) - #} - except: - pass - - HtmlForm_Comment.submit.value='submit' - HtmlForm_Comment.reset = HT.Input(type='reset', name='reset', value='reset') - ##########end of HtmlForm########## - - self.dict['body'] = HtmlForm_Comment - - diff --git a/web/webqtl/schema/ShowSchemaPage.py b/web/webqtl/schema/ShowSchemaPage.py deleted file mode 100755 index e9ced5a1..00000000 --- a/web/webqtl/schema/ShowSchemaPage.py +++ /dev/null @@ -1,194 +0,0 @@ -# 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 sys - -from htmlgen import HTMLgen2 as HT - -from base.templatePage import templatePage -from base import webqtlConfig -from utility import webqtlUtil - - - -################################################### -#Description: show the schema of webqtl's database# -#Author: Hongqiang Li # -#Version: 1.0 # -################################################### - -class ShowSchemaPage(templatePage): - def __init__(self,fd): - cookies = fd.cookies - sys.stderr = sys.stdout - templatePage.__init__(self, fd) - body = HT.SimpleDocument() - - ############################################################################### - #get user's privilege from cookie, if the user doesn't have enough privilege, # - #he won't see the update comment icon # - ############################################################################### - ShowUpdateIcon = False - - if not self.openMysql(): - return - - Cursor_WebQtl = Cursor_Comment = self.cursor - - if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['user']: - ShowUpdateIcon = True - - ################## - #show description# - ################## - body.append('<BR>') - body.append('<H1>') - body.append('Description of Schema') - if ShowUpdateIcon: - #{ - # Modified by Hongqiang Li - # Image_Update = HT.Image('http://web2qtl.utmem.edu/images/modify.gif') - Image_Update = HT.Image('/images/modify.gif') - # - Href_Update = HT.Href(webqtlConfig.CGIDIR+'main.py?FormID=schemaShowComment&TableName=Description_of_Schema', Image_Update) - body.append(Href_Update) - #} - body.append('</H1>') - - Cursor_WebQtl.execute('select Comment from TableComments where TableName=\'Description_of_Schema\'') - Comment = Cursor_WebQtl.fetchone(); - if Comment: - if str(Comment[0])!='None': - body.append(Comment[0]) - - body.append('<HR WIDTH=100%>') - body.append('<H2>Tables</H2>') - - ################## - #show table names# - ################## - Cursor_WebQtl.execute('show tables') - Tables=Cursor_WebQtl.fetchall() - BlockedTables = ['User', 'TableComments', 'TableFieldAnnotation', 'ProbeSetXRef_TEMP', 'DBList', 'DBType', 'HumanGene', 'LCorr', 'Temp', 'TempData'] - for i in range(0, len(Tables)): - #{ - TableName = Tables[i][0] - if TableName in BlockedTables: #skip the table who is blocked - continue - - HrefTable_Schema = HT.Href(webqtlConfig.CGIDIR+'main.py?FormID=schemaShowPage#'+TableName, TableName) - body.append(str(HrefTable_Schema)+'<BR>') - #} - body.append('<hr width=100%>') - - for i in range(0, len(Tables)): - #{ - TableName = Tables[i][0] - if TableName in BlockedTables: #skip the table who is blocked - continue - - ##################### - #get table's comment# - ##################### - SqlCmd = 'select Comment from TableComments where TableName=\'%s\'' %(TableName) - Cursor_WebQtl.execute(SqlCmd) - Comment = Cursor_WebQtl.fetchall() - - #################################### - #get the content of a table's schma# - #################################### - Cursor_WebQtl.execute('desc %s' %(TableName)) - TableDesc = Cursor_WebQtl.fetchall(); - - HtmlTR_Schema = [] - for row in range(0, len(TableDesc)): - #{ - HtmlTD_Schema = [] - for col in range(0, len(TableDesc[row])): - if str(TableDesc[row][col])=='None' or str(TableDesc[row][col])=='': #just means I don't want show 'None' *_^ - HtmlTD_Schema.append(' ') - else: - HtmlTD_Schema.append(TableDesc[row][col]) - - ############################## - #get table fileds' annotation# - ############################## - TableField = TableName+'.'+TableDesc[row][0] - Cursor_WebQtl.execute('select Annotation, Foreign_Key from TableFieldAnnotation where TableField=%s', (TableField)) - Annotation = Cursor_WebQtl.fetchone(); - if Annotation: - #{ - if str(Annotation[1])=='None' or str(Annotation[1])=='': - HtmlTD_Schema.append(' ') - else: - HtmlTD_Schema.append(Annotation[1]) - if str(Annotation[0])=='None' or str(Annotation[0])=='': - HtmlTD_Schema.append(' ') - else: - HtmlTD_Schema.append(Annotation[0]) - #} - else: - #{ - HtmlTD_Schema.append(' ') - HtmlTD_Schema.append(' ') - #} - - HtmlTR_Schema.append(HtmlTD_Schema) - #} - - ############################### - #Html code of a table's schema# - ############################### - body.append(HT.NAME(TableName, TableName)) - if ShowUpdateIcon: - #{ - # Modified by Hongqiang Li - #Image_Update = HT.Image('http://web2qtl.utmem.edu/images/modify.gif') - Image_Update = HT.Image('/images/modify.gif') - # - Href_Update = HT.Href(webqtlConfig.CGIDIR+'main.py?FormID=schemaShowComment&TableName=%s' %(TableName), Image_Update) - body.append(Href_Update) - #} - body.append('<BR><BR>') - - body.append('<B>Comment:</B><BR>') - #body.append("<I>") - if Comment: - if str(Comment[0][0])!='None': - for content in Comment[0][0].split('\n'): - body.append(content) - body.append('<BR>') - #body.append("</I>") - - HtmlTable_Schema = HT.Table(width='0%', heading=['Field', 'Type', 'Null', 'Key', 'Default', 'Extra', 'Foreign_Key', 'Annotation'], body = HtmlTR_Schema) - body.append(HtmlTable_Schema) - body.append('<hr width=100%>') - #} - - self.dict['body'] = body - - - diff --git a/web/webqtl/schema/UpdateCommentPage.py b/web/webqtl/schema/UpdateCommentPage.py deleted file mode 100755 index eb1dbb67..00000000 --- a/web/webqtl/schema/UpdateCommentPage.py +++ /dev/null @@ -1,101 +0,0 @@ -# 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 sys - -from htmlgen import HTMLgen2 as HT - -from base.templatePage import templatePage -from base import webqtlConfig - - -class UpdateCommentPage(templatePage): - def __init__(self,fd): - sys.stderr = sys.stdout - templatePage.__init__(self, fd) - body = HT.SimpleDocument() - - if not self.updMysql(): - #{ - print 'Content-type: text/html\n' - print 'Can not update the comment of %s' %(TableName) - return - #} - - - Cursor_Comment=self.cursor - TableName = fd.formdata.getfirst('TableName') - Comment = fd.formdata.getfirst('Comment') - - ######################## - #update table's comment# - ######################## - Cursor_Comment.execute('select * from TableComments where TableName=%s', (TableName)) - if Cursor_Comment.fetchall(): - Cursor_Comment.execute('update TableComments set Comment=%s where TableName=%s', (Comment, TableName)) - else: - Cursor_Comment.execute('insert into TableComments values(%s,%s)', (TableName, Comment)) - - - ################################# - #update table fields' annotation# - ################################# - try: - #{ - Cursor_Comment.execute('desc %s' %(TableName)) - TableDesc = Cursor_Comment.fetchall() - for i in range(0, len(TableDesc)): - #{ - TableField = TableName+'.'+str(TableDesc[i][0]) - TableFieldForeignKey = TableField+'ForeignKey' - TableFieldAnnotation = TableField+'Annotation' - - ForeignKey = fd.formdata.getfirst(TableFieldForeignKey) - if ForeignKey == 'None': - ForeignKey='' - Annotation = fd.formdata.getfirst(TableFieldAnnotation) - if Annotation == 'None': - Annotation=' ' - - Cursor_Comment.execute('select * from TableFieldAnnotation where TableField=%s', (TableField)) - if Cursor_Comment.fetchall(): - Cursor_Comment.execute('update TableFieldAnnotation set Foreign_Key=%s, Annotation=%s where TableField=%s', (ForeignKey, Annotation, TableField)) - else: - Cursor_Comment.execute('insert into TableFieldAnnotation values(%s,%s,%s)', (TableField, ForeignKey, Annotation)) - #} - #} - except: - pass - - HtmlHref = HT.Href(webqtlConfig.CGIDIR+'main.py?FormID=schemaShowPage#%s' %(TableName), 'table') - HtmlBlock = HT.Blockquote(); - HtmlBlock.append('This ') - HtmlBlock.append(HtmlHref) - HtmlBlock.append('\'s comment has been succesfully updated') - - body.append(HtmlBlock) - self.dict['body'] = body - diff --git a/web/webqtl/schema/__init__.py b/web/webqtl/schema/__init__.py deleted file mode 100755 index e69de29b..00000000 --- a/web/webqtl/schema/__init__.py +++ /dev/null |