alf (red_alf) wrote in changelog,
alf
red_alf
changelog

[ljcom] r8118: LJSUP-5345: 'AdNectar' (or 'Sponsored') ...

Committer: afedorov
LJSUP-5345: 'AdNectar' (or 'Sponsored') category in LJ Shop

U   trunk/cgi-bin/LJ/Pay/ShopVGift.pm
U   trunk/cgi-bin/LJ/Widget/ShopVGift.pm
U   trunk/htdocs/admin/vgift/edit.bml
Modified: trunk/cgi-bin/LJ/Pay/ShopVGift.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/ShopVGift.pm	2010-01-19 08:45:40 UTC (rev 8117)
+++ trunk/cgi-bin/LJ/Pay/ShopVGift.pm	2010-01-19 09:32:14 UTC (rev 8118)
@@ -379,7 +379,7 @@
     my $domain = LJ::Lang::get_dom("general");
     my $lang = LJ::Lang::get_effective_lang();
     foreach my $cat (keys %LJ::VGIFT_CATEGORIES) {
-        my $cat_value = $LJ::VGIFT_CATEGORIES{$cat};
+        my $cat_value = $LJ::VGIFT_CATEGORIES{$cat}->{name};
         $display_cat = $cat_value unless $display_cat;
         $vgifts_cat{$cat_value}[0] = LJ::Lang::get_text($lang, "vgiftcat.$cat_value", $domain->{'dmid'}); # Category Display Name
         $vgifts_cat{$cat_value}[1] = ''; # Category HTML Block
@@ -387,7 +387,7 @@
         # If there are sub-categories
         if ($LJ::VGIFT_SUBCATS{$cat_value}) {
             foreach my $subcat (keys %{$LJ::VGIFT_SUBCATS{$cat_value} || {}}) {
-                my $subcat_value = $LJ::VGIFT_SUBCATS{$cat_value}->{$subcat};
+                my $subcat_value = $LJ::VGIFT_SUBCATS{$cat_value}->{$subcat}->{name};
                 $vgifts_cat{$subcat_value}[0] = LJ::Lang::get_text($lang, "vgiftcat.$cat_value", $domain->{'dmid'}) .
                                           " > " . LJ::Lang::get_text($lang, "vgiftcat.$subcat_value", $domain->{'dmid'}); # Category Display Name
                 $vgifts_cat{$subcat_value}[1] = ''; # Category HTML Block

Modified: trunk/cgi-bin/LJ/Widget/ShopVGift.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/ShopVGift.pm	2010-01-19 08:45:40 UTC (rev 8117)
+++ trunk/cgi-bin/LJ/Widget/ShopVGift.pm	2010-01-19 09:32:14 UTC (rev 8118)
@@ -154,13 +154,13 @@
 
     my $cat_nav .= "<ul>";
 
-    foreach my $cat (sort { $a <=> $b } keys %LJ::VGIFT_CATEGORIES) {
-        my $cat_value = $LJ::VGIFT_CATEGORIES{$cat};
+    foreach my $cat (sort { $LJ::VGIFT_CATEGORIES{$a}->{sortorder} <=> $LJ::VGIFT_CATEGORIES{$b}->{sortorder} } keys %LJ::VGIFT_CATEGORIES) {
+        my $cat_value = $LJ::VGIFT_CATEGORIES{$cat}->{name};
         # Sub-categories
         my $subcat_nav = '';
         if ($LJ::VGIFT_SUBCATS{$cat_value}) {
-            foreach my $subcat (sort keys %{$LJ::VGIFT_SUBCATS{$cat_value} || []}) {
-                my $subcat_value = $LJ::VGIFT_SUBCATS{$cat_value}->{$subcat};
+            foreach my $subcat (sort {$LJ::VGIFT_SUBCATS{$cat_value}->{$a}->{sortorder} <=> $LJ::VGIFT_SUBCATS{$cat_value}->{$b}->{sortorder}} keys %{$LJ::VGIFT_SUBCATS{$cat_value} || []}) {
+                my $subcat_value = $LJ::VGIFT_SUBCATS{$cat_value}->{$subcat}->{name};
                 if ($vgifts_cat{$subcat_value}[3]) {
                     $subcat_nav .= "<li><a href='?cat=$subcat_value' class='vg_cat".(($subcat_value eq $display_cat)?' on':'')."'>" .
                         BML::ml("vgiftcat.$subcat_value") . "</a></li>";

Modified: trunk/htdocs/admin/vgift/edit.bml
===================================================================
--- trunk/htdocs/admin/vgift/edit.bml	2010-01-19 08:45:40 UTC (rev 8117)
+++ trunk/htdocs/admin/vgift/edit.bml	2010-01-19 09:32:14 UTC (rev 8118)
@@ -150,13 +150,13 @@
         $ret .= "<tr><td>&nbsp;</td><td>&nbsp;S&nbsp;N&nbsp;A&nbsp;</td></tr>";
         foreach my $v_cat (@{$vgift->{cats}}) {
             $ret .= "<tr><td><select name='cat'>";
-            foreach my $cat (keys %LJ::VGIFT_CATEGORIES) {
-                my $cat_value = $LJ::VGIFT_CATEGORIES{$cat};
+            foreach my $cat (sort { $LJ::VGIFT_CATEGORIES{$a}->{sortorder} <=> $LJ::VGIFT_CATEGORIES{$b}->{sortorder} } keys %LJ::VGIFT_CATEGORIES) {
+                my $cat_value = $LJ::VGIFT_CATEGORIES{$cat}->{name};
                 $ret .= "<option value='" . $cat_value . "' " . ($cat eq $v_cat->{cat_id} ? "selected" : "") . " >" . $cat_value . "</option>";
                 # If there are sub-categories
                 if ($LJ::VGIFT_SUBCATS{$cat_value}) {
-                    foreach my $subcat (keys %{$LJ::VGIFT_SUBCATS{$cat_value} || {}}) {
-                        my $subcat_value = $LJ::VGIFT_SUBCATS{$cat_value}->{$subcat};
+                    foreach my $subcat (sort { $LJ::VGIFT_SUBCATS{$cat_value}->{$a}->{sortorder} <=> $LJ::VGIFT_SUBCATS{$cat_value}->{$b}->{sortorder} } keys %{$LJ::VGIFT_SUBCATS{$cat_value} || {}}) {
+                        my $subcat_value = $LJ::VGIFT_SUBCATS{$cat_value}->{$subcat}->{name};
                         $ret .= "<option value='" . $subcat_value . "' " . ($subcat eq $v_cat->{cat_id} ? "selected" : "") . " >" . $cat_value . " &gt; " . $subcat_value . "</option>";
                     }
                 }
@@ -170,18 +170,18 @@
         # new category
         $ret .= "<tr><td><select name='newcat' onChange=\"set_url()\">";
         $ret .= "<option value='-1'>Select</option>";
-        foreach my $cat (keys %LJ::VGIFT_CATEGORIES) {
-            my $cat_value = $LJ::VGIFT_CATEGORIES{$cat};
+        foreach my $cat (sort { $LJ::VGIFT_CATEGORIES{$a}->{sortorder} <=> $LJ::VGIFT_CATEGORIES{$b}->{sortorder} } keys %LJ::VGIFT_CATEGORIES) {
+            my $cat_value = $LJ::VGIFT_CATEGORIES{$cat}->{name};
             $ret .= "<option value='" . $cat_value . "'>" . $cat_value . "</option>\n";
             # If there are sub-categories
             if ($LJ::VGIFT_SUBCATS{$cat_value}) {
-                foreach my $subcat (keys %{$LJ::VGIFT_SUBCATS{$cat_value} || {}}) {
-                    my $subcat_value = $LJ::VGIFT_SUBCATS{$cat_value}->{$subcat};
+                foreach my $subcat (sort { $LJ::VGIFT_SUBCATS{$cat_value}->{$a}->{sortorder} <=> $LJ::VGIFT_SUBCATS{$cat_value}->{$b}->{sortorder} } keys %{$LJ::VGIFT_SUBCATS{$cat_value} || {}}) {
+                    my $subcat_value = $LJ::VGIFT_SUBCATS{$cat_value}->{$subcat}->{name};
                     $ret .= "<option value='" . $subcat_value . "'>" . $cat_value . " &gt; " . $subcat_value . "</option>\n";
                 }
             }
         }
-        $ret .= q|</select></td><td><a id='ahrefadd' href='#'">add</a></td></tr>|;
+        $ret .= q|</select></td><td><a id='ahrefadd' href='#'">add</a></td></tr>|; #"
     }
     $ret .= "</table></td></tr>";
     $ret .= "<tr><td><img src=\"".$vgift->small_img_url."\"></td><td><img src=\"".$vgift->large_img_url."\"></td></tr>";
@@ -196,13 +196,13 @@
     $ret .= "<h1>VGift management</h1>\n";
     $ret .= "<form method='get'>";
     $ret .= "<select name='cat'>";
-    foreach my $cat (keys %LJ::VGIFT_CATEGORIES) {
-        my $cat_value = $LJ::VGIFT_CATEGORIES{$cat};
+    foreach my $cat (sort { $LJ::VGIFT_CATEGORIES{$a}->{sortorder} <=> $LJ::VGIFT_CATEGORIES{$b}->{sortorder} } keys %LJ::VGIFT_CATEGORIES) {
+        my $cat_value = $LJ::VGIFT_CATEGORIES{$cat}->{name};
         $ret .= "<option value=" . $cat_value . ">" . $cat_value . "</option>";
         # If there are sub-categories
         if ($LJ::VGIFT_SUBCATS{$cat_value}) {
-            foreach my $subcat (keys %{$LJ::VGIFT_SUBCATS{$cat_value} || {}}) {
-                my $subcat_value = $LJ::VGIFT_SUBCATS{$cat_value}->{$subcat};
+            foreach my $subcat (sort { $LJ::VGIFT_SUBCATS{$cat_value}->{$a}->{sortorder} <=> $LJ::VGIFT_SUBCATS{$cat_value}->{$b}->{sortorder} } keys %{$LJ::VGIFT_SUBCATS{$cat_value} || {}}) {
+                my $subcat_value = $LJ::VGIFT_SUBCATS{$cat_value}->{$subcat}->{name};
                 $ret .= "<option value=" . $subcat_value . ">" . $cat_value . " &gt; " . $subcat_value . "</option>";
             }
         }

Tags: bml, ljcom, pm, red_alf
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