juks (juks) wrote in changelog,
juks
juks
changelog

[livejournal] r18202: * LJSV-1382 Inbox

Committer: iaskarov
* LJSV-1382 Inbox
U   trunk/cgi-bin/weblib.pl
U   trunk/htdocs/inbox/compose.bml
Modified: trunk/cgi-bin/weblib.pl
===================================================================
--- trunk/cgi-bin/weblib.pl	2011-02-03 10:36:20 UTC (rev 18201)
+++ trunk/cgi-bin/weblib.pl	2011-02-03 11:03:49 UTC (rev 18202)
@@ -2475,11 +2475,22 @@
 }
 
 # Add some javascript language strings
-sub add_js_ml {
-    my %data = @_;
-    
-    for (keys %data) {
-        $LJ::JSML{$_} = $data{$_};
+sub need_string {
+    my @strings = @_;
+  
+    for my $item (@strings) {
+        # When comes as a hash should be treated as key => value
+        if(ref $item eq 'HASH') {
+            for my $key (keys %$item) {
+                $LJ::JSML{$key} = $item->{$key};
+            }
+        # When handling array, name the ml by the value of the second element
+        } elsif(ref $item eq 'ARRAY') {
+            $LJ::JSML{$$item[1]} = LJ::Lang::ml($$item[0]);
+        # If scalar - use the ml named this way
+        } else {
+            $LJ::JSML{$item} = LJ::Lang::ml($item);
+        }
     }
 }
 

Modified: trunk/htdocs/inbox/compose.bml
===================================================================
--- trunk/htdocs/inbox/compose.bml	2011-02-03 10:36:20 UTC (rev 18201)
+++ trunk/htdocs/inbox/compose.bml	2011-02-03 11:03:49 UTC (rev 18202)
@@ -142,7 +142,7 @@
         }
     }
     
-    LJ::add_js_ml( userpic_title => $ML{'.userpic.title'} );
+    LJ::need_string(['.userpic.title', 'userpic_title']);
 
     # Display errors
     $body .= LJ::error_list(@errors) if (@errors);

Tags: bml, juks, livejournal, pl
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