Janine (janinedog) wrote in changelog,
Janine
janinedog
changelog

[livejournal] r14758: LJSUP-3592

Committer: janine
LJSUP-3592

Take settings page out of beta.

U   trunk/cgi-bin/weblib.pl
U   trunk/htdocs/manage/profile/index.bml
U   trunk/htdocs/manage/settings/index.bml
U   trunk/htdocs/manage/subscriptions/comments.bml
U   trunk/htdocs/manage/subscriptions/entry.bml
U   trunk/htdocs/manage/subscriptions/user.bml
Modified: trunk/cgi-bin/weblib.pl
===================================================================
--- trunk/cgi-bin/weblib.pl	2009-01-06 20:30:55 UTC (rev 14757)
+++ trunk/cgi-bin/weblib.pl	2009-01-07 21:11:48 UTC (rev 14758)
@@ -3278,7 +3278,7 @@
     }
 
     if ($post_to_settings_page) {
-        $ret .= "<form method='POST' action='$LJ::SITEROOT/manage/settings/index2.bml?cat=notifications'>$formauth";
+        $ret .= "<form method='POST' action='$LJ::SITEROOT/manage/settings/?cat=notifications'>$formauth";
     } elsif (!$settings_page) {
         $ret .= "<form method='POST' action='$LJ::SITEROOT/manage/subscriptions/$getextra'>$formauth";
     }
@@ -3504,7 +3504,7 @@
 
             if ($is_tracking_category && ! $pending_sub->pending) {
                 my $subid = $pending_sub->id;
-                my $deletesub_url = $settings_page ? "$LJ::SITEROOT/manage/settings/index2.bml?cat=notifications&deletesub_$subid=1" : "?deletesub_$subid=1";
+                my $deletesub_url = $settings_page ? "$LJ::SITEROOT/manage/settings/?cat=notifications&deletesub_$subid=1" : "?deletesub_$subid=1";
                 $cat_html .= qq {
                     <a href='$deletesub_url'><img src="$LJ::IMGPREFIX/portal/btn_del.gif" /></a>
                 };

Modified: trunk/htdocs/manage/profile/index.bml
===================================================================
--- trunk/htdocs/manage/profile/index.bml	2009-01-06 20:30:55 UTC (rev 14757)
+++ trunk/htdocs/manage/profile/index.bml	2009-01-07 21:11:48 UTC (rev 14758)
@@ -40,6 +40,7 @@
 
     # extra arguments for get requests
     my $getextra = $authas ne $remote->{'user'} ? "?authas=$authas" : '';
+    my $getsep = $getextra ? "&" : "?";
 
     ### user is now authenticated ###
 
@@ -100,7 +101,7 @@
         $ret .= "</form>\n\n";
 
         $ret .= "<?p " . BML::ml(".intro1", { 'aopts1' => "href='$LJ::SITEROOT/manage/comments/$getextra'",
-                                             'aopts2' => "href='$LJ::SITEROOT/manage/settings/$getextra'"} )
+                                             'aopts2' => "href='$LJ::SITEROOT/manage/settings/$getextra${getsep}cat=display'"} )
                 . " p?>";
 
         $ret .= "</div>\n";
@@ -291,11 +292,7 @@
                                 "N" => BML::ml(".security.visibility.nobody"));
         $ret .= "</span></div>";
 
-        if ($remote->is_in_beta('settings2008')) {
-            $ret .= LJ::Widget::Location->render( skip_timezone => 1 );
-        } else {
-            $ret .= LJ::Widget::Location->render;
-        }
+        $ret .= LJ::Widget::Location->render( skip_timezone => 1 );
 
 
         ## CONTACT INFO
@@ -394,19 +391,17 @@
                                          'selected' => $u->hide_ljtalk });
                 $ret .= "<label for='opt_showljtalk' style='font-size: 10px;'>$ML{'.showljtalk'}</label>";
 
-                if ($remote->is_in_beta('settings2008')) {
-                    # Jabber Online Status
-                    my $jabber_title = LJ::run_hook("jabber_title") || $ML{'/manage/settings/index.bml.jabber.title'};
-                    $ret .= "<br />";
-                    $ret .= BML::ml('/manage/settings/index.bml.jabber', {'jabbertitle' => $jabber_title}) . " ";
-                    $ret .= LJ::html_select({ 'name' => 'opt_showonlinestatus',
-                                              'id' => 'opt_showonlinestatus',
-                                              'selected' => $u->opt_showonlinestatus },
-                                              "Y" => BML::ml("/manage/settings/index.bml.security.visibility.everybody"),
-                                              "F" => BML::ml("/manage/settings/index.bml.security.visibility.friends"),
-                                              "N"  => BML::ml("/manage/settings/index.bml.security.visibility.nobody") );
-                    $ret .= "<br />\n<span class='helper'>" . BML::ml('/manage/settings/index.bml.jabber.text', {'jabbertitle' => $jabber_title}) . "</span>";
-                }
+                # Jabber Online Status
+                my $jabber_title = LJ::run_hook("jabber_title") || $ML{'/manage/settings/index.bml.jabber.title'};
+                $ret .= "<br />";
+                $ret .= BML::ml('/manage/settings/index.bml.jabber', {'jabbertitle' => $jabber_title}) . " ";
+                $ret .= LJ::html_select({ 'name' => 'opt_showonlinestatus',
+                                          'id' => 'opt_showonlinestatus',
+                                          'selected' => $u->opt_showonlinestatus },
+                                          "Y" => BML::ml("/manage/settings/index.bml.security.visibility.everybody"),
+                                          "F" => BML::ml("/manage/settings/index.bml.security.visibility.friends"),
+                                          "N"  => BML::ml("/manage/settings/index.bml.security.visibility.nobody") );
+                $ret .= "<br />\n<span class='helper'>" . BML::ml('/manage/settings/index.bml.jabber.text', {'jabbertitle' => $jabber_title}) . "</span>";
             }
             $ret .= "</td></tr>\n";
         }
@@ -666,9 +661,7 @@
             # In this case, the question is actually if they want to hide
             # it, hence looking for a value of 'N' before 'Y'.
             $POST{'opt_showljtalk'} = $POST{'opt_showljtalk'} ? 'N' : 'Y';
-            if ($remote->is_in_beta('settings2008')) {
-                $POST{'opt_showonlinestatus'} = '' unless $POST{'opt_showonlinestatus'} =~ m/^(Y|F|N)$/;
-            }
+            $POST{'opt_showonlinestatus'} = '' unless $POST{'opt_showonlinestatus'} =~ m/^(Y|F|N)$/;
 
             # for the directory.
             $POST{'sidx_bdate'} = undef;
@@ -698,10 +691,8 @@
               sidx_bdate sidx_bday
               opt_showmutualfriends opt_showschools
               opt_showbday opt_showlocation opt_showljtalk
-              opt_sharebday
+              opt_sharebday opt_showonlinestatus
             );
-            push @uprops, "opt_showonlinestatus"
-                if $remote->is_in_beta('settings2008');
 
             # reset the gizmo account for this user account
             $u->gizmo_account( $POST{'gizmo'} )

Modified: trunk/htdocs/manage/settings/index.bml
===================================================================
--- trunk/htdocs/manage/settings/index.bml	2009-01-06 20:30:55 UTC (rev 14757)
+++ trunk/htdocs/manage/settings/index.bml	2009-01-07 21:11:48 UTC (rev 14758)
@@ -1,662 +1,530 @@
 <?page
-title=><?_code return $ML{'.title'} _code?>
 body<=
 <?_code
-    LJ::set_active_crumb('editsettings');
-    return;
-_code?>
-
-<?_code
 {
     use strict;
-    use vars qw(%POST %GET $head);
+    use vars qw(%GET %POST $title $windowtitle $headextra @errors @warnings);
 
-    my $print_with_ad = sub {
-        my $str = shift;
+    BML::set_language_scope('/manage/settings/index.bml');
 
-        my $ad_full_width = LJ::get_ads({ location => 'bml.manage.settings/error', ljadwrapper => 1 });
-        return $ad_full_width . $str;
-    };
+    LJ::need_res("stc/settings.css", "js/settings.js");
+    LJ::set_active_crumb('manage');
 
-    return $print_with_ad->(LJ::server_down_html()) if $LJ::SERVER_DOWN;
-
     my $remote = LJ::get_remote();
-
-    # these need to be declared out here, due to scoping issues
-    my $getextra;
-    my $u;
     my $authas;
-    my %saved;
+    my $u;
 
     if ($remote) {
-        $authas = $GET{'authas'} || $remote->{'user'};
+        $authas = $GET{authas} || $remote->user;
         $u = LJ::get_authas_user($authas);
-        return $print_with_ad->(LJ::bad_input($ML{'.you.could.not.auth'}))
+        return LJ::bad_input($ML{'error.invalidauth'})
             unless $u;
+    }
 
-        return $print_with_ad->($LJ::MSG_READONLY_USER) if $u->readonly;
+    my @cats_order = qw(
+        account
+        display
+        notifications
+        mobile
+        privacy
+        history
+    );
 
-        # extra arguments for get requests
-        $getextra = $authas ne $remote->{'user'} ? "?authas=$authas" : '';
+    # the different navigation categories and their settings
+    my %cats_with_settings = (
+        account => {
+            name => $ML{'.cat.account'},
+            visible => 1,
+            disabled => !$u ? 1 : 0,
+            form => 0,
+            desc => $ML{'.cat.account.desc'},
+            settings => [qw(
+                LJ::Setting::Display::AccountLevel
+                LJ::Setting::Display::AccountStatus
+                LJ::Setting::Display::Username
+                LJ::Setting::Display::Email
+                LJ::Setting::Display::Password
+                LJ::Setting::Display::SecretQuestion
+                LJ::Setting::Display::DomainMapping
+            )],
+        },
+        display => {
+            name => $ML{'.cat.display'},
+            visible => 1,
+            disabled => 0,
+            form => 1,
+            desc => $ML{'.cat.display.desc'},
+            settings => [qw(
+                LJ::Setting::Language
+                LJ::Setting::TimeZone
+                LJ::Setting::ImagePlaceholders
+                LJ::Setting::EmbedPlaceholders
+                LJ::Setting::GraphicPreviews
+                LJ::Setting::EmailFormat
+                LJ::Setting::EntryEditor
+                LJ::Setting::StyleAlwaysMine
+                LJ::Setting::StyleMine
+                LJ::Setting::CtxPopup
+                LJ::Setting::GettingStarted
+                LJ::Setting::SiteScheme
+                LJ::Setting::AdultContent
+                LJ::Setting::ViewingAdultContent
+                LJ::Setting::SafeSearch
+                LJ::Setting::CyrillicServices
+            )],
+        },
+        notifications => {
+            name => $ML{'.cat.notifications'},
+            visible => 1,
+            disabled => !$u || $u->is_community ? 1 : 0,
+            form => 1,
+            desc => $ML{'.cat.notifications.desc'},
+            settings => [qw(
+                LJ::Setting::CommentEmailNotify
+                LJ::Setting::SelfCommentEmail
+            )],
+        },
+        mobile => {
+            name => $ML{'.cat.mobile'},
+            visible => 1,
+            disabled => !$u || $u->is_community ? 1 : 0,
+            form => 1,
+            desc => $ML{'.cat.mobile.desc'},
+            settings => [qw(
+                LJ::Setting::VoicePosting
+                LJ::Setting::SMS
+                LJ::Setting::EmailPosting
+                LJ::Setting::Display::MobileApps
+            )],
+        },
+        privacy => {
+            name => $ML{'.cat.privacy'},
+            visible => 1,
+            disabled => !$u ? 1 : 0,
+            form => 1,
+            desc => $ML{'.cat.privacy.desc'},
+            settings => [qw(
+                LJ::Setting::MinSecurity
+                LJ::Setting::SearchInclusion
+                LJ::Setting::ContentPromotion
+                LJ::Setting::NotifyWeblogs
+                LJ::Setting::FacebookBeacon
+                LJ::Setting::EnableComments
+                LJ::Setting::CommentScreening
+                LJ::Setting::CommentCaptcha
+                LJ::Setting::CommentIP
+                LJ::Setting::Display::BanUsers
+                LJ::Setting::FindByEmail
+            )],
+        },
+        history => {
+            name => $ML{'.cat.history'},
+            visible => 1,
+            disabled => !$u || $u->is_community ? 1 : 0,
+            form => 0,
+            desc => $ML{'.cat.history.desc'},
+            settings => [qw(
+                LJ::Setting::Display::Logins
+                LJ::Setting::Display::Payments
+                LJ::Setting::Display::Emails
+                LJ::Setting::Display::EmailPosts
+                LJ::Setting::Display::SMSHistory
+                LJ::Setting::Display::GiftCerts
+            )],
+        },
+    );
 
-        if ($remote->is_in_beta('settings2008')) {
-            my $getsep = $getextra ? "&" : "?";
-            return BML::redirect("$LJ::SITEROOT/manage/settings/index2.bml$getextra${getsep}cat=display");
-        }
+    LJ::run_hook("settings_extra_cats", \@cats_order, \%cats_with_settings, user => $u);
 
-        ### user is now authenticated ###
+    my $given_cat = $GET{cat};
+    if ($u) {
+        $given_cat = "account"
+            unless defined $cats_with_settings{$given_cat} &&
+                   $cats_with_settings{$given_cat}->{visible} &&
+                   !$cats_with_settings{$given_cat}->{disabled};
+    } else {
+        $given_cat = "display";
+    }
 
-        # load user props
-        LJ::load_user_props(
-                            $u, { use_master => 1 },
-                            qw(
-                               opt_imagelinks
-                               opt_stylemine
-                               opt_stylealwaysmine
-                               opt_blockrobots
-                               opt_weblogscom
-                               opt_ctxpopup
-                               opt_showonlinestatus
-                               newpost_minsecurity
-                               default_copyright
-                               )
-                            );
+    my @settings = @{$cats_with_settings{$given_cat}->{settings}};
 
-        # to store values before they undergo normalisation
-        %saved = ();
+    # remove any settings that don't exist for this category
+    my $remove_setting = sub {
+        my $el_ref = shift;
 
-        # clean userprops
-        foreach (values %$u) { LJ::text_out(\$_); }
-    }
+        splice(@settings, $$el_ref, 1);
+        $$el_ref--;
+    };
+    for (my $i = 0; $i < scalar @settings; $i++) {
+        my $setting = $settings[$i];
 
-    # thumb schemes have thumbnails
-        # text schemes are in a drop-down
-    my @thumb_schemes;
-    my @text_schemes;
-    my @bml_schemes = LJ::site_schemes();
-    foreach (@bml_schemes) {
-        if (ref $_->{'thumb'} eq 'ARRAY') {
-            push @thumb_schemes, $_;
+        if (eval "use $setting; 1;") {
+            $remove_setting->(\$i) unless $setting->should_render($u);
         } else {
-            push @text_schemes, $_;
+            $remove_setting->(\$i);
         }
     }
 
+    my $save_rv;
+    my $submit_msg;
+    if (LJ::did_post()) {
+        return LJ::bad_input($ML{'error.invalidform'})
+            unless LJ::check_form_auth();
 
-    ###
-    ### no post, show edit form
-    ###
-    $head = "";
+        if ($given_cat eq "notifications") {
+            my @notif_errors;
 
-    unless (LJ::did_post()) {
-        my $ret;
+            # do they want to add or edit subscriptions?
+            next unless $POST{mode} eq 'save_subscriptions';
 
-        if ($remote) {
-            $ret .= "<div>";
-            # user switcher
-            $ret .= "<form method='get' action='index.bml'>\n";
-            $ret .= LJ::make_authas_select($remote, { 'authas' => $GET{'authas'} });
-            $ret .= "</form>\n\n";
-            $ret .= "</div>\n";
-        }
+            my @sub_edit;
+            my @to_consider;
+            my @to_activate;
 
-        $ret .= "<?p " . BML::ml('.intro2', { aopts1 => "href='$LJ::SITEROOT/manage/profile/'", aopts2 => "href='$LJ::SITEROOT/manage/comments/'" }) . " p?>"
-            if $remote;
-        $ret .= BML::ml('.you.can.change', {
-        "login"=>"href='$LJ::SITEROOT/login.bml?ret=1'",
-        "create"=>"href='$LJ::SITEROOT/create.bml'",
-        }) unless $remote;
+            foreach my $postkey (keys %POST) {
+                my $subscr;
+                my $old_postkey = $postkey;
+                my $old = $postkey =~ /-old$/;
 
-        $ret.= "<div class='ljclear'></div>\n";
+                # are there other options for this pending subscription? if so, process those not this one
+                next if $postkey =~ /\.arg\d/;
 
-        $ret .= "<form method='post' action='$LJ::SITEROOT/manage/settings/$getextra'>\n";
-        $ret .= LJ::form_auth()
-            if $remote;
+                $subscr = LJ::Subscription->thaw($postkey, $u, \%POST) or next;
 
-        # personal information
-        $ret .= "<div class='section_head'> $ML{'.section.viewing'}</div>\n";
-        $ret .= "<table class='field_block'>\n";
+                if ($subscr->pending) {
+                    push @to_consider, $subscr;
+                } else {
+                    push @to_activate, $subscr if !$old && !$subscr->active;
+                }
 
-        unless ($remote && $u->is_community()) {
-            # scheme selector
-            if (@bml_schemes) {
-                $ret .= "<tr><td class='field_name'>$ML{'.fn.scheme'}</td><td>\n";
+                # remove old string
+                $postkey =~ s/-old// if $old;
 
-                # display hidden schemes?
-                my $show_hidden = $GET{"view"} eq "schemes";
+                next unless $old;
 
-                my $scheme = BML::get_scheme() || $BML::COOKIE{'BMLschemepref'} || $bml_schemes[0]->{'scheme'};
+                my $oldvalue = $POST{$old_postkey};
+                my $checked = $POST{$postkey};
 
-                if (@thumb_schemes) {
-                    my $cols = 3;
-                    my $width = int(100 / $cols +.5) . "%";
+                push @sub_edit, [
+                                 $subscr,
+                                 $checked,
+                                 $oldvalue,
+                                 ];
+            }
 
-                    foreach my $sh (@thumb_schemes) {
-                        next unless !$sh->{'hidden'} || $show_hidden;
-                        my $th = $sh->{'thumb'};
-                        $ret .= "\n<div style='float: left; margin: 0px 10px 10px 5px;'><h3>";
-                        $ret .= LJ::html_check({ 'type' => 'radio', 'name' => 'scheme',
-                                             'value' => $sh->{'scheme'},
-                                             'id' => "scheme-$sh->{'scheme'}",
-                                             'selected' => $scheme eq $sh->{'scheme'} });
-                        $ret .= "$sh->{'title'}</h3>";
-                        $ret .= "<label for='scheme-$sh->{'scheme'}'><img ";
-                        $ret .= "src='$LJ::IMGPREFIX/$th->[0]'";
-                        $ret .= " width='$th->[1]'" if $th->[1];
-                        $ret .= " height='$th->[2]'" if $th->[2];
+            # first process deletions
+            foreach my $edit_info (@sub_edit) {
+                my ($subscr, $checked, $oldvalue) = @$edit_info;
 
-                        $ret .= "style='border: solid 1px black; margin: 1px;' ";
-                        my $alt = BML::ml('.scheme.preview', {'title' => $sh->{'title'},});
-                        $ret .= " alt='$alt' title='$sh->{'title'}' /></label></div>\n";
-                    }
-                    $ret .= "<div class='ljclear'></div>";
+                if (!$checked && $oldvalue && $subscr->method->configured_for_user($u)) {
+                    # if it's not checked and is currently a real subscription, deactivate it
+                    # unless we disabled it for them (disabled checkboxes don't POST)
+                    $subscr->deactivate;
                 }
+            }
 
-                # have to check this here, so we don't output HTML that never gets used.
-                # only display if we're showing hidden schemes, or if we have a scheme
-                # that isn't hidden in the first place.
-                if (grep { $show_hidden || !$_->{hidden} } @text_schemes) {
-                    my $ct = 0;
-                    my $cols = 3;
-                    my $width = int(100 / $cols +.5) . "%";
-                    my $switch = @text_schemes / $cols;
+            # then process new subs and activations
+            foreach my $subscr (@to_activate) {
+                my @inbox_subs = grep { $_->active && $_->enabled } $u->find_subscriptions(method => 'Inbox');
 
-                    $ret .= "<table border='0' width='100%' cellpadding='2'>";
-                    $ret .= "<tr valign='top' align='left'>";
+                if ((scalar @inbox_subs) >= $u->max_subscriptions) {
+                    # too many, sorry
+                    push @notif_errors, LJ::errobj("Subscription::TooMany", subscr => $subscr, u => $u);
+                } else {
+                    # all is good, reactivate it
+                    $subscr->activate;
+                }
+            }
 
-                    foreach my $sh (@text_schemes) {
-                        next unless !$sh->{'hidden'} || $show_hidden;
+            # Define limits
+            my $paid_max = LJ::get_cap('paid', 'subscriptions');
+            my $u_max  = $u->max_subscriptions;
+            # max for total number of subscriptions (generally it is $paid_max)
+            my $system_max  = $u_max > $paid_max ? $u_max : $paid_max;
 
-                        if ($ct == 0) {
-                            $ret .= "<td width='$width' align='left'>";
-                        }
+            my $inbox_ntypeid = LJ::NotificationMethod::Inbox->ntypeid;
+            my @other_ntypeid_to_consider;
 
-                        $ret .= "<p>" .
-                            LJ::html_check({ 'type' => 'radio', 'name' => 'text_scheme',
-                                             'value' => $sh->{'scheme'},
-                                             'id' => "scheme-$sh->{'scheme'}",
-                                             'selected' => $scheme eq $sh->{'scheme'} });
+            # process new inbox subs
+            foreach my $subscr (@to_consider) {
+                # if this is not an inbox sub, check it
+                if ($subscr->ntypeid != $inbox_ntypeid) {
+                    push @other_ntypeid_to_consider, $subscr;
+                } else {
+                    # this is an inbox subscription, save it
+                    my @all_subs = $u->find_subscriptions(method => 'Inbox');
+                    my @active_subs = grep { $_->active && $_->enabled } @all_subs;
 
-                        $ret .= "<label for='scheme-$sh->{'scheme'}'>$sh->{'title'}</label></p>";
-
-                        if (++$ct >= $switch) {
-                            $ret .= "</td>";
-                            $ct = 0;
-                        }
+                    if (@active_subs >= $u_max) {
+                        push @notif_errors, LJ::errobj("Subscription::TooMany", subscr => $subscr, u => $u);
+                    } elsif (@all_subs >= $system_max) {
+                        push @notif_errors, LJ::errobj("Subscription::TooManySystemMax", subscr => $subscr, u => $u, max => $system_max);
+                    } else {
+                        # save this for consideration after we've processed all inbox subscriptions first
+                        $subscr->commit;
                     }
-
-                    $ret .= "</tr><tr><td colspan='$cols' align='left'>";
-                    $ret .= "</td></tr></table>";
                 }
-                $ret .= "</td></tr>\n";
             }
 
-            # Language
-            $ret .= "<tr><td class='field_name'>$ML{'.fn.language'}</td>\n<td>";
-            $ret .= "<b style='white-space: nowrap'>$ML{'.language'} </b>\n";
+            # process all other new subs
+            foreach my $subscr (@other_ntypeid_to_consider) {
+                my %inbox_sub_params = $subscr->sub_info;
+                # don't save a subscription if there is no corresponding inbox sub for it
+                $inbox_sub_params{ntypeid} = $inbox_ntypeid;
+                delete $inbox_sub_params{flags};
 
-            my $curr = BML::get_language();
-            my @inc;
-            push @inc, $GET{'addlang'} if $GET{'addlang'};
-            my $list = LJ::Lang::get_lang_names(@LJ::LANGS, @inc);
-            $ret .= LJ::html_select({ 'name' => 'lang',
-                                      selected => $curr}, @$list);
-            $ret .= "</td></tr>\n";
-        }
+                my ($inbox_sub) = $u->has_subscription(%inbox_sub_params);
 
-        # logged-out users end this page early
-        unless ($remote) {
-            $ret .= "</table>";
-        }
+                # If Inbox is always on, then act like an Inbox sub exists
+                my $always_checked = $subscr->event_class->always_checked ? 1 : 0;
+                next if (!$always_checked && !($inbox_sub && $inbox_sub->active && $inbox_sub->enabled));
 
-        if ($remote) { # everything from here on down only applies to logged-in users
+                my @all_subs = $u->find_subscriptions(method => $subscr->method);
+                my @active_subs = grep { $_->active && $_->enabled } @all_subs;
 
-        # Additional settings
-        $ret .= LJ::run_hook('additional_custom_settings', $u);
-        
-        # Graphic Previews
-        my $graphicpreviews_obj = LJ::graphicpreviews_obj();
-        if ($graphicpreviews_obj->is_enabled($u)) {
-            $ret .= "<tr><td class='field_name'>$ML{'.fn.graphicpreviews'}</td>\n<td>";
-            $ret .= LJ::html_check({ 'type' => 'check', 'name' => 'show_graphic_previews', 'id' => 'show_graphic_previews',
-                                     'value' => 1, 'selected' => $graphicpreviews_obj->should_render($u) });
-            $ret .= " <label for='show_graphic_previews'>$ML{'.graphicpreviews.desc'}</label>";
-            $ret .= " " . LJ::help_icon("graphic_previews") . "<br />\n";
-            $ret .= "<span class='helper'>$ML{'.graphicpreviews.note'}</span>";
-            $ret .= "</td></tr>\n";
-        }
+                if (@active_subs >= $u_max) {
+                    push @notif_errors, LJ::errobj("Subscription::TooMany", subscr => $subscr, u => $u);
+                    next;
+                } elsif (@all_subs >= $system_max) {
+                    push @notif_errors, LJ::errobj("Subscription::TooManySystemMax", subscr => $subscr, u => $u, max => $system_max);
+                    next;
+                }
 
-        # Image placeholders
-        my ($maxwidth, $maxheight) = (0, 0);
-        ($maxwidth, $maxheight) = ($1, $2) if ($u->{'opt_imagelinks'} =~ m/^(\d+)\|(\d+)$/);
-        my $is_stock = {'320|240' => 1, '640|480' => 1, '0|0' => 1, '' => 1}->{$u->{'opt_imagelinks'}};
-        my $extra = $is_stock ? '' : BML::ml('.imagelinks.size.custom', {'width' => $maxwidth, 'height' => $maxheight});
-        $ret .= "<tr><td class='field_name'>$ML{'.fn.imageplace'}</td>\n<td>";
-        $ret .= "$ML{'.imageplace'} ";
-        $ret .= LJ::html_select({'name' => 'opt_imagelinks', 'selected' => $u->{'opt_imagelinks'}},
-                                 '0', BML::ml('.imageplace.none'),
-                                 '0|0', BML::ml('.imageplace.all'),
-                                 '320|240', BML::ml('.imageplace.medium'),
-                                 '640|480', BML::ml('.imageplace.large'),
-                                 $extra ? ("$maxwidth|$maxheight", $extra) : ());
-        $ret.= "<br /><span class='helper'>$ML{'.imageplace.text'}</span>";
-        $ret .= "</td></tr>\n";
+                $subscr->commit;
+            }
 
-        # Embed placeholders
-        $ret .= LJ::run_hook('opt_embedplaceholders', $u );
+            delete $u->{_subscriptions};
 
-        # Style Always Mine
-        if ($u->can_use_stylealwaysmine) {
-            $ret .= "<tr><td class='field_name'>$ML{'.fn.stylealwaysmine'}</td>\n<td>";
-            $ret .= LJ::html_check({
-                        'type' => 'check',
-                        'name' => 'opt_stylealwaysmine',
-                        'id'   => 'opt_stylealwaysmine',
-                        'value' => 1,
-                        'selected' => $u->{'opt_stylealwaysmine'} eq 'Y' ? 1: 0 });
-            $ret .= " <label for='opt_stylealwaysmine'>$ML{'.stylealwaysmine'}</label><br />\n";
-            $ret .= "<span class='helper'>$ML{'.stylealwaysmine.text'}</span>";
-            $ret .= "</td></tr>\n";
-        }
+            return BML::redirect($POST{ret_url}) if $POST{ret_url} && !scalar @notif_errors;
 
-        # Comment pages
-        $ret .= "<tr><td class='field_name'>$ML{'.fn.commentpage'}</td>\n<td>";
-        $ret .= LJ::html_check({ 'type' => 'check', 'name' => 'opt_stylemine', 'id' => 'opt_stylemine',
-                                 'value' => 1, 'selected' => $u->{'opt_stylemine'} });
-        $ret .= " <label for='opt_stylemine'>$ML{'.commentpage'}</label><br />\n";
-        $ret .= "<span class='helper'>$ML{'.commentpage.text'}</span>";
-        $ret .= "</td></tr>\n";
+            # save the LJ::Setting notifications too
+            unless ($POST{post_to_settings_page}) {
+                $save_rv = LJ::Setting->save_all($u, \%POST, \@settings);
+            }
 
-        # Contextual Popup Disable
-        if ($LJ::CTX_POPUP) {
-            $ret .= "<tr><td class='field_name'>$ML{'.fn.contextualhover'}</td>\n<td>";
-            $ret .= LJ::html_check({ 'type' => 'check', 'name' => 'opt_ctxpopup', 'id' => 'opt_ctxpopup',
-                                     'value' => 1, 'selected' => $u->prop('opt_ctxpopup') });
-            $ret .= " <label for='opt_ctxpopup'>$ML{'.contextualhover'}</label><br />\n";
-            $ret .= "<span class='helper'>$ML{'.contextualhover.text'}</span>";
-            $ret .= "</td></tr>\n";
-        }
-
-        # Getting Started widget
-        $ret .= "<tr><td class='field_name'><a name='getting-started'></a>$ML{'.fn.gettingstarted'}</td>\n<td>";
-        if (LJ::Widget::GettingStarted->tasks_completed($u)) {
-            # if the user has completed all of the tasks, show a disabled option that doesn't have the box checked,
-            # but don't change the current value of the opt_getting_started prop while the option is disabled
-
-            $ret .= LJ::html_check({ 'type' => 'check', 'name' => 'opt_getting_started_notused', 'id' => 'opt_getting_started',
-                                     'selected' => 0, 'disabled' => 1 });
-            $ret .= " <label for='opt_getting_started'>$ML{'.gettingstarted'}</label><br />\n";
-            $ret .= "<span class='helper'>$ML{'.gettingstarted.text.completed'}</span>";
-            $ret .= LJ::html_hidden({ 'name' => 'opt_getting_started', 'value' => $u->has_enabled_getting_started });
+            if (scalar @notif_errors || LJ::Setting->save_had_errors($save_rv)) {
+                $submit_msg .= LJ::error_list(@notif_errors) . "<br />";
+            } else {
+                $submit_msg .= "<?warningbar $ML{'.success'} warningbar?><br />";
+            }
         } else {
-            $ret .= LJ::html_check({ 'type' => 'check', 'name' => 'opt_getting_started', 'id' => 'opt_getting_started',
-                                     'value' => 1, 'selected' => $u->has_enabled_getting_started });
-            $ret .= " <label for='opt_getting_started'>$ML{'.gettingstarted'}</label><br />\n";
-            $ret .= "<span class='helper'>$ML{'.gettingstarted.text'}</span>";
-        }
-        $ret .= "</td></tr>\n";
+            $save_rv = LJ::Setting->save_all($u, \%POST, \@settings);
 
-        $ret .= "</table>\n";
-
-        # Additional privacy options
-        $ret .= "<div class='section_head'>$ML{'.section.privacy'}</div>\n";
-        $ret .= "<table class='field_block'>\n";
-
-        # new post minimum security
-        $ret .= "<tr><td class='field_name'>$ML{'.fn.minsecurity'}</td>\n<td>";
-        $ret .= "<label for='newpost_minsecurity'>$ML{'.minsecurity'}</label> ";
-
-        my @securities  = (""        => $ML{'.minsecurity.public'},
-                           "friends" => $u->is_community ? $ML{'.minsecurity.members'} : $ML{'.minsecurity.friends'});
-        push @securities, ("private" => $ML{'.minsecurity.private'})
-            if $u->is_person;
-
-        $ret .= LJ::html_select({ 'name' => 'newpost_minsecurity', selected => $u->{'newpost_minsecurity'} },
-                                @securities);
-
-        $ret .= "<br />\n<span class='helper'>$ML{'.minsecurity.text'}</span>";
-        $ret .= "</td></tr>";
-
-        ## copyright 
-        if (LJ::is_enabled('default_copyright', $u)) {
-	        $ret .= "<tr><td class='field_name'>$ML{'.fn.public'}</td>\n<td>";
-	        $ret .= LJ::html_check({ 'type' => 'check', 'name' => 'default_copyright', 'id' => 'default_copyright',
-	                                 'selected' => $u->{'default_copyright'} eq 'P' ? 1 : 0 });
-	        $ret .= " <label for='default_copyright'>" . BML::ml('.public') . "</label>";
-	        $ret .= "<br /><span class='helper'>$ML{'.public.helper'}</span>";
-	        $ret .= "</td></tr>\n";
+            if (LJ::Setting->save_had_errors($save_rv)) {
+                $submit_msg .= "<?errorbar $ML{'.errors'} errorbar?><br />";
+            } else {
+                $submit_msg .= "<?warningbar $ML{'.success'} warningbar?><br />";
+            }
         }
+    }
 
-        # Search Inclusion
-        $ret .= "<tr><td class='field_name'>$ML{'.fn.searchincl'}</td>\n<td>";
-        $ret .= LJ::html_check({ 'type' => 'check', 'name' => 'opt_blockrobots', 'id' => 'opt_blockrobots',
-                                 'selected' => $u->{'opt_blockrobots'} });
-        $ret .= " <label for='opt_blockrobots'>" . BML::ml('.searchincl2', { sitename => $LJ::SITENAMESHORT }) . "</label><br />";
-        $ret .= "<span class='helper'>$ML{'.searchincl.text'}</span>";
-        $ret .= "</td></tr>\n";
+    if ($given_cat eq "notifications") {
+        # look for deletions from GET
+        my $deleted_subs = 0;
+        foreach my $subscr ($u->subscriptions) {
+            my $id = $subscr->id;
+            next unless $id;
 
-        # Vertical Inclusion
-        if (LJ::is_enabled("verticals", $remote) && !$u->is_comm) {
-            $ret .= "<tr><td class='field_name'>$ML{'.fn.verticalincl'}</td>\n<td>";
-            $ret .= LJ::html_check({
-                type => 'check',
-                name => 'opt_exclude_from_verticals',
-                id => 'opt_exclude_from_verticals',
-                selected => $u->opt_exclude_from_verticals eq "none" ? 0 : 1,
-            });
-            $ret .= " <label for='opt_exclude_from_verticals'>$ML{'.verticalincl'}</label><br />\n";
-            $ret .= "<span class='helper'>$ML{'.verticalincl.text'}</span>";
-            $ret .= "</td></tr>\n";
+            if ($GET{"deletesub_$id"}) {
+                $subscr->delete;
+                $deleted_subs = 1;
+            }
         }
+        $submit_msg .= "<?warningbar $ML{'.success'} warningbar?><br />"
+            if $deleted_subs;
+    }
 
-        # Weblogs.com
-        unless ($LJ::DISABLED{'weblogs_com'}) {
-            $ret .= "<tr><td class='field_name'>$ML{'.fn.weblogs'}</td>\n<td>";
-            $ret .= LJ::html_check({ 'type' => 'check', 'name' => 'opt_weblogscom', 'id' => 'opt_weblogscom',
-                                     'selected' => $u->{'opt_weblogscom'},
-                                     'disabled' => !($u->get_cap("weblogscom") || $u->{'opt_weblogscom'}) });
-            $ret .= " <label for='opt_weblogscom'>$ML{'.weblogscom'}</label><br />\n";
-            $ret .= "<span class='helper'>$ML{'.weblogscom.text'}</span>";
-            $ret .= "</td></tr>\n";
-        }
+    my $ret = "<div id='settings_page'>";
 
-        # Anyone else to notify, if personal journal?
-        $ret .= LJ::run_hook('third_party_notify_options', $u)
-            if $u->is_personal;
+    my ($getextra, $getsep) = ("", "?");
+    $title = $windowtitle = $ML{'.title.self'};
+    if ($u && $authas ne $remote->user) {
+        $getextra = "?authas=$authas";
+        $getsep = "&";
+        $title = BML::ml('.title.comm', { user => $u->ljuser_display({ head_size => 24 }) });
+        $windowtitle = BML::ml('.title.comm', { user => $u->display_username });
+    }
 
-        # Jabber Online Status
-        my $jabber_title = LJ::run_hook("jabber_title") || $ML{'.jabber.title'};
-        $ret .= "<tr><td class='field_name'>$ML{'.fn.jabber'}</td>\n<td>";
-        $ret .= BML::ml('.jabber', {'jabbertitle' => $jabber_title}) . " ";
-        $ret .= LJ::html_select({ 'name' => 'opt_showonlinestatus',
-                                  'id' => 'opt_showonlinestatus',
-                                  'selected' => $u->opt_showonlinestatus },
-                                  "Y" => BML::ml(".security.visibility.everybody"),
-                                  "F" => BML::ml(".security.visibility.friends"),
-                                  "N"  => BML::ml(".security.visibility.nobody") );
-        $ret .= "<br />\n<span class='helper'>" . BML::ml('.jabber.text', {'jabbertitle' => $jabber_title}) . "</span>";
-        $ret .= "</td></tr>\n";
+    if ($u) {
+        $ret .= "<div id='authas_select'>";
+        $ret .= "<form action='$LJ::SITEROOT/manage/settings/' method='get'>";
+        $ret .= LJ::make_authas_select($remote, { authas => $GET{authas} });
+        $ret .= LJ::html_hidden( cat => $given_cat );
+        $ret .= "</form>";
+        $ret .= "</div>";
+    }
 
-        $ret .= join('', map { $_->[0] } LJ::run_hooks('extra_privacy_options', $u));
-        $ret .= "</table>\n";
+    $ret .= "<p id='intro'>" . BML::ml('.intro3', { aopts1 => "href='$LJ::SITEROOT/manage/profile/$getextra'", aopts2 => "href='$LJ::SITEROOT/customize/$getextra'" }) . "</p>"
+        if $u;
+    $ret .= $submit_msg;
 
-        # adult content settings
-        unless (LJ::conf_test($LJ::DISABLED{content_flag})) {
-            my $hide_adult = $u->hide_adult_content;
+    $ret .= "<div id='settings_left'>";
 
-            my $journal_adult = $u->adult_content;
+    $ret .= "<ul id='settings_nav'>";
+    foreach my $cat (@cats_order) {
+        next unless $cats_with_settings{$cat}->{visible};
 
-            my @adult_settings = (
-                                  none => $ML{'.adultcontentflag.select.none'},
-                                  concepts => $ML{'.adultcontentflag.select.concepts'},
-                                  explicit => $ML{'.adultcontentflag.select.explicit'},
-                                  );
-
-            my @adult_viewing = (
-                {
-                    value => 'none',
-                    text => $ML{'.viewingadult.select.none'},
-                    disabled => $u->is_minor || !$u->best_guess_age ? 1 : 0,
-                },
-                {
-                    value => 'explicit',
-                    text => $ML{'.viewingadult.select.explicit'},
-                    disabled => $u->is_child || !$u->best_guess_age ? 1 : 0,
-                },
-                {
-                    value => 'concepts',
-                    text => $ML{'.viewingadult.select.concepts'},
-                    disabled => 0,
-                },
-            );
-
-            my $journal_adult_settings_menu = LJ::html_select({
-                name => 'adult_content',
-                selected => $journal_adult,
-            }, @adult_settings);
-
-            my $hide_adult_content_menu = LJ::html_select({
-                name => 'hide_adult_content',
-                selected => $hide_adult,
-            }, @adult_viewing);
- 
-            # adult content settings
-            $ret .= "<div class='section_head'>$ML{'.section.adult_content'}</div>";
-            $ret .= "<p>" . BML::ml('.section.adult_content.note', { sitename => $LJ::SITENAMESHORT }) . "</p>";
-            $ret .= "<table class='field_block'>";
-
-            $ret .= "<tr>";
-            $ret .= "<td class='field_name'>$ML{'.fn.adultcontentflag'}</td>";
-            $ret .= "<td>$ML{'.adultcontentflag'} $journal_adult_settings_menu<br />";
-            $ret .= "<span class='helper'>" . BML::ml('.adultcontentflag.text', { explicitage => 18, conceptsage => 14 }) . " ";
-            $ret .= LJ::help_icon("adult_content");
-            $ret .= "</span></td>";
-            $ret .= "</tr>";
-
-            $ret .= "<tr>";
-            $ret .= "<td class='field_name'>$ML{'.fn.viewingadult'}</td>";
-            $ret .= "<td>";
-            $ret .= "$ML{'.viewingadult'} $hide_adult_content_menu ";
-            $ret .= LJ::help_icon("adult_content");
-            $ret .= "</td>";
-            $ret .= "</tr>";
-
-            if (LJ::is_enabled("safe_search")) {
-                my $safesearch = $u->safe_search;
-
-                my @safe_search_options = (
-                    0 => $ML{'.safesearch.select.none'},
-                    10 => $ML{'.safesearch2.select.explicit'},
-                    20 => $ML{'.safesearch2.select.concepts'},
-                );
-
-                my $safe_search_menu = LJ::html_select({
-                    name => 'safe_search',
-                    selected => $safesearch,
-                }, @safe_search_options);
-
-                $ret .= "<tr>";
-                $ret .= "<td class='field_name'>$ML{'.fn.safesearch'}</td>";
-                $ret .= "<td>$ML{'.safesearch2'} ";
-                $ret .= LJ::help_icon("adult_content") . "<br />";
-                $ret .= $safe_search_menu;
-                $ret .= "</td>";
-                $ret .= "</tr>";
-            }
-
-            $ret .= "</table>";
+        if ($cats_with_settings{$cat}->{disabled}) {
+            $ret .= "<li class='disabled'>$cats_with_settings{$cat}->{name}</li>";
+        } else {
+            my $active_class = " class='active'" if $cat eq $given_cat;
+            $ret .= "<li><a href='$LJ::SITEROOT/manage/settings/$getextra${getsep}cat=$cat'$active_class>$cats_with_settings{$cat}->{name}</a></li>";
         }
     }
+    $ret .= "</ul>";
 
-        # ending submit block
-        $ret .= "<?standout " . LJ::html_submit(undef, $ML{'.finished.save_button'}) . " standout?>\n";
-        $ret .= "</form>\n";
+    $ret .= "<div id='settings_nav_title'><p>";
+    $ret .= $cats_with_settings{$given_cat}->{desc};
+    $ret .= "</p></div>";
 
-        return $print_with_ad->($ret);
+    if ($cats_with_settings{$given_cat}->{form}) {
+        my $confirm_msg = LJ::ejs($ML{'.form.confirm'});
+        $ret .= "<script>Settings.confirm_msg = \"$confirm_msg\";</script>";
+        $ret .= "<form id='settings_form' action='$LJ::SITEROOT/manage/settings/$getextra${getsep}cat=$given_cat' method='post'>";
+        $ret .= LJ::form_auth();
     }
+    $ret .= "<div class='settings_content'>";
+    $ret .= "<div class='$given_cat'>";
 
+    if ($given_cat eq "notifications") {
+        my $my_account_extra = LJ::run_hook('subscriptions_manage_my_account_extra', $u);
 
-    ###
-    ### we have a post, process edits
-    ###
+        # set up default subscriptions for users that have not managed ESN stuff
+        if (!$u->prop('esn_has_managed') && !$u->subscription_count) {
+            $u->set_prop( esn_has_managed => 1 );
 
-    if (LJ::did_post()) {
-        return $print_with_ad->("<?h1 $ML{'Error'} h1?><?p $ML{'error.invalidform'} p?>") unless !$remote || LJ::check_form_auth();
+            my @default_subscriptions = (
+                LJ::Subscription::Pending->new($u,
+                    event => 'OfficialPost',
+                ),
+            );
 
-        return $print_with_ad->("<?badinput?>") unless LJ::text_in(\%POST);
+            push @default_subscriptions, $my_account_extra
+                if $my_account_extra;
 
-        # set language
-        if (exists $POST{'lang'}) {
-            LJ::Lang::set_lang($POST{lang});
-        }
+            if ($u->prop('opt_gettalkemail') ne 'N') {
+                push @default_subscriptions, (
+                    LJ::Subscription::Pending->new($u,
+                        event => 'JournalNewComment',
+                        journal => $u,
+                        method => 'Inbox',
+                    ),
 
-        # was a scheme change posted?
-        my $scheme;
-        if (exists $POST{'text_scheme'}) {
-            foreach (@text_schemes) {
-                $scheme = $_->{'scheme'} if $POST{'text_scheme'} eq $_->{'scheme'};
+                    LJ::Subscription::Pending->new($u,
+                        event => 'JournalNewComment',
+                        journal => $u,
+                        method => 'Email',
+                    ),
+                );
             }
-        } else {
-            foreach (@thumb_schemes) {
-                $scheme = $_->{'scheme'} if $POST{'scheme'} eq $_->{'scheme'};
-            }
-        }
 
-        # set scheme
-        if ($scheme) {
-            my $cval = $scheme;
-
-            # don't set cookie for default scheme
-            if ($scheme eq $bml_schemes[0]->{'scheme'} && !$LJ::SAVE_SCHEME_EXPLICITLY) {
-                $cval = '';
-                delete $COOKIE{'BMLschemepref'};
-            }
-
-            if ($remote) {
-                # set a userprop to remember their schemepref
-                $remote->set_prop('schemepref', $cval);
-
-                # cookie expires when session expires
-                $cval = [ $scheme, $remote->{'_session'}->{'timeexpire'} ]
-                    if ($remote->{'_session'}->{'exptype'} eq 'long');
-            }
-
-            # set cookie
-            $COOKIE{'BMLschemepref'} = $cval if $cval;
-            BML::set_scheme($scheme);
-
+            $_->commit foreach @default_subscriptions;
         }
 
-        # everything past here only applies if we have a remote user
-        if ($remote) {
+        my @categories = (
+            {
+                "My Account" => [
+                    LJ::Subscription::Pending->new($u,
+                        event => 'OfficialPost',
+                    ),
+                    LJ::Subscription::Pending->new($u,
+                        event => 'JournalNewComment',
+                        journal => $u,
+                    ),
+                    "LJ::Setting::CommentEmailNotify",
+                    "LJ::Setting::SelfCommentEmail",
+                    LJ::Subscription::Pending->new($u,
+                        event => 'PollVote',
+                        journal => $u,
+                    ),
+                    'Befriended',
+                    'Defriended',
+                    LJ::Subscription::Pending->new($u,
+                        event => 'UserMessageRecvd',
+                        journal => $u,
+                        default_selected => 1,
+                    ),
+                ],
+            },
+            {
+                "Friends and Communities" => [
+                    'InvitedFriendJoins',
+                    'CommunityInvite',
+                    'CommunityJoinRequest',
+                    LJ::Subscription::Pending->new($u,
+                        event => 'NewUserpic',
+                    ),
+                    LJ::Subscription::Pending->new($u,
+                        event => 'Birthday',
+                    ),
+                    (LJ::run_hook('subscriptions_manage_friend_pending_extra', $u) || ()),
+                ],
+            },
+        );
 
-        my $dbh = LJ::get_db_writer();
+        unshift @{$categories[0]->{'My Account'}}, $my_account_extra
+            if $my_account_extra;
 
-        # Embed placeholders
-        LJ::run_hook('opt_embedplaceholders', $u, \%POST);
+        $ret .= LJ::subscribe_interface($u,
+            journal       => $u,
+            categories    => \@categories,
+            showtracking  => 1,
+            settings_page => 1,
+        ) . "<br />";
 
-        ### change any of the userprops ?
-        {
-            # opts
-            $POST{'opt_imagelinks'} = 0 unless $POST{'opt_imagelinks'} =~ m/^(\d+)\|(\d+)$/;
-            $POST{'opt_stylemine'} = $POST{'opt_stylemine'} ? 1 : 0;
-            $POST{'opt_blockrobots'} = $POST{'opt_blockrobots'} ? 1 : 0;
-            $POST{'opt_weblogscom'} = $POST{'opt_weblogscom'} ? 1 : 0 unless ($LJ::DISABLED{'weblogs_com'});
-            $POST{'opt_ctxpopup'} = $POST{'opt_ctxpopup'} ? 'Y' : 'N' if $LJ::CTX_POPUP;
-            $POST{'opt_showonlinestatus'} = '' unless $POST{'opt_showonlinestatus'} =~ m/^(Y|F|N)$/;
-            $POST{'opt_getting_started'} = $POST{'opt_getting_started'} ? 'Y' : 'N';
-            $POST{'newpost_minsecurity'} = "" unless $POST{'newpost_minsecurity'} =~ /(?:friends|private)/;
-            $POST{'default_copyright'} = $POST{'default_copyright'} ? 'P' : 'C';
+    } else {
+        my $setting_ct = 1;
+        $ret .= "<table cellpadding='0' cellspacing='0'>";
+        foreach my $setting (@settings) {
+            my $errors = $setting->errors_from_save($save_rv);
+            my $args = $setting->args_from_save($save_rv);
 
+            my $label = $setting->label;
+            my $option = $setting->option($u, $errors, $args, getargs => \%GET );
+            my $actionlink = $setting->actionlink($u);
+            my $helpicon = LJ::help_icon($setting->helpurl($u));
+            my $last_class = $setting_ct == scalar @settings ? " last" : "";
 
-            my @uprops = qw(
-              opt_imagelinks opt_stylemine
-              opt_blockrobots opt_ctxpopup opt_showonlinestatus
-              opt_getting_started newpost_minsecurity
-            );
-            push @uprops, 'default_copyright'
-    	        if LJ::SUP->is_sup_enabled($u);
-            
-            # weblogs.com requires a special cap, but let people turn it off even without the cap
-            push @uprops, 'opt_weblogscom'
-                if ( !$LJ::DISABLED{'weblogs_com'} && ($u->get_cap('weblogscom') || !$POST{'opt_weblogscom'}) );
+            $ret .= "<tr>";
+            $ret .= "<td class='${given_cat}_label$last_class'>$label</td>" if $label;
+            $ret .= "<td class='${given_cat}_option$last_class'>" . ($option ? $option : " ") . "</td>";
+            $ret .= "<td class='${given_cat}_actionlink$last_class'>" . ($actionlink ? $actionlink : " ") . "</td>";
+            $ret .= "<td class='help$last_class'>" . ($helpicon ? $helpicon : " ") . "</td>";
+            $ret .= "</tr>";
 
-            if (LJ::is_enabled("content_flag")) {
-                $POST{adult_content} = "none"
-                    unless $POST{adult_content} eq "explicit" || $POST{adult_content} eq "concepts";
-                push @uprops, 'adult_content';
-
-                if ($u->is_child || !$u->best_guess_age) {
-                    $POST{hide_adult_content} = "concepts";
-                } elsif ($u->is_minor) {
-                    $POST{hide_adult_content} = "explicit"
-                        unless $POST{hide_adult_content} eq "concepts";
-                } else {
-                    $POST{hide_adult_content} = "none"
-                        unless $POST{hide_adult_content} eq "concepts" || $POST{hide_adult_content} eq "explicit";
-                }
-                push @uprops, 'hide_adult_content';
-
-                if (LJ::is_enabled("safe_search")) {
-                    if ($POST{safe_search} != $u->safe_search) {
-                        $POST{safe_search} = 10 unless $POST{safe_search} =~ /^\d+$/;
-                        $POST{safe_search} = "none" if $POST{safe_search} == 0; # we store "none" in the prop to represent 0
-                        push @uprops, 'safe_search';
-                    }
-                }
-            }
-
-            # set userprops
-            foreach my $uprop (@uprops) {
-                my $eff_val = $POST{$uprop};   # effective value, since 0 isn't stored
-                $eff_val = "" unless $eff_val;
-                my $mem_only = $eff_val eq $u->{$uprop};
-                LJ::set_userprop($u, $uprop, $eff_val, $mem_only);
-            }
+            $setting_ct++;
         }
+        $ret .= "</table>";
 
-        my $graphicpreviews_obj = LJ::graphicpreviews_obj();
-        if ($graphicpreviews_obj->is_enabled($u)) {
-            my $post_val = $POST{show_graphic_previews} ? 'on' : 'off';
-            my $prop_val = $u->show_graphic_previews;
-            if ($post_val ne $prop_val) {
-                my $new_val = "explicit_$post_val";
-                $u->set_prop('show_graphic_previews', $new_val);
+        if ($given_cat eq "account") {
+            my $account_stats = LJ::run_hook("settings_account_stats", $u);
+            if ($account_stats) {
+                $ret .= "<div class='account_stats'>";
+                $ret .= $account_stats;
+                $ret .= "</div>";
             }
         }
-
-        if ($u->can_use_stylealwaysmine) {
-            my $post_val = $POST{opt_stylealwaysmine} ? 'Y' : 'N';
-            my $prop_val = $u->opt_stylealwaysmine ? 'Y' : 'N';
-            if ($post_val ne $prop_val) {
-                $u->set_prop('opt_stylealwaysmine', $post_val);
-            }
-        }
-
-        if (LJ::is_enabled("verticals", $remote) && !$u->is_comm) {
-            $u->set_opt_exclude_from_verticals($POST{opt_exclude_from_verticals});
-        }
-
-        LJ::run_hook('set_third_party_notify_options', $u, \%POST);
-        LJ::run_hooks('set_extra_privacy_options', $u, \%POST);
-
     }
 
-        # tell the user all is well
-        my $cprod = $remote ? LJ::CProd->full_box_for($remote, width => 300) : "";
-        my $ad_box = LJ::get_ads({ location => 'bml.manage.settings/main', ljadwrapper => 1, below_ad => $cprod });
-        my $ret = $ad_box;
-        $ret .= "<?h1 $ML{'.success.header'} h1?>\n";
-        $ret .= "<?p $ML{'.success.text'} p?>\n";
-        $ret .= "<?p $ML{'.success.next'} p?>\n<ul>\n";
-        $ret .= "<li><a href='$LJ::SITEROOT/manage/settings/$getextra'>$ML{'.success.next.viewing'}</a></li>";
-        $ret .= "<li><a href='$LJ::SITEROOT/customize/$getextra'>$ML{'.success.next.customize'}</a></li>";
-        $ret .= "<li><a href='" . $u->journal_base . "/friends'>$ML{'.success.next.friends'}</a></li>"
-            if $u && $u->is_person;
-        $ret .= "<li><a href='$LJ::SITEROOT/'>$ML{'.success.next.home'}</a></li>";
-        $ret .= "</ul>";
-        $ret .= LJ::Widget::GettingStarted->render;
-        return $ret;
+    $ret .= "</div>";
+    $ret .= "</div>";
 
-    }
+    $ret .= "<div id='settings_save'>";
+    $ret .= $cats_with_settings{$given_cat}->{form} ? LJ::html_submit($ML{'.btn.save'}) : " ";
+    $ret .= "</div>";
+    $ret .= "</form>" if $cats_with_settings{$given_cat}->{form};
 
-    # should never happen
-    return $print_with_ad->("<?h1 $ML{'Error'} h1?><?p $ML{'error.unknownmode'} p?>");
+    $ret .= "</div>";
 
+    $ret .= "</div>";
+
+    return $ret;
 }
 _code?>
-
 <=body
+title=><?_code return $title; _code?>
+windowtitle=><?_code return $windowtitle; _code?>
 head<=
-<?_code
-    LJ::need_res('stc/lj_base.css', 'stc/lj_settings.css');
-    return $head;
-_code?>
+<?_code return $headextra; _code?>
 <=head
-page?><?_c <LJDEP>
-lib: LJ::TextMessage, cgi-bin/ljlib.pl, cgi-bin/ljlang.pl
-link: htdocs/legal/privacy.bml, htdocs/support/faqbrowse.bml, htdocs/tools/textmessage.bml, htdocs/uploadpic.bml
-link: htdocs/paidaccounts/index.bml, htdocs/users, htdocs/userinfo.bml
-post: htdocs/manage/settings
-img: htdocs/userpic
-</LJDEP> _c?>
+page?>

Modified: trunk/htdocs/manage/subscriptions/comments.bml
===================================================================
--- trunk/htdocs/manage/subscriptions/comments.bml	2009-01-06 20:30:55 UTC (rev 14757)
+++ trunk/htdocs/manage/subscriptions/comments.bml	2009-01-07 21:11:48 UTC (rev 14758)
@@ -84,7 +84,7 @@
                                    journal => $journal,
                                    ret_url => ($can_watch ? $comment->url : $entry->url),
                                    default_selected_notifications => ['LJ::NotificationMethod::Email'],
-                                   post_to_settings_page => $remote->is_in_beta("settings2008") ? 1 : 0,
+                                   post_to_settings_page => 1,
                                    );
 
 }

Modified: trunk/htdocs/manage/subscriptions/entry.bml
===================================================================
--- trunk/htdocs/manage/subscriptions/entry.bml	2009-01-06 20:30:55 UTC (rev 14757)
+++ trunk/htdocs/manage/subscriptions/entry.bml	2009-01-07 21:11:48 UTC (rev 14758)
@@ -66,7 +66,7 @@
                                      categories   => $categories,
                                      ret_url      => $entry->url,
                                      default_selected_notifications => ['LJ::NotificationMethod::Email'],
-                                     post_to_settings_page => $remote->is_in_beta("settings2008") ? 1 : 0,
+                                     post_to_settings_page => 1,
                                      );
 
     return $body;

Modified: trunk/htdocs/manage/subscriptions/user.bml
===================================================================
--- trunk/htdocs/manage/subscriptions/user.bml	2009-01-06 20:30:55 UTC (rev 14757)
+++ trunk/htdocs/manage/subscriptions/user.bml	2009-01-07 21:11:48 UTC (rev 14758)
@@ -73,7 +73,7 @@
                                    $remote,
                                    categories => $categories,
                                    journal    => $journal,
-                                   post_to_settings_page => $remote->is_in_beta("settings2008") ? 1 : 0,
+                                   post_to_settings_page => 1,
                                    );
 
 }

Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments