[dw-free] Remember the option for "Disable Auto-Formatting"
[commit: http://hg.dwscoalition.org/dw-free/rev/aea86f59e0d6]
http://bugs.dwscoalition.org/show_bug.cgi?id=1677
Remember the last used setting of 'preformatting' on post.
Patch by
afuna.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1677
Remember the last used setting of 'preformatting' on post.
Patch by
Files modified:
- bin/upgrading/proplists.dat
- cgi-bin/LJ/User.pm
- cgi-bin/weblib.pl
- htdocs/update.bml
--------------------------------------------------------------------------------
diff -r 5cbdb67acc8b -r aea86f59e0d6 bin/upgrading/proplists.dat
--- a/bin/upgrading/proplists.dat Thu Dec 03 05:38:36 2009 +0000
+++ b/bin/upgrading/proplists.dat Thu Dec 03 05:42:32 2009 +0000
@@ -133,6 +133,14 @@ userproplist.delicious:
indexed: 0
multihomed: 0
prettyname: Delicious user account name
+
+userproplist.disable_auto_formatting:
+ cldversion: 4
+ datatype: bool
+ des: Disable auto-formatting on entries by default for this user
+ indexed: 0
+ multihomed: 0
+ prettyname: User's default value for auto formatting on their entries
userproplist.disable_comm_promo:
cldversion: 4
diff -r 5cbdb67acc8b -r aea86f59e0d6 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm Thu Dec 03 05:38:36 2009 +0000
+++ b/cgi-bin/LJ/User.pm Thu Dec 03 05:42:32 2009 +0000
@@ -2105,10 +2105,19 @@ sub count_usermessage_length {
return $_[0]->get_cap( 'usermessage_length' );
}
-
# returns the country specified by the user
sub country {
return $_[0]->prop( 'country' );
+}
+
+sub disable_auto_formatting {
+ my ( $u, $value ) = @_;
+ if ( defined $value && $value =~ /[01]/ ) {
+ $u->set_prop( disable_auto_formatting => $value );
+ return $value;
+ }
+
+ return $u->prop( 'disable_auto_formatting' ) ? 1 : 0;
}
sub exclude_from_own_stats {
diff -r 5cbdb67acc8b -r aea86f59e0d6 cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl Thu Dec 03 05:38:36 2009 +0000
+++ b/cgi-bin/weblib.pl Thu Dec 03 05:42:32 2009 +0000
@@ -1379,7 +1379,7 @@ sub entry_form {
$out .= "<li class='media'><a href='javascript:void(0);' onclick='InOb.handleInsertEmbed();' title='Embed Media'>"
. "Embed Media</a></li>\n" if LJ::is_enabled('embed_module');
$out .= "</ul>\n";
- my $format_selected = $opts->{'prop_opt_preformatted'} || $opts->{'event_format'} ? "checked='checked'" : "";
+ my $format_selected = ( $opts->{mode} eq "update" && $remote && $remote->disable_auto_formatting ) || $opts->{'prop_opt_preformatted'} || $opts->{'event_format'} ? "checked='checked'" : "";
$out .= "<span id='linebreaks'><input type='checkbox' class='check' value='preformatted' name='event_format' id='event_format' $format_selected />
<label for='event_format'>" . BML::ml('entryform.format3') . "</label>" . LJ::help_icon_html("noautoformat", "", " ") . "</span>\n";
$out .= "</div>\n\n";
diff -r 5cbdb67acc8b -r aea86f59e0d6 htdocs/update.bml
--- a/htdocs/update.bml Thu Dec 03 05:38:36 2009 +0000
+++ b/htdocs/update.bml Thu Dec 03 05:42:32 2009 +0000
@@ -414,6 +414,9 @@
# update succeeded
$$body .= "<?p <strong>$ML{'.update.status.succeeded'}</strong> ";
+ # persist the default value of the disable auto-formatting option
+ $u->disable_auto_formatting( $POST{event_format} ? 1 : 0 );
+
# Clear out a draft
$remote->set_prop('entry_draft', '')
if $remote;
--------------------------------------------------------------------------------

no subject
Shouldn't that be /^[01]$/ ? (Or /\A[01]\z/ to be even more nit-picky.)
Otherwise values such as "You got 0wned" will match.
no subject