From 44b19841360099cc3e78d1a3612f7aa23e2e6524 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Sat, 10 Jul 2010 07:09:57 -0700 Subject: profile additions --- include/datetime.php | 27 +++++++++++++++++---------- mod/profiles.php | 11 ++++++++--- updates.sql | 5 +++++ view/profile_edit.tpl | 15 +++++++++++++++ view/profile_selectors.php | 14 +++++++++++++- view/style.css | 11 +++++++++++ 6 files changed, 69 insertions(+), 14 deletions(-) diff --git a/include/datetime.php b/include/datetime.php index 0beadbe78..540c43691 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -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 .= "- - "; diff --git a/mod/profiles.php b/mod/profiles.php index 8b44e2d59..34678a237 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -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'] .= ""; + + + -// $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) ? "

This is your public profile.

" : ""), '$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 : '') diff --git a/updates.sql b/updates.sql index f74877d25..07c4c760c 100644 --- a/updates.sql +++ b/updates.sql @@ -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 diff --git a/view/profile_edit.tpl b/view/profile_edit.tpl index 251fdae14..ff0e2f8e4 100644 --- a/view/profile_edit.tpl +++ b/view/profile_edit.tpl @@ -25,6 +25,13 @@ $gender
+
+

Leave year blank to suppress age.

+ +
+$dob +
+
@@ -73,6 +80,14 @@ $marital
+
+ +$sexual +
+
+ + +
diff --git a/view/profile_selectors.php b/view/profile_selectors.php index c6e64403a..902f6a1a5 100644 --- a/view/profile_selectors.php +++ b/view/profile_selectors.php @@ -2,7 +2,7 @@ function gender_selector($current="",$suffix="") { - $select = array('','Male','Female','Other'); + $select = array('','Male', 'Female', 'Transsexual', 'Hermaphrodite', 'Neuter', 'Other', 'Undecided'); $o .= ""; + foreach($select as $selection) { + $selected = (($selection == $current) ? ' selected="selected" ' : ''); + $o .= ""; + } + $o .= ''; + 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' ); diff --git a/view/style.css b/view/style.css index df5bde32f..06dd6581c 100644 --- a/view/style.css +++ b/view/style.css @@ -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 { -- cgit v1.2.3