Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r16308: LJSV-336 (Error message/system text for ...

Committer: ailyin
LJSV-336 (Error message/system text for custom mood theme creator):

- fix core "extra" image parameter handling
- actually pass class

U   trunk/bin/upgrading/s2layers/core1.s2
U   trunk/cgi-bin/LJ/S2.pm
Modified: trunk/bin/upgrading/s2layers/core1.s2
===================================================================
--- trunk/bin/upgrading/s2layers/core1.s2	2010-03-03 08:16:31 UTC (rev 16307)
+++ trunk/bin/upgrading/s2layers/core1.s2	2010-03-03 09:02:34 UTC (rev 16308)
@@ -1956,9 +1956,17 @@
 }
 
 function Image::as_string(string alttext) [fixed] : string {
+    var string extraParams = "";
+
+    foreach var string extraKey ($.extra) {
+        $extraParams = $extraParams + """$extraKey="$.extra{$extraKey}" """;
+    }
+
+    if ($.height) { $extraParams = $extraParams + """height="$.height" """; }
+    if ($.width)  { $extraParams = $extraParams +  """width="$.width" """; }
+
     return "<img src=\"$.url\" title=\"\" alt=\"" + ehtml($alttext) + "\"" +
-        htmlattr("height", $.height) +
-        htmlattr("width", $.width) + " />";
+        $extraParams + " />";
 }
 
 function Image::as_string() [fixed] : string {

Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm	2010-03-03 08:16:31 UTC (rev 16307)
+++ trunk/cgi-bin/LJ/S2.pm	2010-03-03 09:02:34 UTC (rev 16308)
@@ -1885,12 +1885,14 @@
     if (my $mid = $p->{'current_moodid'}) {
         my $theme = defined $arg->{'moodthemeid'} ? $arg->{'moodthemeid'} : $u->{'moodthemeid'};
         my %pic;
-        $e->{'mood_icon'} = Image($pic{'pic'}, $pic{'w'}, $pic{'h'})
-            if LJ::get_mood_picture($theme, $mid, \%pic);
+        my $img_alt = undef;
         if (my $mood = LJ::mood_name($mid)) {
             my $extra = LJ::run_hook("current_mood_extra", $theme) || "";
+            $img_alt = $mood;
             $e->{'metadata'}->{'mood'} = "$mood$extra";
         }
+        $e->{'mood_icon'} = Image($pic{'pic'}, $pic{'w'}, $pic{'h'}, $img_alt, 'class' => 'meta-mood-img' )
+            if LJ::get_mood_picture($theme, $mid, \%pic);
     }
     if ($p->{'current_mood'}) {
         $e->{'metadata'}->{'mood'} = $p->{'current_mood'};

Tags: andy, livejournal, pm, s2
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