Merge pull request #1982 from annando/1510-reduced-profile

Profile data are now reduced to only the most important fields
This commit is contained in:
Tobias Diekershoff 2015-10-25 16:54:24 +01:00
commit 03ff349a94
3 changed files with 284 additions and 18 deletions

View file

@ -206,7 +206,7 @@ function profiles_post(&$a) {
if($ignore_year)
$dob = '0000-' . $dob;
}
$name = notags(trim($_POST['name']));
if(! strlen($name)) {
@ -327,7 +327,7 @@ function profiles_post(&$a) {
$hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
set_pconfig(local_user(),'system','detailled_profile', (($_POST['detailled_profile'] == 1) ? 1: 0));
$changes = array();
$value = '';
@ -540,7 +540,7 @@ function profile_activity($changed, $value) {
return;
$arr = array();
$arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), local_user());
$arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), local_user());
$arr['uid'] = local_user();
$arr['contact-id'] = $self[0]['id'];
$arr['wall'] = 1;
@ -552,7 +552,7 @@ function profile_activity($changed, $value) {
$arr['author-avatar'] = $arr['owner-avatar'] = $self[0]['thumb'];
$arr['verb'] = ACTIVITY_UPDATE;
$arr['object-type'] = ACTIVITY_OBJ_PROFILE;
$A = '[url=' . $self[0]['url'] . ']' . $self[0]['name'] . '[/url]';
@ -570,7 +570,7 @@ function profile_activity($changed, $value) {
$changes .= $ch;
}
$prof = '[url=' . $self[0]['url'] . '?tab=profile' . ']' . t('public profile') . '[/url]';
$prof = '[url=' . $self[0]['url'] . '?tab=profile' . ']' . t('public profile') . '[/url]';
if($t == 1 && strlen($value)) {
$message = sprintf( t('%1$s changed %2$s to “%3$s”'), $A, $changes, $value);
@ -578,9 +578,9 @@ function profile_activity($changed, $value) {
}
else
$message = sprintf( t('%1$s has an updated %2$s, changing %3$s.'), $A, $prof, $changes);
$arr['body'] = $message;
$arr['body'] = $message;
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PROFILE . '</type><title>' . $self[0]['name'] . '</title>'
. '<id>' . $self[0]['url'] . '/' . $self[0]['name'] . '</id>';
@ -664,8 +664,10 @@ function profiles_content(&$a) {
'$no_selected' => (($r[0]['hide-friends'] == 0) ? " checked=\"checked\" " : "")
));
$personal_account = !(in_array($a->user["page-flags"],
array(PAGE_COMMUNITY, PAGE_PRVGROUP)));
$detailled_profile = (get_pconfig(local_user(),'system','detailled_profile') AND $personal_account);
$f = get_config('system','birthday_input_format');
if(! $f)
@ -674,6 +676,17 @@ function profiles_content(&$a) {
$is_default = (($r[0]['is-default']) ? 1 : 0);
$tpl = get_markup_template("profile_edit.tpl");
$o .= replace_macros($tpl,array(
'$personal_account' => $personal_account,
'$detailled_profile' => $detailled_profile,
'$details' => array(
'detailled_profile', //Name
t('Show more profile fields:'), //Label
$detailled_profile, //Value
'', //Help string
array(t('No'),t('Yes')) //Off - On strings
),
'$multi_profiles' => feature_enabled(local_user(),'multi_profiles'),
'$form_security_token' => get_form_security_token("profile_edit"),
'$form_security_token_photo' => get_form_security_token("profile_photo"),
@ -775,10 +788,10 @@ function profiles_content(&$a) {
return $o;
}
//Profiles list.
else {
//If we don't support multi profiles, don't display this list.
if(!feature_enabled(local_user(),'multi_profiles')){
$r = q(
@ -790,11 +803,11 @@ function profiles_content(&$a) {
goaway($a->get_baseurl(true) . '/profiles/'.$r[0]['id']);
}
}
$r = q("SELECT * FROM `profile` WHERE `uid` = %d",
local_user());
if(count($r)) {
$tpl_header = get_markup_template('profile_listing_header.tpl');
$o .= replace_macros($tpl_header,array(
'$header' => t('Edit/Manage Profiles'),
@ -802,17 +815,17 @@ function profiles_content(&$a) {
'$cr_new' => t('Create New Profile'),
'$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new")
));
$tpl = get_markup_template('profile_entry.tpl');
foreach($r as $rr) {
$o .= replace_macros($tpl, array(
'$photo' => $a->get_cached_avatar_image($rr['thumb']),
'$id' => $rr['id'],
'$alt' => t('Profile Image'),
'$profile_name' => $rr['profile-name'],
'$visible' => (($rr['is-default']) ? '<strong>' . t('visible to everybody') . '</strong>'
'$visible' => (($rr['is-default']) ? '<strong>' . t('visible to everybody') . '</strong>'
: '<a href="' . $a->get_baseurl(true) . '/profperm/' . $rr['id'] . '" />' . t('Edit visibility') . '</a>')
));
}

View file

@ -21,6 +21,8 @@
<form id="profile-edit-form" name="form1" action="profiles/{{$profile_id}}" method="post" >
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
{{if $detailled_profile}}
{{include file="field_yesno.tpl" field=$details}}
<div id="profile-edit-profile-name-wrapper" >
<label id="profile-edit-profile-name-label" for="profile-edit-profile-name" >{{$lbl_profname}} </label>
<input type="text" size="32" name="profile_name" id="profile-edit-profile-name" value="{{$profile_name|escape:'html'}}" /><div class="required">*</div>
@ -318,7 +320,129 @@
</div>
<div class="profile-edit-submit-end"></div>
{{else}}
{{if $personal_account}}
{{include file="field_yesno.tpl" field=$details}}
{{/if}}
<div id="profile-edit-profile-name-wrapper" >
<label id="profile-edit-profile-name-label" for="profile-edit-profile-name" >{{$lbl_profname}} </label>
<input type="text" size="32" name="profile_name" id="profile-edit-profile-name" value="{{$profile_name|escape:'html'}}" /><div class="required">*</div>
</div>
<div id="profile-edit-profile-name-end"></div>
<div id="profile-edit-name-wrapper" >
<label id="profile-edit-name-label" for="profile-edit-name" >{{$lbl_fullname}} </label>
<input type="text" size="32" name="name" id="profile-edit-name" value="{{$name|escape:'html'}}" />
</div>
<div id="profile-edit-name-end"></div>
{{if $personal_account}}
<div id="profile-edit-gender-wrapper" >
<label id="profile-edit-gender-label" for="gender-select" >{{$lbl_gender}} </label>
{{$gender}}
</div>
<div id="profile-edit-gender-end"></div>
<div id="profile-edit-dob-wrapper" >
<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>
{{/if}}
<div id="profile-edit-homepage-wrapper" >
<label id="profile-edit-homepage-label" for="profile-edit-homepage" >{{$lbl_homepage}} </label>
<input type="url" size="32" name="homepage" id="profile-edit-homepage" value="{{$homepage|escape:'html'}}" />
</div>
<div id="profile-edit-homepage-end"></div>
{{$hide_friends}}
<div id="profile-edit-address-wrapper" >
<label id="profile-edit-address-label" for="profile-edit-address" >{{$lbl_address}} </label>
<input type="text" size="32" name="address" id="profile-edit-address" value="{{$address|escape:'html'}}" />
</div>
<div id="profile-edit-address-end"></div>
<div id="profile-edit-locality-wrapper" >
<label id="profile-edit-locality-label" for="profile-edit-locality" >{{$lbl_city}} </label>
<input type="text" size="32" name="locality" id="profile-edit-locality" value="{{$locality|escape:'html'}}" />
</div>
<div id="profile-edit-locality-end"></div>
<div id="profile-edit-postal-code-wrapper" >
<label id="profile-edit-postal-code-label" for="profile-edit-postal-code" >{{$lbl_zip}} </label>
<input type="text" size="32" name="postal_code" id="profile-edit-postal-code" value="{{$postal_code|escape:'html'}}" />
</div>
<div id="profile-edit-postal-code-end"></div>
<div id="profile-edit-country-name-wrapper" >
<label id="profile-edit-country-name-label" for="profile-edit-country-name" >{{$lbl_country}} </label>
<select name="country_name" id="profile-edit-country-name" onChange="Fill_States('{{$region}}');">
<option selected="selected" >{{$country_name}}</option>
<option>temp</option>
</select>
</div>
<div id="profile-edit-country-name-end"></div>
<div id="profile-edit-region-wrapper" >
<label id="profile-edit-region-label" for="profile-edit-region" >{{$lbl_region}} </label>
<select name="region" id="profile-edit-region" onChange="Update_Globals();" >
<option selected="selected" >{{$region}}</option>
<option>temp</option>
</select>
</div>
<div id="profile-edit-region-end"></div>
<div id="profile-edit-pubkeywords-wrapper" >
<label id="profile-edit-pubkeywords-label" for="profile-edit-pubkeywords" >{{$lbl_pubkey}} </label>
<input type="text" size="32" name="pub_keywords" id="profile-edit-pubkeywords" title="{{$lbl_ex2}}" value="{{$pub_keywords|escape:'html'}}" />
</div><div id="profile-edit-pubkeywords-desc">{{$lbl_pubdsc}}</div>
<div id="profile-edit-pubkeywords-end"></div>
<div id="profile-edit-prvkeywords-wrapper" >
<label id="profile-edit-prvkeywords-label" for="profile-edit-prvkeywords" >{{$lbl_prvkey}} </label>
<input type="text" size="32" name="prv_keywords" id="profile-edit-prvkeywords" title="{{$lbl_ex2}}" value="{{$prv_keywords|escape:'html'}}" />
</div><div id="profile-edit-prvkeywords-desc">{{$lbl_prvdsc}}</div>
<div id="profile-edit-prvkeywords-end"></div>
<div id="about-jot-wrapper" >
<p id="about-jot-desc" >
{{$lbl_about}}
</p>
<textarea rows="10" cols="72" id="profile-about-text" name="about" >{{$about}}</textarea>
</div>
<div id="about-jot-end"></div>
<div class="profile-edit-submit-wrapper" >
<input type="submit" name="submit" class="profile-edit-submit-button" value="{{$submit}}" />
</div>
<div class="profile-edit-submit-end"></div>
<input type="hidden" name="pdesc" id="profile-edit-pdesc" value="{{$pdesc}}" />
<input type="hidden" id="contact-jot-text" name="contact" value="{{$contact}}" />
<input type="hidden" name="hometown" id="profile-edit-hometown" value="{{$hometown}}" />
<input type="hidden" name="politic" id="profile-edit-politic" value="{{$politic}}" />
<input type="hidden" name="religion" id="profile-edit-religion" value="{{$religion}}" />
<input type="hidden" id="likes-jot-text" name="likes" value="{{$likes}}" />
<input type="hidden" id="dislikes-jot-text" name="dislikes" value="{{$dislikes}}" />
<input type="hidden" name="with" id="profile-edit-with" value="{{$with}}" />
<input type="hidden" name="howlong" id="profile-edit-howlong" value="{{$howlong}}" />
<input type="hidden" id="romance-jot-text" name="romance" value="{{$romance}}" />
<input type="hidden" id="work-jot-text" name="work" value="{{$work}}" />
<input type="hidden" id="education-jot-text" name="education" value="{{$education}}" />
<input type="hidden" id="interest-jot-text" name="interest" value="{{$interest}}" />
<input type="hidden" id="music-jot-text" name="music" value="{{$music}}" />
<input type="hidden" id="book-jot-text" name="book" value="{{$book}}" />
<input type="hidden" id="tv-jot-text" name="tv" value="{{$tv}}" />
<input type="hidden" id="film-jot-text" name="film" value="{{$film}}" />
{{/if}}
</form>
</div>
<script type="text/javascript">Fill_Country('{{$country_name}}');Fill_States('{{$region}}');</script>

View file

@ -32,9 +32,11 @@
<input type="hidden" name="profile" value="{{$profile_name}}" />
<!-- Profile picture -->
{{if $detailled_profile}}
<div class="toggle-section js-toggle-section">
<a class="section-caption js-section-toggler" href="javascript:;">{{$lbl_picture_section}} &raquo;</a>
<div class="js-section toggle-section-content hidden">
{{/if}}
<div id="profile-photo-upload-wrapper">
<label id="profile-photo-upload-label" for="profile-photo-upload">{{$lbl_profile_photo}}:</label>
@ -46,19 +48,23 @@
</div>
<div class="profile-edit-submit-end"></div>
{{if $detailled_profile}}
</div>
</div>
{{/if}}
</form>
<form id="profile-edit-form" name="form1" action="profiles/{{$profile_id}}" method="post" >
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
{{if $detailled_profile}}
<!-- Basic information -->
<div class="toggle-section js-toggle-section">
<a class="section-caption js-section-toggler" href="javascript:;">{{$lbl_basic_section}} &raquo;</a>
<div class="js-section toggle-section-content hidden">
{{include file="field_yesno.tpl" field=$details}}
{{if $multi_profiles}}
<div id="profile-edit-profile-name-wrapper" >
<label id="profile-edit-profile-name-label" for="profile-edit-profile-name" >{{$lbl_profname}} </label>
@ -309,6 +315,129 @@
</div>
</div>
{{else}}
{{if $personal_account}}
{{include file="field_yesno.tpl" field=$details}}
{{/if}}
<div id="profile-edit-profile-name-wrapper" >
<label id="profile-edit-profile-name-label" for="profile-edit-profile-name" >{{$lbl_profname}} </label>
<input type="text" size="32" name="profile_name" id="profile-edit-profile-name" value="{{$profile_name|escape:'html'}}" /><div class="required">*</div>
</div>
<div id="profile-edit-profile-name-end"></div>
<div id="profile-edit-name-wrapper" >
<label id="profile-edit-name-label" for="profile-edit-name" >{{$lbl_fullname}} </label>
<input type="text" size="32" name="name" id="profile-edit-name" value="{{$name|escape:'html'}}" />
</div>
<div id="profile-edit-name-end"></div>
{{if $personal_account}}
<div id="profile-edit-gender-wrapper" >
<label id="profile-edit-gender-label" for="gender-select" >{{$lbl_gender}} </label>
{{$gender}}
</div>
<div id="profile-edit-gender-end"></div>
<div id="profile-edit-dob-wrapper" >
<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>
{{/if}}
<div id="profile-edit-homepage-wrapper" >
<label id="profile-edit-homepage-label" for="profile-edit-homepage" >{{$lbl_homepage}} </label>
<input type="text" size="32" name="homepage" id="profile-edit-homepage" value="{{$homepage}}" />
</div>
<div id="profile-edit-homepage-end"></div>
{{$hide_friends}}
<div id="profile-edit-address-wrapper" >
<label id="profile-edit-address-label" for="profile-edit-address" >{{$lbl_address}} </label>
<input type="text" size="32" name="address" id="profile-edit-address" value="{{$address|escape:'html'}}" />
</div>
<div id="profile-edit-address-end"></div>
<div id="profile-edit-locality-wrapper" >
<label id="profile-edit-locality-label" for="profile-edit-locality" >{{$lbl_city}} </label>
<input type="text" size="32" name="locality" id="profile-edit-locality" value="{{$locality|escape:'html'}}" />
</div>
<div id="profile-edit-locality-end"></div>
<div id="profile-edit-postal-code-wrapper" >
<label id="profile-edit-postal-code-label" for="profile-edit-postal-code" >{{$lbl_zip}} </label>
<input type="text" size="32" name="postal_code" id="profile-edit-postal-code" value="{{$postal_code|escape:'html'}}" />
</div>
<div id="profile-edit-postal-code-end"></div>
<div id="profile-edit-country-name-wrapper" >
<label id="profile-edit-country-name-label" for="profile-edit-country-name" >{{$lbl_country}} </label>
<select name="country_name" id="profile-edit-country-name" onChange="Fill_States('{{$region}}');">
<option selected="selected" >{{$country_name}}</option>
<option>temp</option>
</select>
</div>
<div id="profile-edit-country-name-end"></div>
<div id="profile-edit-region-wrapper" >
<label id="profile-edit-region-label" for="profile-edit-region" >{{$lbl_region}} </label>
<select name="region" id="profile-edit-region" onChange="Update_Globals();" >
<option selected="selected" >{{$region}}</option>
<option>temp</option>
</select>
</div>
<div id="profile-edit-region-end"></div>
<div id="profile-edit-pubkeywords-wrapper" >
<label id="profile-edit-pubkeywords-label" for="profile-edit-pubkeywords" >{{$lbl_pubkey}} </label>
<input type="text" size="32" name="pub_keywords" id="profile-edit-pubkeywords" title="{{$lbl_ex2}}" value="{{$pub_keywords|escape:'html'}}" />
</div><div id="profile-edit-pubkeywords-desc">{{$lbl_pubdsc}}</div>
<div id="profile-edit-pubkeywords-end"></div>
<div id="profile-edit-prvkeywords-wrapper" >
<label id="profile-edit-prvkeywords-label" for="profile-edit-prvkeywords" >{{$lbl_prvkey}} </label>
<input type="text" size="32" name="prv_keywords" id="profile-edit-prvkeywords" title="{{$lbl_ex2}}" value="{{$prv_keywords|escape:'html'}}" />
</div><div id="profile-edit-prvkeywords-desc">{{$lbl_prvdsc}}</div>
<div id="profile-edit-prvkeywords-end"></div>
<div id="about-jot-wrapper" >
<p id="about-jot-desc" >
{{$lbl_about}}
</p>
<textarea rows="10" cols="72" id="profile-about-text" name="about" >{{$about}}</textarea>
</div>
<div id="about-jot-end"></div>
<div class="profile-edit-submit-wrapper" >
<input type="submit" name="submit" class="profile-edit-submit-button" value="{{$submit}}" />
</div>
<div class="profile-edit-submit-end"></div>
<input type="hidden" name="pdesc" id="profile-edit-pdesc" value="{{$pdesc}}" />
<input type="hidden" id="contact-jot-text" name="contact" value="{{$contact}}" />
<input type="hidden" name="hometown" id="profile-edit-hometown" value="{{$hometown}}" />
<input type="hidden" name="politic" id="profile-edit-politic" value="{{$politic}}" />
<input type="hidden" name="religion" id="profile-edit-religion" value="{{$religion}}" />
<input type="hidden" id="likes-jot-text" name="likes" value="{{$likes}}" />
<input type="hidden" id="dislikes-jot-text" name="dislikes" value="{{$dislikes}}" />
<input type="hidden" name="with" id="profile-edit-with" value="{{$with}}" />
<input type="hidden" name="howlong" id="profile-edit-howlong" value="{{$howlong}}" />
<input type="hidden" id="romance-jot-text" name="romance" value="{{$romance}}" />
<input type="hidden" id="work-jot-text" name="work" value="{{$work}}" />
<input type="hidden" id="education-jot-text" name="education" value="{{$education}}" />
<input type="hidden" id="interest-jot-text" name="interest" value="{{$interest}}" />
<input type="hidden" id="music-jot-text" name="music" value="{{$music}}" />
<input type="hidden" id="book-jot-text" name="book" value="{{$book}}" />
<input type="hidden" id="tv-jot-text" name="tv" value="{{$tv}}" />
<input type="hidden" id="film-jot-text" name="film" value="{{$film}}" />
{{/if}}
</form>
</div>