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-29 06:07 pm

[dw-free] ?mode=reply form doesn't have the icon browser

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

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

Add the icon browser to the full reply page, if the user is allowed to use
this feature.

Patch by [personal profile] cesy.

Files modified:
  • cgi-bin/LJ/S2/ReplyPage.pm
  • cgi-bin/LJ/Talk.pm
  • htdocs/talkpost.bml
  • htdocs/talkpost_do.bml
--------------------------------------------------------------------------------
diff -r e460b0827d43 -r 99ed26f60316 cgi-bin/LJ/S2/ReplyPage.pm
--- a/cgi-bin/LJ/S2/ReplyPage.pm	Tue Jun 29 11:34:56 2010 -0500
+++ b/cgi-bin/LJ/S2/ReplyPage.pm	Wed Jun 30 02:12:57 2010 +0800
@@ -63,6 +63,23 @@ sub ReplyPage
     $p->{'head_content'} .= $LJ::COMMON_CODE{'chalresp_js'};
 
     LJ::need_res('stc/display_none.css');
+    
+    # libs for userpicselect
+    LJ::need_res(qw(
+                    js/core.js
+                    js/dom.js
+                    js/json.js
+                    js/template.js
+                    js/ippu.js
+                    js/lj_ippu.js
+                    js/userpicselect.js
+                    js/httpreq.js
+                    js/hourglass.js
+                    js/inputcomplete.js
+                    stc/ups.css
+                    js/datasource.js
+                    js/selectable_table.js
+                    )) if LJ::is_enabled('userpicselect') && $remote && $remote->can_use_userpic_select;
 
     if ($u->should_block_robots || $entry->should_block_robots) {
         $p->{'head_content'} .= LJ::robot_meta_tags();
diff -r e460b0827d43 -r 99ed26f60316 cgi-bin/LJ/Talk.pm
--- a/cgi-bin/LJ/Talk.pm	Tue Jun 29 11:34:56 2010 -0500
+++ b/cgi-bin/LJ/Talk.pm	Wed Jun 30 02:12:57 2010 +0800
@@ -1734,9 +1734,46 @@ sub talkform {
         }
         @pics = sort { lc($a) cmp lc($b) } @pics;
         $ret .= LJ::html_select({'name' => 'prop_picture_keyword',
-                                 'selected' => $form->{'prop_picture_keyword'}, },
+                                 'selected' => $form->{'prop_picture_keyword'}, 'id' => 'prop_picture_keyword'},
                                 ("", $BML::ML{'.opt.defpic'}, map { ($_, $_) } @pics));
 
+        # userpic browse button
+        $ret .= qq {
+            <input type="button" id="lj_userpicselect" value="Browse" />
+
+            <script type="text/javascript" language="JavaScript">
+            DOM.addEventListener(window, "load", function (evt) {
+                // attach userpicselect code to userpicbrowse button
+                var ups_btn = \$("lj_userpicselect");
+                if (ups_btn) {
+                    DOM.addEventListener(ups_btn, "click", function (evt) {
+                     var ups = new UserpicSelect();
+                     ups.init();
+                     ups.setPicSelectedCallback(function (picid, keywords) {
+                         var kws_dropdown = \$("prop_picture_keyword");
+
+                         if (kws_dropdown) {
+                             var items = kws_dropdown.options;
+
+                             // select the keyword in the dropdown
+                             keywords.forEach(function (kw) {
+                                 for (var i = 0; i < items.length; i++) {
+                                     var item = items[i];
+                                     if (item.value == kw) {
+                                         kws_dropdown.selectedIndex = i;
+                                         return;
+                                     }
+                                 }
+                             });
+                         }
+                     });
+                     ups.show();
+                 });
+                }
+            });
+            </script>
+        } if LJ::is_enabled('userpicselect') && $remote && $remote->can_use_userpic_select;
+                
         $ret .= LJ::help_icon_html("userpics", " ");
     }
 
diff -r e460b0827d43 -r 99ed26f60316 htdocs/talkpost.bml
--- a/htdocs/talkpost.bml	Tue Jun 29 11:34:56 2010 -0500
+++ b/htdocs/talkpost.bml	Wed Jun 30 02:12:57 2010 +0800
@@ -27,6 +27,23 @@ body<=
 
     my $remote = LJ::get_remote();
     my $errtxt;
+
+    # libs for userpicselect
+    LJ::need_res(qw(
+                    js/core.js
+                    js/dom.js
+                    js/json.js
+                    js/template.js
+                    js/ippu.js
+                    js/lj_ippu.js
+                    js/userpicselect.js
+                    js/httpreq.js
+                    js/hourglass.js
+                    js/inputcomplete.js
+                    stc/ups.css
+                    js/datasource.js
+                    js/selectable_table.js
+                    )) if LJ::is_enabled('userpicselect') && $remote && $remote->can_use_userpic_select;
 
     my $pics = LJ::Talk::get_subjecticons();
 
diff -r e460b0827d43 -r 99ed26f60316 htdocs/talkpost_do.bml
--- a/htdocs/talkpost_do.bml	Tue Jun 29 11:34:56 2010 -0500
+++ b/htdocs/talkpost_do.bml	Wed Jun 30 02:12:57 2010 +0800
@@ -44,8 +44,6 @@ body<=
     }
 
     return LJ::server_down_html() if $LJ::SERVER_DOWN;
-
-    LJ::need_res('stc/display_none.css');
 
     my $editid = $POST{editid};
 
@@ -118,6 +116,24 @@ body<=
     my $remote = LJ::get_remote();
     my $journalu = LJ::load_user($POST{journal});
     return LJ::bad_input('Unknown journal.  Please go back and try again.') unless $journalu;
+
+    LJ::need_res('stc/display_none.css');
+    # libs for userpicselect
+    LJ::need_res(qw(
+                    js/core.js
+                    js/dom.js
+                    js/json.js
+                    js/template.js
+                    js/ippu.js
+                    js/lj_ippu.js
+                    js/userpicselect.js
+                    js/httpreq.js
+                    js/hourglass.js
+                    js/inputcomplete.js
+                    stc/ups.css
+                    js/datasource.js
+                    js/selectable_table.js
+                    )) if LJ::is_enabled('userpicselect') && $remote && $remote->can_use_userpic_select;
 
     # FIXME: this isn't entirely correct, if ecphash is present but ignored/incorrect
     # that fix would need to be done in talklib.pl
--------------------------------------------------------------------------------