Implement author filtering.
authorSteinar H. Gunderson <sesse@debian.org>
Wed, 25 Jul 2007 23:48:21 +0000 (01:48 +0200)
committerSteinar H. Gunderson <sesse@debian.org>
Wed, 25 Jul 2007 23:48:21 +0000 (01:48 +0200)
files/pr0n.css
perl/Sesse/pr0n/Index.pm
templates/bilder.knatten.com/submittedby
templates/default/submittedby
templates/images.tg05.gathering.org/submittedby
templates/itk-bilder.samfundet.no/submittedby
templates/skoyen.bilder.knatten.com/submittedby
templates/skoyen.bildereks.knatten.com/submittedby

index 438d8d3492f9af3534e0411cf887681cd3875067..acc7ed422321159e9ee3e1a1dacbdf4ff50987ab 100644 (file)
@@ -46,7 +46,8 @@ li {
        margin-bottom: 0.5em;
 }
 .filter {
-       font-size: smaller;
+       font-size: small;
+       font-weight: normal;
 }
 * {
 /*     border: 1px solid red; */
index fab7971956a166bf54f4ed5431c727bc08f0e2df..809bda651d9e6ad60f439948ebd7ccfe7f1ebdb6 100644 (file)
@@ -64,7 +64,8 @@ sub handler {
                sel => 0,
                fullscreen => 0,
                model => undef,
-               lens => undef
+               lens => undef,
+               author => undef
        );
        
        my $where;
@@ -89,7 +90,7 @@ sub handler {
                
        my %settings = %defsettings;
 
-       for my $s qw(thumbxres thumbyres xres yres start num all infobox rot sel fullscreen model lens) {
+       for my $s qw(thumbxres thumbyres xres yres start num all infobox rot sel fullscreen model lens author) {
                my $val = $apr->param($s);
                if (defined($val) && $val =~ /^(\d+)$/) {
                        $settings{$s} = $val;
@@ -97,7 +98,7 @@ sub handler {
                if (($s eq "num" || $s eq "xres" || $s eq "yres") && defined($val) && $val == -1) {
                        $settings{$s} = $val;
                }
-               if ($s eq "model" || $s eq "lens") {
+               if ($s eq "model" || $s eq "lens" || $s eq "author") {
                        $settings{$s} = Sesse::pr0n::Common::pretty_unescape($val);
                }
        }
@@ -114,6 +115,7 @@ sub handler {
        my $sel = $settings{'sel'};
        my $model = $settings{'model'};
        my $lens = $settings{'lens'};
+       my $author = $settings{'author'};
 
        # Construct SQL for this filter
        if ($all == 0) {
@@ -138,6 +140,11 @@ sub handler {
                        $where .= " AND id IN ( SELECT image FROM exif_info WHERE (key='Lens' OR key='LensSpec') AND TRIM(value)=$lq )";
                }
        }
+       if (defined($author)) {
+               my $aq = $dbh->quote($author);
+
+               $where .= " AND takenby=$aq";
+       }
 
        if (defined($num) && $num == -1) {
                $num = undef;
@@ -328,8 +335,22 @@ sub handler {
                        if ($takenby ne $lastupl) {
                                $r->print("    </p>\n\n") if ($lastupl ne "" && $rot != 1);
                                $lastupl = $takenby;
+
+                               my %newsettings = %settings;
+
+                               my $action;
+                               if (defined($author)) {
+                                       chomp ($action = Sesse::pr0n::Templates::fetch_template($r, "unfilter"));
+                                       $newsettings{'author'} = undef;
+                               } else {
+                                       chomp ($action = Sesse::pr0n::Templates::fetch_template($r, "filter"));
+                                       $newsettings{'author'} = $ref->{'takenby'};
+                               }
+
+                               my $url = "/$event/" . Sesse::pr0n::Common::get_query_string(\%newsettings, \%defsettings);
+                               
                                $r->print("    <h2>");
-                               Sesse::pr0n::Templates::print_template($r, "submittedby", { author => $lastupl });
+                               Sesse::pr0n::Templates::print_template($r, "submittedby", { author => $lastupl, action => $action, filterurl => $url });
                                print_fullscreen_fromhere($r, $event, \%settings, \%defsettings, $img_num);
                                $r->print("</h2>\n");
 
index fd7ddd94b54961897a487ae8726b8e3e14073ac5..0322a28cbd5d3c961b9d208709f7bb0704ffbe2a 100644 (file)
@@ -1 +1 @@
-Tatt av: %AUTHOR%
+Tatt av: %AUTHOR% <span class="filter">(<a href="%FILTERURL%">%ACTION%</a>)</span>
index b27c685a3e647576a22e9cd200395ac94a75da2d..9f20f32935c98691507718d1346608cbbd0f83a1 100644 (file)
@@ -1 +1 @@
-Taken by: %AUTHOR%
+Taken by: %AUTHOR% <span class="filter">(<a href="%FILTERURL%">%ACTION%</a>)</span>
index b27c685a3e647576a22e9cd200395ac94a75da2d..9f20f32935c98691507718d1346608cbbd0f83a1 100644 (file)
@@ -1 +1 @@
-Taken by: %AUTHOR%
+Taken by: %AUTHOR% <span class="filter">(<a href="%FILTERURL%">%ACTION%</a>)</span>
index fd7ddd94b54961897a487ae8726b8e3e14073ac5..0322a28cbd5d3c961b9d208709f7bb0704ffbe2a 100644 (file)
@@ -1 +1 @@
-Tatt av: %AUTHOR%
+Tatt av: %AUTHOR% <span class="filter">(<a href="%FILTERURL%">%ACTION%</a>)</span>
index fd7ddd94b54961897a487ae8726b8e3e14073ac5..0322a28cbd5d3c961b9d208709f7bb0704ffbe2a 100644 (file)
@@ -1 +1 @@
-Tatt av: %AUTHOR%
+Tatt av: %AUTHOR% <span class="filter">(<a href="%FILTERURL%">%ACTION%</a>)</span>
index fd7ddd94b54961897a487ae8726b8e3e14073ac5..0322a28cbd5d3c961b9d208709f7bb0704ffbe2a 100644 (file)
@@ -1 +1 @@
-Tatt av: %AUTHOR%
+Tatt av: %AUTHOR% <span class="filter">(<a href="%FILTERURL%">%ACTION%</a>)</span>