1 package LJ
::Setting
::FindByEmail
;
2 use base
'LJ::Setting';
6 sub tags
{ qw(email search) }
11 return "find_by_email";
16 my ($class, $u, $errs, $args) = @_;
18 my $key = $class->pkgkey;
20 my $helper = (defined $args->{helper
} and $args->{helper
} == 0) ?
0 : 1;
21 my $faq = (defined $args->{faq
} and $args->{faq
} == 1) ?
1 : 0;
22 my $display_null = (defined $args->{display_null
} and $args->{display_null
} == 0) ?
0 : 1;
24 $ret .= "<label for='${key}opt_findbyemail'>" .
25 $class->ml('settings.findbyemail.question',
26 { sitename
=> $LJ::SITENAMESHORT
}) . "</label>";
28 # Display learn more link?
29 $ret .= " (<a href='" . $LJ::HELPURL
{$class->helpurl($u)} .
30 "'>" . $class->ml('settings.settingprod.learn') . "</a>)<br />"
31 if ($faq && $LJ::HELPURL
{$class->helpurl($u)});
35 push @options, { text
=> $class->ml('settings.option.select'), value
=> '' }
36 if not $u->opt_findbyemail and $display_null;
37 my $default = $display_null ?
'' : 'H';
38 push @options, { text
=> LJ
::Lang
::ml
('settings.findbyemail.opt.Y'), value
=> "Y" };
39 push @options, { text
=> LJ
::Lang
::ml
('settings.findbyemail.opt.H'), value
=> "H" };
40 push @options, { text
=> LJ
::Lang
::ml
('settings.findbyemail.opt.N'), value
=> "N" };
41 $ret .= LJ
::html_select
({ 'name' => "${key}opt_findbyemail",
42 'id' => "${key}opt_findbyemail",
43 ### 'class' => "select",
44 'selected' => $u->opt_findbyemail || $default },
47 # Display helper text about setting?
48 $ret .= "<div class='helper'>" .
49 $class->ml('settings.findbyemail.helper', {
50 sitename
=> $LJ::SITENAMESHORT
,
51 siteabbrev
=> $LJ::SITENAMEABBREV
}) .
52 "</div>" if ($helper);
54 "<div class='helper'>" .
55 $class->ml('settings.findbyemail.notice', {siteroot
=> $LJ::SITEROOT
}) .
58 $ret .= $class->errdiv($errs, "opt_findbyemail");
64 my ($class, $u, $args) = @_;
65 my $opt_findbyemail = $class->get_arg($args, "opt_findbyemail");
66 $class->errors("opt_findbyemail" => $class->ml('settings.findbyemail.error.invalid')) unless $opt_findbyemail=~ /^[NHY]$/;
71 my ($class, $u, $args) = @_;
72 $class->error_check($u, $args);
74 my $opt_findbyemail = $class->get_arg($args, "opt_findbyemail");
75 return $u->set_prop('opt_findbyemail', $opt_findbyemail);
80 $class->ml('settings.findbyemail.label');
83 # return key value pairs for field names and values chosen
85 my ($class, $args) = @_;
88 push @list, "opt_findbyemail";
89 push @list, $class->get_arg($args, "opt_findbyemail") || '';