fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-06-28 11:24 am

[dw-free] replace ljmood.pl with DW::Mood.pm

[commit: http://hg.dwscoalition.org/dw-free/rev/b2eaddd6eb1e]

http://bugs.dwscoalition.org/show_bug.cgi?id=2690

More cleanup: use $u->moodtheme, instead of $u->{moodthemeid}

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/S2.pm
  • htdocs/manage/moodthemes.bml
  • htdocs/preview/entry.bml
  • htdocs/talkpost.bml
  • htdocs/talkread.bml
--------------------------------------------------------------------------------
diff -r 55b70d4d9440 -r b2eaddd6eb1e cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Mon Jun 28 19:21:39 2010 +0800
+++ b/cgi-bin/LJ/S2.pm	Mon Jun 28 19:30:19 2010 +0800
@@ -2002,7 +2002,7 @@ sub Entry_from_entryobj
 
     # override used moodtheme if necessary
     my $moodthemeid = $u->prop( 'opt_forcemoodtheme' ) eq 'Y' ?
-        $u->{moodthemeid} : $poster->{moodthemeid};
+        $u->moodtheme : $poster->moodtheme;
 
     # tags loading and sorting
     my $tags = LJ::Tags::get_logtags( $journal, $jitemid );
diff -r 55b70d4d9440 -r b2eaddd6eb1e htdocs/manage/moodthemes.bml
--- a/htdocs/manage/moodthemes.bml	Mon Jun 28 19:21:39 2010 +0800
+++ b/htdocs/manage/moodthemes.bml	Mon Jun 28 19:30:19 2010 +0800
@@ -445,7 +445,7 @@ body<=
                     my $tobj = DW::Mood->new( $tid );
 
                     my $use_dis = 0;
-                    if ($tid == $u->{'moodthemeid'}) {
+                    if ( $tid == $u->moodtheme ) {
                         $ret .= "<tr><td><b><a href='/moodlist?moodtheme=$tid&ownerid=$u->{'userid'}'>$ename</a></b></td>";
                         $use_dis = 1;
                     } else {
diff -r 55b70d4d9440 -r b2eaddd6eb1e htdocs/preview/entry.bml
--- a/htdocs/preview/entry.bml	Mon Jun 28 19:21:39 2010 +0800
+++ b/htdocs/preview/entry.bml	Mon Jun 28 19:30:19 2010 +0800
@@ -150,7 +150,6 @@ _c?>
         ## dump the log entry, unless we're browsing a thread.
         my %current;
         if ($req{'prop_current_mood'} || $req{'prop_current_moodid'}) {
-            my $themeid = $up->{'moodthemeid'};
             my $moodid = $req{'prop_current_moodid'};
             my $mood = $req{'prop_current_mood'};
 
@@ -165,6 +164,7 @@ _c?>
 
             if ( my $val = $moodid ) {
                 $moodname ||= DW::Mood->mood_name( $val );
+                my $themeid = $up ? $up->moodtheme : undef;
                 my $theme = DW::Mood->new( $themeid );
                 my %pic;
                 if ( $theme && $theme->get_picture( $val, \%pic ) ) {
diff -r 55b70d4d9440 -r b2eaddd6eb1e htdocs/talkpost.bml
--- a/htdocs/talkpost.bml	Mon Jun 28 19:21:39 2010 +0800
+++ b/htdocs/talkpost.bml	Mon Jun 28 19:30:19 2010 +0800
@@ -277,8 +277,6 @@ body<=
 
     my %current;
     if ($props->{'current_mood'} || $props->{'current_moodid'}) {
-
-        my $themeid = $up->{'moodthemeid'};
         my $moodid = $props->{'current_moodid'};
         my $mood = $props->{'current_mood'};
 
@@ -293,6 +291,7 @@ body<=
 
         if ( my $val = $moodid ) {
             $moodname ||= DW::Mood->mood_name( $val );
+            my $themeid = $up ? $up->moodtheme : undef;
             my $theme = DW::Mood->new( $themeid );
             my %pic;
             if ( $theme && $theme->get_picture( $val, \%pic ) ) {
diff -r 55b70d4d9440 -r b2eaddd6eb1e htdocs/talkread.bml
--- a/htdocs/talkread.bml	Mon Jun 28 19:21:39 2010 +0800
+++ b/htdocs/talkread.bml	Mon Jun 28 19:30:19 2010 +0800
@@ -308,7 +308,6 @@ body<=
     ## dump the log entry, unless we're browsing a thread.
     my %current;
     if ($props->{'current_mood'} || $props->{'current_moodid'}) {
-        my $themeid = $up->{'moodthemeid'};
         my $moodid = $props->{'current_moodid'};
         my $mood = $props->{'current_mood'};
 
@@ -323,6 +322,7 @@ body<=
 
         if ( my $val = $moodid ) {
             $moodname ||= DW::Mood->mood_name( $val );
+            my $themeid = $up ? $up->moodtheme : undef;
             my $theme = DW::Mood->new( $themeid );
             my %pic;
             if ( $theme && $theme->get_picture( $val, \%pic ) ) {
--------------------------------------------------------------------------------