Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!c:/Python26/python.exe
- import os
- import cgi, cgitb
- cgitb.enable()
- print 'Content-type: text/html\n\n'
- print "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/msa.css\" >"
- class HtmlTemplate:
- def Header(self):
- print '''
- <html><head>
- <title>Multiple Sequence alignment</title>
- </head>
- '''
- def Body(self):
- print '''
- <body>
- <p align="center"><img src='images/mheader.jpg'></img></p>
- <br>
- <br>
- '''
- def Form(self):
- print '''
- <script language=\"javascript\" type=\"text/javascript\">
- function validate(form)
- {
- if ((form.dfile.value.length==0) && (form.sequence.value.length==0))
- {
- alert("Upload fasta file or paste sequence");
- return false;
- }
- else if ((form.dfile.value.length>0) && (form.sequence.value.length>0))
- {
- alert("Only one option is available");
- return false;
- }
- else
- {
- return true;
- }
- }
- </script>
- <table width="575" height="305" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#a1a1a1" bgcolor="#f3f3f3">
- <tr>
- <td width="565" height="303" valign="top">
- <form method="post" action="display.py" enctype="multipart/form-data" onsubmit="return validate(this);">
- <table width="544" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td colspan="3"> </td>
- </tr>
- <tr>
- <td width="156"><div align="center"><u>Upload fasta file</u></div></td>
- <td colspan="2"> <input name="dfile" type="file" class="style1" size="45" /> </td>
- </tr>
- <tr>
- <td colspan="3"><div align="center"></div></td>
- </tr>
- <tr>
- <td colspan="3"><div align="center">******OR******</div></td>
- </tr>
- <tr>
- <td valign="top"><div align="center"><u>Paste your sequence</u></div></td>
- <td colspan="2"><textarea name="sequence" cols="45" rows="10" class="style2" id="sequence"></textarea> </td>
- </tr>
- <tr>
- <td height="39"> </td>
- <td width="309" height="39"> </td>
- <td width="79"><INPUT TYPE = hidden NAME = "action" VALUE ="display">
- <INPUT TYPE = submit class="style2" VALUE = "Execute">
- </td>
- </tr>
- </table>
- </form>
- </td>
- </tr>
- </table>'''
- def Footer(self):
- print '''
- <p align="center">
- <br><br>
- <table width="931" border="0" cellpadding="0" cellspacing="0" bgcolor="#cccccc">
- <tr>
- <td><div align="center">Thaman Chand @ 2010</div></td>
- </tr>
- </table>
- </p>
- '''
- def CloseHtml(self):
- print "</body>"
- print "</html>"
- ## Calling all the functions of the class template with object (objx)
- objx=HtmlTemplate()
- objx.Header()
- objx.Body()
- objx.Form()
- objx.Footer()
- objx.CloseHtml()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement