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

[dw-free] Investigate using cgi-bin/imageconf.pl instead of scattering image URLs all over the place

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

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

Refactoring of images for htdocs.

Patch by [personal profile] kareila.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/imageconf.pl
  • htdocs/directory.bml
  • htdocs/directory.bml.text
  • htdocs/feeds/list.bml
  • htdocs/manage/circle/edit.bml
  • htdocs/manage/circle/edit.bml.text
  • htdocs/manage/subscriptions/filters.bml
  • htdocs/profile.bml
  • htdocs/search.bml
  • htdocs/view/index.bml
--------------------------------------------------------------------------------
diff -r 9380b580348a -r 888c1e9c65fb bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Thu Jul 08 15:00:02 2010 +0800
+++ b/bin/upgrading/en.dat	Thu Jul 08 15:05:09 2010 +0800
@@ -1983,6 +1983,10 @@ fcklang.videoprompt=Please enter the You
 
 help=Help
 
+img.arrow-down=Open
+
+img.arrow-right=Closed
+
 img.atom=Atom
 
 img.btn_del=Delete
@@ -1991,6 +1995,10 @@ img.btn_down=Down
 
 img.btn_freeze=Freeze
 
+img.btn_next=Next
+
+img.btn_prev=Previous
+
 img.btn_scr=Screen
 
 img.btn_unfreeze=Unfreeze
@@ -1999,6 +2007,10 @@ img.btn_unscr=Unscreen
 
 img.btn_up=Up
 
+img.circle_no=No
+
+img.circle_yes=Yes
+
 img.editcomment=Edit
 
 img.editentry=Edit Entry
@@ -2007,8 +2019,12 @@ img.edittags=Edit Tags
 
 img.foaf=FOAF
 
+img.hourglass=Waiting...
+
 img.ins_obj=Insert Image/Object
 
+img.key=View public key
+
 img.memadd=Add to memories!
 
 img.next_entry=Next Entry
@@ -2019,6 +2035,8 @@ img.prev_entry=Previous Entry
 
 img.rss=RSS
 
+img.searchdots=...
+
 img.tellfriend=Tell a Friend!
 
 img.track=Track This
@@ -2028,6 +2046,8 @@ img.track_thread_active=Track This
 img.track_thread_active=Track This
 
 img.untrack=Untrack This
+
+img.us_map=US Map
 
 img.xml=XML Source
 
diff -r 9380b580348a -r 888c1e9c65fb cgi-bin/imageconf.pl
--- a/cgi-bin/imageconf.pl	Thu Jul 08 15:00:02 2010 +0800
+++ b/cgi-bin/imageconf.pl	Thu Jul 08 15:05:09 2010 +0800
@@ -36,6 +36,20 @@ use vars qw(%img);
     width => 22,
     height => 20,
     alt => 'img.btn_down',
+};
+
+$img{btn_next} = {
+    src => '/btn_next.gif',
+    width => 22,
+    height => 20,
+    alt => 'img.btn_next',
+};
+
+$img{btn_prev} = {
+    src => '/btn_prev.gif',
+    width => 22,
+    height => 20,
+    alt => 'img.btn_prev',
 };
 
 $img{btn_del} = {
@@ -185,6 +199,62 @@ use vars qw(%img);
     alt => 'img.rss',
 };
 
+$img{key} = {
+    src => '/key.gif',
+    width => 16,
+    height => 16,
+    alt => 'img.key',
+};
+
+$img{hourglass} = {
+    src => '/hourglass.gif',
+    width => 17,
+    height => 17,
+    alt => 'img.hourglass',
+};
+
+$img{searchdots} = {
+    src => '/searchingdots.gif',
+    width => 18,
+    height => 12,
+    alt => 'img.searchdots',
+};
+
+$img{us_map} = {
+    src => '/us_map.gif',
+    width => 489,
+    height => 315,
+    alt => 'img.us_map',
+};
+
+$img{circle_yes} = {
+    src => '/silk/site/tick.png',
+    width => 16,
+    height => 16,
+    alt => 'img.circle_yes',
+};
+
+$img{circle_no} = {
+    src => '/silk/site/cross.png',
+    width => 16,
+    height => 16,
+    alt => 'img.circle_no',
+};
+
+$img{'arrow-down'} = {
+    src => 'profile_icons/arrow-down.gif',
+    width => 12,
+    height => 12,
+    alt => 'img.arrow-down',
+};
+
+$img{'arrow-right'} = {
+    src => 'profile_icons/arrow-right.gif',
+    width => 12,
+    height => 12,
+    alt => 'img.arrow-right',
+};
+
 $img{'security-protected'} = {
     src => '/silk/entry/locked.png',
     width => 16,
diff -r 9380b580348a -r 888c1e9c65fb htdocs/directory.bml
--- a/htdocs/directory.bml	Thu Jul 08 15:00:02 2010 +0800
+++ b/htdocs/directory.bml	Thu Jul 08 15:05:09 2010 +0800
@@ -49,13 +49,16 @@ body<=
             $count{$_->{'statcat'}}->{$_->{'statkey'}} = $_->{'statval'};
         }
 
+        my $mapimg = LJ::img( 'us_map', '', { id => "USMap", border => 0,
+                                              usemap => "#state_test",
+                                              ismap => 'ismap' } );
         $ret .= qq {
             <div id="States">
                 <?h1 $ML{'.browse.usa.title'} h1?>
                 <?p $ML{'.browse.usa.desc'} p?>
                 <form action='get' name="stateForm">
                 <div>
-                <img id="USMap" alt="$ML{'.us_map'}" src="$LJ::IMGPREFIX/us_map.gif" width='489' height='315' border='0' usemap="#state_test" ismap='ismap' />
+                $mapimg
                 <div id="StateInfo"></div>
                 </div>
                 </form>
@@ -182,9 +185,10 @@ body<=
         $refurl .= ($args ? "&" : "?") . 'start_search=1';
         $headextra = "<meta http-equiv='Refresh' content='1;URL=$refurl' id='refresher' />";
 
+        my $dots = LJ::img( 'searchdots', '' );
         $ret .= qq {
             <div id="SearchWaitText" style='text-align: center;'>
-               <b>$ML{'.search.title'}<img src='$LJ::IMGPREFIX/searchingdots.gif' alt='...' width='18' height='12' /></b>
+               <b>$ML{'.search.title'}$dots</b>
                <p>$ML{'.search.monkey'}</p>
             </div>
         };
diff -r 9380b580348a -r 888c1e9c65fb htdocs/directory.bml.text
--- a/htdocs/directory.bml.text	Thu Jul 08 15:00:02 2010 +0800
+++ b/htdocs/directory.bml.text	Thu Jul 08 15:05:09 2010 +0800
@@ -55,7 +55,5 @@ directory usage, be sure that you are lo
 
 .update=Update:
 
-.us_map=US Map
-
 .user=User
 
diff -r 9380b580348a -r 888c1e9c65fb htdocs/feeds/list.bml
--- a/htdocs/feeds/list.bml	Thu Jul 08 15:00:02 2010 +0800
+++ b/htdocs/feeds/list.bml	Thu Jul 08 15:05:09 2010 +0800
@@ -42,9 +42,10 @@ body<=
      $ret .= "<td>" . LJ::ljuser($_->{'user'}, { 'type' => 'Y' }) . "</td>";
      $ret .= "<td>" . LJ::ehtml($_->{'name'}) . "</td>";
      $ret .= "<td>" . $_->{'numreaders'} . "</td>";
-     $ret .= "<td><a href='" . LJ::ehtml($_->{'synurl'}) . "'>".
-             "<img src='$LJ::IMGPREFIX/xml.gif' width='36' height='14' align='middle' border='0' alt='$ML{'.xml_icon.alt'}' /></a></td>";
-     $ret .= "</tr>";
+     $ret .= "<td><a href='" . LJ::ehtml( $_->{synurl} ) . "'>";
+     $ret .= LJ::img( 'xml', '', { align => 'middle', border => 0,
+                                   alt => $ML{'.xml_icon.alt'} } );
+     $ret .= "</a></td></tr>";
  }
  $ret .= "</table>" . $navbar;
  return $ret;
diff -r 9380b580348a -r 888c1e9c65fb htdocs/manage/circle/edit.bml
--- a/htdocs/manage/circle/edit.bml	Thu Jul 08 15:00:02 2010 +0800
+++ b/htdocs/manage/circle/edit.bml	Thu Jul 08 15:05:09 2010 +0800
@@ -144,12 +144,12 @@ body<=
                     if ($type eq "people") {
                         if ( $other_u->can_watch( $u ) ) {
                             my $watched = $is_watched_by_userid{$uid} ? 1 : 0;
-                            $ret .= " | <img src='$LJ::IMGPREFIX/silk/site/";
+                            $ret .= " | ";
                             if ( $watched ) {
-                                $ret .= "tick.png' alt='" . $ML{'.circle.img.y'} . "'> ";
+                                $ret .= LJ::img( 'circle_yes', '' );
                                 $ret .= $ML{'.circle.subscribe.y'}
                             } else {
-                                $ret .= "cross.png' alt='" . $ML{'.circle.img.n'} . "'> ";
+                                $ret .= LJ::img( 'circle_no', '' );
                                 $ret .= $ML{'.circle.subscribe.n'}
                             }
                             $iscontent = 1;
@@ -177,24 +177,23 @@ body<=
                     if ($type eq "people") {
                         if ( $other_u->can_trust( $u ) ) {
                             my $trusted = $is_trusted_by_userid{$uid} ? 1 : 0;
-                            $ret .= " | <img src='$LJ::IMGPREFIX/silk/site/";
+                            $ret .= " | ";
                             if ( $trusted ) {
-                                $ret .= "tick.png' alt='" . $ML{'.circle.img.y'} . "'> ";
+                                $ret .= LJ::img( 'circle_yes', '' );
                                 $ret .= $ML{'.circle.access.y'}
                             } else {
-                                $ret .= "cross.png' alt='" . $ML{'.circle.img.n'} . "'> ";
+                                $ret .= LJ::img( 'circle_no', '' );
                                 $ret .= $ML{'.circle.access.n'}
                             }
                             $iscontent = 1;
                         }
                     } elsif ($type eq "comms") {
                         # check membership
-                        $ret .= "<img src='/img/silk/site/";
                         if ( $is_member_of_userid{$uid} ) {
-                            $ret .= "tick.png' alt='" . $ML{'.circle.img.y'} . "'> ";
+                            $ret .= LJ::img( 'circle_yes', '' );
                             $ret .= $ML{'.circle.member.y'};
                         } else {
-                            $ret .= "cross.png' alt='" . $ML{'.circle.img.n'} . "'> ";
+                            $ret .= LJ::img( 'circle_no', '' );
                             $ret .= $ML{'.circle.member.n'};
                         }
                         $iscontent = 1;
diff -r 9380b580348a -r 888c1e9c65fb htdocs/manage/circle/edit.bml.text
--- a/htdocs/manage/circle/edit.bml.text	Thu Jul 08 15:00:02 2010 +0800
+++ b/htdocs/manage/circle/edit.bml.text	Thu Jul 08 15:05:09 2010 +0800
@@ -29,10 +29,6 @@
 .circle.header.people=People ([[num]])
 
 .circle.header=Current Relationships
-
-.circle.img.n=No
-
-.circle.img.y=Yes
 
 .circle.intro=Here are the <a [[aopts1]]>people</a>, <a [[aopts2]]>communities</a>, and <a [[aopts3]]>feeds</a> that are in your circle.  You can change who appears on your Reading Page and who you give access to by using the check boxes.
 
diff -r 9380b580348a -r 888c1e9c65fb htdocs/manage/subscriptions/filters.bml
--- a/htdocs/manage/subscriptions/filters.bml	Thu Jul 08 15:00:02 2010 +0800
+++ b/htdocs/manage/subscriptions/filters.bml	Thu Jul 08 15:05:09 2010 +0800
@@ -39,6 +39,7 @@ body<=
     $ret .= "<?standout " . BML::ml( '.accessfilters', { aopts => "href='$LJ::SITEROOT/manage/circle/editfilters'" } ) . " standout?>\n\n"; 
 
     # and now the main page HTML
+    my $img = LJ::img( 'hourglass', '', { id => 'cf-hourglass' } );
     $ret .= <<EOF;
 
 <div id='cf-select'>
@@ -49,7 +50,7 @@ body<=
         </select>
     </div>
     <div id='cf-save'>
-        <img id='cf-hourglass' src='$LJ::IMGPREFIX/hourglass.gif' />
+        $img
         <span id='cf-unsaved'>Saving in N seconds...</span>
     </div>
     <div id='cf-make-new'>
diff -r 9380b580348a -r 888c1e9c65fb htdocs/profile.bml
--- a/htdocs/profile.bml	Thu Jul 08 15:00:02 2010 +0800
+++ b/htdocs/profile.bml	Thu Jul 08 15:05:09 2010 +0800
@@ -164,7 +164,8 @@ body<=
 
     my $arrowimg = sub {
         my $section = $_[0];
-        return qq(<img id="${section}_arrow" src="$LJ::IMGPREFIX/profile_icons/arrow-down.gif" align="absmiddle" alt="" />);
+        return LJ::img( 'arrow-down', '', { id => "${section}_arrow",
+                                            align => "absmiddle" } );
     };
 
     # given a single item (scalar or hashref), linkify it appropriately
@@ -246,7 +247,8 @@ body<=
         my $header_image = $opts{header_image} ? "<img src='$opts{header_image}' alt='' /> " : '';
         my $collapse_text = $collapsible ? qq(
             <span class='expandcollapse on' id='$opts{section_name}_header'>
-                <img id="$opts{section_name}_arrow" src="$LJ::IMGPREFIX/profile_icons/arrow-down.gif" align="absmiddle" alt="" />
+                ) . LJ::img( 'arrow-down', '', { id => "$opts{section_name}_arrow",
+                align => "absmiddle" } ) . qq(
                 $header_image$ML{$opts{section_name_ml}}
             </span>
         ) : "$header_image$ML{$opts{section_name_ml}}";
@@ -281,7 +283,8 @@ body<=
         if ( $collapsible ) {
             $collapse_text = qq(
                 <span class='expandcollapse on' id='$opts{section_name}_header'>
-                    <img id="$opts{section_name}_arrow" src="$LJ::IMGPREFIX/profile_icons/arrow-down.gif" align="absmiddle" alt="" />
+                    ) . LJ::img( 'arrow-down', '', { id => "$opts{section_name}_arrow",
+                    align => "absmiddle" } ) . qq(
                     $section_name$section_hidden_text
                 </span>
             );
@@ -322,13 +325,10 @@ body<=
 
     $ret .= q{ <div class='username'> } . $u->ljuser_display;
     if ( $u->public_key ) {
-        $ret .= qq( 
-            <a href='$LJ::SITEROOT/pubkey?user=$user'>
-                <img src='$LJ::IMGPREFIX/key.gif' width='16' height='16' border='0'
-                     alt="$ML{'.pubkey.alt'}" title="$ML{'.pubkey.alt'}"
-                     style='vertical-align: middle; border: 0;' />
-            </a>
-        );
+        $ret .= "<a href='$LJ::SITEROOT/pubkey?user=$user'>";
+        $ret .= LJ::img( 'key', '', { border => 0, title => $ML{'.pubkey.alt'},
+                          style => 'vertical-align: middle; border: 0;' } );
+        $ret .= "</a>\n";
     }
     $ret .= q{ </div> };
 
diff -r 9380b580348a -r 888c1e9c65fb htdocs/search.bml
--- a/htdocs/search.bml	Thu Jul 08 15:00:02 2010 +0800
+++ b/htdocs/search.bml	Thu Jul 08 15:05:09 2010 +0800
@@ -167,9 +167,9 @@ body<=
 
         my $icon = {
                 public => '',
-                private => "<img src='$LJ::IMGPREFIX/silk/entry/private.png'>",
-                usemask => "<img src='$LJ::IMGPREFIX/silk/entry/filtered.png'>",
-                access => "<img src='$LJ::IMGPREFIX/silk/entry/locked.png'>",
+                private => LJ::img( "security-private",   "" );
+                usemask => LJ::img( "security-groups",    "" );
+                access  => LJ::img( "security-protected", "" );
             }->{$match->{security}};
 
         my $tags = join( ', ', map { "<strong>" . $match->{tags}->{$_} . "</strong>" } keys %{ $match->{tags} } );
diff -r 9380b580348a -r 888c1e9c65fb htdocs/view/index.bml
--- a/htdocs/view/index.bml	Thu Jul 08 15:00:02 2010 +0800
+++ b/htdocs/view/index.bml	Thu Jul 08 15:05:09 2010 +0800
@@ -138,8 +138,10 @@ _c?>
         my @prev = ($year, $month-1);
         if ($prev[1] < 1) { @prev = ($year-1, 12); }
 
-        my $next = "<a href=\"" . $base . "/$next[0]/" . sprintf("%02d", $next[1]) . "/\"><img src=\"$LJ::IMGPREFIX/btn_next.gif\" width='22' height='20' border='0'></a>";
-        my $prev = "<a href=\"" . $base . "/$prev[0]/" . sprintf("%02d", $prev[1]) . "/\"><img src=\"$LJ::IMGPREFIX/btn_prev.gif\" width='22' height='20' border='0'></a>";
+        my $next = "<a href='" . $base . "/$next[0]/" . sprintf("%02d", $next[1]) . "/'>";
+        $next .= LJ::img( "btn_next", "", { border => 0 } ) . "</a>";
+        my $prev = "<a href='" . $base . "/$prev[0]/" . sprintf("%02d", $prev[1]) . "/'>";
+        $prev .= LJ::img( "btn_prev", "", { border => 0 } ) . "</a>";
 
         $body .= "<?standout \n";
         $body .= "<form method='post' action='$LJ::SITEROOT/view/' style='display:inline'><input type='hidden' name='type' value='month' /><input type='hidden' name='user' value='$u->{'user'}' />";
--------------------------------------------------------------------------------