Example #1
0
def redirector(name, weboptions):
    """
        Prints a page which redirects the user to querystatus.cgi and writes starting time to file
    """
    
    redirectWait = 3

    utilities.startLogFile(name, 'pdb2pqr_start_time', str(time.time()))
    
    jobid = int(name)
    
    analiticsDict = weboptions.getOptions()
    
    events = {}
    
    events['submission'] = analiticsDict['pdb']+'|'+str(os.environ["REMOTE_ADDR"])
    del analiticsDict['pdb']
    
    events['titration'] = str(analiticsDict.get('ph'))
    if 'ph' in analiticsDict:
        del analiticsDict['ph']
        
    events['apbsInput'] = str(analiticsDict.get('apbs'))
    del analiticsDict['apbs']
    
    #Clean up selected extensions output
    if 'selectedExtensions' in analiticsDict:
        analiticsDict['selectedExtensions'] = ' '.join(analiticsDict['selectedExtensions'])
    
    options = ','.join(str(k)+':'+str(v) for k,v in analiticsDict.items())
    events['options']=options

    eventsScriptString = ''
    for event in events:
        eventsScriptString += utilities.getEventTrackingString(category='submissionData',
                                                               action=event, 
                                                               label=events[event]) 
        
    redirectURL = "{website}querystatus.cgi?jobid={jobid}&calctype=pdb2pqr".format(website=WEBSITE, 
                                                                                   jobid=jobid)

    string = """
<html>
    <head>
        {trackingscript}
        <script type="text/javascript">
            {trackingevents}
        </script>
        <meta http-equiv="Refresh" content="{wait}; url={redirectURL}"> 
        <link rel="stylesheet" href="{website}pdb2pqr.css"type="text/css">
    </head>
    <body>
    <center>
        You are being automatically redirected to a new location.<br />
        If your browser does not redirect you in {wait} seconds, or you do
        not wish to wait, <a href="{redirectURL}">click here</a></center>. 
    </body>
</html>""".format(trackingscript=utilities.getTrackingScriptString(jobid=jobid), 
                  trackingevents=eventsScriptString, redirectURL=redirectURL, wait=redirectWait, website=WEBSITE)
    return string
Example #2
0
def main(apbsOptions):
    cgiFile = "jmol.cgi"
    cgiName = "thisform"
    defaultVisType = "jmol"
    checkJmolType = True
    cssFile = 'pdb2pqr.css'
    jobid = form['jobid'].value

    string =  """
<html>
    <head>
        {trackingscript}
        <script type="text/javascript">
            {trackingevents}
        </script>
        <title>Visualization</title>
        <link rel="stylesheet" href="pdb2pqr.css" type="text/css">
        <script type="text/JavaScript" src="jmol/Jmol.js"></script>
        <script type="text/JavaScript">APPLET_PATH="jmol/";GZIP=""</script>
        <script type="text/JavaScript" src="jmol/apbsjmol.js"></script>
    </head>
    <body onload="init()">
        <script type="text/javascript">createVisualization({jobid}, -5.0, 5.0)</script>
    </body>
</html>""".format(jobid=jobid,
                  trackingevents=getEventTrackingString(category='apbs',
                                                        action='visualize', 
                                                        label=str(os.environ["REMOTE_ADDR"])),
                  trackingscript=getTrackingScriptString(jobid=jobid))

    print string
Example #3
0
def main(apbsOptions):
    cgiFile = "jmol.cgi"
    cgiName = "thisform"
    defaultVisType = "jmol"
    checkJmolType = True
    cssFile = 'pdb2pqr.css'
    jobid = form['jobid'].value

    string = """
<html>
    <head>
        {trackingscript}
        <script type="text/javascript">
            {trackingevents}
        </script>
        <title>Visualization</title>
        <link rel="stylesheet" href="pdb2pqr.css" type="text/css">
        <script type="text/JavaScript" src="jmol/Jmol.js"></script>
        <script type="text/JavaScript">APPLET_PATH="jmol/";GZIP=""</script>
        <script type="text/JavaScript" src="jmol/apbsjmol.js"></script>
    </head>
    <body onload="init()">
        <script type="text/javascript">createVisualization({jobid}, -5.0, 5.0)</script>
    </body>
</html>""".format(jobid=jobid,
                  trackingevents=getEventTrackingString(
                      category='apbs',
                      action='visualize',
                      label=str(os.environ["REMOTE_ADDR"])),
                  trackingscript=getTrackingScriptString(jobid=jobid))

    print string
Example #4
0
def redirector(name, weboptions):
    """
        Prints a page which redirects the user to querystatus.cgi and writes starting time to file
    """
    
    redirectWait = 3

    utilities.startLogFile(name, 'pdb2pqr_start_time', str(time.time()))
    
    jobid = int(name)
    
    analiticsDict = weboptions.getOptions()
    
    events = {}
    
    events['submission'] = analiticsDict['pdb']+'|'+str(os.environ["REMOTE_ADDR"])
    del analiticsDict['pdb']
    
    events['titration'] = str(analiticsDict.get('ph'))
    if 'ph' in analiticsDict:
        del analiticsDict['ph']
        
    events['apbsInput'] = str(analiticsDict.get('apbs'))
    del analiticsDict['apbs']
    
    #Clean up selected extensions output
    if 'selectedExtensions' in analiticsDict:
        analiticsDict['selectedExtensions'] = ' '.join(analiticsDict['selectedExtensions'])
    
    options = ','.join(str(k)+':'+str(v) for k,v in analiticsDict.items())
    events['options']=options

    eventsScriptString = ''
    for event in events:
        eventsScriptString += utilities.getEventTrackingString(category='submissionData',
                                                               action=event, 
                                                               label=events[event]) 
        
    redirectURL = "{website}querystatus.cgi?jobid={jobid}&calctype=pdb2pqr".format(website=WEBSITE, 
                                                                                   jobid=jobid)

    string = """
<html>
    <head>
        {trackingscript}
        <script type="text/javascript">
            {trackingevents}
        </script>
        <meta http-equiv="Refresh" content="{wait}; url={redirectURL}"> 
        <link rel="stylesheet" href="{website}pdb2pqr.css"type="text/css">
    </head>
    <body>
    <center>
        You are being automatically redirected to a new location.<br />
        If your browser does not redirect you in {wait} seconds, or you do
        not wish to wait, <a href="{redirectURL}">click here</a></center>. 
    </body>
</html>""".format(trackingscript=utilities.getTrackingScriptString(jobid=jobid), 
                  trackingevents=eventsScriptString, redirectURL=redirectURL, wait=redirectWait, website=WEBSITE)
    return string
Example #5
0
def printheader(pagetitle, refresh=None, jobid=None):
    str = ""
    str += "<html>\n"
    str += "<HEAD>\n"
    if refresh:
        str += "\t<META HTTP-EQUIV=\"Refresh\" CONTENT=\"%s\">\n" % refresh
    str += "\t<TITLE>%s</TITLE>\n" % pagetitle
    str += "\t<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n" % STYLESHEET
    str += getTrackingScriptString(jobid)
    str += "</HEAD>\n"
    return str
Example #6
0
def printheader(pagetitle,refresh=None,jobid=None):
    str = ""
    str+= "<html>\n"
    str+= "<HEAD>\n"
    if refresh:
        str+= "\t<META HTTP-EQUIV=\"Refresh\" CONTENT=\"%s\">\n" % refresh
    str+= "\t<TITLE>%s</TITLE>\n" % pagetitle
    str+= "\t<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n" % STYLESHEET
    str+= getTrackingScriptString(jobid)
    str+= "</HEAD>\n"
    return str
def printheader(pagetitle,refresh=None,jobid=None):
    str = ""
    str+= "<html>\n"
    str+= "<HEAD>\n"
    str+= '<img src="https://raw.githubusercontent.com/Electrostatics/apbs-pdb2pqr/master/apbs/doc/icons/APBS_128_v2.png" style="float:right; position:relative;right:200px; top: 2px;">'
    if refresh:
        str+= "\t<META HTTP-EQUIV=\"Refresh\" CONTENT=\"%s\">\n" % refresh
    str+= "\t<TITLE>%s</TITLE>\n" % pagetitle
    str+= "\t<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n" % STYLESHEET
    str+= getTrackingScriptString(jobid)
    str+= "</HEAD>\n"
    return str
Example #8
0
def printheader(pagetitle, refresh=None, jobid=None):
    str = ""
    str += "<html>\n"
    str += "<HEAD>\n"
    str += '<img src="https://raw.githubusercontent.com/Electrostatics/apbs-pdb2pqr/master/apbs/doc/icons/APBS_128_v2.png" style="float:right; position:relative;right:200px; top: 2px;">'
    if refresh:
        str += "\t<META HTTP-EQUIV=\"Refresh\" CONTENT=\"%s\">\n" % refresh
    str += "\t<TITLE>%s</TITLE>\n" % pagetitle
    str += "\t<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n" % STYLESHEET
    str += getTrackingScriptString(jobid)
    str += "</HEAD>\n"
    return str
Example #9
0
def main(apbsOptions):
    cgiFile = "jmol.cgi"
    cgiName = "thisform"
    defaultVisType = "jmol"
    checkJmolType = True
    cssFile = 'pdb2pqr.css'
    jobid = form['jobid'].value

    string = """
<!DOCTYPE html>
    <head>
        {trackingscript}
        <script type="text/javascript">
            {trackingevents}
        </script>
        <title>Visualization</title>
        <link rel="stylesheet" href="3dmol/css/pdb2pqr_3dmol.css" type="text/css">
        <link rel="stylesheet" href="3dmol/css/foundation.css">
        <link rel="stylesheet" type="text/css" href="3dmol/css/pure-min.css" media="screen" />
       

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script src="http://3dmol.csb.pitt.edu/build/3Dmol.js"></script>
        <script type="text/JavaScript" src="3dmol/js/visualize_html.js"></script>
        <script type="text/JavaScript" src="3dmol/js/3dmol.js"></script>
    </head>
    <body>
        <script type="text/javascript">build_page({jobid})</script>
        <script type="text/javascript">getpqr({jobid})</script>
       
    </body>
</html>""".format(jobid=jobid,
                  trackingevents=getEventTrackingString(
                      category='apbs',
                      action='visualize',
                      label=str(os.environ["REMOTE_ADDR"])),
                  trackingscript=getTrackingScriptString(jobid=jobid))

    print string
Example #10
0
def main(apbsOptions):
    cgiFile = "jmol.cgi"
    cgiName = "thisform"
    defaultVisType = "jmol"
    checkJmolType = True
    cssFile = 'pdb2pqr.css'
    jobid = form['jobid'].value

    string =  """
<!DOCTYPE html>
    <head>
        {trackingscript}
        <script type="text/javascript">
            {trackingevents}
        </script>
        <title>Visualization</title>
        <link rel="stylesheet" href="3dmol/css/pdb2pqr_3dmol.css" type="text/css">
        <link rel="stylesheet" href="3dmol/css/foundation.css">
        <link rel="stylesheet" type="text/css" href="3dmol/css/pure-min.css" media="screen" />
       

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script src="http://3dmol.csb.pitt.edu/build/3Dmol.js"></script>
        <script type="text/JavaScript" src="3dmol/js/visualize_html.js"></script>
        <script type="text/JavaScript" src="3dmol/js/3dmol.js"></script>
    </head>
    <body>
        <script type="text/javascript">build_page({jobid})</script>
        <script type="text/javascript">getpqr({jobid})</script>
       
    </body>
</html>""".format(jobid=jobid,
                  trackingevents=getEventTrackingString(category='apbs',
                                                        action='visualize', 
                                                        label=str(os.environ["REMOTE_ADDR"])),
                  trackingscript=getTrackingScriptString(jobid=jobid))

    print string
Example #11
0
def main(apbsOptions):
    cgiFile = "jmol.cgi"
    cgiName = "thisform"
    defaultVisType = "jmol"
    checkJmolType = True
    cssFile = 'pdb2pqr.css'
    try:
        jobid = form['jobid'].value
        tool = form['tool'].value  #run 3dmol or jmol
    except KeyError:
        print redirectString
        return

    string_3dmol = """
<!DOCTYPE html>
    <head>
        {trackingscript}
        <script type="text/javascript">
            {trackingevents}
        </script>
        <title>Visualization</title>
        <link rel="stylesheet" href="3dmol/css/pdb2pqr_3dmol.css" type="text/css">
        <link rel="stylesheet" href="3dmol/css/foundation.css">
        <link rel="stylesheet" type="text/css" href="3dmol/css/pure-min.css" media="screen" />
        <link rel="stylesheet" href="3dmol/css/toggles.css" type="text/css">
        <link rel="stylesheet" href="3dmol/css/ui_css.css" type="text/css">
        <script type="text/JavaScript" src="3dmol/js/pitt_3Dmol.js"></script>
        
       

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script src="http://3dmol.csb.pitt.edu/build/3Dmol.js"></script>
        <script type="text/JavaScript" src="3dmol/js/visualize_html.js"></script>
        <script type="text/JavaScript" src="3dmol/js/3dmol.js"></script>
    </head>
    <body>
        <script type="text/javascript">build_page({jobid})</script>
        <script type="text/javascript">getpqr({jobid})</script>
        <script type="text/javascript">getcube({jobid})</script>
    </body>
</html>""".format(jobid=jobid,
                  trackingevents=getEventTrackingString(
                      category='apbs',
                      action='visualize',
                      label=str(os.environ["REMOTE_ADDR"])),
                  trackingscript=getTrackingScriptString(jobid=jobid))

    string_jmol = """
<!DOCTYPE html>
    <head>
        {trackingscript}
        <script type="text/javascript">
            {trackingevents}
        </script>
        <title>Visualization</title>
        <link rel="stylesheet" href="pdb2pqr.css" type="text/css">
        <script type="text/JavaScript" src="jmol/Jmol.js"></script>
        <script type="text/JavaScript">APPLET_PATH="jmol/";GZIP=""</script>
        <script type="text/JavaScript" src="jmol/apbsjmol.js"></script>
    </head>
    <body onload="init()">
        <script type="text/javascript">createVisualization({jobid}, -5.0, 5.0)</script>
    </body>
</html>""".format(jobid=jobid,
                  trackingevents=getEventTrackingString(
                      category='apbs',
                      action='visualize',
                      label=str(os.environ["REMOTE_ADDR"])),
                  trackingscript=getTrackingScriptString(jobid=jobid))

    if (tool == 'tool_3dmol'):
        print string_3dmol
    if (tool == 'tool_jmol'):
        print string_jmol
Example #12
0
def main(apbsOptions):
    cgiFile = "jmol.cgi"
    cgiName = "thisform"
    defaultVisType = "jmol"
    checkJmolType = True
    cssFile = 'pdb2pqr.css'
    try:
        jobid = form['jobid'].value
        tool = form['tool'].value #run 3dmol or jmol
    except KeyError:
        print redirectString
        return

    string_3dmol =  """
<!DOCTYPE html>
    <head>
        {trackingscript}
        <script type="text/javascript">
            {trackingevents}
        </script>
        <title>Visualization</title>
        <link rel="stylesheet" href="3dmol/css/pdb2pqr_3dmol.css" type="text/css">
        <link rel="stylesheet" href="3dmol/css/foundation.css">
        <link rel="stylesheet" type="text/css" href="3dmol/css/pure-min.css" media="screen" />
        <link rel="stylesheet" href="3dmol/css/toggles.css" type="text/css">
        <link rel="stylesheet" href="3dmol/css/ui_css.css" type="text/css">
        <script type="text/JavaScript" src="3dmol/js/pitt_3Dmol.js"></script>
        
       

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script src="http://3dmol.csb.pitt.edu/build/3Dmol.js"></script>
        <script type="text/JavaScript" src="3dmol/js/visualize_html.js"></script>
        <script type="text/JavaScript" src="3dmol/js/3dmol.js"></script>
    </head>
    <body>
        <script type="text/javascript">build_page({jobid})</script>
        <script type="text/javascript">getpqr({jobid})</script>
        <script type="text/javascript">getcube({jobid})</script>
    </body>
</html>""".format(jobid=jobid,
                  trackingevents=getEventTrackingString(category='apbs',
                                                        action='visualize', 
                                                        label=str(os.environ["REMOTE_ADDR"])),
                  trackingscript=getTrackingScriptString(jobid=jobid))


    string_jmol =  """
<!DOCTYPE html>
    <head>
        {trackingscript}
        <script type="text/javascript">
            {trackingevents}
        </script>
        <title>Visualization</title>
        <link rel="stylesheet" href="pdb2pqr.css" type="text/css">
        <script type="text/JavaScript" src="jmol/Jmol.js"></script>
        <script type="text/JavaScript">APPLET_PATH="jmol/";GZIP=""</script>
        <script type="text/JavaScript" src="jmol/apbsjmol.js"></script>
    </head>
    <body onload="init()">
        <script type="text/javascript">createVisualization({jobid}, -5.0, 5.0)</script>
    </body>
</html>""".format(jobid=jobid,
                  trackingevents=getEventTrackingString(category='apbs',
                                                        action='visualize', 
                                                        label=str(os.environ["REMOTE_ADDR"])),
                  trackingscript=getTrackingScriptString(jobid=jobid))

    if(tool == 'tool_3dmol'):
        print string_3dmol
    if(tool == 'tool_jmol'):
        print string_jmol