#!/usr/local/bin/python
import cgi
import sys
import urllib
sys.path.append('plugins')

execfile('plugin_config.py')

def doMain():
        print "Content-Type: text/html\n\n"
	print '''
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
<style>
h2 {
font-size: 18px;
line-height: normal;
font-weight: bold;
background-color: #f0f0f0;
border-bottom: 1px solid #3c78b5;
padding: 2px;
margin: 27px 0px 4px 0px;
}

h3 {
font-size: 14px;
line-height: normal;
font-weight: bold;
background-color: #f0f0f0;
padding: 2px;
margin: 21px 0px 4px 0px;
}
</style>
<title>Berry 411 Plugins</title>
<b>Berry Search Plugins</b> let you add new search features to Berry 411. <br><br>Add a plugin by entering a plugin name or URL using the <b>Edit Plugins</b> page.  <br>
<br>
The following plugin names are currently available. <hr>
'''
	allplugins = plugin_redirects.keys() + builtins
	allplugins.sort()
	print "<ol>"
	for plugin in allplugins:
	    if plugin_descriptions.has_key(plugin):
		    print  "<li> <b>"+plugin+"</b>"
		    desc =  plugin_descriptions[plugin]
		    if desc:
			    print ": ", desc
		    print "<br>"
	print "</ol>"
	
	print """<hr><br><b>Plugin URLs</b>: You can also specify a plugin by entering a URL.  Pretty much any mobile friendly web page can be used.  The follow escape codes expand to the user's search string and location
	<ul> <li> <b>%s: search string</b> <li> <b>%n: current location</b> </ul>
<b>Registering plugin names</b>:
<a name="register">
	Please contact the author if you would like to register your plugin so that others can easily use it.</a>
	"""

if __name__ == "__main__":
    doMain()
