aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-02-23 19:07:01 -0800
committerzotlabs <mike@macgirvin.com>2017-02-23 19:07:01 -0800
commitb1ff5367e7e853d7e0e24c91aecc3a8f80d0ba87 (patch)
tree603c8e4271337b80cbb866dbe7106e4b63b1ea0d
parent96fdb88690fcb572b5bc4948a7df71b3c257a97d (diff)
downloadvolse-hubzilla-b1ff5367e7e853d7e0e24c91aecc3a8f80d0ba87.tar.gz
volse-hubzilla-b1ff5367e7e853d7e0e24c91aecc3a8f80d0ba87.tar.bz2
volse-hubzilla-b1ff5367e7e853d7e0e24c91aecc3a8f80d0ba87.zip
more work on profile vcards - still a lot of work to go
-rw-r--r--Zotlabs/Module/Profiles.php36
-rw-r--r--include/channel.php2
-rw-r--r--view/js/mod_connedit.js2
-rw-r--r--view/js/mod_profiles.js4
-rwxr-xr-xview/tpl/profile_advanced.tpl22
-rwxr-xr-xview/tpl/profile_edit.tpl126
6 files changed, 178 insertions, 14 deletions
diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php
index 32e888f14..da8b16b00 100644
--- a/Zotlabs/Module/Profiles.php
+++ b/Zotlabs/Module/Profiles.php
@@ -330,13 +330,7 @@ class Profiles extends \Zotlabs\Web\Controller {
'photo' => $channel['xchan_photo_l'],
'adr' => [],
'adr_type' => [ $default_vcard_cat ],
- 'tel' => [],
- 'tel_type' => [ $default_vcard_cat ],
- 'email' => [],
- 'email_type' => [ $default_vcard_cat ],
- 'impp' => [],
- 'impp_type' => [ $default_vcard_cat ],
- 'url' => [],
+ 'url' => [ $homepage ],
'url_type' => [ $default_vcard_cat ]
];
@@ -350,9 +344,12 @@ class Profiles extends \Zotlabs\Web\Controller {
6 => $country_name
];
-
$profile_vcard = update_vcard($defcard,$orig_vcard);
+ $orig_vcard = \Sabre\VObject\Reader::read($profile_vcard);
+
+ $profile_vcard = update_vcard($_REQUEST,$orig_vcard);
+
require_once('include/text.php');
linkify_tags($a, $likes, local_channel());
@@ -700,6 +697,10 @@ class Profiles extends \Zotlabs\Web\Controller {
}
//logger('extra_fields: ' . print_r($extra_fields,true));
+
+ $vc = $r[0]['profile_vcard'];
+ $vctmp = (($vc) ? \Sabre\VObject\Reader::read($vc) : null);
+ $vcard = (($vctmp) ? get_vcard_array($vctmp,$contact['abook_id']) : [] );
$f = get_config('system','birthday_input_format');
if(! $f)
@@ -717,6 +718,7 @@ class Profiles extends \Zotlabs\Web\Controller {
. get_form_security_token("profile_drop"),
'$fields' => $fields,
+ '$vcard' => $vcard,
'$guid' => $r[0]['profile_guid'],
'$banner' => t('Edit Profile Details'),
'$submit' => t('Submit'),
@@ -776,11 +778,27 @@ class Profiles extends \Zotlabs\Web\Controller {
'$film' => array('film', t('Film/Dance/Culture/Entertainment'), $r[0]['film']),
'$interest' => array('interest', t('Hobbies/Interests'), $r[0]['interest']),
'$romance' => array('romance',t('Love/Romance'), $r[0]['romance']),
- '$work' => array('work', t('Work/Employment'), $r[0]['employment']),
+ '$employ' => array('work', t('Work/Employment'), $r[0]['employment']),
'$education' => array('education', t('School/Education'), $r[0]['education']),
'$contact' => array('contact', t('Contact information and social networks'), $r[0]['contact']),
'$channels' => array('channels', t('My other channels'), $r[0]['channels']),
'$extra_fields' => $extra_fields,
+ '$tel_label' => t('Phone'),
+ '$email_label' => t('Email'),
+ '$impp_label' => t('Instant messenger'),
+ '$url_label' => t('Website'),
+ '$adr_label' => t('Address'),
+ '$note_label' => t('Note'),
+ '$mobile' => t('Mobile'),
+ '$home' => t('Home'),
+ '$work' => t('Work'),
+ '$other' => t('Other'),
+ '$add_card' => t('Add Contact'),
+ '$add_field' => t('Add Field'),
+ '$create' => t('Create'),
+ '$update' => t('Update'),
+ '$delete' => t('Delete'),
+ '$cancel' => t('Cancel'),
));
$arr = array('profile' => $r[0], 'entry' => $o);
diff --git a/include/channel.php b/include/channel.php
index 755bfc5d6..b838f8393 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -1608,7 +1608,7 @@ function get_profile_fields_basic($filter = 0) {
$profile_fields_basic = (($filter == 0) ? get_config('system','profile_fields_basic') : null);
if(! $profile_fields_basic)
- $profile_fields_basic = array('fullname','pdesc','chandesc','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','sexual','homepage','hometown','keywords','about','contact');
+ $profile_fields_basic = array('fullname','pdesc','chandesc','comms','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','sexual','homepage','hometown','keywords','about','contact');
$x = array();
if($profile_fields_basic)
diff --git a/view/js/mod_connedit.js b/view/js/mod_connedit.js
index 4739c490c..7100e0d07 100644
--- a/view/js/mod_connedit.js
+++ b/view/js/mod_connedit.js
@@ -82,7 +82,7 @@ $(document).ready(function() {
function doRemove() {
var what = $(this).data('remove');
var element = $(this).parents('div.form-' + what);
- var where = '#abook_edit_form' + $(this).data('id');
+ var where = '#abook-edit-form' + $(this).data('id');
if(what === 'vcard-org' || what === 'vcard-title' || what === 'vcard-note') {
$(where + ' .add-' + what).show()
diff --git a/view/js/mod_profiles.js b/view/js/mod_profiles.js
index acc9f9953..784f64458 100644
--- a/view/js/mod_profiles.js
+++ b/view/js/mod_profiles.js
@@ -38,7 +38,7 @@ $(document).ready(function() {
var what = $(this).data('add');
var id = $(this).data('id');
var element = '#template-form-' + what;
- var where = '#abook-edit-form';
+ var where = '#profile-edit-form';
$(element + ' .remove-field').attr('data-id', id)
@@ -58,7 +58,7 @@ $(document).ready(function() {
function doRemove() {
var what = $(this).data('remove');
var element = $(this).parents('div.form-' + what);
- var where = '#abook_edit_form' + $(this).data('id');
+ var where = '#profile-edit-form' + $(this).data('id');
if(what === 'vcard-org' || what === 'vcard-title' || what === 'vcard-note') {
$(where + ' .add-' + what).show()
diff --git a/view/tpl/profile_advanced.tpl b/view/tpl/profile_advanced.tpl
index 4000f39d6..ba0efe999 100755
--- a/view/tpl/profile_advanced.tpl
+++ b/view/tpl/profile_advanced.tpl
@@ -47,6 +47,28 @@
{{foreach $fields as $f}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{if $f == 'name'}}
<dl id="aprofile-fullname" class="aprofile">
<dt>{{$profile.fullname.0}}</dt>
diff --git a/view/tpl/profile_edit.tpl b/view/tpl/profile_edit.tpl
index b0211d697..a50d11136 100755
--- a/view/tpl/profile_edit.tpl
+++ b/view/tpl/profile_edit.tpl
@@ -108,6 +108,128 @@
</div>
</div>
</div>
+
+ {{if $fields.comms }}
+
+ <div id="template-form-vcard-tel" class="form-group form-vcard-tel">
+ <select name="tel_type[]">
+ <option value="CELL">{{$mobile}}</option>
+ <option value="HOME">{{$home}}</option>
+ <option value="WORK">{{$work}}</option>
+ <option value="OTHER">{{$other}}</option>
+ </select>
+ <input type="text" name="tel[]" value="" placeholder="{{$tel_label}}">
+ <i data-remove="vcard-tel" data-id="" class="fa fa-trash-o remove-field drop-icons fakelink"></i>
+ </div>
+
+ <div id="template-form-vcard-email" class="form-group form-vcard-email">
+ <select name="email_type[]">
+ <option value="HOME">{{$home}}</option>
+ <option value="WORK">{{$work}}</option>
+ <option value="OTHER">{{$other}}</option>
+ </select>
+ <input type="text" name="email[]" value="" placeholder="{{$email_label}}">
+ <i data-remove="vcard-email" data-id="" class="fa fa-trash-o remove-field drop-icons fakelink"></i>
+ </div>
+
+ <div id="template-form-vcard-impp" class="form-group form-vcard-impp">
+ <select name="impp_type[]">
+ <option value="HOME">{{$home}}</option>
+ <option value="WORK">{{$work}}</option>
+ <option value="OTHER">{{$other}}</option>
+ </select>
+ <input type="text" name="impp[]" value="" placeholder="{{$impp_label}}">
+ <i data-remove="vcard-impp" data-id="" class="fa fa-trash-o remove-field drop-icons fakelink"></i>
+ </div>
+
+ <div class="section-content-wrapper-np">
+ <div id="vcard-cancel-{{$vcard.id}}" class="vcard-cancel vcard-cancel-btn" data-id="{{$vcard.id}}" data-action="cancel"><i class="fa fa-close"></i></div>
+ <div id="vcard-add-field-{{$vcard.id}}" class="dropdown pull-right vcard-add-field">
+ <button data-toggle="dropdown" type="button" class="btn btn-default btn-sm dropdown-toggle"><i class="fa fa-plus"></i> {{$add_field}}</button>
+ <ul class="dropdown-menu">
+ <li class="add-vcard-tel"><a href="#" data-add="vcard-tel" data-id="{{$vcard.id}}" class="add-field" onclick="return false;">{{$tel_label}}</a></li>
+ <li class="add-vcard-email"><a href="#" data-add="vcard-email" data-id="{{$vcard.id}}" class="add-field" onclick="return false;">{{$email_label}}</a></li>
+ <li class="add-vcard-impp"><a href="#" data-add="vcard-impp" data-id="{{$vcard.id}}" class="add-field" onclick="return false;">{{$impp_label}}</a></li>
+ </ul>
+ </div>
+ <div id="vcard-header-{{$vcard.id}}" class="vcard-header" data-id="{{$vcard.id}}" data-action="open">
+ <i class="vcard-fn-preview fa fa-address-card-o"></i>
+ <span id="vcard-preview-{{$vcard.id}}" class="vcard-preview">
+ {{if $vcard.fn}}<span class="vcard-fn-preview">{{$vcard.fn}}</span>{{/if}}
+ {{if $vcard.emails.0.address}}<span class="vcard-email-preview hidden-xs"><a href="mailto:{{$vcard.emails.0.address}}">{{$vcard.emails.0.address}}</a></span>{{/if}}
+ {{if $vcard.tels.0}}<span class="vcard-tel-preview hidden-xs">{{$vcard.tels.0.nr}}{{if $is_mobile}} <a class="btn btn-default btn-xs" href="tel:{{$vcard.tels.0.nr}}"><i class="fa fa-phone connphone"></i></a>{{/if}}</span>{{/if}}
+ </span>
+ <input id="vcard-fn-{{$vcard.id}}" class="vcard-fn" type="text" name="fn" value="{{$vcard.fn}}" size="{{$vcard.fn|count_characters:true}}" placeholder="{{$name_label}}">
+ </div>
+ </div>
+ <div id="vcard-info-{{$vcard.id}}" class="vcard-info section-content-wrapper">
+
+ <div class="vcard-tel form-group">
+ <div class="form-vcard-tel-wrapper">
+ {{if $vcard.tels}}
+ {{foreach $vcard.tels as $tel}}
+ <div class="form-group form-vcard-tel">
+ <select name="tel_type[]">
+ <option value=""{{if $tel.type.0 != 'CELL' && $tel.type.0 != 'HOME' && $tel.type.0 != 'WORK' && $tel.type.0 != 'OTHER'}} selected="selected"{{/if}}>{{$tel.type.1}}</option>
+ <option value="CELL"{{if $tel.type.0 == 'CELL'}} selected="selected"{{/if}}>{{$mobile}}</option>
+ <option value="HOME"{{if $tel.type.0 == 'HOME'}} selected="selected"{{/if}}>{{$home}}</option>
+ <option value="WORK"{{if $tel.type.0 == 'WORK'}} selected="selected"{{/if}}>{{$work}}</option>
+ <option value="OTHER"{{if $tel.type.0 == 'OTHER'}} selected="selected"{{/if}}>{{$other}}</option>
+ </select>
+ <input type="text" name="tel[]" value="{{$tel.nr}}" size="{{$tel.nr|count_characters:true}}" placeholder="{{$tel_label}}">
+ <i data-remove="vcard-tel" data-id="{{$vcard.id}}" class="fa fa-trash-o remove-field drop-icons fakelink"></i>
+ </div>
+ {{/foreach}}
+ {{/if}}
+ </div>
+ </div>
+
+
+ <div class="vcard-email form-group">
+ <div class="form-vcard-email-wrapper">
+ {{if $vcard.emails}}
+ {{foreach $vcard.emails as $email}}
+ <div class="form-group form-vcard-email">
+ <select name="email_type[]">
+ <option value=""{{if $email.type.0 != 'HOME' && $email.type.0 != 'WORK' && $email.type.0 != 'OTHER'}} selected="selected"{{/if}}>{{$email.type.1}}</option>
+ <option value="HOME"{{if $email.type.0 == 'HOME'}} selected="selected"{{/if}}>{{$home}}</option>
+ <option value="WORK"{{if $email.type.0 == 'WORK'}} selected="selected"{{/if}}>{{$work}}</option>
+ <option value="OTHER"{{if $email.type.0 == 'OTHER'}} selected="selected"{{/if}}>{{$other}}</option>
+ </select>
+ <input type="text" name="email[]" value="{{$email.address}}" size="{{$email.address|count_characters:true}}" placeholder="{{$email_label}}">
+ <i data-remove="vcard-email" data-id="{{$vcard.id}}" class="fa fa-trash-o remove-field drop-icons fakelink"></i>
+ </div>
+ {{/foreach}}
+ {{/if}}
+ </div>
+ </div>
+
+ <div class="vcard-impp form-group">
+ <div class="form-vcard-impp-wrapper">
+ {{if $vcard.impps}}
+ {{foreach $vcard.impps as $impp}}
+ <div class="form-group form-vcard-impp">
+ <select name="impp_type[]">
+ <option value=""{{if $impp.type.0 != 'HOME' && $impp.type.0 != 'WORK' && $impp.type.0 != 'OTHER'}} selected="selected"{{/if}}>{{$impp.type.1}}</option>
+ <option value="HOME"{{if $impp.type.0 == 'HOME'}} selected="selected"{{/if}}>{{$home}}</option>
+ <option value="WORK"{{if $impp.type.0 == 'WORK'}} selected="selected"{{/if}}>{{$work}}</option>
+ <option value="OTHER"{{if $impp.type.0 == 'OTHER'}} selected="selected"{{/if}}>{{$other}}</option>
+ </select>
+ <input type="text" name="impp[]" value="{{$impp.address}}" size="{{$impp.address|count_characters:true}}" placeholder="{{$impp_label}}">
+ <i data-remove="vcard-impp" data-id="{{$vcard.id}}" class="fa fa-trash-o remove-field drop-icons fakelink"></i>
+ </div>
+ {{/foreach}}
+ {{/if}}
+ </div>
+ </div>
+
+ <div class="settings-submit-wrapper" >
+ <button type="submit" name="done" value="{{$submit}}" class="btn btn-primary">{{$submit}}</button>
+ </div>
+ </div>
+ {{/if}}
+
+
{{if $fields.address || $fields.locality || $fields.postal_code || $fields.region || $fields.country_name || $fields.hometown}}
<div class="panel">
<div class="section-subtitle-wrapper" role="tab" id="location">
@@ -150,7 +272,9 @@
</div>
</div>
</div>
+
{{/if}}
+
{{if $fields.marital || $fields.sexual}}
<div class="panel">
<div class="section-subtitle-wrapper" role="tab" id="relation">
@@ -270,7 +394,7 @@
{{/if}}
{{if $fields.employment}}
- {{include file="field_textarea.tpl" field=$work}}
+ {{include file="field_textarea.tpl" field=$employ}}
{{/if}}
{{if $fields.education}}