mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-04-18 04:04 am

[dw-free] Add basic whereami page.

[commit: http://hg.dwscoalition.org/dw-free/rev/d3d6d154fd5b]

Add basic whereami page.

Patch by [staff profile] mark.

Files modified:
  • htdocs/misc/whereami.bml
  • htdocs/misc/whereami.bml.text
--------------------------------------------------------------------------------
diff -r 3a7d4067e889 -r d3d6d154fd5b htdocs/misc/whereami.bml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/misc/whereami.bml	Sat Apr 18 04:04:06 2009 +0000
@@ -0,0 +1,46 @@
+<?_c
+#
+# misc/whereami.bml
+#
+# User facing "nifty" page to let users see what cluster they're on.
+#
+# Authors:
+#      Mark Smith <mark@dreamwidth.org>
+#
+# Copyright (c) 2009 by Dreamwidth Studios, LLC.
+#
+# This program is free software; you may redistribute it and/or modify it under
+# the same terms as Perl itself. For a copy of the license, please reference
+# 'perldoc perlartistic' or 'perldoc perlgpl'.
+#
+_c?><?page
+body<=
+<?_code
+{
+    use strict;
+
+    # for pages that require authentication
+    my $remote = LJ::get_remote()
+        or return '<?needlogin?>';
+
+    # allow the remote user to authenticate as another account (community, etc)
+    my $authas = $GET{authas} || $remote->user;
+    my $u = LJ::get_authas_user( $authas );
+    return LJ::bad_input( $ML{'error.invalidauth'} )
+        unless $u;
+
+    # okay, now print out the useful information
+    my $cname = $LJ::CLUSTER_NAME{$u->clusterid} || $ML{'.cluster.unknown'};
+
+    my $ret = '<?p <?_ml .intro _ml?> p?>';
+    $ret .= "<form method='get' id='userpic_authas' action='$LJ::SITEROOT/misc/whereami.bml'>\n";
+    $ret .= LJ::make_authas_select($remote, { authas => $GET{authas} }) . "\n";
+    $ret .= "</form><br /><?p ";
+    $ret .= BML::ml( '.cluster', { cluster => $cname, user => $u->ljuser_display } );
+    $ret .= ' p?>';
+    return $ret;
+}
+_code?>
+<=body
+title=><?_ml .title _ml?>
+page?>
diff -r 3a7d4067e889 -r d3d6d154fd5b htdocs/misc/whereami.bml.text
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/misc/whereami.bml.text	Sat Apr 18 04:04:06 2009 +0000
@@ -0,0 +1,9 @@
+;; -*- coding: utf-8 -*-
+
+.cluster=[[user]] is located on the <strong>[[cluster]]</strong>.
+
+.cluster.unknown=Unnamed Cluster
+
+.intro=This site is made up of clusters of servers that store user data.  Each of these clusters can contain many tens or hundreds of thousands of different users and communities.
+
+.title=Cluster Locator
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org