Hide from the dropdown unless it's already been selected.
Patch by exor674.
diffs (88 lines):
diff -r db5d61eac59c -r 28345829eb57 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm Sat Jul 18 21:14:47 2009 -0500
+++ b/cgi-bin/LJ/S2.pm Sun Jul 19 05:53:56 2009 +0000
@@ -446,6 +446,23 @@ sub load_layers {
return $maxtime;
}
+sub is_public_internal_layer {
+ my $layerid = shift;
+
+ my $pub = get_public_layers();
+ while ($layerid) {
+ # doesn't exist, probably private
+ return 0 unless defined $pub->{$layerid};
+ my $internal = $pub->{$layerid}->{is_internal};
+
+ return 1 if defined $internal && $internal;
+ return 0 if defined $internal && ! $internal;
+
+ $layerid = $pub->{$layerid}->{b2lid};
+ }
+ return 0;
+}
+
# find existing re-distributed layers that are in the database
# and their styleids.
sub get_public_layers
@@ -459,7 +476,7 @@ sub get_public_layers
}
$sysid ||= LJ::get_userid("system");
- my $layers = get_layers_of_user($sysid, "is_system", [qw(des note author
author_name author_email)]);
+ my $layers = get_layers_of_user($sysid, "is_system", [qw(des note author
author_name author_email is_internal)]);
$LJ::CACHED_PUBLIC_LAYERS = $layers if $layers;
LJ::MemCache::set("s2publayers", $layers, 60*10) if $layers;
diff -r db5d61eac59c -r 28345829eb57 cgi-bin/LJ/S2Theme.pm
--- a/cgi-bin/LJ/S2Theme.pm Sat Jul 18 21:14:47 2009 -0500
+++ b/cgi-bin/LJ/S2Theme.pm Sun Jul 19 05:53:56 2009 +0000
@@ -272,6 +272,7 @@ sub load_all {
foreach my $layer (keys %$pub) {
next unless $layer =~ /^\d+$/;
next unless $pub->{$layer}->{type} eq "theme";
+ next if LJ::S2::is_public_internal_layer($layer);
push @themes, $class->new( themeid => $layer );
}
diff -r db5d61eac59c -r 28345829eb57 htdocs/customize/advanced/styles.bml
--- a/htdocs/customize/advanced/styles.bml Sat Jul 18 21:14:47 2009 -0500
+++ b/htdocs/customize/advanced/styles.bml Sun Jul 19 05:53:56 2009 +0000
@@ -346,12 +346,13 @@
my @opts = ();
+ my $lid = $POST{'action:change'} ? $POST{$type} :
$style->{layer}->{$type};
+ $lid = $POST{"other_$type"} if $lid eq "_other";
+
# returns html_select to caller
my $html_select = sub {
my $dis = scalar(@opts) > 2 ? 0 : 1;
- my $lid = $POST{'action:change'} ? $POST{$type} :
$style->{'layer'}->{$type};
- $lid = $POST{"other_$type"} if $lid eq "_other";
my $sel = ($lid && ! $pub->{$lid} && ! $ulay->{$lid}) ? "_other" :
$lid;
return [ LJ::html_select({ 'name' => $type, 'id' => "select_$type",
'onChange' => "showOther('$type')",
@@ -368,6 +369,7 @@
$ref->{$_}->{'type'} eq $type &&
$ref->{$_}->{'b2lid'} == $b2lid &&
(!defined $is_active || $is_active) &&
+ !$pub->{$_}->{is_internal} && # checking this directly
here, as I don't care if the parent layers are internal
/^\d+$/
} keys %$ref;
};
@@ -379,9 +381,12 @@
# no user core layers
return $html_select->() if $type eq 'core';
- # user layers
+ # user layers / using an internal layer
push @opts, ('', '---');
my $startsize = scalar(@opts);
+
+ # add the current layer if it's internal and the user is using it.
+ push @opts, ( $lid, BML::ml('.stylelayers.select.layout.user',
{'layername' => $pub->{$lid}->{'name'}, 'id' => $lid}) ) if $lid &&
$pub->{$lid}->{is_internal};
push @opts, map { $_, BML::ml('.stylelayers.select.layout.user',
{'layername' => $ulay->{$_}->{'name'}, 'id' => $_}) } $greplist->($ulay);
# if we didn't push anything above, remove dividing line
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog