vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r16014: LJSUP-5276: add gender field to sing-up ...

Committer: vsukhanov
LJSUP-5276: add gender field to sing-up and profile page. Added option to set accessability to this info.

U   trunk/bin/upgrading/en.dat
U   trunk/bin/upgrading/proplists.dat
U   trunk/cgi-bin/LJ/User.pm
U   trunk/cgi-bin/LJ/Widget/CreateAccount.pm
U   trunk/htdocs/manage/profile/index.bml
U   trunk/htdocs/manage/profile/index.bml.text
Modified: trunk/bin/upgrading/en.dat
===================================================================
--- trunk/bin/upgrading/en.dat	2009-12-09 13:33:20 UTC (rev 16013)
+++ trunk/bin/upgrading/en.dat	2009-12-10 04:49:56 UTC (rev 16014)
@@ -2026,6 +2026,12 @@
 
 feeds.text=Apparently there's good content outside of LJ?  We'll let you add [[link]] to your Friends page so you never have to leave.
 
+gender.female=Female
+
+gender.male=Male
+
+gender.specify=Specify
+
 img.btn_del=Delete
 
 img.btn_down=Down
@@ -3341,6 +3347,8 @@
 
 widget.createaccount.field.birthdate=Birthdate:
 
+widget.createaccount.field.gender=Gender:
+
 widget.createaccount.field.captcha=Prove you're human:
 
 widget.createaccount.field.captcha.hear=Type the numbers you hear:
@@ -3369,6 +3377,8 @@
 
 widget.createaccount.tip.captcha=If you can't read the text, type "audio" to take a sound test instead.
 
+widget.createaccount.tip.gender=By default we do not show your gender to anybody.
+
 widget.createaccount.tip.email=We need your email address to send important information. We will never share or sell your email address.
 
 widget.createaccount.tip.password=Choose a secure password that is at least 6 characters long. Passwords cannot be based on your username, name, or email address.

Modified: trunk/bin/upgrading/proplists.dat
===================================================================
--- trunk/bin/upgrading/proplists.dat	2009-12-09 13:33:20 UTC (rev 16013)
+++ trunk/bin/upgrading/proplists.dat	2009-12-10 04:49:56 UTC (rev 16014)
@@ -1484,3 +1484,12 @@
   datatype: char
   des: Custom user icon, to be used instead of /img/userinfo.gif in ljuser
   prettyname: Custom user icon
+
+userproplist.opt_sharegender:
+  cldversion: 4
+  datatype: char
+  des: User selected security setting to determine who can see gender info
+  indexed: 0
+  multihomed: 0
+  prettyname: Share Gender
+

Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2009-12-09 13:33:20 UTC (rev 16013)
+++ trunk/cgi-bin/LJ/User.pm	2009-12-10 04:49:56 UTC (rev 16014)
@@ -1438,7 +1438,9 @@
     if ({ map { $_ => 1 }
           qw(opt_sharebday opt_showbday opt_showlocation opt_showmutualfriends
              view_control_strip show_control_strip opt_ctxpopup opt_embedplaceholders
-             esn_inbox_default_expand opt_getting_started)
+             esn_inbox_default_expand opt_getting_started
+             opt_sharegender
+             )
         }->{$prop})
     {
         return $u->$prop;
@@ -1522,6 +1524,26 @@
     }
 }
 
+# opt_sharegender options
+# A - All people
+# R - Registered Users
+# F - Friends Only
+# N - Nobody
+# By default "N".
+sub opt_sharegender {
+    my $u = shift;
+
+    if ($u->raw_prop('opt_sharegender') =~ /^(A|F|N|R)$/) {
+        my $val = $u->raw_prop('opt_sharegender');
+        $val = 'N' unless $val =~ m/^(A|F|N|R)$/;
+        return $val;
+    } else {
+        return 'N' if $u->underage or $u->is_child;
+        return 'F' if $u->is_minor;
+        return 'N';
+    }
+}
+
 # opt_showljtalk options based on user setting
 # Y = Show the LJ Talk field on profile (default)
 # N = Don't show the LJ Talk field on profile

Modified: trunk/cgi-bin/LJ/Widget/CreateAccount.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/CreateAccount.pm	2009-12-09 13:33:20 UTC (rev 16013)
+++ trunk/cgi-bin/LJ/Widget/CreateAccount.pm	2009-12-10 04:49:56 UTC (rev 16014)
@@ -29,6 +29,7 @@
     LJ::run_hook('partners_registration_visited', $get->{from});
 
     my $alt_layout = $opts{alt_layout} ? 1 : 0;
+$alt_layout=1;
     my $ret;
 
     if ($alt_layout) {
@@ -43,9 +44,10 @@
     $ret .= $class->start_form(%{$opts{form_attr}});
 
     my $tip_birthdate = LJ::ejs($class->ml('widget.createaccount.tip.birthdate2'));
-    my $tip_email = LJ::ejs($class->ml('widget.createaccount.tip.email'));
-    my $tip_password = LJ::ejs($class->ml('widget.createaccount.tip.password'));
-    my $tip_username = LJ::ejs($class->ml('widget.createaccount.tip.username'));
+    my $tip_email     = LJ::ejs($class->ml('widget.createaccount.tip.email'));
+    my $tip_password  = LJ::ejs($class->ml('widget.createaccount.tip.password'));
+    my $tip_username  = LJ::ejs($class->ml('widget.createaccount.tip.username'));
+    my $tip_gender    = LJ::ejs($class->ml('widget.createaccount.tip.gender'));
 
     # tip module
     if ($alt_layout) {
@@ -153,6 +155,30 @@
     $ret .= $error_msg->('confirmpass', '<br /><span class="formitemFlag">', '</span>');
     $ret .= "</td></tr>\n" unless $alt_layout;
 
+
+    ### gender
+    if ($alt_layout){
+        $ret .= "<label for='create_gender_mm' class='label_create'>" . $class->ml('widget.createaccount.field.gender') . "</label>";
+        $ret .= "<div class='bubble' id='bubble_gender'>";
+        $ret .= "<div class='bubble-arrow'></div>";
+        $ret .= "<div class='bubble-text'>$tip_gender</div>";
+        $ret .= "</div>";
+    } else {
+        $ret .= "<tr><td class='field-name'>" . $class->ml('widget.createaccount.field.gender') . "</td>\n<td>";
+    }
+    $ret .= $class->html_select(
+                name => "gender",
+                id => "create_gender_mm",
+                selected => $post->{gender},
+                list => [ 
+                    ''  =>  LJ::Lang::ml("gender.specify"),
+                    'M' =>  LJ::Lang::ml("gender.male"),
+                    'F' =>  LJ::Lang::ml("gender.female"),
+                    ],
+                ) . " ";
+    $ret .= "</td></tr>\n" unless $alt_layout;
+    
+
     ### birthdate
     if ($LJ::COPPA_CHECK) {
         if ($alt_layout) {
@@ -428,6 +454,10 @@
         $from_post{errors}->{password} = $class->ml('widget.createaccount.error.password.asciionly');
     }
 
+    ### gender check
+    $from_post{errors}->{confirmpass} = $class->ml('widget.createaccount.error.nogender')
+        unless $post->{gender} =~ /^M|F$/;
+
     ### start COPPA_CHECK
     # age checking to determine how old they are
     if ($LJ::COPPA_CHECK) {

Modified: trunk/htdocs/manage/profile/index.bml
===================================================================
--- trunk/htdocs/manage/profile/index.bml	2009-12-09 13:33:20 UTC (rev 16013)
+++ trunk/htdocs/manage/profile/index.bml	2009-12-10 04:49:56 UTC (rev 16014)
@@ -153,6 +153,23 @@
         $ret .= "<tr><td class='field_name'>$ML{'.fn.gender'}</td><td>";
         $ret .= LJ::html_select({ 'name' => 'gender', 'selected' => $u->{'gender'} },
                                   'U' => $ML{'.gender.unspecified'}, 'M' => $ML{'.gender.male'}, 'F' => $ML{'.gender.female'} );
+        
+        $ret .= "<div style=\"padding-top: .5em;\">\n";
+        $ret .= " <label for='opt_sharebday'>$ML{'.share.gender'}</label>\n";
+        $ret .= LJ::html_select({ 'name' => 'opt_sharegender',
+                                  'selected' => $u->opt_sharegender },
+                                  { text => BML::ml(".security.visibility.everybody"),
+                                    value => "A",
+                                    disabled => $u->is_child,},
+                                  { text => BML::ml(".security.visibility.regusers"),
+                                    value => "R",
+                                    disabled => $u->is_child,},
+                                  { text => BML::ml(".security.visibility.friends"),
+                                    value => "F",
+                                    disabled => $u->is_child,},
+                                  { text => BML::ml(".security.visibility.nobody"),
+                                    value => "N",});
+        $ret .= "</div>";
         $ret .= "</td></tr>\n";
 
 
@@ -660,6 +677,7 @@
             $POST{'opt_showmutualfriends'} = $POST{'opt_showmutualfriends'} ? 1 : 0;
             $POST{'opt_hidefriendofs'} = $POST{'opt_hidefriendofs'} ? 0 : 1;
             $POST{'opt_showschools'} = 'N' unless $POST{'opt_showschools'} =~ m/^(N|R|Y|F)$/;
+            $POST{'opt_sharegender'} = undef unless $POST{'opt_sharegender'} =~ m/^(A|F|N|R)$/;
             $POST{'gender'} = 'U' unless $POST{'gender'} =~ m/^[UMF]$/;
             $POST{'opt_sharebday'} = undef unless $POST{'opt_sharebday'} =~ m/^(A|F|N|R)$/;
             $POST{'opt_showbday'} = 'D' unless $POST{'opt_showbday'} =~ m/^(D|F|N|Y)$/;
@@ -700,6 +718,7 @@
               opt_showmutualfriends opt_showschools
               opt_showbday opt_showlocation opt_showljtalk
               opt_sharebday opt_showonlinestatus
+              opt_sharegender
             );
 
             # reset the gizmo account for this user account

Modified: trunk/htdocs/manage/profile/index.bml.text
===================================================================
--- trunk/htdocs/manage/profile/index.bml.text	2009-12-09 13:33:20 UTC (rev 16013)
+++ trunk/htdocs/manage/profile/index.bml.text	2009-12-10 04:49:56 UTC (rev 16014)
@@ -211,6 +211,8 @@
 
 .share.birthday=Show your Birthday to:
 
+.share.gender=Shaw your Gender to:
+
 .show.birthday=Birthday display options:
 
 .show.birthday.day=Display only the month and day

  • 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 

  • 148 comments
Previous
← Ctrl ← Alt
Next
Ctrl → Alt →
Previous
← Ctrl ← Alt
Next
Ctrl → Alt →