#!/usr/bin/python
# (c) 2010 Jonathan Hayward, jonathan.hayward@pobox.com, JonathansCorner.com
#
# This script was created primarily as a proof of concept, but if you wish to
# use it, you may use it under the terms of any of the GPL or MIT licenses:
#
# GPL: http://www.opensource.org/licenses/gpl-2.0.php or any later version at
# your option.
# MIT: http://www.opensource.org/licenses/mit-license.php
#
# Developers wanting to see how the script works will probably want to skip to
# where the functions are, beginning after the comment on line 211 saying
# "Functions begin here".
import cgi
import cgitb; cgitb.enable()
import commands
import random
import time
import urllib
labels = [u'One', u'Two', u'Three', u'Four', u'Five', u'Six', u'Seven']
links = [
u'''Many Orthodox have fallen for some treacherous spin doctoring.
Orthodoxy, Contraception, and Spin Doctoring: A Look at an Influential and Disturbing Article''',
u'''The first edition of the book "The Orthodox Church" said, "Artificial methods of birth control are forbidden in the Orthodox Church," but subsequent editions have changed. Why?
Orthodoxy, Contraception, and Spin Doctoring: A Look at an Influential and Disturbing Article''',
u'''It could have been titled, "The Elephant in the Room."
An Open Letter to Catholics on Orthodoxy and Ecumenism''',
u'''It was originally written to communicate to Catholics, but there are some things there that Orthodox might need to hear, too.
An Open Letter to Catholics on Orthodoxy and Ecumenism''',
u'''Restoring harmony with nature as we know it is missing something. The spiritual reality reaches far deeper.
Exotic Golden Ages and Restoring Harmony with Nature: Anatomy of a Passion''',
u'''It is a great tragedy to overlook the here and now.
Exotic Golden Ages and Restoring Harmony with Nature: Anatomy of a Passion''',
u'''It's the one act the Bible calls holy.
The Eighth Sacrament''',
u'''A microcosm of spiritual life.
The Eighth Sacrament''',
u'''There is something about life that is too easy to forget.
Our Crown of Thorns''',
u'''There can be something profoundly valuable about suffering.
Our Crown of Thorns''',
u'''A fantasy story inspired by the patristic Greek East instead of the medieval West.
The Steel Orb''',
u'''Another world. But in some ways, more familiar than you might think.
The Steel Orb''',
u'''It seemed a cutting-edge find.
Inclusive Language Greek Manuscript Discovered''',
u'''A landmark in Biblical studies.
Inclusive Language Greek Manuscript Discovered''',
u'''Can we ever escape shame?
Unashamed''',
u'''There was a song, simple and pure.
Unashamed''',
u'''COMMENTARY
ON THE OLD AND NEW TESTAMENTS
IN ONE VOLUME
CONTAINING A CAREFUL ANALYSIS OF ALL CULTURAL ISSUES
NEEDFUL TO UNDERSTAND THE BIBLE
AS DID ITS FIRST READERS
The Commentary''',
u'''He found what he was looking for, and it utterly shocked him. What will studying the Bible's cultures never tell you?
The Commentary''',
u'''The Holy Grail... What is behind the Holy Grail?
The Christmas Tales''',
u'''They were snowbound, at least for a little while. What did they have to share?
The Christmas Tales''',
u'''The confused person's guide to being even more confused about Eastern Orthodoxy.
1054 and All That''',
u'''Everything you don't need to help you understand Orthodoxy.
1054 and All That''',
u'''Becoming a bishop... is easier than you think.
Your Fast Track to Consecration!''',
u'''An idea whose time has come. And gone.
Your Fast Track to Consecration!''',
u'''There are many surprises in life. Not all of them are bad.
Amazing Providence''',
u'''Working for God is not a one-way street.
Amazing Providence''',
u'''We say we have rights. Do we?
Do We Have Rights?''',
u'''Rights have become so important to how we think that we've lost touch with many societies that get along well—without any real system of rights.
Do We Have Rights?''',
u'''There are things about marriage that we miss if we think in terms of men and women.
What the Current Debate Won't Tell You About Headship''',
u'''Men and women are part of something larger.
What the Current Debate Won't Tell You About Headship''',
u'''Orthodox Christians and feminists agree on some things.
The Patriarchy We Object To''',
u'''What is the solution to patriarchy?
The Patriarchy We Object To''',
u'''The fulfillment of nurturing is...
The Fulfillment of Feminism''',
u'''Do today's controversies make Orthodoxy obsolete?
The Fulfillment of Feminism''',
u'''Ever notice that pets have trouble learning even rules you intend for their good?
A Pet Owner's Rules''',
u'''God is like a pet owner.
A Pet Owner's Rules''',
u'''A paean of beauty.
Hymn to the Creator of Heaven and Earth''',
u'''Orthodox worship has always been connected to nature.
Hymn to the Creator of Heaven and Earth''',
u'''Orthodoxy may speak to the heart's deepest longings, but this doesn't mean that Orthodoxy is always what you imagine it to be...
Archdruid of Canterbury Visits Orthodox Patriarch''',
u'''Our idea of "ecumenism" is...
Archdruid of Canterbury Visits Orthodox Patriarch''',
u'''You know, it can be funny how hard Evangelical converts strive to be Eastern Orthodox...
Evangelical Converts Striving to Be Orthodox''',
u'''There is such a thing as trying too hard.
Evangelical Converts Striving to Be Orthodox''',
u'''Time.
The Horn of Joy''',
u'''Time is a many-layered reality, and some of these layers are almost invisible to many of us.
The Horn of Joy''',
u'''An icon may be a painting, but there's more than meets the eye.
Lesser Icons: Reflections on Faith, Icons, and Art''',
u'''How do icons illuminate art?
Lesser Icons: Reflections on Faith, Icons, and Art''',
u'''The Christian life has decisive moments. Including one you might not think of.
Two Decisive Moments''',
u'''"When was the world created?" is a trick question.
Two Decisive Moments''',
u'''It is amazing how much of life we fail to appreciate.
A Wonderful Life''',
u'''She had a very difficult life. And a very beautiful one.
A Wonderful Life''',
u'''They're called "Windows of Heaven."
Stephanos''',
u'''"The crown of earth is the temple, and the crown of the temple is Heaven."
Stephanos''',
u'''It seems Church Fathers can be cantankerous.
Athanasius: On Creative Fidelity''',
u'''Maybe "creative fidelity" wasn't such a breakthrough insight after all.
Athanasius: On Creative Fidelity''',
u'''The best things in life are free.
Money''',
u'''There are some things money can't buy.
Money''',
u'''I misunderstood basic things about Orthodoxy, too.
An Orthodox Looks at a Calvinist Looking at Orthodoxy''',
u'''A Calvinist raises some natural questions about Orthodoxy.
An Orthodox Looks at a Calvinist Looking at Orthodoxy''',
u'''A slightly different way of timekeeping...
with links to something more interesting.
The Natural Cycle Clock''',
u'''Clocks have fascinated people since they were first invented.
The Natural Cycle Clock''',
u'''Does Einstein's theory of relativity say anything that relativism does not? Or does relativism say anything that Einstein's theory of relativity does not?
Is there a difference that matters?
Within the Steel Orb''',
u'''A sleek car under starlight, a different kind of information technology, a deep, blue-robed host, and the wisdom of an alien world.
Within the Steel Orb''',
u'''The Allegory of the Cave, updated.
Plato: The Allegory of the... Flickering Screen?''',
u'''Maybe it's just talking about television... but maybe it isn't.
Plato: The Allegory of the... Flickering Screen?''',
u'''A young man's world expands when he opens a book of legends: Brocéliande.
The Sign of the Grail''',
u'''What lies beyond the Holy Grail?
The Sign of the Grail''',
u'''No, it isn't about magic.
Technonomicon: Technology, Nature, Ascesis''',
u'''There are things deeper than technology.
Technonomicon: Technology, Nature, Ascesis''',
u'''It's becoming the second U.S. national holiday.
Halloween: A Solemn Farewell''',
u'''It's not the only way that the spiritual world can be close.
Halloween: A Solemn Farewell''',
u'''Rough day?
Actually, To Me, It Is a Very Good Day''',
u'''It made me stop and think.
Actually, To Me, It Is a Very Good Day''',
u'''Sing to the Lord a new song.
Sing to the Lord, all the earth.
Doxology''',
u'''Who can tell of the glory of God?
Doxology''',
u'''A survival guide for a recession, depression, or economic collapse.
How to Survive an Economic Depression''',
u'''Does faith have anything to do with how to survive hard times?
How to Survive an Economic Depression''',
u'''Here is a Christian answer.
The Law of Attraction: A Dialogue with an Eastern Orthodox Christian Mystic''',
u'''There are realities deeper than the Law of Attraction dares to hint about.
The Law of Attraction: A Dialogue with an Eastern Orthodox Christian Mystic''',
u'''It's about what's wrong with our ideas today about religion and science.
"Religion and Science" Is Not Just Intelligent Design vs. Evolution''',
u'''Some theologians are concerned about not being scientific enough, but could the problem be that theology is TOO scientific?
"Religion and Science" Is Not Just Intelligent Design vs. Evolution''',
u'''Lessons from a bit of an odd experience.
Dissent: Lessons from Being an Orthodox Theology Student at a Catholic University''',
u'''The issue is not really about dissent. It is fundamentally about faith.
Dissent: Lessons from Being an Orthodox Theology Student at a Catholic University''',
u'''Go through the Psalms at your own pace, one at a time.
Psalms Shuffle Button''',
u'''Just let it pick a Psalm! The Psalms have something to say to you.
Psalms Shuffle Button''',
u'''The Russian Orthodox Church knows a thing or two about living in hard times--and not just surviving, but learning to thrive spiritually.
From Russia, with Love: A Spiritual Guide to Surviving Political and Economic Disaster''',
u'''There is a spiritual dimension to surviving--and more.
From Russia, with Love: A Spiritual Guide to Surviving Political and Economic Disaster''',
u'''It can be an interesting experience to restore communion with Rome.
Pope Makes Historic Ecumenical Bid to Woo Eastern Rite Catholics''',
u'''Wonder who's next?
Pope Makes Historic Ecumenical Bid to Woo Eastern Rite Catholics''',
u'''You cannot fathom how much God loves you.
God the Spiritual Father''',
u'''Would you like a glimpse into the Fatherhood of God?
God the Spiritual Father''',
u'''An author looks back and takes a second look at his work.
An Author's Musing Memoirs: Retrospective Reflections, Retracings, and Retractions''',
u'''A look back...
An Author's Musing Memoirs: Retrospective Reflections, Retracings, and Retractions''',
u'''What is the maximum to have in life?
Maximum Christ, Maximum Ambition, Maximum Repentance''',
u'''Do you want more?
Maximum Christ, Maximum Ambition, Maximum Repentance''',
u'''Rejoice, O flowing fountain of Heaven's treasures!
Akathist to St. Philaret the Merciful''',
u'''A saint who was abuntantly generous when he had much, and then after losing almost everything, was abundantly generous out of the little he had left.
Akathist to St. Philaret the Merciful''',
]
styles = [u'''body
{
background-color: white;
font-family: Verdana, Arial, sans;
}''', #0
u'''body
{
background-color: black;
color: white;
font-family: Courier New, Courier, Monospace;
}
a
{
color: white;
}
h1
{
font-style: normal;
}''', #1
u'''a
{
color: white;
}
body
{
background-color: blue;
color: white;
font-family: Impact, Verdana, Arial, sans;
}
p.timestamp
{
font-size: larger;
}
strong
{
font-style: italic;
font-weight: normal;
}''', #2
u'''body
{
background-color: silver;
font-family: Times New Roman, Times, Serif;
}
h1
{
font-style: normal;
}
''', #3
u'''a
{
color: purple;
}
body
{
background-color: pink;
color: purple;
font-weight: bold;
font-family: Verdana, Arial, sans;
}
strong
{
font-style: italic;
}''', #4
u'''a
{
color: #808080;
text-decoration: none;
}
body
{
background-color: silver;
color: #808080;
font-size: larger;
font-family: Verdana, Arial, sans;
}''', #5
u'''a
{
color: #005800;
}
body
{
background-image: url(http://JonathansCorner.com/images/background.jpg);
color: #302000;
font-size: larger;
font-variant: small-caps;
}
''',
]
# Functions begin here.
def get_cgi(field, default = ""):
return cgi_form.getfirst(field, default)
def get_raw_text():
return get_cgi(u'text', u'Your text here!')
def get_style():
try:
return min(6, max(0, int(get_cgi(u'style'))))
except ValueError:
return 0
def get_text():
return urllib.quote(get_raw_text())
def print_button_frame():
style = get_style()
button_name = labels[style]
css = styles[style]
text = get_text()
print u'''
%(link)s
''' % locals() def print_text_frame(): text = get_raw_text() print u'''