wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r23472: LSS-1: New Style for LJ Shop - Coffee & ...

Committer: wisest-owl
LSS-1: New Style for LJ Shop - Coffee & Camera

U   trunk/cgi-bin/LJ/Customize.pm
U   trunk/cgi-bin/LJ/S2Theme.pm
U   trunk/cgi-bin/LJ/Widget/CurrentTheme.pm
Modified: trunk/cgi-bin/LJ/Customize.pm
===================================================================
--- trunk/cgi-bin/LJ/Customize.pm	2012-12-14 12:35:48 UTC (rev 23471)
+++ trunk/cgi-bin/LJ/Customize.pm	2012-12-14 12:52:48 UTC (rev 23472)
@@ -208,9 +208,9 @@
         }
         $style{'i18nc'} = $i18nc;
         $style{'i18n'} = $i18n;
-        
+
         return \%style if($opts{return});
-        
+
         $class->implicit_style_create($u, %style);
     }
 
@@ -555,7 +555,7 @@
 
         next if $prop_hidden;
 
-        if (LJ::is_enabled("delayed_entries")) { 
+        if (LJ::is_enabled("delayed_entries")) {
             if ($prop->{'name'} eq 'sticky_subject' ||
                 $prop->{'name'} eq 'sticky_post' ) {
                 my $value = $class->get_s2_prop_values('sticky_post', $u, $style);
@@ -656,7 +656,7 @@
 sub get_cats {
     my $class = shift;
     my $u = shift;
- 
+
     my %purchased = $LJ::DISABLED{'lj_shop_styles'} ? () : (
         purchased => {
             text => LJ::Lang::ml('customize.cats.purchased'),
@@ -753,9 +753,9 @@
             text => LJ::Lang::ml('customize.cats.sports'),
         },
     );
-    
+
     LJ::run_hooks("modify_cat_list", \@categories, user => $u,);
-    
+
     return @categories;
 }
 

Modified: trunk/cgi-bin/LJ/S2Theme.pm
===================================================================
--- trunk/cgi-bin/LJ/S2Theme.pm	2012-12-14 12:35:48 UTC (rev 23471)
+++ trunk/cgi-bin/LJ/S2Theme.pm	2012-12-14 12:52:48 UTC (rev 23472)
@@ -523,13 +523,13 @@
     ## system styles
     ##
     ## Note: if you want to override url of preview image of system style,
-    ## don't use 'preview_imgurl' S2 property of theme, override method 
+    ## don't use 'preview_imgurl' S2 property of theme, override method
     ## in subclass (LJ::S2Theme::*) instead.
     ##
     if (my $uniq = $self->uniq) {
         return "$LJ::IMGPREFIX/customize/previews/$uniq.png";
     }
-    
+
     ## custom styles with defined preview image
     my %info;
     LJ::S2::load_layer_info(\%info, [ $self->{s2lid} ]);
@@ -537,12 +537,12 @@
         $url = "$LJ::IMGPREFIX/$url" unless $url =~ /^http/i;
         return LJ::ehtml($url);
     }
-    
+
     ## default "custom layer" icon
     return "$LJ::IMGPREFIX/customize/previews/custom-layer.png?v=12565";
 }
 
-    
+
 sub available_to {
     my $self = shift;
     my $u = shift;
@@ -680,7 +680,8 @@
 # Methods that get overridden by child packages
 ##################################################
 
-sub cats { () } # categories that the theme is in
+## sub cats defined below in code
+#sub cats { () } # categories that the theme is in
 sub layouts { ( "1" => 1 ) } # theme layout/sidebar placement options ( layout type => property value or 1 if no property )
 sub layout_prop { "" } # property that controls the layout/sidebar placement
 sub show_sidebar_prop { "" } # property that controls whether a sidebar shows or not
@@ -744,6 +745,27 @@
 sub setup_props { () }
 sub ordering_props { () }
 sub custom_props { () }
-sub is_buyable { 0 }
 
+sub is_buyable {
+    my $self = shift;
+
+    my $theme = LJ::Pay::Theme->load_by_s2lid ($self->s2lid);
+    return 1 if $theme;
+
+    return 0;
+}
+
+sub cats {
+    my $self = shift;
+
+    return () if UNIVERSAL::can($self, 'cats') == \&cats;
+
+    my $theme = LJ::Pay::Theme->load_by_s2lid ($self->s2lid);
+
+    return $self->cats (@_) unless $theme;
+
+    return @{$theme->get_cats};
+}
+
 1;
+

Modified: trunk/cgi-bin/LJ/Widget/CurrentTheme.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/CurrentTheme.pm	2012-12-14 12:35:48 UTC (rev 23471)
+++ trunk/cgi-bin/LJ/Widget/CurrentTheme.pm	2012-12-14 12:52:48 UTC (rev 23472)
@@ -4,6 +4,7 @@
 use base qw(LJ::Widget);
 use Carp qw(croak);
 use Class::Autouse qw( LJ::Customize );
+use LJ::Pay::Theme;
 
 sub ajax { 1 }
 sub authas { 1 }

Tags: livejournal, pm, wisest-owl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments