Add syndicated level setting under privacy tab in manage/settings.
Patch by kareila.
diffs (131 lines):
diff -r 3e0fbecc06b7 -r 7a0fbc442c67 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat Thu Jul 09 17:28:18 2009 +0000
+++ b/bin/upgrading/en.dat Fri Jul 10 19:11:51 2009 +0000
@@ -2839,6 +2839,22 @@ setting.stylemine.label=Comment Pages
setting.stylemine.option=View comment pages from my Friends page in my own
style
+setting.synlevel.error.invalid=Invalid syndication level.
+
+setting.synlevel.label=Syndication Level
+
+setting.synlevel.option=Display the following level of content in my journal's
feed:
+
+setting.synlevel.option.note=(Feed links: <a [[aopts_atom]]>Atom</a> <a
[[aopts_rss]]>RSS</a>)
+
+setting.synlevel.option.select.cut=Cut Tag
+
+setting.synlevel.option.select.full=Full Text
+
+setting.synlevel.option.select.summary=Brief Summary
+
+setting.synlevel.option.select.title=Title Only
+
setting.timezone.error.invalid=Invalid time zone.
setting.timezone.label=Time Zone
diff -r 3e0fbecc06b7 -r 7a0fbc442c67 cgi-bin/DW/Setting/SynLevel.pm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cgi-bin/DW/Setting/SynLevel.pm Fri Jul 10 19:11:51 2009 +0000
@@ -0,0 +1,90 @@
+#!/usr/bin/perl
+#
+# DW::Setting::SynLevel
+#
+# LJ::Setting module for selecting the syndication level for a journal's
+# RSS or Atom feed.
+#
+# Authors:
+# Jen Griffin <[email protected]>
+#
+# Copyright (c) 2009 by Dreamwidth Studios, LLC.
+#
+# This program is free software; you may redistribute it and/or modify it under
+# the same terms as Perl itself. For a copy of the license, please reference
+# 'perldoc perlartistic' or 'perldoc perlgpl'.
+#
+
+package DW::Setting::SynLevel;
+use base 'LJ::Setting';
+use strict;
+use warnings;
+
+sub should_render {
+ my ( $class, $u ) = @_;
+ return $u->is_identity ? 0 : 1;
+}
+
+sub label {
+ return $_[0]->ml( 'setting.synlevel.label' );
+}
+
+sub option {
+ my ( $class, $u, $errs, $args ) = @_;
+ my $key = $class->pkgkey;
+
+ my $synlevel = $class->get_arg( $args, "synlevel" ) || $u->prop(
"opt_synlevel" );
+
+ my @options = (
+ "cut" => $class->ml( 'setting.synlevel.option.select.cut' ),
+ "full" => $class->ml( 'setting.synlevel.option.select.full' ),
+ "summary" => $class->ml( 'setting.synlevel.option.select.summary' ),
+ "title" => $class->ml( 'setting.synlevel.option.select.title' ),
+ );
+
+ my $ret;
+
+ $ret .= " <label for='${key}synlevel'>";
+ $ret .= $class->ml( 'setting.synlevel.option' );
+ $ret .= "</label>";
+
+ $ret .= LJ::html_select( {
+ name => "${key}synlevel",
+ id => "${key}synlevel",
+ selected => $synlevel,
+ }, @options );
+
+ my $userdomain = $u->journal_base;
+
+ $ret .= "<br />" . $class->ml( 'setting.synlevel.option.note', {
+ aopts_atom => "href='http://$userdomain/data/atom'",
+ aopts_rss => "href='http://$userdomain/data/rss'",
+ } );
+
+ my $errdiv = $class->errdiv( $errs, "synlevel" );
+ $ret .= "<br />$errdiv" if $errdiv;
+
+ return $ret;
+}
+
+sub error_check {
+ my ( $class, $u, $args ) = @_;
+ my $val = $class->get_arg( $args, "synlevel" );
+
+ $class->errors( synlevel => $class->ml( 'setting.synlevel.error.invalid' )
)
+ unless ! $val || $val =~ /^(cut|full|summary|title)$/;
+
+ return 1;
+}
+
+sub save {
+ my ( $class, $u, $args ) = @_;
+ $class->error_check( $u, $args );
+
+ my $val = $class->get_arg( $args, "synlevel" );
+ $u->set_prop( "opt_synlevel" => $val );
+
+ return 1;
+}
+
+1;
diff -r 3e0fbecc06b7 -r 7a0fbc442c67 htdocs/manage/settings/index.bml
--- a/htdocs/manage/settings/index.bml Thu Jul 09 17:28:18 2009 +0000
+++ b/htdocs/manage/settings/index.bml Fri Jul 10 19:11:51 2009 +0000
@@ -103,6 +103,7 @@ body<=
settings => [qw(
DW::Setting::EmailAlias
LJ::Setting::MinSecurity
+ DW::Setting::SynLevel
LJ::Setting::SearchInclusion
LJ::Setting::NotifyWeblogs
LJ::Setting::FacebookBeacon
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog