diff options
author | Mario Vavti <mario@mariovavti.com> | 2016-03-12 22:13:46 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2016-03-12 22:13:46 +0100 |
commit | 2d8deb60826a12b5bbe6ac1a8c123796c201d6fd (patch) | |
tree | 59f032e68fc5ff7b7335d81ddab2f37984b1d1be | |
parent | 4e9440396cbff64e1ffbe3025a2e02baeb41f9c0 (diff) | |
download | volse-hubzilla-2d8deb60826a12b5bbe6ac1a8c123796c201d6fd.tar.gz volse-hubzilla-2d8deb60826a12b5bbe6ac1a8c123796c201d6fd.tar.bz2 volse-hubzilla-2d8deb60826a12b5bbe6ac1a8c123796c201d6fd.zip |
some janitor work on profiles
-rw-r--r-- | include/datetime.php | 12 | ||||
-rw-r--r-- | mod/profiles.php | 29 | ||||
-rwxr-xr-x | view/tpl/profile_edit.tpl | 31 | ||||
-rw-r--r-- | view/tpl/profile_hide_friends.tpl | 20 |
4 files changed, 29 insertions, 63 deletions
diff --git a/include/datetime.php b/include/datetime.php index 57b2b6d37..8ee70a6fa 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -119,6 +119,8 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d * @return string */ function dob($dob) { + $a = get_app(); + list($year, $month, $day) = sscanf($dob, '%4d-%2d-%2d'); $f = get_config('system', 'birthday_input_format'); if (! $f) @@ -129,7 +131,15 @@ function dob($dob) { else $value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d')); - $o = '<input class="form-control" type="text" name="dob" value="' . $value . '" placeholder="' . t('YYYY-MM-DD or MM-DD') . '" />'; + $o = replace_macros(get_markup_template("field_input.tpl"), array('$field' => array( + 'dob', + t('Birthday'), + $value, + ((intval($value)) ? t('Age: ') . age($value,$a->user['timezone'],$a->user['timezone']) : ''), + '', + 'placeholder="' . t('YYYY-MM-DD or MM-DD') .'"' + ))); + // if ($dob && $dob != '0000-00-00') // $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year),'dob'); diff --git a/mod/profiles.php b/mod/profiles.php index 57d3561b1..f6d75bb7e 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -639,14 +639,13 @@ function profiles_content(&$a) { else $fields = $profile_fields_basic; - - $opt_tpl = get_markup_template("profile_hide_friends.tpl"); - $hide_friends = replace_macros($opt_tpl,array('$field' => array( - 'hide_friends', - t('Hide your contact/friend list from viewers of this profile?'), - $r[0]['hide_friends'], - '', - ))); + $hide_friends = array( + 'hide_friends', + t('Hide your contact/friend list from viewers of this profile?'), + $r[0]['hide_friends'], + '', + array(t('No'),t('Yes')) + ); $q = q("select * from profdef where true"); if($q) { @@ -672,6 +671,7 @@ function profiles_content(&$a) { $f = 'ymd'; $is_default = (($r[0]['is_default']) ? 1 : 0); + $tpl = get_markup_template("profile_edit.tpl"); $o .= replace_macros($tpl,array( @@ -695,11 +695,7 @@ function profiles_content(&$a) { '$exportable' => feature_enabled(local_channel(),'profile_export'), '$lbl_import' => t('Import profile from file'), '$lbl_export' => t('Export profile to file'), - '$lbl_profname' => t('Profile Name'), - '$lbl_fullname' => t('Your Full Name'), - '$lbl_title' => t('Title/Description'), '$lbl_gender' => t('Your Gender'), - '$lbl_bd' => t("Birthday"), '$lbl_address' => t('Street Address'), '$lbl_city' => t('Locality/City'), '$lbl_zip' => t('Postal/Zip Code'), @@ -733,12 +729,12 @@ function profiles_content(&$a) { '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), '$baseurl' => $a->get_baseurl(true), '$profile_id' => $r[0]['id'], - '$profile_name' => $r[0]['profile_name'], + '$profile_name' => array('profile_name', t('Profile Name'), $r[0]['profile_name'], '', '*'), '$is_default' => $is_default, '$default' => t('This is your default profile.') . EOL . translate_scope(map_scope($channel['channel_r_profile'])), '$advanced' => $advanced, - '$name' => $r[0]['name'], - '$pdesc' => $r[0]['pdesc'], + '$name' => array('name', t('Your Full Name'), $r[0]['name']), + '$pdesc' => array('pdesc', t('Title/Description'), $r[0]['pdesc']), '$dob' => dob($r[0]['dob']), '$hide_friends' => $hide_friends, '$address' => $r[0]['address'], @@ -746,9 +742,8 @@ function profiles_content(&$a) { '$region' => $r[0]['region'], '$postal_code' => $r[0]['postal_code'], '$country_name' => $r[0]['country_name'], - '$age' => ((intval($r[0]['dob'])) ? '(' . t('Age: ') . age($r[0]['dob'],$a->user['timezone'],$a->user['timezone']) . ')' : ''), '$gender' => gender_selector($r[0]['gender']), - '$gender_min' => gender_selector_min($r[0]['gender']), + '$gender_min' => gender_selector_min($r[0]['gender']), '$marital' => marital_selector($r[0]['marital']), '$marital_min' => marital_selector_min($r[0]['marital']), '$with' => $r[0]['with'], diff --git a/view/tpl/profile_edit.tpl b/view/tpl/profile_edit.tpl index 26da4ebc9..f3f3efd6f 100755 --- a/view/tpl/profile_edit.tpl +++ b/view/tpl/profile_edit.tpl @@ -21,32 +21,19 @@ <div id="profile-edit-links-end"></div> {{if $is_default}} -<p class="section-content-info-wrapper">{{$default}}</p> +<div class="section-content-info-wrapper">{{$default}}</div> {{/if}} <div id="profile-edit-wrapper" > <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> -<div id="profile-edit-profile-name-wrapper" class="form-group field"> -<label id="profile-edit-profile-name-label" for="profile-edit-profile-name" ><span class="required">*</span> {{$lbl_profname}} </label> -<input type="text" class="form-control" size="32" name="profile_name" id="profile-edit-profile-name" value="{{$profile_name}}" /> -</div> -<div id="profile-edit-profile-name-end"></div> - -<div id="profile-edit-name-wrapper" class="form-group field" > -<label id="profile-edit-name-label" for="profile-edit-name" >{{$lbl_fullname}} </label> -<input type="text" class="form-control" size="32" name="name" id="profile-edit-name" value="{{$name}}" /> -</div> -<div id="profile-edit-name-end"></div> +{{include file="field_input.tpl" field=$profile_name}} +{{include file="field_input.tpl" field=$name}} {{if $fields.pdesc}} -<div id="profile-edit-pdesc-wrapper" class="form-group field" > -<label id="profile-edit-pdesc-label" for="profile-edit-pdesc" >{{$lbl_title}} </label> -<input type="text" class="form-control" size="32" name="pdesc" id="profile-edit-pdesc" value="{{$pdesc}}" /> -</div> -<div id="profile-edit-pdesc-end"></div> +{{include file="field_input.tpl" field=$pdesc}} {{/if}} {{if $fields.gender}} @@ -62,16 +49,10 @@ {{/if}} {{if $fields.dob}} -<div id="profile-edit-dob-wrapper" class="form-group field" > -<label id="profile-edit-dob-label" for="dob-select" >{{$lbl_bd}} </label> -<div id="profile-edit-dob" > -{{$dob}} {{$age}} -</div> -</div> -<div id="profile-edit-dob-end"></div> +{{$dob}} {{/if}} -{{$hide_friends}} +{{include file="field_checkbox.tpl" field=$hide_friends}} <div class="profile-edit-submit-wrapper" > <input type="submit" name="submit" class="profile-edit-submit-button" value="{{$submit}}" /> diff --git a/view/tpl/profile_hide_friends.tpl b/view/tpl/profile_hide_friends.tpl deleted file mode 100644 index 4ed6782bb..000000000 --- a/view/tpl/profile_hide_friends.tpl +++ /dev/null @@ -1,20 +0,0 @@ -{{include file="field_checkbox.tpl"}} - -{{* -<p id="hide-friends-text"> -{{$desc}} -</p> - <div id="hide-friends-yes-wrapper"> - <label id="hide-friends-yes-label" for="hide-friends-yes">{{$yes_str}}</label> - <input type="radio" name="hide-friends" id="hide-friends-yes" {{$yes_selected}} value="1" /> - - <div id="hide-friends-break" ></div> - </div> - - <div id="hide-friends-no-wrapper"> - <label id="hide-friends-no-label" for="hide-friends-no">{{$no_str}}</label> - <input type="radio" name="hide-friends" id="hide-friends-no" {{$no_selected}} value="0" /> - - <div id="hide-friends-end"></div> - </div> -*}} |