]> git.mxchange.org Git - friendica.git/commitdiff
profile additions
authorMike Macgirvin <mike@macgirvin.com>
Sat, 10 Jul 2010 14:09:57 +0000 (07:09 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Sat, 10 Jul 2010 14:09:57 +0000 (07:09 -0700)
include/datetime.php
mod/profiles.php
updates.sql
view/profile_edit.tpl
view/profile_selectors.php
view/style.css

index 0beadbe78ebc0e5e774f69df0ce87c7232705746..540c436912d67898c870059c9f93e58f1a154ac5 100644 (file)
@@ -60,7 +60,12 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d
   return($d->format($fmt));
 }}
 
-
+function dob($dob) {
+       list($year,$month,$day) = sscanf($dob,'%4d-%2d-%2d');
+       $y = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
+       $o = datesel('',1920,$y,true,$year,$month,$day);
+       return $o;
+}
 
 if(! function_exists('datesel')) {
 function datesel($pre,$ymin,$ymax,$allow_blank,$y,$m,$d) {
@@ -68,25 +73,27 @@ function datesel($pre,$ymin,$ymax,$allow_blank,$y,$m,$d) {
        $o = '';
        $o .= "<select name=\"{$pre}year\" class=\"{$pre}year\" size=\"1\">";
        if($allow_blank) {
-               $sel = (($y == '') ? " selected=\"selected\" " : "");
-               $o .= "<option value=\"\" $sel></option>";
+               $sel = (($y == '0000') ? " selected=\"selected\" " : "");
+               $o .= "<option value=\"0000\" $sel ></option>";
        }
 
-       for($x = $ymin; $x <= $ymax; $x ++) {
+       for($x = $ymax; $x >= $ymin; $x --) {
                $sel = (($x == $y) ? " selected=\"selected\" " : "");
                $o .= "<option value=\"$x\" $sel>$x</option>";
        }
   
-       $o .= "</select>-<select name=\"{$pre}month\" class=\"{$pre}month\" size=\"1\">";
-       for($x = 1; $x <= 12; $x ++) {
+       $o .= "</select> <select name=\"{$pre}month\" class=\"{$pre}month\" size=\"1\">";
+       for($x = 0; $x <= 12; $x ++) {
                $sel = (($x == $m) ? " selected=\"selected\" " : "");
-               $o .= "<option value=\"$x\" $sel>$x</option>";
+               $y = (($x) ? $x : '');
+               $o .= "<option value=\"$x\" $sel>$y</option>";
        }
 
-       $o .= "</select>-<select name=\"{$pre}day\" class=\"{$pre}day\" size=\"1\">";
-       for($x = 1; $x <= 31; $x ++) {
+       $o .= "</select> <select name=\"{$pre}day\" class=\"{$pre}day\" size=\"1\">";
+       for($x = 0; $x <= 31; $x ++) {
                $sel = (($x == $d) ? " selected=\"selected\" " : "");
-               $o .= "<option value=\"$x\" $sel>$x</option>";
+               $y = (($x) ? $x : '');
+               $o .= "<option value=\"$x\" $sel>$y</option>";
        }
 
        $o .= "</select>";
index 8b44e2d59a7585fcabe1113fdad6401c2900d4f3..34678a237dd4a57ca4f59edb124a7d0969f232b0 100644 (file)
@@ -189,7 +189,7 @@ function profiles_content(&$a) {
 
                require_once('view/profile_selectors.php');
 
-               $tpl = file_get_contents('view/jot-header.tpl');
+               $tpl = file_get_contents('view/profed_head.tpl');
                $opt_tpl = file_get_contents("view/profile-in-directory.tpl");
                $profile_in_dir = replace_macros($opt_tpl,array(
                        '$yes_selected' => (($r[0]['publish']) ? " checked=\"checked\" " : ""),
@@ -199,8 +199,11 @@ function profiles_content(&$a) {
 
                $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
                $a->page['htmlhead'] .= "<script type=\"text/javascript\" src=\"include/country.js\" ></script>";
+
+
+
        
-//             $a->page['aside'] = file_get_contents('view/sidenote.tpl');     
+
                $is_default = (($r[0]['is-default']) ? 1 : 0);
                $tpl = file_get_contents("view/profile_edit.tpl");
                $o .= replace_macros($tpl,array(
@@ -209,7 +212,8 @@ function profiles_content(&$a) {
                        '$profile_name' => $r[0]['profile-name'],
                        '$default' => (($is_default) ? "<p id=\"profile-edit-default-desc\">This is your <strong>public</strong> profile.</p>" : ""),
                        '$name' => $r[0]['name'],
-                       '$dob' => $r[0]['dob'],
+                       '$dob' => dob($r[0]['dob']),
+                       '$hide_birth' => (($r[0]['dob_hide']) ? " checked=\"checked\" " : ""),
                        '$address' => $r[0]['address'],
                        '$locality' => $r[0]['locality'],
                        '$region' => $r[0]['region'],
@@ -218,6 +222,7 @@ function profiles_content(&$a) {
                        '$age' => $r[0]['age'],
                        '$gender' => gender_selector($r[0]['gender']),
                        '$marital' => marital_selector($r[0]['marital']),
+                       '$sexual' => sexpref_selector($r[0]['sexual']),
                        '$about' => $r[0]['about'],
                        '$homepage' => $r[0]['homepage'],
                        '$profile_in_dir' => (($is_default) ? $profile_in_dir : '')
index f74877d259292682005ceebbbd468e73f1b0c7c0..07c4c760c0d19093ef2c31799e1cfaf7d2c17f49 100644 (file)
@@ -17,3 +17,8 @@ ADD `work` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `roman
 ALTER TABLE `profile` ADD `employer` CHAR( 255 ) NOT NULL AFTER `work` ,
 ADD `school` CHAR( 255 ) NOT NULL AFTER `employer` ;
 ALTER TABLE `profile` ADD `summary` CHAR( 255 ) NOT NULL AFTER `about` ;
+
+ALTER TABLE `profile` ADD `dob_hide` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `dob` ;
+
+ALTER TABLE `profile` DROP `age`;
+ ALTER TABLE `profile` DROP `dob_hide`  ;  
\ No newline at end of file
index 251fdae14784d6e78213a502216ccf5700ea2f71..ff0e2f8e44f9c86c49a7d916d0363f0c6343bbd6 100644 (file)
@@ -25,6 +25,13 @@ $gender
 </div>
 <div id="profile-edit-gender-end"></div>
 
+<div id="profile-edit-dob-wrapper" >
+<p id="birthday-description">Leave year blank to suppress age.</p>
+<label id="profile-edit-dob-label" for="dob-select" >Birthday: </label>
+<div id="profile-edit-dob" >
+$dob
+</div>
+<div id="profile-edit-dob-end"></div>
 
 <div id="profile-edit-address-wrapper" >
 <label id="profile-edit-address-label" for="profile-edit-address" >Street Address: </label>
@@ -73,6 +80,14 @@ $marital
 </div>
 <div id="profile-edit-marital-end"></div>
 
+<div id="profile-edit-sexual-wrapper" >
+<label id="profile-edit-sexual-label" for="sexual-select" >Sexual Preference: </label>
+$sexual
+</div>
+<div id="profile-edit-sexual-end"></div>
+
+
+
 <div id="profile-edit-homepage-wrapper" >
 <label id="profile-edit-homepage-label" for="profile-edit-homepage" >Homepage URL: </label>
 <input type="text size="32" name="homepage" id="profile-edit-homepage" value="$homepage" />
index c6e64403a08ca20c21931f9190e1cd1f4d43432e..902f6a1a54b6c36fc91992ca9d3e0d28451ab230 100644 (file)
@@ -2,7 +2,7 @@
 
 
 function gender_selector($current="",$suffix="") {
-       $select = array('','Male','Female','Other');
+       $select = array('','Male', 'Female', 'Transsexual', 'Hermaphrodite', 'Neuter', 'Other', 'Undecided');
 
        $o .= "<select name=\"gender$suffix\" id=\"gender-select$suffix\" size=\"1\" >";
        foreach($select as $selection) {
@@ -13,6 +13,18 @@ function gender_selector($current="",$suffix="") {
        return $o;
 }      
 
+function sexpref_selector($current="",$suffix="") {
+       $select = array('','Males', 'Females', 'Bisexual', 'Autosexual', 'Abstinent', 'Virgin', 'Nonsexual');
+
+       $o .= "<select name=\"sexual$suffix\" id=\"sexual-select$suffix\" size=\"1\" >";
+       foreach($select as $selection) {
+               $selected = (($selection == $current) ? ' selected="selected" ' : '');
+               $o .= "<option value=\"$selection\" $selected >$selection</option>";
+       }
+       $o .= '</select>';
+       return $o;
+}      
+
 
 function marital_selector($current="",$suffix="") {
        $select = array('','Single', 'Lonely', 'Available', 'Unavailable', 'Dating', 'Unfaithful', 'Sex Addict', 'Friends', 'Friends/Benefits', 'Casual', 'Engaged', 'Married', 'Partners', 'Cohabiting', 'Happy', 'Not Looking', 'Swinger', 'Betrayed', 'Separated', 'Unstable', 'Divorced', 'Widowed', 'Uncertain', 'Complicated', 'Don\'t care', 'Ask me' );
index df5bde32fa2a3f965d47fa9e06da0b29911f521b..06dd6581cdd4f180d360c69f5d737334a6783660 100644 (file)
@@ -278,16 +278,23 @@ input#dfrn-url {
        margin-left: 50px;
        margin-bottom: 20px;
 }
+#profile-edit-dob-hide-label {
+       margin-left: 20px;
+       width: 150px;
+}
+
 
 #profile-edit-profile-name-label,
 #profile-edit-name-label,
 #profile-edit-gender-label,
+#profile-edit-dob-label,
 #profile-edit-address-label,
 #profile-edit-locality-label,
 #profile-edit-region-label,
 #profile-edit-postal-code-label,
 #profile-edit-country-name-label,
 #profile-edit-marital-label,
+#profile-edit-sexual-label,
 #profile-edit-homepage-label {
        float: left;
        width: 175px;
@@ -296,12 +303,14 @@ input#dfrn-url {
 #profile-edit-profile-name,
 #profile-edit-name,
 #gender-select,
+#profile-edit-dob,
 #profile-edit-address,
 #profile-edit-locality,
 #profile-edit-region,
 #profile-edit-postal-code,
 #profile-edit-country-name,
 #marital-select,
+#sexual-select,
 #profile-in-dir-yes,
 #profile-in-dir-no {
        float: left;
@@ -322,12 +331,14 @@ input#dfrn-url {
 #profile-edit-profile-name-end,
 #profile-edit-name-end,
 #profile-edit-gender-end,
+#profile-edit-dob-end,
 #profile-edit-address-end,
 #profile-edit-locality-end,
 #profile-edit-region-end,
 #profile-edit-postal-code-end,
 #profile-edit-country-name-end,
 #profile-edit-marital-end,
+#profile-edit-sexual-end,
 #profile-edit-homepage-end,
 #profile-in-dir-break, 
 #profile-in-dir-end {