[dw-free] apply bare-bones style to feed account journals
[commit: http://hg.dwscoalition.org/dw-free/rev/e1bff2a1889c]
http://bugs.dwscoalition.org/show_bug.cgi?id=1308
Create a basic style for feed journals, which prints out the entry text if
the viewer is logged in, and only prints out the title if the viewer is not
logged in. Does not affect display on your read page.
Also tweak which views are in the navigation, so that feed accounts only
links to recent entries, archive, profile views.
Style by
aveleh.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1308
Create a basic style for feed journals, which prints out the entry text if
the viewer is logged in, and only prints out the title if the viewer is not
logged in. Does not affect display on your read page.
Also tweak which views are in the navigation, so that feed accounts only
links to recent entries, archive, profile views.
Style by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- bin/upgrading/s2layers.dat
- bin/upgrading/s2layers/sitefeeds/layout.s2
- bin/upgrading/s2layers/sitefeeds/themes.s2
- cgi-bin/LJ/S2.pm
- cgi-bin/LJ/User.pm
- cgi-bin/ljdefaults.pl
-------------------------------------------------------------------------------- diff -r c77c702ba49d -r e1bff2a1889c bin/upgrading/s2layers.dat --- a/bin/upgrading/s2layers.dat Fri Jun 25 22:09:07 2010 +0800 +++ b/bin/upgrading/s2layers.dat Sat Jun 26 00:18:38 2010 +0800 @@ -6,6 +6,9 @@ core2 core siteviews/layout layout core2 siteviews/themes theme+ siteviews/layout + +sitefeeds/layout layout(core2base/layout) core2 +sitefeeds/themes theme+ sitefeeds/layout bases/layout layout core2 bases/themes theme+ bases/layout diff -r c77c702ba49d -r e1bff2a1889c bin/upgrading/s2layers/sitefeeds/layout.s2 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/upgrading/s2layers/sitefeeds/layout.s2 Sat Jun 26 00:18:38 2010 +0800 @@ -0,0 +1,143 @@ +layerinfo "type" = "layout"; +layerinfo "name" = "Syndicated Account Style"; +layerinfo redist_uniq = "sitefeeds/layout"; + +# Since this is not user-facing style, don't need to do "property use...". +# "set..." is enough to change a property value +# "property use..." is for exposing settings in the wizard + + +##=============================== +## Display settings - general +##=============================== + +set sidebar_width = "15em"; +set sidebar_width_doubled = "30em"; +set layout_type = "two-columns-right"; +set use_custom_friend_colors = false; +set custom_foreground_element = "userpic_border"; +set custom_background_element = "userpic_background"; +set use_journalstyle_entry_page = false; + +##=============================== +## Display settings - fonts +##=============================== + +set font_base_size = "100"; +set font_base_units = "%"; + +##=============================== +## Display settings - modules +##=============================== + +# explicitly define what sections the layout has available +set module_layout_sections = "none|(none)|one|Group One|two|Group Two"; +set module_userprofile_show = true; +set module_navlinks_show = true; +set module_customtext_show = true; +set module_pagesummary_show = true; +set module_active_show = true; +set module_time_show = true; + +set module_calendar_show = false; +set module_tags_show = false; +set module_links_show = false; +set module_syndicate_show = false; +set module_poweredby_show = false; +set module_credit_show = false; + +set module_userprofile_section = "one"; +set module_navlinks_section = "one"; +set module_customtext_section = "one"; +set module_calendar_section = "one"; +set module_pagesummary_section = "one"; +set module_active_section = "one"; +set module_tags_section = "one"; +set module_links_section = "one"; +set module_syndicate_section = "one"; +set module_time_section = "one"; +set module_poweredby_section = "one"; +set module_credit_section = "one"; + +set module_userprofile_order = 1; +set module_customtext_order = 2; +set module_navlinks_order = 3; +set module_pagesummary_order = 4; +set module_active_order = 5; +set module_time_order = 6; +set module_calendar_order = 7; +set module_tags_order = 8; +set module_links_order = 9; +set module_syndicate_order = 10; +set module_poweredby_order = 11; +set module_credit_order = 12; + +set text_module_customtext = ""; +set text_module_customtext_content = "Articles displayed on this page are retrieved via a public feed supplied by the site for this purpose."; + + + +function print_stylesheet() { + +""" +.entry { + margin-bottom: 1em; +} + +.entry .entry-title { + margin: 0; + padding: 0.2em 0.5em; +} +.entry .datetime { + padding: 0 0.5em; +} +.entry-content { + padding: 0.2em 1em; +} +.entry .footer { + padding: 0 0.5em; +} +"""; +} + +function Page::print_entry(Entry e) +"The meat of each new layout. Describes how each page will look. In nearly all cases, the logic and decision-making processes should come from pre-existing functions in core2, and should not get written here. If you limit the structure of the page to HTML, function calls, and attached CSS, then you will be able to pick up all of the enhancements and accessibility requirements managed by core2." +{ + ## For most styles, this will be overridden by FriendsPage::print_entry and such. + $e->print_wrapper_start(); + """<div class="header">\n"""; + $e->print_subject(); + $e->print_metatypes(); + $e->print_time(); + """</div>\n"""; + """<div>\n"""; + """<div class="contents">\n"""; + """<div class="inner">\n"""; + $e->print_userpic(); + $e->print_poster(); + if (viewer_logged_in()) { + $e->print_text(); + } + $e->print_metadata(); + """</div>\n"""; + """</div>\n"""; + """</div>\n"""; + """<div class="footer">\n"""; + """<div class="inner">\n"""; + $e->print_tags(); + $e->print_management_links(); + if ($this isa EntryPage) { + """<hr class="above-entry-interaction-links" />"""; + $e->print_interaction_links("topcomment"); + $this->print_reply_container({ "target" => "topcomment" }); + """<hr class="below-reply-container" />"""; + } + else { + $e->print_interaction_links(); + } + "</div>\n</div>\n"; + $e->print_wrapper_end(); + +} + + diff -r c77c702ba49d -r e1bff2a1889c bin/upgrading/s2layers/sitefeeds/themes.s2 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/upgrading/s2layers/sitefeeds/themes.s2 Sat Jun 26 00:18:38 2010 +0800 @@ -0,0 +1,10 @@ +#NEWLAYER: sitefeeds/default +layerinfo type = "theme"; +layerinfo name = "Default Theme"; +layerinfo redist_uniq = "sitefeeds/default"; + +set color_entry_background = "#ffffff"; +set color_entry_border = "#000000"; +set color_entry_title = "#ffffff"; +set color_entry_title_background = "#000000"; +set color_page_background = "#cccccc"; diff -r c77c702ba49d -r e1bff2a1889c cgi-bin/LJ/S2.pm --- a/cgi-bin/LJ/S2.pm Fri Jun 25 22:09:07 2010 +0800 +++ b/cgi-bin/LJ/S2.pm Sat Jun 26 00:18:38 2010 +0800 @@ -705,8 +705,10 @@ sub s2_context } }; - if ($styleid eq "siteviews") { + if ( $styleid eq "siteviews" ) { %style = siteviews_style( $u, $remote, $opts{mode} ); + } elsif ( $styleid eq "sitefeeds" ) { + %style = sitefeeds_style(); } if (ref($styleid) eq "CODE") { @@ -878,6 +880,24 @@ sub siteviews_style { return %style; } + +sub sitefeeds_style { + return unless %$LJ::DEFAULT_FEED_STYLE; + + my $public = get_public_layers(); + + my %style; + + # convert the value names to s2layerid + while ( my ( $layer, $name ) = each %$LJ::DEFAULT_FEED_STYLE ) { + next unless $public->{$name}; + my $id = $public->{$name}->{'s2lid'}; + $style{$layer} = $id; + } + + return %style; +} + # parameter is either a single context, or just a bunch of layerids # will then unregister the non-public layers @@ -2146,6 +2166,8 @@ sub Page # Identity (type I) accounts only have read views $p->{views_order} = [ 'read', 'userinfo' ] if $u->is_identity; + # feed accounts only have recent entries views + $p->{views_order} = [ 'recent', 'archive', 'userinfo' ] if $u->is_syndicated; $p->{views_order} = [ 'recent', 'archive', 'read', 'network', 'tags', 'memories', 'userinfo' ] if $u->can_use_network_page; $p->{has_activeentries} = 0; diff -r c77c702ba49d -r e1bff2a1889c cgi-bin/LJ/User.pm --- a/cgi-bin/LJ/User.pm Fri Jun 25 22:09:07 2010 +0800 +++ b/cgi-bin/LJ/User.pm Sat Jun 26 00:18:38 2010 +0800 @@ -8428,6 +8428,11 @@ sub make_journal { return (2, $1); } + # feed accounts have a special style + if ( $u->is_syndicated && %$LJ::DEFAULT_FEED_STYLE ) { + return (2, "sitefeeds"); + } + my $forceflag = 0; LJ::Hooks::run_hooks("force_s1", $u, \$forceflag); diff -r c77c702ba49d -r e1bff2a1889c cgi-bin/ljdefaults.pl --- a/cgi-bin/ljdefaults.pl Fri Jun 25 22:09:07 2010 +0800 +++ b/cgi-bin/ljdefaults.pl Sat Jun 26 00:18:38 2010 +0800 @@ -26,6 +26,12 @@ 'core' => 'core1', 'layout' => 'generator/layout', 'i18n' => 'generator/en', + }; + + $DEFAULT_FEED_STYLE ||= { + core => 'core2', + layout => 'sitefeeds/layout', + theme => 'sitefeeds/default', }; # cluster 0 is no longer supported --------------------------------------------------------------------------------
no subject