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

@ -327,7 +327,7 @@ function profiles_post(&$a) {
$hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
set_pconfig(local_user(),'system','detailled_profile', (($_POST['detailled_profile'] == 1) ? 1: 0));
$changes = array(); $changes = array();
$value = ''; $value = '';
@ -664,8 +664,10 @@ function profiles_content(&$a) {
'$no_selected' => (($r[0]['hide-friends'] == 0) ? " checked=\"checked\" " : "") '$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'); $f = get_config('system','birthday_input_format');
if(! $f) if(! $f)
@ -674,6 +676,17 @@ function profiles_content(&$a) {
$is_default = (($r[0]['is-default']) ? 1 : 0); $is_default = (($r[0]['is-default']) ? 1 : 0);
$tpl = get_markup_template("profile_edit.tpl"); $tpl = get_markup_template("profile_edit.tpl");
$o .= replace_macros($tpl,array( $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'), '$multi_profiles' => feature_enabled(local_user(),'multi_profiles'),
'$form_security_token' => get_form_security_token("profile_edit"), '$form_security_token' => get_form_security_token("profile_edit"),
'$form_security_token_photo' => get_form_security_token("profile_photo"), '$form_security_token_photo' => get_form_security_token("profile_photo"),

View file

@ -21,6 +21,8 @@
<form id="profile-edit-form" name="form1" action="profiles/{{$profile_id}}" method="post" > <form id="profile-edit-form" name="form1" action="profiles/{{$profile_id}}" method="post" >
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'> <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" > <div id="profile-edit-profile-name-wrapper" >
<label id="profile-edit-profile-name-label" for="profile-edit-profile-name" >{{$lbl_profname}} </label> <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> <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>
<div class="profile-edit-submit-end"></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> </form>
</div> </div>
<script type="text/javascript">Fill_Country('{{$country_name}}');Fill_States('{{$region}}');</script> <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}}" /> <input type="hidden" name="profile" value="{{$profile_name}}" />
<!-- Profile picture --> <!-- Profile picture -->
{{if $detailled_profile}}
<div class="toggle-section js-toggle-section"> <div class="toggle-section js-toggle-section">
<a class="section-caption js-section-toggler" href="javascript:;">{{$lbl_picture_section}} &raquo;</a> <a class="section-caption js-section-toggler" href="javascript:;">{{$lbl_picture_section}} &raquo;</a>
<div class="js-section toggle-section-content hidden"> <div class="js-section toggle-section-content hidden">
{{/if}}
<div id="profile-photo-upload-wrapper"> <div id="profile-photo-upload-wrapper">
<label id="profile-photo-upload-label" for="profile-photo-upload">{{$lbl_profile_photo}}:</label> <label id="profile-photo-upload-label" for="profile-photo-upload">{{$lbl_profile_photo}}:</label>
@ -46,19 +48,23 @@
</div> </div>
<div class="profile-edit-submit-end"></div> <div class="profile-edit-submit-end"></div>
{{if $detailled_profile}}
</div> </div>
</div> </div>
{{/if}}
</form> </form>
<form id="profile-edit-form" name="form1" action="profiles/{{$profile_id}}" method="post" > <form id="profile-edit-form" name="form1" action="profiles/{{$profile_id}}" method="post" >
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'> <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
{{if $detailled_profile}}
<!-- Basic information --> <!-- Basic information -->
<div class="toggle-section js-toggle-section"> <div class="toggle-section js-toggle-section">
<a class="section-caption js-section-toggler" href="javascript:;">{{$lbl_basic_section}} &raquo;</a> <a class="section-caption js-section-toggler" href="javascript:;">{{$lbl_basic_section}} &raquo;</a>
<div class="js-section toggle-section-content hidden"> <div class="js-section toggle-section-content hidden">
{{include file="field_yesno.tpl" field=$details}}
{{if $multi_profiles}} {{if $multi_profiles}}
<div id="profile-edit-profile-name-wrapper" > <div id="profile-edit-profile-name-wrapper" >
<label id="profile-edit-profile-name-label" for="profile-edit-profile-name" >{{$lbl_profname}} </label> <label id="profile-edit-profile-name-label" for="profile-edit-profile-name" >{{$lbl_profname}} </label>
@ -309,6 +315,129 @@
</div> </div>
</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> </form>
</div> </div>