forked from GNUsocial/gnu-social
[ExtendedProfile] Hide 'Extra fields' from profile when no field was created by the sysadmin
This commit is contained in:
parent
e5831d6807
commit
0795a39459
@ -57,7 +57,7 @@ class ExtendedProfile
|
||||
$detail->profile_id = $this->profile->getID();
|
||||
$detail->find();
|
||||
|
||||
$fields = array();
|
||||
$fields = [];
|
||||
|
||||
while ($detail->fetch()) {
|
||||
$fields[$detail->field_name][] = clone($detail);
|
||||
@ -115,7 +115,7 @@ class ExtendedProfile
|
||||
public function getPhones()
|
||||
{
|
||||
$phones = (isset($this->fields['phone'])) ? $this->fields['phone'] : null;
|
||||
$pArrays = array();
|
||||
$pArrays = [];
|
||||
|
||||
if (empty($phones)) {
|
||||
$pArrays[] = array(
|
||||
@ -148,7 +148,7 @@ class ExtendedProfile
|
||||
public function getIms()
|
||||
{
|
||||
$ims = (isset($this->fields['im'])) ? $this->fields['im'] : null;
|
||||
$iArrays = array();
|
||||
$iArrays = [];
|
||||
|
||||
if (empty($ims)) {
|
||||
$iArrays[] = array(
|
||||
@ -176,7 +176,7 @@ class ExtendedProfile
|
||||
public function getWebsites()
|
||||
{
|
||||
$sites = (isset($this->fields['website'])) ? $this->fields['website'] : null;
|
||||
$wArrays = array();
|
||||
$wArrays = [];
|
||||
|
||||
if (empty($sites)) {
|
||||
$wArrays[] = array(
|
||||
@ -207,7 +207,7 @@ class ExtendedProfile
|
||||
$start = (isset($this->fields['start'])) ? $this->fields['start'] : null;
|
||||
$end = (isset($this->fields['end'])) ? $this->fields['end'] : null;
|
||||
|
||||
$eArrays = array();
|
||||
$eArrays = [];
|
||||
|
||||
if (empty($companies)) {
|
||||
$eArrays[] = array(
|
||||
@ -245,7 +245,7 @@ class ExtendedProfile
|
||||
$descs = (isset($this->fields['degree_descr'])) ? $this->fields['degree_descr'] : null;
|
||||
$start = (isset($this->fields['school_start'])) ? $this->fields['school_start'] : null;
|
||||
$end = (isset($this->fields['school_end'])) ? $this->fields['school_end'] : null;
|
||||
$iArrays = array();
|
||||
$iArrays = [];
|
||||
|
||||
if (empty($schools)) {
|
||||
$iArrays[] = array(
|
||||
@ -287,10 +287,12 @@ class ExtendedProfile
|
||||
*/
|
||||
public function getSections()
|
||||
{
|
||||
$display_extra = false;
|
||||
$gsefields = GNUsocialProfileExtensionField::allFields();
|
||||
$extra_fields = [];
|
||||
gnusocial_profile_merge($this->profile);
|
||||
foreach ($gsefields as $field) {
|
||||
$display_extra = true;
|
||||
$field_key = $field->systemname;
|
||||
switch ($field->type) {
|
||||
case 'text':
|
||||
@ -304,95 +306,99 @@ class ExtendedProfile
|
||||
$extra_fields[$field_key]['label'] = $field->title;
|
||||
$extra_fields[$field_key]['value'] = $this->profile->$field_key;
|
||||
}
|
||||
return array(
|
||||
'basic' => array(
|
||||
|
||||
$sections = [
|
||||
'basic' => [
|
||||
// TRANS: Field label for extended profile properties.
|
||||
'label' => _m('Personal'),
|
||||
'fields' => array(
|
||||
'fullname' => array(
|
||||
'fields' => [
|
||||
'fullname' => [
|
||||
// TRANS: Field label for extended profile properties.
|
||||
'label' => _m('Full name'),
|
||||
'profile' => 'fullname',
|
||||
'vcard' => 'fn',
|
||||
),
|
||||
'title' => array(
|
||||
],
|
||||
'title' => [
|
||||
// TRANS: Field label for extended profile properties.
|
||||
'label' => _m('Title'),
|
||||
'vcard' => 'title',
|
||||
),
|
||||
'manager' => array(
|
||||
],
|
||||
'manager' => [
|
||||
// TRANS: Field label for extended profile properties.
|
||||
'label' => _m('Manager'),
|
||||
'type' => 'person',
|
||||
'vcard' => 'x-manager',
|
||||
),
|
||||
'location' => array(
|
||||
],
|
||||
'location' => [
|
||||
// TRANS: Field label for extended profile properties.
|
||||
'label' => _m('Location'),
|
||||
'profile' => 'location'
|
||||
),
|
||||
'bio' => array(
|
||||
],
|
||||
'bio' => [
|
||||
// TRANS: Field label for extended profile properties.
|
||||
'label' => _m('Bio'),
|
||||
'type' => 'textarea',
|
||||
'profile' => 'bio',
|
||||
),
|
||||
'tags' => array(
|
||||
],
|
||||
'tags' => [
|
||||
// TRANS: Field label for extended profile properties.
|
||||
'label' => _m('Tags'),
|
||||
'type' => 'tags',
|
||||
'profile' => 'tags',
|
||||
),
|
||||
),
|
||||
),
|
||||
'contact' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
'contact' => [
|
||||
// TRANS: Field label for extended profile properties.
|
||||
'label' => _m('Contact'),
|
||||
'fields' => array(
|
||||
'fields' => [
|
||||
'phone' => $this->getPhones(),
|
||||
'im' => $this->getIms(),
|
||||
'website' => $this->getWebsites()
|
||||
),
|
||||
),
|
||||
'personal' => array(
|
||||
],
|
||||
],
|
||||
'personal' => [
|
||||
// TRANS: Field label for extended profile properties.
|
||||
'label' => _m('Personal'),
|
||||
'fields' => array(
|
||||
'birthday' => array(
|
||||
'fields' => [
|
||||
'birthday' => [
|
||||
// TRANS: Field label for extended profile properties.
|
||||
'label' => _m('Birthday'),
|
||||
'type' => 'date',
|
||||
'vcard' => 'bday',
|
||||
),
|
||||
'spouse' => array(
|
||||
],
|
||||
'spouse' => [
|
||||
// TRANS: Field label for extended profile properties.
|
||||
'label' => _m('Spouse\'s name'),
|
||||
'vcard' => 'x-spouse',
|
||||
),
|
||||
'kids' => array(
|
||||
],
|
||||
'kids' => [
|
||||
// TRANS: Field label for extended profile properties.
|
||||
'label' => _m('Kids\' names')
|
||||
),
|
||||
),
|
||||
),
|
||||
'experience' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
'experience' => [
|
||||
// TRANS: Field label for extended profile properties.
|
||||
'label' => _m('Work experience'),
|
||||
'fields' => array(
|
||||
'fields' => [
|
||||
'experience' => $this->getExperiences()
|
||||
),
|
||||
),
|
||||
'education' => array(
|
||||
],
|
||||
],
|
||||
'education' => [
|
||||
// TRANS: Field label for extended profile properties.
|
||||
'label' => _m('Education'),
|
||||
'fields' => array(
|
||||
'fields' => [
|
||||
'education' => $this->getEducation()
|
||||
),
|
||||
),
|
||||
'extra' => [
|
||||
'label' => _m('Extra fields'),
|
||||
],
|
||||
],
|
||||
];
|
||||
if ($display_extra) {
|
||||
$sections['extra'] = [
|
||||
'label' => _m('Additional information'),
|
||||
'fields' => $extra_fields,
|
||||
]
|
||||
);
|
||||
];
|
||||
}
|
||||
return $sections;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-08-14 15:06+0100\n"
|
||||
"POT-Creation-Date: 2019-08-14 15:07+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -75,72 +75,72 @@ msgid "Institution"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Field label for extended profile properties.
|
||||
#: lib/extendedprofile.php:310 lib/extendedprofile.php:359
|
||||
#: lib/extendedprofile.php:313 lib/extendedprofile.php:362
|
||||
msgid "Personal"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Field label for extended profile properties.
|
||||
#: lib/extendedprofile.php:314
|
||||
#: lib/extendedprofile.php:317
|
||||
msgid "Full name"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Field label for extended profile properties.
|
||||
#: lib/extendedprofile.php:320 actions/profilefieldsadminpanel.php:137
|
||||
#: lib/extendedprofile.php:323 actions/profilefieldsadminpanel.php:180
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Field label for extended profile properties.
|
||||
#: lib/extendedprofile.php:325
|
||||
#: lib/extendedprofile.php:328
|
||||
msgid "Manager"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Field label for extended profile properties.
|
||||
#: lib/extendedprofile.php:331
|
||||
#: lib/extendedprofile.php:334
|
||||
msgid "Location"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Field label for extended profile properties.
|
||||
#: lib/extendedprofile.php:336
|
||||
#: lib/extendedprofile.php:339
|
||||
msgid "Bio"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Field label for extended profile properties.
|
||||
#: lib/extendedprofile.php:342
|
||||
#: lib/extendedprofile.php:345
|
||||
msgid "Tags"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Field label for extended profile properties.
|
||||
#: lib/extendedprofile.php:350
|
||||
#: lib/extendedprofile.php:353
|
||||
msgid "Contact"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Field label for extended profile properties.
|
||||
#: lib/extendedprofile.php:363
|
||||
#: lib/extendedprofile.php:366
|
||||
msgid "Birthday"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Field label for extended profile properties.
|
||||
#: lib/extendedprofile.php:369
|
||||
#: lib/extendedprofile.php:372
|
||||
msgid "Spouse's name"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Field label for extended profile properties.
|
||||
#: lib/extendedprofile.php:374
|
||||
#: lib/extendedprofile.php:377
|
||||
msgid "Kids' names"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Field label for extended profile properties.
|
||||
#: lib/extendedprofile.php:380
|
||||
#: lib/extendedprofile.php:383
|
||||
msgid "Work experience"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Field label for extended profile properties.
|
||||
#: lib/extendedprofile.php:387
|
||||
#: lib/extendedprofile.php:390
|
||||
msgid "Education"
|
||||
msgstr ""
|
||||
|
||||
#: lib/extendedprofile.php:393
|
||||
msgid "Extra fields"
|
||||
#: lib/extendedprofile.php:398
|
||||
msgid "Additional information"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Title for extended profile entry deletion dialog.
|
||||
@ -196,7 +196,7 @@ msgstr ""
|
||||
#. TRANS: Field label in education area of extended profile.
|
||||
#. TRANS: Field label in education edit area of extended profile.
|
||||
#: lib/extendedprofilewidget.php:433 lib/extendedprofilewidget.php:487
|
||||
#: actions/profilefieldsadminpanel.php:153
|
||||
#: actions/profilefieldsadminpanel.php:196
|
||||
msgid "Description"
|
||||
msgstr ""
|
||||
|
||||
@ -212,7 +212,7 @@ msgid "TYPE: %s"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Button text for saving extended profile properties.
|
||||
#: lib/extendedprofilewidget.php:667
|
||||
#: lib/extendedprofilewidget.php:667 actions/profilefieldsadminpanel.php:224
|
||||
msgctxt "BUTTON"
|
||||
msgid "Save"
|
||||
msgstr ""
|
||||
@ -224,128 +224,138 @@ msgid "Save details"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Title for extended profile settings.
|
||||
#: actions/profiledetailsettings.php:29
|
||||
#. TRANS: %%site.name%% is the name of the site.
|
||||
#: actions/profiledetailsettings.php:35
|
||||
msgid "Extended profile settings"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Message given submitting a form with an unknown action.
|
||||
#: actions/profiledetailsettings.php:53
|
||||
#: actions/profiledetailsettings.php:59
|
||||
msgid "Unexpected form submission."
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Success message after saving extended profile details.
|
||||
#: actions/profiledetailsettings.php:102
|
||||
#: actions/profiledetailsettings.php:108
|
||||
msgid "Details saved."
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Exception thrown when no date was entered in a required date field.
|
||||
#. TRANS: %s is the field name.
|
||||
#: actions/profiledetailsettings.php:112
|
||||
#: actions/profiledetailsettings.php:118
|
||||
#, php-format
|
||||
msgid "You must supply a date for \"%s\"."
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Exception thrown on incorrect data input.
|
||||
#. TRANS: %1$s is a field name, %2$s is the incorrect input.
|
||||
#: actions/profiledetailsettings.php:124
|
||||
#: actions/profiledetailsettings.php:130
|
||||
#, php-format
|
||||
msgid "Invalid date entered for \"%1$s\": %2$s."
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Exception thrown when entering an invalid URL.
|
||||
#. TRANS: %s is the invalid URL.
|
||||
#: actions/profiledetailsettings.php:241
|
||||
#: actions/profiledetailsettings.php:247
|
||||
#, php-format
|
||||
msgid "Invalid URL: %s."
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Server error displayed when a field could not be saved in the database.
|
||||
#: actions/profiledetailsettings.php:484 actions/profiledetailsettings.php:497
|
||||
#: actions/profiledetailsettings.php:490 actions/profiledetailsettings.php:503
|
||||
msgid "Could not save profile details."
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Validation error in form for profile settings.
|
||||
#. TRANS: %s is an invalid tag.
|
||||
#: actions/profiledetailsettings.php:539
|
||||
#: actions/profiledetailsettings.php:545
|
||||
#, php-format
|
||||
msgid "Invalid tag: \"%s\"."
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Server error thrown when user profile settings could not be saved.
|
||||
#: actions/profiledetailsettings.php:578
|
||||
#: actions/profiledetailsettings.php:584
|
||||
msgid "Could not save profile."
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:34
|
||||
#: actions/profilefieldsadminpanel.php:39
|
||||
msgid "Profile fields"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:39
|
||||
#: actions/profilefieldsadminpanel.php:49
|
||||
msgid "GNU Social custom profile fields"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:55
|
||||
#: actions/profilefieldsadminpanel.php:65
|
||||
msgid ""
|
||||
"Internal system name must be unique and consist of only alphanumeric "
|
||||
"characters!"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:65
|
||||
#: actions/profilefieldsadminpanel.php:75
|
||||
msgid "There was an error with the field data."
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:97
|
||||
#: actions/profilefieldsadminpanel.php:87
|
||||
msgid "Field not found."
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:140
|
||||
msgid "New Profile Field"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:106
|
||||
#: actions/profilefieldsadminpanel.php:149
|
||||
msgid "Edit Profile Field"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:110
|
||||
#: actions/profilefieldsadminpanel.php:153
|
||||
msgid "Existing Custom Profile Fields"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:139
|
||||
#: actions/profilefieldsadminpanel.php:182
|
||||
msgid "The title of the field"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:145
|
||||
#: actions/profilefieldsadminpanel.php:188
|
||||
msgid "Internal name"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:147
|
||||
#: actions/profilefieldsadminpanel.php:190
|
||||
msgid ""
|
||||
"The alphanumeric name used internally for this field. Also the key used for "
|
||||
"federation (e.g. ActivityPub and OStatus) user info."
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:155
|
||||
#: actions/profilefieldsadminpanel.php:198
|
||||
msgid "An optional more detailed description of the field"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:161
|
||||
#: actions/profilefieldsadminpanel.php:204
|
||||
msgid "Type"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:162
|
||||
#: actions/profilefieldsadminpanel.php:205
|
||||
msgid "Text"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:163
|
||||
#: actions/profilefieldsadminpanel.php:206
|
||||
msgid "String"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:164
|
||||
#: actions/profilefieldsadminpanel.php:207
|
||||
msgid "The type of the datafield"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:181
|
||||
msgid "Save"
|
||||
#: actions/profilefieldsadminpanel.php:224
|
||||
msgid "Save field"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:181
|
||||
msgid "Save new field"
|
||||
#: actions/profilefieldsadminpanel.php:226
|
||||
msgctxt "BUTTON"
|
||||
msgid "Remove"
|
||||
msgstr ""
|
||||
|
||||
#: actions/profilefieldsadminpanel.php:226
|
||||
msgid "Remove field"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Link title for link on user profile.
|
||||
|
Loading…
Reference in New Issue
Block a user