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

[dw-free] performance improvements

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

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

Allow us to enable and disable icon renames via site config.

Patch by [personal profile] exor674.

Files modified:
  • etc/config.pl
  • htdocs/editicons.bml
  • htdocs/editicons.bml.text
--------------------------------------------------------------------------------
diff -r 4df3a5c6fe85 -r b80946faeee5 etc/config.pl
--- a/etc/config.pl	Thu Sep 16 13:45:36 2010 -0500
+++ b/etc/config.pl	Mon Sep 20 15:24:00 2010 +0800
@@ -144,6 +144,7 @@
                  free_create => 1,
                  googlecheckout => 1,
                  'interests-findsim' => 0,
+                 icon_renames => 0,
                  memories => 0,
                  opt_findbyemail => 1,
                  payments => 0,
diff -r 4df3a5c6fe85 -r b80946faeee5 htdocs/editicons.bml
--- a/htdocs/editicons.bml	Thu Sep 16 13:45:36 2010 -0500
+++ b/htdocs/editicons.bml	Mon Sep 20 15:24:00 2010 +0800
@@ -520,7 +520,7 @@ use strict;
             $body .= "<div class='pkg userpic_wrapper'>";
             $body .= "<span class='EditIconsUserpic'>" .  $pic->imgtag . "</span>\n";
 
-            # TODO: if no keywords then light grey text and empty out when you click in it
+            # FIXME: if no keywords then light grey text and empty out when you click in it
             my $keywords = $pic->keywords;
             my $comment = $pic->comment;
             my $description = $pic->description;
@@ -537,10 +537,15 @@ use strict;
             if ($display_rename) {
                 $body .= "<div id='rename_div_$pid' class='userpic_rename pkg'>\n";
                 $body .= "<script type='text/javascript'>document.getElementById('rename_div_$pid').style.display = 'none';</script>\n";
-                $body .= LJ::html_check({ 'type' => 'checkbox', 'name' => "rename_keyword_$pid", 'class' => "checkbox",
-                                          'id' => "rename_keyword_$pid", 'value' => 1,
-                                          'disabled' => $LJ::DISABLE_MEDIA_UPLOADS });
-                $body .= "<label for='rename_keyword_$pid'>$ML{'.label.rename'}</label>"; 
+                if ( LJ::is_enabled( "icon_renames" ) ) {
+                    $body .= LJ::html_check({ 'type' => 'checkbox', 'name' => "rename_keyword_$pid", 'class' => "checkbox",
+                                              'id' => "rename_keyword_$pid", 'value' => 1,
+                                              'disabled' => $LJ::DISABLE_MEDIA_UPLOADS });
+                    $body .= "<label for='rename_keyword_$pid'>$ML{'.label.rename'}</label>";
+                } else {
+                    $body .= "$ML{'.label.rename.disabled'}";
+                }
+
                 $body .= "</div>\n";
             }
             $body .= "</div>\n";
@@ -662,11 +667,15 @@ sub update_userpics
         # only modify if changing the data, make sure not collidiing with other edits, etc
         if ($POST{"kw_$picid"} ne $POST{"kw_orig_$picid"}) {
             my $kws = $POST{"kw_$picid"};
-            
+
             if ($POST{"rename_keyword_$picid"}) {
-                eval {
-                    $up->set_and_rename_keywords($kws, $POST{"kw_orig_$picid"});
-                } or push @errors, $@->as_html;
+                if ( LJ::is_enabled( "icon_renames" ) ) {
+                    eval {
+                       $up->set_and_rename_keywords($kws, $POST{"kw_orig_$picid"});
+                    } or push @errors, $@->as_html;
+                } else {
+                    push @errors, $ML{'.label.rename.disabled'};
+                }
             } else {
                 eval {
                     $up->set_keywords($kws);
diff -r 4df3a5c6fe85 -r b80946faeee5 htdocs/editicons.bml.text
--- a/htdocs/editicons.bml.text	Thu Sep 16 13:45:36 2010 -0500
+++ b/htdocs/editicons.bml.text	Mon Sep 20 15:24:00 2010 +0800
@@ -99,6 +99,8 @@
 
 .label.rename=Rename Keywords
 
+.label.rename.disabled=Renaming keywords is temporarily disabled
+
 .makedefault=Make this your <u>d</u>efault picture
 
 .makedefault.key|notes=Enter here a <b>lower-case</b> version of the letter you underlined in ".makedefault". This is the shortcut key for the makedefault option.
--------------------------------------------------------------------------------