Changeset 52


Ignore:
Timestamp:
Apr 22, 2003, 6:52:18 PM (19 years ago)
Author:
kake
Message:

username.cgi is now preferences.cgi and sets preference for including geocaches link in navbar, as well as username

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Build.PL

    r51 r52  
    1212    dist_version_from => "wiki.cgi",
    1313    license => "perl",
    14     script_files => [ "wiki.cgi", "wiki.conf", "username.cgi",
     14    script_files => [ "wiki.cgi", "wiki.conf", "preferences.cgi",
    1515                      "supersearch.cgi",
    1616                      "templates/backlink_results.tt",
     
    2424                      "templates/node.tt",
    2525                      "templates/node_history.tt",
     26                      "templates/preferences.tt",
    2627                      "templates/rdf_index.tt",
    2728                      "templates/recent_changes.tt",
  • trunk/MANIFEST

    r51 r52  
    44META.yml
    55README
     6preferences.cgi
    67supersearch.cgi
    78templates/backlink_results.tt
     
    2324t/01_add_test_data.t
    2425t/rdf.t
    25 username.cgi
    2626wiki.cgi
  • trunk/templates/navbar.tt

    r51 r52  
    88    <li>[% geocache_link %]</li>
    99    [% END %]
    10     <li><a href="username.cgi">Set username</a></li>
     10    <li><a href="preferences.cgi">Set username/preferences</a></li>
    1111    [% IF not_editable %]
    1212    </ul><br />
  • trunk/wiki.cgi

    r51 r52  
    423423    my ($content, $checksum) = @node_data{ qw( content checksum ) };
    424424    my %metadata   = %{$node_data{metadata}};
    425     my $username   = &get_cookie;
     425    my $username   = get_cookie( "username" );
    426426    my %tt_vars = ( content    => $q->escapeHTML($content),
    427427                    checksum   => $q->escapeHTML($checksum),
     
    443443
    444444sub get_cookie {
     445    my $cookie_name = shift or return "";
     446    my %defaults = ( username              => "Anonymous",
     447                     include_geocache_link => 0 );
    445448    my %cookies = fetch CGI::Cookie;
    446     my $cookie;
    447     if ($cookies{'username'}) {
    448         $cookie = $cookies{'username'}->value;
     449    if ($cookies{$cookie_name}) {
     450        return $cookies{$cookie_name}->value;
    449451    }
    450452    else {
    451         $cookie = "Anonymous";
    452     }
    453     return $cookie;
     453        return $defaults{$cookie_name};
     454    }
    454455}
    455456
     
    507508
    508509sub make_geocache_link {
     510    return "" unless get_cookie( "include_geocache_link" );
    509511    my $node = shift || $home_name;
    510512    my %current_data = $wiki->retrieve_node( $node );
Note: See TracChangeset for help on using the changeset viewer.