[dw-free] Allow user to specify a reason for an entry being marked as 14+/18+
[commit: http://hg.dwscoalition.org/dw-free/rev/6c26c423dbe1]
http://bugs.dwscoalition.org/show_bug.cgi?id=15
Allow specifying reason for adult content restriction.
Patch by
exor674.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=15
Allow specifying reason for adult content restriction.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- bin/upgrading/en.dat
- cgi-bin/DW/Setting/AdultContentReason.pm
- htdocs/manage/settings/index.bml
-------------------------------------------------------------------------------- diff -r 6228d9286ad0 -r 6c26c423dbe1 bin/upgrading/en.dat --- a/bin/upgrading/en.dat Sat Mar 21 23:52:54 2009 +0000 +++ b/bin/upgrading/en.dat Sat Mar 21 23:54:27 2009 +0000 @@ -2471,6 +2471,8 @@ setting.adultcontent.option.select.none= setting.adultcontent.option.self=This journal contains content suitable for +setting.adultcontentreason.label=Adult Content Reason + setting.bio.desc|notes=There shouldn't be a description unless the page specifies one setting.bio.desc=_none diff -r 6228d9286ad0 -r 6c26c423dbe1 cgi-bin/DW/Setting/AdultContentReason.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/DW/Setting/AdultContentReason.pm Sat Mar 21 23:54:27 2009 +0000 @@ -0,0 +1,48 @@ +package DW::Setting::AdultContentReason; +use base 'LJ::Setting'; +use strict; +use warnings; +use LJ::Constants; + +sub should_render { + my ( $class, $u ) = @_; + + return !LJ::is_enabled( "content_flag" ) || !$u || $u->is_identity ? 0 : 1; +} + +sub label { + return $_[0]->ml( 'setting.adultcontentreason.label' ); +} + +sub option { + my ( $class, $u, $errs, $args ) = @_; + + my $key = $class->pkgkey; + my $ret; + + $ret .= LJ::html_text({ + name => "${key}reason", + id => "${key}reason", + class => "text", + value => $errs ? $class->get_arg( $args, "reason" ) : $u->adult_content_reason, + size => 60, + maxlength => 255, + }); + + my $errdiv = $class->errdiv( $errs, "reason" ); + $ret .= "<br />$errdiv" if $errdiv; + + return $ret; +} + +sub save { + my ( $class, $u, $args ) = @_; + + my $txt = $class->get_arg( $args, "reason" ); + $txt = LJ::trim( $txt || "" ); + $txt = LJ::text_trim( $txt, 0, 255 ); + $u->set_prop( "adult_content_reason", $txt ); + return 1; +} + +1; diff -r 6228d9286ad0 -r 6c26c423dbe1 htdocs/manage/settings/index.bml --- a/htdocs/manage/settings/index.bml Sat Mar 21 23:52:54 2009 +0000 +++ b/htdocs/manage/settings/index.bml Sat Mar 21 23:54:27 2009 +0000 @@ -65,6 +65,7 @@ body<= LJ::Setting::CtxPopup LJ::Setting::SiteScheme LJ::Setting::AdultContent + DW::Setting::AdultContentReason LJ::Setting::ViewingAdultContent LJ::Setting::SafeSearch LJ::Setting::CyrillicServices --------------------------------------------------------------------------------