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 .= "
";
- 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 .= "- " .
BML::ml("vgiftcat.$subcat_value") . " ";
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 .= " S N A ";
foreach my $v_cat (@{$vgift->{cats}}) {
$ret .= "";
- 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 .= "{cat_id} ? "selected" : "") . " >" . $cat_value . "";
# 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 .= "{cat_id} ? "selected" : "") . " >" . $cat_value . " > " . $subcat_value . "";
}
}
@@ -170,18 +170,18 @@
# new category
$ret .= "";
$ret .= "Select";
- 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 .= "" . $cat_value . "\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 .= "" . $cat_value . " > " . $subcat_value . "\n";
}
}
}
- $ret .= q| add|;
+ $ret .= q| add|; #"
}
$ret .= "";
$ret .= "
small_img_url."\">
large_img_url."\">";
@@ -196,13 +196,13 @@
$ret .= "VGift management
\n";
$ret .= "