Типа я (zilogic) wrote in changelog,
Типа я
zilogic
changelog

[livejournal] r21679: LJSUP-11751: Incorrect look Trava widget...

Committer: amyshkin
LJSUP-11751: Incorrect look Trava widget in some style
U   trunk/cgi-bin/LJ/S2/EntryPage.pm
U   trunk/cgi-bin/LJ/S2.pm
U   trunk/cgi-bin/cleanhtml.pl
U   trunk/cgi-bin/ljviews.pl
U   trunk/htdocs/community/moderate.bml
U   trunk/htdocs/preview/entry.bml
U   trunk/htdocs/talkpost.bml
U   trunk/htdocs/talkread.bml
Modified: trunk/cgi-bin/LJ/S2/EntryPage.pm
===================================================================
--- trunk/cgi-bin/LJ/S2/EntryPage.pm	2012-04-09 12:04:02 UTC (rev 21678)
+++ trunk/cgi-bin/LJ/S2/EntryPage.pm	2012-04-09 13:55:13 UTC (rev 21679)
@@ -40,8 +40,8 @@
 
     $p->{'page_id'} = 'journal-' . $u->username . '-' . $entry->ditemid;
     $p->{'multiform_on'} = $entry->comments_manageable_by($remote);
-    
-    my $itemid = $entry->jitemid;
+
+    my $itemid    = $entry->jitemid;
     my $permalink = $entry->url;
     my $stylemine = $get->{'style'} eq "mine" ? "style=mine" : "";
     my $style_set = defined $get->{'s2id'} ? "s2id=" . int( $get->{'s2id'} ) : "";
@@ -52,69 +52,71 @@
 
     # quickreply js libs
     LJ::need_res(qw(
-                    js/basic.js
-                    js/json.js
-                    js/template.js
-                    js/ippu.js
-                    js/lj_ippu.js
-                    js/userpicselect.js
-                    js/hourglass.js
-                    js/inputcomplete.js
-                    stc/ups.css
-                    stc/lj_base.css
-                    js/datasource.js
-                    js/selectable_table.js
-                    )) if ! $LJ::DISABLED{userpicselect} && $remote && $remote->get_cap('userpicselect');
+        js/basic.js
+        js/json.js
+        js/template.js
+        js/ippu.js
+        js/lj_ippu.js
+        js/userpicselect.js
+        js/hourglass.js
+        js/inputcomplete.js
+        stc/ups.css
+        stc/lj_base.css
+        js/datasource.js
+        js/selectable_table.js
+    )) if ! $LJ::DISABLED{userpicselect} && $remote && $remote->get_cap('userpicselect');
 
     LJ::need_res(qw(
-                    js/quickreply.js
-                    js/md5.js
-                    js/thread_expander.js
-                    js/thread_expander.ex.js
-                    ));
+        js/quickreply.js
+        js/md5.js
+        js/thread_expander.js
+        js/thread_expander.ex.js
+    ));
 
     if($remote) {
-        LJ::need_string(qw/ 
-                            comment.cancel
-                            comment.delete
-                            comment.delete.q
-                            comment.delete.all
-                            comment.delete.all.my
-                            comment.delete.all.sub
-                            comment.delete.no.options
-                            comment.ban.user
-                            comment.mark.spam
-                            comment.mark.spam.title
-                            comment.mark.spam.subject
-                            comment.mark.spam.button
-                            comment.mark.spam2
-                            comment.mark.spam2.title
-                            comment.mark.spam2.subject
-                            comment.mark.spam2.button
-                            comment.delete/)
+        LJ::need_string(qw(
+            comment.cancel
+            comment.delete
+            comment.delete.q
+            comment.delete.all
+            comment.delete.all.my
+            comment.delete.all.sub
+            comment.delete.no.options
+            comment.ban.user
+            comment.mark.spam
+            comment.mark.spam.title
+            comment.mark.spam.subject
+            comment.mark.spam.button
+            comment.mark.spam2
+            comment.mark.spam2.title
+            comment.mark.spam2.subject
+            comment.mark.spam2.button
+            comment.delete/
+        ));
     }
 
     $p->{'entry'} = $s2entry;
     LJ::run_hook('notify_event_displayed', $entry);
 
     # add the comments
-    my $view_arg = $get->{'view'} || "";
+    my $view_arg  = $get->{'view'} || "";
     my $flat_mode = ($view_arg =~ /\bflat\b/);
-    my $view_num = ($view_arg =~ /(\d+)/) ? $1 : undef;
+    my $view_num  = ($view_arg =~ /(\d+)/) ? $1 : undef;
 
     my %userpic;
     my %user;
     my $copts = {
-        'flat' => $flat_mode,
-        'thread' => int($get->{'thread'} / 256),
-        'page' => $get->{'page'},
-        'view' => $view_num,
+        'flat'       => $flat_mode,
+        'thread'     => int($get->{'thread'} / 256),
+        'page'       => $get->{'page'},
+        'view'       => $view_num,
         'userpicref' => \%userpic,
-        'userref' => \%user,
+        'userref'    => \%user,
+
         # user object is cached from call just made in EntryPage_entry
-        'up' => LJ::load_user($s2entry->{'poster'}->{'username'}),
-        'viewall' => $viewall,
-        'expand_all' => $opts->{expand_all},
+        'up'          => LJ::load_user($s2entry->{'poster'}->{'username'}),
+        'viewall'     => $viewall,
+        'expand_all'  => $opts->{expand_all},
         'init_comobj' => 0,
         'showspam'    => $p->{'showspam'} && !$get->{from_rpc},
     };
@@ -588,25 +590,27 @@
     }
 
     my $s2entry = Entry($u, {
-        'subject' => $subject,
-        'text' => $event,
-        'dateparts' => $entry->is_delayed ? $entry->alldatepart :
-                    LJ::TimeUtil->alldatepart_s2($entry->eventtime_mysql),
-        'system_dateparts' => $entry->is_delayed ? $entry->system_alldatepart :
-                    LJ::TimeUtil->alldatepart_s2($entry->logtime_mysql),
-        'security' => $entry->security,
-        'allowmask' => $entry->allowmask,
-        'props' => $entry->props,
-        'itemid' => $ditemid,
-        'delayedid' => $entry->is_delayed ? $entry->delayedid : undef ,
-        'comments' => $comments,
-        'journal' => $userlite_journal,
-        'poster' => $userlite_poster,
-        'tags' => \@taglist,
-        'new_day' => 0,
-        'end_day' => 0,
-        'userpic' => $userpic,
-        'permalink_url' => $permalink,
+        'subject'          => $subject,
+        'text'             => $event,
+        'dateparts'        => $entry->is_delayed
+                              ? $entry->alldatepart
+                              : LJ::TimeUtil->alldatepart_s2($entry->eventtime_mysql),
+        'system_dateparts' => $entry->is_delayed
+                              ? $entry->system_alldatepart
+                              : LJ::TimeUtil->alldatepart_s2($entry->logtime_mysql),
+        'security'         => $entry->security,
+        'allowmask'        => $entry->allowmask,
+        'props'            => $entry->props,
+        'itemid'           => $ditemid,
+        'delayedid'        => $entry->is_delayed ? $entry->delayedid : undef ,
+        'comments'         => $comments,
+        'journal'          => $userlite_journal,
+        'poster'           => $userlite_poster,
+        'tags'             => \@taglist,
+        'new_day'          => 0,
+        'end_day'          => 0,
+        'userpic'          => $userpic,
+        'permalink_url'    => $permalink,
     });
 
     return ($entry, $s2entry);

Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm	2012-04-09 12:04:02 UTC (rev 21678)
+++ trunk/cgi-bin/LJ/S2.pm	2012-04-09 13:55:13 UTC (rev 21679)
@@ -248,8 +248,8 @@
 
     if ($ctype =~ m!^text/html!) {
         $cleaner = HTMLCleaner->new(
-                                    'output' => $cleaner_output,
-                                    'valid_stylesheet' => \&LJ::valid_stylesheet_url,
+            'output'           => $cleaner_output,
+            'valid_stylesheet' => \&LJ::valid_stylesheet_url,
                                     );
     }
 
@@ -265,23 +265,27 @@
     my $print_ctr = 0;  # every 'n' prints we check the recursion depth
 
     my $out_straight = sub {
+        my ( $text ) = @_;
         # Hacky: forces text flush.  see:
         # http://zilla.livejournal.org/906
         if ($need_flush) {
             $cleaner->parse("<!-- -->");
             $need_flush = 0;
         }
-        $$LJ::S2::ret_ref .= $_[0];
+
+        LJ::Setting::Music::expand_ljmusic_tag(\$text);
+        $$LJ::S2::ret_ref .= $text;
         S2::check_depth() if ++$print_ctr % 8 == 0;
     };
+
     my $out_clean = sub {
-        my $text = shift;
-
+        my ( $text ) = @_;
         $cleaner->parse($text);
-
+        LJ::Setting::Music::expand_ljmusic_tag($LJ::S2::ret_ref);
         $need_flush = 1;
         S2::check_depth() if ++$print_ctr % 8 == 0;
     };
+
     S2::set_output($out_straight);
     S2::set_output_safe($cleaner ? $out_clean : $out_straight);
 
@@ -1984,7 +1988,6 @@
 
     my $p = $arg->{'props'};
     if ($p->{'current_music'}) {
-        LJ::CleanHTML::clean_subject(\$e->{'metadata'}->{'music'});
         $e->{'metadata'}->{'music'} = LJ::Setting::Music::format_current_music_string($p->{'current_music'});
     }
     if (my $mid = $p->{'current_moodid'}) {

Modified: trunk/cgi-bin/cleanhtml.pl
===================================================================
--- trunk/cgi-bin/cleanhtml.pl	2012-04-09 12:04:02 UTC (rev 21678)
+++ trunk/cgi-bin/cleanhtml.pl	2012-04-09 13:55:13 UTC (rev 21679)
@@ -444,6 +444,12 @@
                 next TOKEN;
             }
 
+            if ( $tag eq 'lj-music' ) {
+                $newdata .= LJ::Setting::Music::format_ljmusic( $attr->{'provider'}, $attr->{'id'} );
+
+                next TOKEN;
+            }
+
             ## lj-userpic:
             ##      <lj-userpic> - current journal's default userpic
             ##      <lj-userpic remote> - remote user's default userpic
@@ -1922,14 +1928,14 @@
     my $opts = shift || {};
 
     clean($ref, {
-        'wordlength' => 40,
-        'addbreaks' => 0,
-        'eat' => $subject_eat,
-        'mode' => 'deny',
-        'allow' => $subject_allow,
-        'remove' => $subject_remove,
-        'autoclose' => $subject_allow,
-        'noearlyclose' => 1,
+        'wordlength'     => 40,
+        'addbreaks'      => 0,
+        'eat'            => $subject_eat,
+        'mode'           => 'deny',
+        'allow'          => $subject_allow,
+        'remove'         => $subject_remove,
+        'autoclose'      => $subject_allow,
+        'noearlyclose'   => 1,
         'remove_attribs' => [qw/id class style/],
         %$opts,
     });

Modified: trunk/cgi-bin/ljviews.pl
===================================================================
--- trunk/cgi-bin/ljviews.pl	2012-04-09 12:04:02 UTC (rev 21678)
+++ trunk/cgi-bin/ljviews.pl	2012-04-09 13:55:13 UTC (rev 21679)
@@ -1002,8 +1002,8 @@
 
 sub current_music_str {
     my $val = shift;
+    $val = LJ::Setting::Music::format_current_music_string($val);
     LJ::CleanHTML::clean_subject(\$val);
-    $val = LJ::Setting::Music::format_current_music_string($val);
     return $val;
 }
 

Modified: trunk/htdocs/community/moderate.bml
===================================================================
--- trunk/htdocs/community/moderate.bml	2012-04-09 12:04:02 UTC (rev 21678)
+++ trunk/htdocs/community/moderate.bml	2012-04-09 13:55:13 UTC (rev 21679)
@@ -9,7 +9,8 @@
     LJ::set_active_crumb('moderate');
     return LJ::server_down_html() if ($LJ::SERVER_DOWN);
     use Class::Autouse qw (LJ::Poll);
- 
+    use LJ::Setting::Music;
+
     LJ::need_res(qw(
                     stc/widgets/selecttags.css
                     js/widget_ippu/selecttags.js
@@ -550,7 +551,7 @@
             }
         }
         if ($props->{'current_music'}) {
-            $current{'Music'} = $props->{'current_music'};
+            $current{'Music'} = LJ::Setting::Music::format_current_music_string($props->{'current_music'});
             LJ::CleanHTML::clean_subject(\$current{'Music'});
         }
         # tags manage permissions should be checked here too

Modified: trunk/htdocs/preview/entry.bml
===================================================================
--- trunk/htdocs/preview/entry.bml	2012-04-09 12:04:02 UTC (rev 21678)
+++ trunk/htdocs/preview/entry.bml	2012-04-09 13:55:13 UTC (rev 21679)
@@ -1,6 +1,7 @@
 <?_code
 {
     use strict;
+    use LJ::Setting::Music;
 
     my $delayed_id = $POST{'delayed_id'} || LJ::Request->notes('delayed_id');
     if (!(LJ::did_post() || $delayed_id)) {
@@ -190,7 +191,7 @@
             $current{'Mood'} = "$moodpic$moodname";
         }
         if ($req{'prop_current_music'}) {
-            $current{'Music'} = $req{'prop_current_music'};
+            $current{'Music'} = LJ::Setting::Music::format_current_music_string($req{'prop_current_music'});
             LJ::CleanHTML::clean_subject(\$current{'Music'});
         }
 

Modified: trunk/htdocs/talkpost.bml
===================================================================
--- trunk/htdocs/talkpost.bml	2012-04-09 12:04:02 UTC (rev 21678)
+++ trunk/htdocs/talkpost.bml	2012-04-09 13:55:13 UTC (rev 21679)
@@ -348,8 +348,8 @@
         $current{'Mood'} = "$moodpic$moodname";
     }
     if ($props->{'current_music'}) {
+        $current{'Music'} = LJ::Setting::Music::format_current_music_string($props->{'current_music'});
         LJ::CleanHTML::clean_subject(\$current{'Music'});
-        $current{'Music'} = LJ::Setting::Music::format_current_music_string($props->{'current_music'});
     }
 
     if ($props->{'current_location'} || $props->{'current_coords'}) {

Modified: trunk/htdocs/talkread.bml
===================================================================
--- trunk/htdocs/talkread.bml	2012-04-09 12:04:02 UTC (rev 21678)
+++ trunk/htdocs/talkread.bml	2012-04-09 13:55:13 UTC (rev 21679)
@@ -410,7 +410,7 @@
     }
 
     if ($props->{'current_music'}) {
-        $current{'Music'} = $props->{'current_music'};
+        $current{'Music'} = LJ::Setting::Music::format_current_music_string($props->{'current_music'});
         LJ::CleanHTML::clean_subject(\$current{'Music'});
     }
 
@@ -456,12 +456,7 @@
             $curname = "<b>Current $_:</b>" unless $curname;
 
             $ret .= "<tr><td align=right>$curname</td>";
-
-            if ($_ eq 'Music') {
-                $ret .= "<td>" . LJ::Setting::Music::format_current_music_string($current{$_}) . "</td></tr>\n";
-            } else {
-                $ret .= "<td>$current{$_}</td></tr>\n";
-            }
+            $ret .= "<td>$current{$_}</td></tr>\n";
         }
         $ret .= "</table><p>\n";
     }

Tags: amyshkin, bml, livejournal, pl, pm, zilogic
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