Add missing metadata items to entry preview.
Patch by afuna.
diffs (113 lines):
diff -r 5f0f1648285b -r 09ad0e14b1dd cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm Mon Jul 13 02:24:12 2009 +0000
+++ b/cgi-bin/LJ/S2.pm Mon Jul 13 02:31:48 2009 +0000
@@ -1923,8 +1923,11 @@ sub Entry
my $r = BML::get_request();
# custom friend groups
- my $entry = LJ::Entry->new($e->{journal}->{_u}, ditemid => $e->{itemid});
- my $group_names = $entry->group_names;
+ my $group_names = $arg->{group_names};
+ unless ( $group_names ) {
+ my $entry = LJ::Entry->new($e->{journal}->{_u}, ditemid =>
$e->{itemid});
+ $group_names = $entry->group_names;
+ }
$e->{metadata}->{groups} = $group_names if $group_names;
# TODO: Populate this field more intelligently later, but for now this will
diff -r 5f0f1648285b -r 09ad0e14b1dd htdocs/preview/entry.bml
--- a/htdocs/preview/entry.bml Mon Jul 13 02:24:12 2009 +0000
+++ b/htdocs/preview/entry.bml Mon Jul 13 02:31:48 2009 +0000
@@ -162,8 +162,45 @@ body<=
$current{'Music'} = $req{'prop_current_music'};
LJ::CleanHTML::clean_subject(\$current{'Music'});
}
+ if ( $req{prop_current_location} || $req{prop_current_coords} ) {
+ my $loc = eval { LJ::Location->new( coords =>
$req{prop_current_coords},
+ location =>
$req{prop_current_location} ) };
+ $current{Location} = $loc->as_html_current if $loc;
+ }
- $ret .= "<div style='margin-left: 30px'>";
+ # custom friend groups
+ my %group_ids = ( map { $_ => 1 } grep { $req{allowmask} & ( 1 << $_ )
} 1..60 );
+
+ if ( scalar( keys %group_ids ) > 0 ) {
+ my $groups = $u->trust_groups || {};
+ if ( keys %$groups ) {
+ my @trust_groups = ();
+
+ foreach my $groupid ( keys %$groups ) {
+ next unless $group_ids{$groupid};
+
+ my $name = LJ::ehtml( $groups->{$groupid}->{groupname} );
+ my $url = LJ::eurl( $u->journal_base .
"/security/group:$name" );
+
+ my $group_text = $u->get_cap( "security_filter" ) ? "<a
href='$url'>$name</a>" : $name;
+ push @trust_groups, $group_text;
+ }
+
+ $current{Groups} = join( ', ', @trust_groups ) if
@trust_groups;
+ }
+ }
+
+ my @taglist = ();
+ LJ::Tags::is_valid_tagstring( $POST{prop_taglist}, \...@taglist );
+ if ( @taglist ) {
+ my $base = $u->journal_base;
+ $current{Tags} = join( ', ',
+ map { "<a href='$base/tag/" . LJ::eurl( $_
) . "'>" . LJ::ehtml( $_ ) . "</a>" }
+ @taglist
+ );
+ }
+
+ $ret .= "<div id='entry' class='usercontent' style='margin-left:
30px'>";
if (%current)
{
@@ -242,9 +279,35 @@ body<=
LJ::Tags::is_valid_tagstring($POST{prop_taglist}, \...@taglist);
@taglist = map { LJ::S2::Tag($u, -1, $_) } @taglist;
+ # build metadata props
+ $req{props}->{$_} = $req{"prop_".$_}
+ foreach ( qw( current_music current_location current_coords
current_moodid current_mood ) );
+
+ # custom friends groups
+ my $group_names;
+ my %group_ids = ( map { $_ => 1 } grep { $req{allowmask} & ( 1 << $_ )
} 1..60 );
+
+ if ( scalar( keys %group_ids ) > 0 ) {
+ my $groups = $u->trust_groups || {};
+ if ( keys %$groups ) {
+ my @trust_groups = ();
+
+ foreach my $groupid ( keys %$groups ) {
+ next unless $group_ids{$groupid};
+
+ my $name = LJ::ehtml( $groups->{$groupid}->{groupname} );
+ my $url = LJ::eurl( $u->journal_base .
"/security/group:$name" );
+
+ my $group_text = $u->get_cap( "security_filter" ) ? "<a
href='$url'>$name</a>" : $name;
+ push @trust_groups, $group_text;
+ }
+
+ $group_names = join( ', ', @trust_groups ) if @trust_groups;
+ }
+ }
+
# format it
my $raw_subj = $req{'subject'};
-
my $s2entry = LJ::S2::Entry($u, {
'subject' => $subject,
'text' => $event,
@@ -261,6 +324,8 @@ body<=
'tags' => \...@taglist,
'userpic' => $userpic,
'permalink_url' => "#",
+ adult_content_level => $req{prop_adult_content},
+ group_names => $group_names,
});
$p->{'multiform_on'} = 0;
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog