aboutsummaryrefslogtreecommitdiff
path: root/wqflask/dataSharing/SharingListDataSetPage.py
diff options
context:
space:
mode:
authorSam Ockman2012-06-29 16:49:08 -0400
committerSam Ockman2012-06-29 16:49:08 -0400
commit877e0832959c0ab9e7ad417cfdc233b450274a8d (patch)
tree3d8ae29720223d6204819172a68c23b820cd8c08 /wqflask/dataSharing/SharingListDataSetPage.py
parent3a222b876cf291921194d9f0e2dd3fc8e6a999a2 (diff)
downloadgenenetwork2-877e0832959c0ab9e7ad417cfdc233b450274a8d.tar.gz
Added dataSharing to flask directory
Diffstat (limited to 'wqflask/dataSharing/SharingListDataSetPage.py')
-rwxr-xr-xwqflask/dataSharing/SharingListDataSetPage.py99
1 files changed, 99 insertions, 0 deletions
diff --git a/wqflask/dataSharing/SharingListDataSetPage.py b/wqflask/dataSharing/SharingListDataSetPage.py
new file mode 100755
index 00000000..ec90f5f3
--- /dev/null
+++ b/wqflask/dataSharing/SharingListDataSetPage.py
@@ -0,0 +1,99 @@
+#
+# 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
+
+from htmlgen import HTMLgen2 as HT
+from base import webqtlConfig
+
+from base.templatePage import templatePage
+
+
+#########################################
+# Sharing List DataSet Page
+#########################################
+class SharingListDataSetPage(templatePage):
+
+ def __init__(self, fd=None):
+ templatePage.__init__(self, fd)
+
+ if not self.openMysql():
+ return
+
+ if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['admin']:
+ pass
+ else:
+ heading = "Editing Info"
+ detail = ["You don't have the permission to list the datasets"]
+ self.error(heading=heading,detail=detail,error="Error")
+ return
+
+
+ TD_LR = HT.TD(height=200,width="100%",bgColor='#eeeeee')
+
+ query = """select GN_AccesionId, InfoPageTitle, Progreso from InfoFiles order by GN_AccesionId"""
+ self.cursor.execute(query)
+ result = self.cursor.fetchall()
+
+ heading = HT.Paragraph('Dataset Table', Class="title")
+
+ newrecord = HT.Href(text="New Record", url="/webqtl/main.py?FormID=sharinginfoadd")
+
+ info = "Click the accession id to view the dataset info. Click the dataset name to edit the dataset info."
+
+ datasetTable = HT.TableLite(border=0, cellpadding=0, cellspacing=0, Class="collap", width="100%")
+
+ tableHeaderRow = HT.TR()
+ tableHeaderRow.append(HT.TD("Accession Id", Class='fs14 fwb ffl b1 cw cbrb', align="center"))
+ tableHeaderRow.append(HT.TD("Dataset name", Class='fs14 fwb ffl b1 cw cbrb', align="center"))
+ tableHeaderRow.append(HT.TD("Progress", Class='fs14 fwb ffl b1 cw cbrb', align="center"))
+ tableHeaderRow.append(HT.TD("Operation", Class='fs14 fwb ffl b1 cw cbrb', align="center"))
+ datasetTable.append(tableHeaderRow)
+
+ for one_row in result:
+ Accession_Id, InfoPage_title, Progress = one_row
+ datasetRow = HT.TR()
+ datasetRow.append(HT.TD(HT.Href(text="GN%s" % Accession_Id, url="/webqtl/main.py?FormID=sharinginfo&GN_AccessionId=%s" % Accession_Id, Class='fs12 fwn'), Class="fs12 fwn b1 c222"))
+ datasetRow.append(HT.TD(HT.Href(text="%s" % InfoPage_title, url="/webqtl/main.py?FormID=sharinginfo&GN_AccessionId=%s" % Accession_Id, Class='fs12 fwn'), Class="fs12 fwn b1 c222"))
+ datasetRow.append(HT.TD("%s" % Progress, Class='fs12 fwn ffl b1 c222'))
+ operation_edit = HT.Href(text="Edit", url="/webqtl/main.py?FormID=sharinginfoedit&GN_AccessionId=%s" % Accession_Id)
+ operation_delete = HT.Href(text="Delete", onClick="deleteRecord(%s); return false;" % Accession_Id)
+ operation = HT.TD(Class="fs12 fwn b1 c222", align="center")
+ operation.append(operation_edit)
+ operation.append("    ")
+ operation.append(operation_delete)
+ datasetRow.append(operation)
+ datasetTable.append(datasetRow)
+
+ TD_LR.append(heading, HT.P(), newrecord, HT.P(), info, HT.P(), datasetTable)
+
+ js1 = """ <script language="javascript" type="text/javascript">
+ function deleteRecord(id){
+ question = confirm("Are you sure you want to delete the dataset info record (Accession Id="+id+")?")
+ if (question != "0"){
+ window.open("/webqtl/main.py?FormID=sharinginfodelete&GN_AccessionId="+id, "_self");
+ }
+ }
+ </script>"""
+ self.dict['js1'] = js1
+ self.dict['body'] = str(TD_LR) \ No newline at end of file