- print ' Guru Meditation #DEADBEEF.ABADC0DE'
- print '</pre>'
- # FIXME: This simple JS snippet is harder to pass than ACID 3.0
- print """
- <script language="JavaScript" type="text/javascript">
- var guru = document.getElementById('guru');
- // Firefox 2.0 doesn't take border-color, but returns border-top-color fine
- var color = document.defaultView.getComputedStyle(guru,null).getPropertyValue('border-top-color');
-
- function guruOn() {
- guru.style.setProperty('border-color', color, '');
- setTimeout('guruOff()', 1000);
- }
- function guruOff() {
- guru.style.setProperty('border-color', '#000000', '');
- setTimeout('guruOn()', 1000);
- }
- // Safari 2.0 returns this rgba crap
- // Konqueror 3.5.6 doesn't seem to support computed properties
- if (color && color != 'rgba(0, 0, 0, 0)') {
- //window.alert("enabled! color='" + color + "'");
- guruOn();
- }
- </script>"""
-
-def send_title(name, text="Limbo", msg=None, msg_type='error'):
- global title_done
- if title_done: return
-
- # Head
- emit_header()
- print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'
- print ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
- print '<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">'
-
- site_name = globals().get('site_name', 'Unconfigured Site')
- print "<head><title>%s: %s</title>" % (site_name, text)
- print ' <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />'
- if not name:
- print ' <meta name="robots" content="noindex,nofollow" />'
- for css in css_url:
- print ' <link rel="stylesheet" type="text/css" href="%s" />' % css
- print '</head>'
-
- # Body
- if name and privileged_url is not None:
- print '<body ondblclick="location.href=\'' + privileged_path() + '?edit=' + name + '\'">'
- else:
- print '<body>'
-
- title_done = True
- send_guru(msg, msg_type)
-
- # Navbar
- print '<div class="nav">'
- print ' <b>' + site_name + ': ',
- if name:
- print link_tag('?fullsearch=' + name, text, 'navlink') + '</b> '
- else:
- print text + '</b> '
- print ' | ' + link_tag('FrontPage', 'Front Page', 'navlink')
- print ' | ' + link_tag('FindPage', 'Find Page', 'navlink')
- if globals().has_key('history_url'):
- print ' | <a href="' + history_url + '" class="navlink">Recent Changes</a>'
- if name:
- print ' | <a href="' + history_url + '?a=history;f=' + name + '" class="navlink">Page History</a>'
-
- if name:
- print ' | ' + link_tag('?raw=' + name, 'Raw Text', 'navlink')
- if privileged_url is not None:
- print ' | ' + link_tag('?edit=' + name, 'Edit Page', 'navlink', authentication=True)
- else:
- print ' | <i>Immutable Page</i>'
-
- user = remote_user()
- if user != 'AnonymousCoward':
- print ' | <span class="login"><i>logged in as <b>' + cgi.escape(user) + '</b></i></span>'
-
- print '<hr /></div>'
-
-def link_tag(params, text=None, ss_class=None, authentication=False):
+ print '\n Guru Meditation #DEADBEEF.ABADC0DE'
+ print('</pre><script type="text/javascript" src="%s" defer="defer"></script>' \
+ % relative_url('sys/GuruMeditation.js'))
+
+def send_httperror(status="404 Not Found", query="", trace=False):
+ print("Status: %s" % status)
+ msg_text = "%s: on query '%s'" % (status, query)
+ if trace:
+ import traceback
+ msg_text += '\n\n' + traceback.format_exc()
+ page = Page()
+ page.send_title(msg_text=msg_text)
+ page.send_footer()
+
+def link_tag(dest, text=None, privileged=False, **kvargs):