[dw-free] remove LJ::Widget::StyleAlwaysMine and associated code
[commit: http://hg.dwscoalition.org/dw-free/rev/e8691db15123]
http://bugs.dwscoalition.org/show_bug.cgi?id=1550
Remove settings, modules, callers. We'll replace them with our
implementation later.
Patch by
denise.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1550
Remove settings, modules, callers. We'll replace them with our
implementation later.
Patch by
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Files modified:
- bin/upgrading/en.dat
- bin/upgrading/proplists.dat
- cgi-bin/LJ/Setting/StyleAlwaysMine.pm
- cgi-bin/LJ/User.pm
- cgi-bin/LJ/Widget/StyleAlwaysMine.pm
- cgi-bin/weblib.pl
- htdocs/manage/settings/index.bml.text
- htdocs/tools/setstylemine.bml
-------------------------------------------------------------------------------- diff -r 47d8462593ee -r e8691db15123 bin/upgrading/en.dat --- a/bin/upgrading/en.dat Tue Aug 04 19:32:47 2009 -0500 +++ b/bin/upgrading/en.dat Wed Aug 05 01:20:45 2009 +0000 @@ -2817,10 +2817,6 @@ setting.sitescheme.error.invalid=Invalid setting.sitescheme.label=Site Scheme -setting.stylealwaysmine.label=Other Journals - -setting.stylealwaysmine.option=View all journals and communities in my own style - setting.stylemine.label=Comment Pages setting.stylemine.option=View comment pages from my Friends page in my own style diff -r 47d8462593ee -r e8691db15123 bin/upgrading/proplists.dat --- a/bin/upgrading/proplists.dat Tue Aug 04 19:32:47 2009 -0500 +++ b/bin/upgrading/proplists.dat Wed Aug 05 01:20:45 2009 +0000 @@ -774,14 +774,6 @@ userproplist.opt_showschools: multihomed: 0 prettyname: Show School Information on Userinfo -userproplist.opt_stylealwaysmine: - cldversion: 4 - datatype: char - des: 1: always use user journal style when viewing any journal - indexed: 0 - multihomed: 0 - prettyname: Always my Style - userproplist.opt_stylemine: cldversion: 4 datatype: bool diff -r 47d8462593ee -r e8691db15123 cgi-bin/LJ/Setting/StyleAlwaysMine.pm --- a/cgi-bin/LJ/Setting/StyleAlwaysMine.pm Tue Aug 04 19:32:47 2009 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -package LJ::Setting::StyleAlwaysMine; -use base 'LJ::Setting'; -use strict; -use warnings; - -sub should_render { - my ($class, $u) = @_; - - return LJ::is_enabled("stylealwaysmine") && $u && $u->is_personal ? 1 : 0; -} - -sub label { - my $class = shift; - - return $class->ml('setting.stylealwaysmine.label'); -} - -sub option { - my ($class, $u, $errs, $args) = @_; - my $key = $class->pkgkey; - - my $stylealwaysmine = $class->get_arg($args, "stylealwaysmine") || $u->opt_stylealwaysmine; - my $can_use_stylealwaysmine = $u->can_use_stylealwaysmine ? 1 : 0; - my $upgrade_link = $can_use_stylealwaysmine ? "" : (LJ::run_hook("upgrade_link", $u, "paid") || ""); - - my $ret = LJ::html_check({ - name => "${key}stylealwaysmine", - id => "${key}stylealwaysmine", - value => 1, - selected => $stylealwaysmine && $can_use_stylealwaysmine ? 1 : 0, - disabled => $can_use_stylealwaysmine ? 0 : 1, - }); - $ret .= " <label for='${key}stylealwaysmine'>" . $class->ml('setting.stylealwaysmine.option') . " $upgrade_link</label>"; - - return $ret; -} - -sub save { - my ($class, $u, $args) = @_; - - my $val = $class->get_arg($args, "stylealwaysmine") ? "Y" : "N"; - $u->set_prop( opt_stylealwaysmine => $val ); - - return 1; -} - -1; diff -r 47d8462593ee -r e8691db15123 cgi-bin/LJ/User.pm --- a/cgi-bin/LJ/User.pm Tue Aug 04 19:32:47 2009 -0500 +++ b/cgi-bin/LJ/User.pm Wed Aug 05 01:20:45 2009 +0000 @@ -1569,16 +1569,6 @@ sub writer { ######################################################################## ### 6. What the App Shows to Users -sub can_use_stylealwaysmine { - my $u = shift; - my $ret = 0; - - return 0 unless LJ::is_enabled('stylealwaysmine'); - $ret = LJ::run_hook("can_use_stylealwaysmine", $u); - return $ret; -} - - # format unixtimestamp according to the user's timezone setting sub format_time { my $u = shift; @@ -1601,14 +1591,6 @@ sub is_in_beta { sub is_in_beta { my ($u, $key) = @_; return LJ::BetaFeatures->user_in_beta( $u => $key ); -} - - -sub opt_stylealwaysmine { - my $u = shift; - - return 0 unless $u->can_use_stylealwaysmine; - return $u->raw_prop('opt_stylealwaysmine') eq 'Y' ? 1 : 0; } @@ -8116,8 +8098,7 @@ sub make_journal } # style=mine passed in GET? - if ( $remote && ( lc( $geta->{'style'} ) eq 'mine' || - $remote->opt_stylealwaysmine ) ) { + if ( $remote && ( lc( $geta->{'style'} ) eq 'mine' ) ) { # get remote props and decide what style remote uses $remote->preload_props("stylesys", "s2_style"); @@ -8262,8 +8243,7 @@ sub make_journal # if we are in this path, and they have style=mine set, it means # they either think they can get a S2 styled page but their account # type won't let them, or they really want this to fallback to bml - if ($remote && ( $geta->{'style'} eq 'mine' || - $remote->opt_stylealwaysmine ) ) { + if ( $remote && ( $geta->{'style'} eq 'mine' ) ) { $fallback = 'bml'; } diff -r 47d8462593ee -r e8691db15123 cgi-bin/LJ/Widget/StyleAlwaysMine.pm --- a/cgi-bin/LJ/Widget/StyleAlwaysMine.pm Tue Aug 04 19:32:47 2009 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -package LJ::Widget::StyleAlwaysMine; - -use strict; -use base qw(LJ::Widget); -use Carp qw(croak); - -sub need_res { qw( stc/controlstrip-local.css ) } - -sub authas { 1 } - -sub render_body { - my $class = shift; - my %opts = @_; - - my $u = $opts{u}; - return "" unless LJ::isu($u); - - my $ret; - - if ($u->can_use_stylealwaysmine) { - $ret .= $class->start_form( action => "$LJ::SITEROOT/tools/setstylemine.bml", - name => "setstyle_form"); - if ($u->opt_stylealwaysmine) { - $ret .= $class->html_hidden( feature => 'off', user => $u->user ); - $ret .= "<a href='' onclick='document.setstyle_form.submit();return false;'>" . - $class->ml("web.controlstrip.links.styleorigstyle") . - "</a>"; - } else { - $ret .= $class->html_hidden( feature => 'on', user => $u->user ); - $ret .= "<a href='' onclick='document.setstyle_form.submit();return false;'>" . - $class->ml("web.controlstrip.links.stylemystyle") . - "</a>"; - } - $ret .= $class->end_form; - } - - return $ret; -} - -sub handle_post { - my $class = shift; - my $post = shift; - my %opts = @_; - - my $u = LJ::load_user($post->{user}); - die "Invalid user." unless $u; - - $opts{returnto} = $post->{returnto} if $post->{returnto}; - - if ($post->{feature} eq 'on') { - $u->set_prop('opt_stylealwaysmine', 'Y'); - } elsif ($post->{feature} eq 'off') { - $u->set_prop('opt_stylealwaysmine', 'N'); - } - - return; -} - -1; diff -r 47d8462593ee -r e8691db15123 cgi-bin/weblib.pl --- a/cgi-bin/weblib.pl Tue Aug 04 19:32:47 2009 -0500 +++ b/cgi-bin/weblib.pl Wed Aug 05 01:20:45 2009 +0000 @@ -2778,9 +2778,6 @@ sub control_strip $ret .= " "; } - $ret .= LJ::Widget::StyleAlwaysMine->render( u => $remote ) - if ($remote && $remote->{userid} != $journal->{userid}); - $ret .= LJ::run_hook('control_strip_logo', $remote, $journal); $ret .= "</td>"; diff -r 47d8462593ee -r e8691db15123 htdocs/manage/settings/index.bml.text --- a/htdocs/manage/settings/index.bml.text Tue Aug 04 19:32:47 2009 -0500 +++ b/htdocs/manage/settings/index.bml.text Wed Aug 05 01:20:45 2009 +0000 @@ -85,8 +85,6 @@ .fn.searchincl=Search inclusion .fn.public=Publicity - -.fn.stylealwaysmine=Other Journals .fn.viewingadult=Viewing Age Limited Content @@ -181,10 +179,6 @@ as well. .security.visibility.nobody=Nobody -.stylealwaysmine=View all journals and communities in your own style - -.stylealwaysmine.text=When you visit any journal or community, it will be displayed in your own journal style. - .success=You have successfully saved your account settings. .success.header=Success! diff -r 47d8462593ee -r e8691db15123 htdocs/tools/setstylemine.bml --- a/htdocs/tools/setstylemine.bml Tue Aug 04 19:32:47 2009 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -<?page -body<= -<?_code -{ - use strict; - use vars qw(%POST); - - my $returnto = BML::get_client_header('Referer'); - return BML::redirect($returnto) unless LJ::check_form_auth(); - - LJ::Widget->handle_post(\%POST, qw(StyleAlwaysMine), { returnto => \$returnto }); - - return BML::redirect($returnto); - -} -_code?> -<=body -title=><?_code return $title; _code?> -head<= -<?_code return $headextra; _code?> -<=head -page?> --------------------------------------------------------------------------------