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

[livejournal] r17349: LJSUP-6573 (Add ability to select pictur...

Committer: ailyin
LJSUP-6573 (Add ability to select pictures for Facebook publishing)
U   trunk/cgi-bin/LJ/Talk.pm
U   trunk/cgi-bin/weblib.pl
U   trunk/templates/CommentForm/Form.tmpl
Modified: trunk/cgi-bin/LJ/Talk.pm
===================================================================
--- trunk/cgi-bin/LJ/Talk.pm	2010-09-10 09:12:56 UTC (rev 17348)
+++ trunk/cgi-bin/LJ/Talk.pm	2010-09-10 09:27:34 UTC (rev 17349)
@@ -1569,13 +1569,14 @@
                 "ver"       => ( $LJ::UNICODE ? "1" : "0" ),
                 "user"      => $remote->{'user'},
                 "getpickws" => 1,
+                'getpickwurls' => 1,
             },
             \%res,
             { "noauth" => 1, "userid" => $remote->{'userid'} }
         );
     }
 
-    my ( $show_userpics, @pics_display );
+    my ( $show_userpics, @pics_display, %userpicmap );
     if ( $res{'pickw_count'} ) {
         $show_userpics = 1;
 
@@ -1598,6 +1599,10 @@
                     $form->{'prop_picture_keyword'},
                 };
         }
+
+        foreach my $i (1 .. $res{'pickw_count'}) {
+            $userpicmap{$res{"pickw_$i"}} = $res{"pickwurl_$i"};
+        }
     }
 
     # only show on initial compostion
@@ -1765,6 +1770,7 @@
         'opt_preformatted_selected' => $form->{'prop_opt_preformatted'},
         'show_userpics'             => $show_userpics,
         'userpics'                  => \@pics_display,
+        'userpicmap'                => LJ::JSON->to_json(\%userpicmap),
         'subjicon_types'            => \@subjicon_types,
         'text_hint'                 => $opts->{'text_hint'},
         'create_link'               => $create_link,

Modified: trunk/cgi-bin/weblib.pl
===================================================================
--- trunk/cgi-bin/weblib.pl	2010-09-10 09:12:56 UTC (rev 17348)
+++ trunk/cgi-bin/weblib.pl	2010-09-10 09:27:34 UTC (rev 17349)
@@ -704,13 +704,16 @@
     $qrhtml .= LJ::ljuser($remote->{'user'});
     $qrhtml .= "</td><td align='center'>";
 
+    my %userpicmap;
+
     # Userpic selector
     {
         my %res;
         LJ::do_request({ "mode" => "login",
                          "ver" => ($LJ::UNICODE ? "1" : "0"),
                          "user" => $remote->{'user'},
-                         "getpickws" => 1, },
+                         "getpickws" => 1,
+                         'getpickwurls' => 1, },
                        \%res, { "noauth" => 1, "userid" => $remote->{'userid'}}
                        );
 
@@ -733,6 +736,10 @@
                 } unless $LJ::DISABLED{userpicselect} || ! $remote->get_cap('userpicselect');
 
             $qrhtml .= LJ::help_icon_html("userpics", " ");
+
+            foreach my $i (1 .. $res{'pickw_count'}) {
+                $userpicmap{$res{"pickw_$i"}} = $res{"pickwurl_$i"};
+            }
         }
     }
 
@@ -804,7 +811,9 @@
                                       {'name' => 'saved_ptid', 'id' => 'saved_ptid'},
                                       ));
 
+    my $userpicmap = LJ::JSON->to_json(\%userpicmap);
     $ret .= qq{
+               var userpicmap = $userpicmap;
                document.write("$qrsaveform");
                var de = document.createElement('div');
                de.id = 'qrdiv';

Modified: trunk/templates/CommentForm/Form.tmpl
===================================================================
--- trunk/templates/CommentForm/Form.tmpl	2010-09-10 09:12:56 UTC (rev 17348)
+++ trunk/templates/CommentForm/Form.tmpl	2010-09-10 09:27:34 UTC (rev 17349)
@@ -100,6 +100,9 @@
 
         <div id='userpics'>
             <TMPL_IF show_userpics>
+                <script type="text/javascript">
+                    var userpicmap=<TMPL_VAR userpicmap>;
+                </script>
                 <TMPL_VAR ml_picturetouse>
                 <select name="prop_picture_keyword">
                     <TMPL_LOOP userpics>

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