#!/usr/bin/env python # # Copyright (C) 2007 Platform Computing Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA import os import sys import urllib import socket # for debugging #import cgitb; cgitb.enable() # Globals OCS_KITPATH = '/var/www/html/kits' BASE_URL = 'http://localhost/cgi-bin' LIST_KITS_CGI = 'list_kits.cgi' LIST_GUIDES_CGI = 'list_guides.cgi' LIST_MANPAGES_CGI = 'list_manpages.cgi' LIST_HOSTINFO_CGI = 'list_hostinfo.cgi' LIST_USEFUL_CGI = 'list_useful.cgi' # Helpers def outputURL(cgi): url = urllib.URLopener() fp = url.open('%s/%s' % (BASE_URL,cgi)) for line in fp.readlines(): print line[:-1] fp.close() def headContents(): print 'Welcome to Platform HPC' print '' def pageHeader(): print '' print ' ' print ' ' print ' ' print ' ' print '
' outputURL(LIST_HOSTINFO_CGI) print '
' def pageTOC(): print '' print '' print '
' print 'Table of Contents:
' print 'Useful Links
' print 'Installed Kits
' print 'Guides
' print 'Platform OCS Tools Man Pages
' print '
' print '
' def sectionHeader(header): print '' % header.replace(' ', '_') print '' print '' print '
' print header + '
' print '
' def sectionFooter(): print '
Back to Top
' print '
' def startHTML(): print "" def endHTML(): print "" def startBody(): print "" def endBody(): print "" # Output HTML print "Content-Type: text/html" print startHTML() headContents() startBody() pageHeader() pageTOC() # List useful links sectionHeader('Useful links') print '

A collection of links to web GUIs of installed applications and support sites:

' outputURL(LIST_USEFUL_CGI) sectionFooter() # List kit links sectionHeader('Installed Kits') print '

The following kits are available on this cluster:

' outputURL(LIST_KITS_CGI) sectionFooter() # List guide links sectionHeader('Guides') print '

Refer to the following guides for detailed instructions:

' outputURL(LIST_GUIDES_CGI) sectionFooter() # List manpage links sectionHeader('Platform OCS Tools Man Pages') print '

Refer to the following man pages for detailed command-line usage:

' outputURL(LIST_MANPAGES_CGI) sectionFooter() endBody() endHTML()