1 _info?>Change Notifications body<= login."; } if ($mode eq "save" && ! LJ::did_post) { push @errors, ""; } return LJ::bad_input(@errors) if @errors; LJ::Support::init_remote($remote); my $cats = LJ::Support::load_cats(); my @filter_cats = LJ::Support::filter_cats($remote, $cats); if ($mode eq "modify") { my $ret = ""; $ret .= "
\n"; $ret .= "\n"; $ret .= "off (the default), new (you'll get notifications when a new support request in that category is posted) or all (you'll get notifications and then a copy of each comment/solution posted). p?>"; my %notify; my $dbr = LJ::get_db_reader(); $sth = $dbr->prepare("SELECT spcatid, level FROM supportnotify WHERE userid=$remote->{'userid'}"); $sth->execute; while (my ($spcatid, $level) = $sth->fetchrow_array) { ## if user used to be able to read a category, subscribed, then lost ## privs, this ensures any future save will turn off things they ## don't have access to: if (LJ::Support::can_read_cat($cats->{$spcatid}, $remote)) { $notify{$spcatid} = $level; } } my %valname = ("off" => "Off.", "new" => "New only.", "all" => "All", ); $ret .= "
\n"; foreach my $cat (@filter_cats) { $ret .= "

$cat->{'catname'}

\n"; } $ret .= "
\n"; ### ending submit block $ret .= "\n"; $ret .= " standout?>\n"; $ret .= "
\n"; return $ret; } if ($mode eq "save") { my $dbh = LJ::get_db_writer(); $dbh->do("DELETE FROM supportnotify WHERE userid=$remote->{'userid'}"); my $sql; foreach my $cat (@filter_cats) { my $id = $cat->{'spcatid'}; my $setting = $FORM{"spcatid_$id"}; if ($setting eq "all" || $setting eq "new") { if ($sql) { $sql .= ", "; } else { $sql .= "REPLACE INTO supportnotify (spcatid, userid, level) VALUES "; } $sql .= "($id, $remote->{'userid'}, '$setting')"; } } if ($sql) { $dbh->do($sql); } return ""; } return "Unknown mode." _code?> <=body page?> link: htdocs/login.bml post: htdocs/support/changenotify.bml _c?>