New setting.

        Patch by exor674. 

diffs (107 lines):

diff -r ce46cffd561b -r 3969f1cbd58a bin/upgrading/en.dat
--- a/bin/upgrading/en.dat      Fri May 29 17:47:10 2009 +0000
+++ b/bin/upgrading/en.dat      Sun May 31 17:04:34 2009 +0000
@@ -2681,6 +2681,10 @@ setting.entryeditor.option.plaintext=HTM
 
 setting.entryeditor.option.richtext=Rich Text
 
+setting.excludeownstats.label=Journal Statistics
+
+setting.excludeownstats.option=Do not include me in my own statistics
+
 setting.gender.error.invalid=Invalid option
 
 setting.gender.error.wrongtype=Only personal or identity journals can have a 
gender.
diff -r ce46cffd561b -r 3969f1cbd58a bin/upgrading/proplists.dat
--- a/bin/upgrading/proplists.dat       Fri May 29 17:47:10 2009 +0000
+++ b/bin/upgrading/proplists.dat       Sun May 31 17:04:34 2009 +0000
@@ -269,6 +269,14 @@ userproplist.esn_inbox_default_expand:
   indexed: 0
   multihomed: 0
   prettyname: Default ESN inbox expanded state
+
+userproplist.exclude_from_own_stats:
+  cldversion: 4
+  datatype: bool
+  des: Exclude yourself from your own journal stats
+  indexed: 0
+  multihomed: 0
+  prettyname: Exclude from self journal stats
 
 userproplist.external_foaf_url:
   cldversion: 4
diff -r ce46cffd561b -r 3969f1cbd58a cgi-bin/LJ/PageStats.pm
--- a/cgi-bin/LJ/PageStats.pm   Fri May 29 17:47:10 2009 +0000
+++ b/cgi-bin/LJ/PageStats.pm   Sun May 31 17:04:34 2009 +0000
@@ -53,6 +53,13 @@ sub should_do_pagestats {
     my $u = $self->get_user;
 
     return 0 if $u && $u->prop('opt_exclude_stats');
+
+    my $ctx = $self->get_context;
+
+    if ( $ctx && $ctx eq 'journal' ) {
+        return 0 if $u && $u->exclude_from_own_stats && $u->equals( 
LJ::get_active_journal() );
+    }
+
     return 1;
 }
 
diff -r ce46cffd561b -r 3969f1cbd58a cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm        Fri May 29 17:47:10 2009 +0000
+++ b/cgi-bin/LJ/User.pm        Sun May 31 17:04:34 2009 +0000
@@ -1792,6 +1792,10 @@ sub can_use_google_analytics {
     return $_[0]->get_cap( 'google_analytics' ) ? 1 : 0;
 }
 
+# Check if the user can use *any* page statistic module for their own journal.
+sub can_use_page_statistics {
+    return $_[0]->can_use_google_analytics;
+}
 
 # <LJFUNC>
 # name: LJ::User::caps_icon
@@ -1832,17 +1836,26 @@ sub control_strip_display {
 
 # returns the country specified by the user
 sub country {
-    my $u = shift;
-    return $u->prop('country');
-}
-
+    return $_[0]->prop( 'country' );
+}
+
+sub exclude_from_own_stats {
+    my $u = shift;
+
+    if ( defined $_[0] && $_[0] =~ /[01]/ ) {
+        $u->set_prop( exclude_from_own_stats => $_[0] );
+        return $_[0];
+    }
+
+    return $u->prop( 'exclude_from_own_stats' ) eq "1" ? 1 : 0;
+}
 
 # returns the max capability ($cname) for all the classes
 # the user is a member of
 sub get_cap {
-    my ($u, $cname) = @_;
+    my ( $u, $cname ) = @_;
     return 1 if $LJ::T_HAS_ALL_CAPS;
-    return LJ::get_cap($u, $cname);
+    return LJ::get_cap( $u, $cname );
 }
 
 
diff -r ce46cffd561b -r 3969f1cbd58a htdocs/manage/settings/index.bml
--- a/htdocs/manage/settings/index.bml  Fri May 29 17:47:10 2009 +0000
+++ b/htdocs/manage/settings/index.bml  Sun May 31 17:04:34 2009 +0000
@@ -69,6 +69,7 @@ body<=
                 LJ::Setting::ViewingAdultContent
                 LJ::Setting::SafeSearch
                 DW::Setting::GoogleAnalytics
+                DW::Setting::ExcludeOwnStats
             )],
         },
         notifications => {
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to